| @@ -6,8 +6,12 @@ | ||
| 6 | 6 | var __hasOwnProp = Object.prototype.hasOwnProperty; |
| 7 | 7 | var __commonJS = (cb, mod) => function __require() { |
| 8 | 8 | return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; |
| 9 | 9 | }; |
| 10 | +var __export = (target, all) => { | |
| 11 | + for (var name in all) | |
| 12 | + __defProp(target, name, { get: all[name], enumerable: true }); | |
| 13 | +}; | |
| 10 | 14 | var __copyProps = (to, from, except, desc) => { |
| 11 | 15 | if (from && typeof from === "object" || typeof from === "function") { |
| 12 | 16 | for (let key of __getOwnPropNames(from)) |
| 13 | 17 | if (!__hasOwnProp.call(to, key) && key !== except) |
| @@ -51,15 +55,177 @@ | ||
| 51 | 55 | module.exports = window.ReactDOM; |
| 52 | 56 | } |
| 53 | 57 | }); |
| 54 | 58 | |
| 55 | -// package-external:@wordpress/data | |
| 56 | -var require_data = __commonJS({ | |
| 57 | - "package-external:@wordpress/data"(exports, module) { | |
| 58 | - module.exports = window.wp.data; | |
| 59 | +// node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js | |
| 60 | +var require_use_sync_external_store_shim_development = __commonJS({ | |
| 61 | + "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) { | |
| 62 | + "use strict"; | |
| 63 | + (function() { | |
| 64 | + function is(x, y) { | |
| 65 | + return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; | |
| 66 | + } | |
| 67 | + function useSyncExternalStore$2(subscribe, getSnapshot) { | |
| 68 | + didWarnOld18Alpha || void 0 === React117.startTransition || (didWarnOld18Alpha = true, console.error( | |
| 69 | + "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release." | |
| 70 | + )); | |
| 71 | + var value = getSnapshot(); | |
| 72 | + if (!didWarnUncachedGetSnapshot) { | |
| 73 | + var cachedValue = getSnapshot(); | |
| 74 | + objectIs(value, cachedValue) || (console.error( | |
| 75 | + "The result of getSnapshot should be cached to avoid an infinite loop" | |
| 76 | + ), didWarnUncachedGetSnapshot = true); | |
| 77 | + } | |
| 78 | + cachedValue = useState25({ | |
| 79 | + inst: { value, getSnapshot } | |
| 80 | + }); | |
| 81 | + var inst = cachedValue[0].inst, forceUpdate = cachedValue[1]; | |
| 82 | + useLayoutEffect3( | |
| 83 | + function() { | |
| 84 | + inst.value = value; | |
| 85 | + inst.getSnapshot = getSnapshot; | |
| 86 | + checkIfSnapshotChanged(inst) && forceUpdate({ inst }); | |
| 87 | + }, | |
| 88 | + [subscribe, value, getSnapshot] | |
| 89 | + ); | |
| 90 | + useEffect20( | |
| 91 | + function() { | |
| 92 | + checkIfSnapshotChanged(inst) && forceUpdate({ inst }); | |
| 93 | + return subscribe(function() { | |
| 94 | + checkIfSnapshotChanged(inst) && forceUpdate({ inst }); | |
| 95 | + }); | |
| 96 | + }, | |
| 97 | + [subscribe] | |
| 98 | + ); | |
| 99 | + useDebugValue2(value); | |
| 100 | + return value; | |
| 101 | + } | |
| 102 | + function checkIfSnapshotChanged(inst) { | |
| 103 | + var latestGetSnapshot = inst.getSnapshot; | |
| 104 | + inst = inst.value; | |
| 105 | + try { | |
| 106 | + var nextValue = latestGetSnapshot(); | |
| 107 | + return !objectIs(inst, nextValue); | |
| 108 | + } catch (error2) { | |
| 109 | + return true; | |
| 110 | + } | |
| 111 | + } | |
| 112 | + function useSyncExternalStore$1(subscribe, getSnapshot) { | |
| 113 | + return getSnapshot(); | |
| 114 | + } | |
| 115 | + "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); | |
| 116 | + var React117 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState25 = React117.useState, useEffect20 = React117.useEffect, useLayoutEffect3 = React117.useLayoutEffect, useDebugValue2 = React117.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2; | |
| 117 | + exports.useSyncExternalStore = void 0 !== React117.useSyncExternalStore ? React117.useSyncExternalStore : shim; | |
| 118 | + "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); | |
| 119 | + })(); | |
| 59 | 120 | } |
| 60 | 121 | }); |
| 61 | 122 | |
| 123 | +// node_modules/use-sync-external-store/shim/index.js | |
| 124 | +var require_shim = __commonJS({ | |
| 125 | + "node_modules/use-sync-external-store/shim/index.js"(exports, module) { | |
| 126 | + "use strict"; | |
| 127 | + if (false) { | |
| 128 | + module.exports = null; | |
| 129 | + } else { | |
| 130 | + module.exports = require_use_sync_external_store_shim_development(); | |
| 131 | + } | |
| 132 | + } | |
| 133 | +}); | |
| 134 | + | |
| 135 | +// node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js | |
| 136 | +var require_with_selector_development = __commonJS({ | |
| 137 | + "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) { | |
| 138 | + "use strict"; | |
| 139 | + (function() { | |
| 140 | + function is(x, y) { | |
| 141 | + return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; | |
| 142 | + } | |
| 143 | + "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); | |
| 144 | + var React117 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore3 = shim.useSyncExternalStore, useRef42 = React117.useRef, useEffect20 = React117.useEffect, useMemo34 = React117.useMemo, useDebugValue2 = React117.useDebugValue; | |
| 145 | + exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) { | |
| 146 | + var instRef = useRef42(null); | |
| 147 | + if (null === instRef.current) { | |
| 148 | + var inst = { hasValue: false, value: null }; | |
| 149 | + instRef.current = inst; | |
| 150 | + } else inst = instRef.current; | |
| 151 | + instRef = useMemo34( | |
| 152 | + function() { | |
| 153 | + function memoizedSelector(nextSnapshot) { | |
| 154 | + if (!hasMemo) { | |
| 155 | + hasMemo = true; | |
| 156 | + memoizedSnapshot = nextSnapshot; | |
| 157 | + nextSnapshot = selector(nextSnapshot); | |
| 158 | + if (void 0 !== isEqual && inst.hasValue) { | |
| 159 | + var currentSelection = inst.value; | |
| 160 | + if (isEqual(currentSelection, nextSnapshot)) | |
| 161 | + return memoizedSelection = currentSelection; | |
| 162 | + } | |
| 163 | + return memoizedSelection = nextSnapshot; | |
| 164 | + } | |
| 165 | + currentSelection = memoizedSelection; | |
| 166 | + if (objectIs(memoizedSnapshot, nextSnapshot)) | |
| 167 | + return currentSelection; | |
| 168 | + var nextSelection = selector(nextSnapshot); | |
| 169 | + if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) | |
| 170 | + return memoizedSnapshot = nextSnapshot, currentSelection; | |
| 171 | + memoizedSnapshot = nextSnapshot; | |
| 172 | + return memoizedSelection = nextSelection; | |
| 173 | + } | |
| 174 | + var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot; | |
| 175 | + return [ | |
| 176 | + function() { | |
| 177 | + return memoizedSelector(getSnapshot()); | |
| 178 | + }, | |
| 179 | + null === maybeGetServerSnapshot ? void 0 : function() { | |
| 180 | + return memoizedSelector(maybeGetServerSnapshot()); | |
| 181 | + } | |
| 182 | + ]; | |
| 183 | + }, | |
| 184 | + [getSnapshot, getServerSnapshot, selector, isEqual] | |
| 185 | + ); | |
| 186 | + var value = useSyncExternalStore3(subscribe, instRef[0], instRef[1]); | |
| 187 | + useEffect20( | |
| 188 | + function() { | |
| 189 | + inst.hasValue = true; | |
| 190 | + inst.value = value; | |
| 191 | + }, | |
| 192 | + [value] | |
| 193 | + ); | |
| 194 | + useDebugValue2(value); | |
| 195 | + return value; | |
| 196 | + }; | |
| 197 | + "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); | |
| 198 | + })(); | |
| 199 | + } | |
| 200 | +}); | |
| 201 | + | |
| 202 | +// node_modules/use-sync-external-store/shim/with-selector.js | |
| 203 | +var require_with_selector = __commonJS({ | |
| 204 | + "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) { | |
| 205 | + "use strict"; | |
| 206 | + if (false) { | |
| 207 | + module.exports = null; | |
| 208 | + } else { | |
| 209 | + module.exports = require_with_selector_development(); | |
| 210 | + } | |
| 211 | + } | |
| 212 | +}); | |
| 213 | + | |
| 214 | +// package-external:@wordpress/theme | |
| 215 | +var require_theme = __commonJS({ | |
| 216 | + "package-external:@wordpress/theme"(exports, module) { | |
| 217 | + module.exports = window.wp.theme; | |
| 218 | + } | |
| 219 | +}); | |
| 220 | + | |
| 221 | +// package-external:@wordpress/private-apis | |
| 222 | +var require_private_apis = __commonJS({ | |
| 223 | + "package-external:@wordpress/private-apis"(exports, module) { | |
| 224 | + module.exports = window.wp.privateApis; | |
| 225 | + } | |
| 226 | +}); | |
| 227 | + | |
| 62 | 228 | // package-external:@wordpress/i18n |
| 63 | 229 | var require_i18n = __commonJS({ |
| 64 | 230 | "package-external:@wordpress/i18n"(exports, module) { |
| 65 | 231 | module.exports = window.wp.i18n; |
| @@ -65,8 +231,22 @@ | ||
| 65 | 231 | module.exports = window.wp.i18n; |
| 66 | 232 | } |
| 67 | 233 | }); |
| 68 | 234 | |
| 235 | +// package-external:@wordpress/primitives | |
| 236 | +var require_primitives = __commonJS({ | |
| 237 | + "package-external:@wordpress/primitives"(exports, module) { | |
| 238 | + module.exports = window.wp.primitives; | |
| 239 | + } | |
| 240 | +}); | |
| 241 | + | |
| 242 | +// package-external:@wordpress/data | |
| 243 | +var require_data = __commonJS({ | |
| 244 | + "package-external:@wordpress/data"(exports, module) { | |
| 245 | + module.exports = window.wp.data; | |
| 246 | + } | |
| 247 | +}); | |
| 248 | + | |
| 69 | 249 | // package-external:@wordpress/components |
| 70 | 250 | var require_components = __commonJS({ |
| 71 | 251 | "package-external:@wordpress/components"(exports, module) { |
| 72 | 252 | module.exports = window.wp.components; |
| @@ -79,2534 +259,18431 @@ | ||
| 79 | 259 | module.exports = window.wp.keyboardShortcuts; |
| 80 | 260 | } |
| 81 | 261 | }); |
| 82 | 262 | |
| 83 | -// package-external:@wordpress/primitives | |
| 84 | -var require_primitives = __commonJS({ | |
| 85 | - "package-external:@wordpress/primitives"(exports, module) { | |
| 86 | - module.exports = window.wp.primitives; | |
| 263 | +// package-external:@wordpress/keycodes | |
| 264 | +var require_keycodes = __commonJS({ | |
| 265 | + "package-external:@wordpress/keycodes"(exports, module) { | |
| 266 | + module.exports = window.wp.keycodes; | |
| 87 | 267 | } |
| 88 | 268 | }); |
| 89 | 269 | |
| 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 | -}); | |
| 270 | +// packages/workflow/build-module/index.mjs | |
| 271 | +var import_element47 = __toESM(require_element(), 1); | |
| 96 | 272 | |
| 97 | -// packages/workflow/build-module/index.mjs | |
| 98 | -var import_element3 = __toESM(require_element(), 1); | |
| 273 | +// node_modules/clsx/dist/clsx.mjs | |
| 274 | +function r(e) { | |
| 275 | + var t, f, n = ""; | |
| 276 | + if ("string" == typeof e || "number" == typeof e) n += e; | |
| 277 | + else if ("object" == typeof e) if (Array.isArray(e)) { | |
| 278 | + var o = e.length; | |
| 279 | + for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); | |
| 280 | + } else for (f in e) e[f] && (n && (n += " "), n += f); | |
| 281 | + return n; | |
| 282 | +} | |
| 283 | +function clsx() { | |
| 284 | + for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); | |
| 285 | + return n; | |
| 286 | +} | |
| 287 | +var clsx_default = clsx; | |
| 99 | 288 | |
| 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; | |
| 289 | +// node_modules/@base-ui/utils/useControlled.mjs | |
| 290 | +var React = __toESM(require_react(), 1); | |
| 291 | + | |
| 292 | +// node_modules/@base-ui/utils/createLogOnce.mjs | |
| 293 | +var loggedMessages; | |
| 294 | +if (true) { | |
| 295 | + loggedMessages = /* @__PURE__ */ new Set(); | |
| 119 | 296 | } |
| 120 | -function D(_) { | |
| 121 | - return _.toLowerCase().replace(X, " "); | |
| 297 | +function createLogOnce(severity, prefix) { | |
| 298 | + return function logOnce(...messages) { | |
| 299 | + if (true) { | |
| 300 | + const message = messages.join(" "); | |
| 301 | + const output = prefix ? `${prefix}: ${message}` : message; | |
| 302 | + const key = `${severity}:${output}`; | |
| 303 | + if (!loggedMessages.has(key)) { | |
| 304 | + loggedMessages.add(key); | |
| 305 | + if (severity === "warn") { | |
| 306 | + console.warn(output); | |
| 307 | + } else { | |
| 308 | + console.error(output); | |
| 309 | + } | |
| 310 | + } | |
| 311 | + } | |
| 312 | + }; | |
| 122 | 313 | } |
| 123 | -function W(_, C, h) { | |
| 124 | - return _ = h && h.length > 0 ? `${_ + " " + h.join(" ")}` : _, G(_, C, D(_), D(C), 0, 0, {}); | |
| 314 | + | |
| 315 | +// node_modules/@base-ui/utils/error.mjs | |
| 316 | +var error = createLogOnce("error", "Base UI"); | |
| 317 | + | |
| 318 | +// node_modules/@base-ui/utils/useControlled.mjs | |
| 319 | +function useControlled({ | |
| 320 | + controlled, | |
| 321 | + default: defaultProp, | |
| 322 | + name, | |
| 323 | + state = "value" | |
| 324 | +}) { | |
| 325 | + const { | |
| 326 | + current: isControlled | |
| 327 | + } = React.useRef(controlled !== void 0); | |
| 328 | + const [valueState, setValue] = React.useState(defaultProp); | |
| 329 | + const value = isControlled && controlled !== void 0 ? controlled : valueState; | |
| 330 | + if (true) { | |
| 331 | + React.useEffect(() => { | |
| 332 | + if (isControlled !== (controlled !== void 0)) { | |
| 333 | + error([`A component is changing the ${isControlled ? "" : "un"}controlled ${state} state of ${name} to be ${isControlled ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${name} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join("\n")); | |
| 334 | + } | |
| 335 | + }, [state, name, controlled]); | |
| 336 | + const { | |
| 337 | + current: defaultValue | |
| 338 | + } = React.useRef(defaultProp); | |
| 339 | + React.useEffect(() => { | |
| 340 | + if (!isControlled && serializeToDevModeString(defaultValue) !== serializeToDevModeString(defaultProp)) { | |
| 341 | + error([`A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. To suppress this warning opt to use a controlled ${name}.`].join("\n")); | |
| 342 | + } | |
| 343 | + }, [defaultProp]); | |
| 344 | + } | |
| 345 | + const setValueIfUncontrolled = React.useCallback((newValue) => { | |
| 346 | + if (!isControlled) { | |
| 347 | + setValue(newValue); | |
| 348 | + } | |
| 349 | + }, []); | |
| 350 | + return [value, setValueIfUncontrolled]; | |
| 125 | 351 | } |
| 352 | +function serializeToDevModeString(input) { | |
| 353 | + let nextId = 0; | |
| 354 | + const seen = /* @__PURE__ */ new WeakMap(); | |
| 355 | + try { | |
| 356 | + const result = JSON.stringify(input, function replacer(key, value) { | |
| 357 | + if (key === "_owner" && this != null && typeof this === "object" && "$$typeof" in this) { | |
| 358 | + return void 0; | |
| 359 | + } | |
| 360 | + if (typeof value === "bigint") { | |
| 361 | + return `__bigint__:${value}`; | |
| 362 | + } | |
| 363 | + if (value !== null && typeof value === "object") { | |
| 364 | + const id = seen.get(value); | |
| 365 | + if (id !== void 0) { | |
| 366 | + return `__object__:${id}`; | |
| 367 | + } | |
| 368 | + seen.set(value, nextId); | |
| 369 | + nextId += 1; | |
| 370 | + } | |
| 371 | + return value; | |
| 372 | + }); | |
| 373 | + return result ?? `__top__:${typeof input}`; | |
| 374 | + } catch { | |
| 375 | + return "__unserializable__"; | |
| 376 | + } | |
| 377 | +} | |
| 126 | 378 | |
| 127 | -// node_modules/@radix-ui/react-dialog/dist/index.mjs | |
| 128 | -var React24 = __toESM(require_react(), 1); | |
| 379 | +// node_modules/@base-ui/utils/safeReact.mjs | |
| 380 | +var React2 = __toESM(require_react(), 1); | |
| 381 | +var SafeReact = { | |
| 382 | + ...React2 | |
| 383 | +}; | |
| 129 | 384 | |
| 130 | -// 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); | |
| 385 | +// node_modules/@base-ui/utils/useRefWithInit.mjs | |
| 386 | +var React3 = __toESM(require_react(), 1); | |
| 387 | +var UNINITIALIZED = {}; | |
| 388 | +function useRefWithInit(init, initArg) { | |
| 389 | + const ref = React3.useRef(UNINITIALIZED); | |
| 390 | + if (ref.current === UNINITIALIZED) { | |
| 391 | + ref.current = init(initArg); | |
| 392 | + } | |
| 393 | + return ref; | |
| 394 | +} | |
| 395 | + | |
| 396 | +// node_modules/@base-ui/utils/useStableCallback.mjs | |
| 397 | +var useInsertionEffect = SafeReact.useInsertionEffect; | |
| 398 | +var useSafeInsertionEffect = ( | |
| 399 | + // React 17 doesn't have useInsertionEffect. | |
| 400 | + useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late. | |
| 401 | + useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn() | |
| 402 | +); | |
| 403 | +function useStableCallback(callback) { | |
| 404 | + const stable = useRefWithInit(createStableCallback).current; | |
| 405 | + stable.next = callback; | |
| 406 | + useSafeInsertionEffect(stable.effect); | |
| 407 | + return stable.trampoline; | |
| 408 | +} | |
| 409 | +function createStableCallback() { | |
| 410 | + const stable = { | |
| 411 | + next: void 0, | |
| 412 | + callback: assertNotCalled, | |
| 413 | + trampoline: (...args) => stable.callback?.(...args), | |
| 414 | + effect: () => { | |
| 415 | + stable.callback = stable.next; | |
| 137 | 416 | } |
| 138 | 417 | }; |
| 418 | + return stable; | |
| 139 | 419 | } |
| 420 | +function assertNotCalled() { | |
| 421 | + if (true) { | |
| 422 | + throw ( | |
| 423 | + /* minify-error-disabled */ | |
| 424 | + new Error("Base UI: Cannot call an event handler while rendering.") | |
| 425 | + ); | |
| 426 | + } | |
| 427 | +} | |
| 140 | 428 | |
| 141 | -// 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; | |
| 429 | +// node_modules/@base-ui/utils/warn.mjs | |
| 430 | +var warn = createLogOnce("warn", "Base UI"); | |
| 431 | + | |
| 432 | +// node_modules/@base-ui/utils/empty.mjs | |
| 433 | +function NOOP() { | |
| 434 | +} | |
| 435 | +var EMPTY_ARRAY = Object.freeze([]); | |
| 436 | +var EMPTY_OBJECT = Object.freeze({}); | |
| 437 | + | |
| 438 | +// node_modules/@base-ui/react/internals/composite/list/CompositeList.mjs | |
| 439 | +var React6 = __toESM(require_react(), 1); | |
| 440 | + | |
| 441 | +// node_modules/@base-ui/utils/useIsoLayoutEffect.mjs | |
| 442 | +var React4 = __toESM(require_react(), 1); | |
| 443 | +var noop = () => { | |
| 444 | +}; | |
| 445 | +var useIsoLayoutEffect = typeof document !== "undefined" ? React4.useLayoutEffect : noop; | |
| 446 | + | |
| 447 | +// node_modules/@base-ui/react/internals/composite/list/CompositeListContext.mjs | |
| 448 | +var React5 = __toESM(require_react(), 1); | |
| 449 | +var CompositeListContext = /* @__PURE__ */ React5.createContext({ | |
| 450 | + register: () => { | |
| 451 | + }, | |
| 452 | + unregister: () => { | |
| 453 | + }, | |
| 454 | + subscribeMapChange: () => () => { | |
| 455 | + }, | |
| 456 | + nextIndexRef: { | |
| 457 | + current: 0 | |
| 148 | 458 | } |
| 459 | +}); | |
| 460 | +if (true) CompositeListContext.displayName = "CompositeListContext"; | |
| 461 | +function useCompositeListContext() { | |
| 462 | + return React5.useContext(CompositeListContext); | |
| 149 | 463 | } |
| 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; | |
| 464 | + | |
| 465 | +// node_modules/@base-ui/react/internals/composite/list/CompositeList.mjs | |
| 466 | +var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); | |
| 467 | +function CompositeList(props) { | |
| 468 | + const { | |
| 469 | + children, | |
| 470 | + elementsRef, | |
| 471 | + labelsRef, | |
| 472 | + onMapChange: onMapChangeProp | |
| 473 | + } = props; | |
| 474 | + const onMapChange = useStableCallback(onMapChangeProp); | |
| 475 | + const [, setMapTick] = React6.useState(false); | |
| 476 | + const listeners = useRefWithInit(createListeners).current; | |
| 477 | + const map = useRefWithInit(createMap).current; | |
| 478 | + const nextIndexRef = React6.useRef(0); | |
| 479 | + const isDirtyRef = React6.useRef(true); | |
| 480 | + const itemsRef = React6.useRef(null); | |
| 481 | + const mutationObserverRef = React6.useRef(null); | |
| 482 | + const scheduleMapUpdate = useStableCallback(() => { | |
| 483 | + if (isDirtyRef.current) { | |
| 484 | + return; | |
| 485 | + } | |
| 486 | + isDirtyRef.current = true; | |
| 487 | + setMapTick((tick) => !tick); | |
| 488 | + }); | |
| 489 | + const register2 = useStableCallback((node, registration) => { | |
| 490 | + map.set(node, registration); | |
| 491 | + scheduleMapUpdate(); | |
| 492 | + }); | |
| 493 | + const unregister = useStableCallback((node) => { | |
| 494 | + map.delete(node); | |
| 495 | + scheduleMapUpdate(); | |
| 496 | + }); | |
| 497 | + const syncRefs = useStableCallback((items) => { | |
| 498 | + const nextMap = /* @__PURE__ */ new Map(); | |
| 499 | + elementsRef.current.length = 0; | |
| 500 | + if (labelsRef) { | |
| 501 | + labelsRef.current.length = 0; | |
| 502 | + } | |
| 503 | + items.forEach((item) => { | |
| 504 | + nextMap.set(item.element, { | |
| 505 | + ...item.registration.metadata ?? {}, | |
| 506 | + index: item.index | |
| 507 | + }); | |
| 508 | + elementsRef.current[item.index] = item.element; | |
| 509 | + if (labelsRef) { | |
| 510 | + labelsRef.current[item.index] = item.registration.label !== void 0 ? item.registration.label : item.registration.textRef?.current?.textContent ?? item.element.textContent; | |
| 157 | 511 | } |
| 158 | - return cleanup; | |
| 159 | 512 | }); |
| 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); | |
| 513 | + nextIndexRef.current = elementsRef.current.length; | |
| 514 | + return nextMap; | |
| 515 | + }); | |
| 516 | + function observe(sortedNodes) { | |
| 517 | + mutationObserverRef.current?.disconnect(); | |
| 518 | + mutationObserverRef.current = null; | |
| 519 | + if (typeof MutationObserver !== "function" || sortedNodes.length < 2) { | |
| 520 | + return; | |
| 521 | + } | |
| 522 | + const mutationObserver = new MutationObserver((entries) => { | |
| 523 | + if (!hasMovedNode(entries)) { | |
| 524 | + return; | |
| 525 | + } | |
| 526 | + let previousConnectedNode = null; | |
| 527 | + for (const node of sortedNodes) { | |
| 528 | + if (!node.isConnected) { | |
| 529 | + continue; | |
| 530 | + } | |
| 531 | + if (previousConnectedNode && sortByDocumentPosition(previousConnectedNode, node) > 0) { | |
| 532 | + mutationObserver.disconnect(); | |
| 533 | + scheduleMapUpdate(); | |
| 534 | + return; | |
| 535 | + } | |
| 536 | + previousConnectedNode = node; | |
| 537 | + } | |
| 538 | + }); | |
| 539 | + mutationObserverRef.current = mutationObserver; | |
| 540 | + const roots = /* @__PURE__ */ new Set(); | |
| 541 | + for (let i = 1; i < sortedNodes.length; i += 1) { | |
| 542 | + const root2 = getCommonAncestor(sortedNodes[i - 1], sortedNodes[i]); | |
| 543 | + if (root2) { | |
| 544 | + roots.add(root2); | |
| 545 | + } | |
| 546 | + } | |
| 547 | + roots.forEach((root2) => mutationObserver.observe(root2, { | |
| 548 | + childList: true | |
| 549 | + })); | |
| 550 | + } | |
| 551 | + const flush = useStableCallback(() => { | |
| 552 | + const [items, automaticNodes] = getCompositeListSnapshot(map); | |
| 553 | + const nextMap = syncRefs(items); | |
| 554 | + const previousItems = itemsRef.current; | |
| 555 | + const changed = !previousItems || previousItems.length !== items.length || items.some((item, index2) => { | |
| 556 | + const previousItem = previousItems[index2]; | |
| 557 | + return item.index !== previousItem.index || item.element !== previousItem.element || item.registration.index !== previousItem.registration.index || item.registration.metadata !== previousItem.registration.metadata; | |
| 558 | + }); | |
| 559 | + observe(automaticNodes); | |
| 560 | + itemsRef.current = items; | |
| 561 | + isDirtyRef.current = false; | |
| 562 | + if (!changed) { | |
| 563 | + return; | |
| 564 | + } | |
| 565 | + listeners.forEach((listener) => listener(nextMap)); | |
| 566 | + onMapChange(nextMap); | |
| 567 | + }); | |
| 568 | + useIsoLayoutEffect(() => { | |
| 569 | + if (!isDirtyRef.current && itemsRef.current) { | |
| 570 | + syncRefs(itemsRef.current); | |
| 571 | + } | |
| 572 | + return () => { | |
| 573 | + elementsRef.current = []; | |
| 574 | + if (labelsRef) { | |
| 575 | + labelsRef.current = []; | |
| 576 | + } | |
| 577 | + }; | |
| 578 | + }, [elementsRef, labelsRef, syncRefs]); | |
| 579 | + useIsoLayoutEffect(() => { | |
| 580 | + if (isDirtyRef.current) { | |
| 581 | + flush(); | |
| 582 | + } | |
| 583 | + }); | |
| 584 | + useIsoLayoutEffect(() => { | |
| 585 | + return () => { | |
| 586 | + mutationObserverRef.current?.disconnect(); | |
| 587 | + isDirtyRef.current = true; | |
| 588 | + }; | |
| 589 | + }, []); | |
| 590 | + const subscribeMapChange = useStableCallback((fn) => { | |
| 591 | + listeners.add(fn); | |
| 592 | + return () => { | |
| 593 | + listeners.delete(fn); | |
| 594 | + }; | |
| 595 | + }); | |
| 596 | + const contextValue = React6.useMemo(() => ({ | |
| 597 | + register: register2, | |
| 598 | + unregister, | |
| 599 | + subscribeMapChange, | |
| 600 | + nextIndexRef | |
| 601 | + }), [register2, unregister, subscribeMapChange, nextIndexRef]); | |
| 602 | + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompositeListContext.Provider, { | |
| 603 | + value: contextValue, | |
| 604 | + children | |
| 605 | + }); | |
| 606 | +} | |
| 607 | +function createMap() { | |
| 608 | + return /* @__PURE__ */ new Map(); | |
| 609 | +} | |
| 610 | +function createListeners() { | |
| 611 | + return /* @__PURE__ */ new Set(); | |
| 612 | +} | |
| 613 | +function getCompositeListSnapshot(map) { | |
| 614 | + const reservedIndices = /* @__PURE__ */ new Set(); | |
| 615 | + const items = []; | |
| 616 | + const automaticItems = []; | |
| 617 | + map.forEach((registration, node) => { | |
| 618 | + if (!node.isConnected) { | |
| 619 | + return; | |
| 620 | + } | |
| 621 | + const index2 = registration.index; | |
| 622 | + const item = { | |
| 623 | + index: index2 ?? -1, | |
| 624 | + element: node, | |
| 625 | + registration | |
| 626 | + }; | |
| 627 | + if (index2 === null) { | |
| 628 | + automaticItems.push(item); | |
| 629 | + } else if (index2 >= 0) { | |
| 630 | + reservedIndices.add(index2); | |
| 631 | + items.push(item); | |
| 632 | + } | |
| 633 | + }); | |
| 634 | + let nextAutomaticIndex = 0; | |
| 635 | + automaticItems.sort((a, b) => sortByDocumentPosition(a.element, b.element)); | |
| 636 | + automaticItems.forEach((item) => { | |
| 637 | + while (reservedIndices.has(nextAutomaticIndex)) { | |
| 638 | + nextAutomaticIndex += 1; | |
| 639 | + } | |
| 640 | + item.index = nextAutomaticIndex; | |
| 641 | + items.push(item); | |
| 642 | + nextAutomaticIndex += 1; | |
| 643 | + }); | |
| 644 | + if (reservedIndices.size > 0) { | |
| 645 | + items.sort((a, b) => a.index - b.index); | |
| 646 | + } | |
| 647 | + return [items, automaticItems.map((item) => item.element)]; | |
| 648 | +} | |
| 649 | +function getCommonAncestor(firstNode, lastNode) { | |
| 650 | + let ancestor = firstNode.parentElement; | |
| 651 | + while (ancestor && !ancestor.contains(lastNode)) { | |
| 652 | + ancestor = ancestor.parentElement; | |
| 653 | + } | |
| 654 | + return ancestor; | |
| 655 | +} | |
| 656 | +function hasMovedNode(entries) { | |
| 657 | + for (const entry of entries) { | |
| 658 | + for (let i = 0; i < entry.removedNodes.length; i += 1) { | |
| 659 | + if (entry.removedNodes[i].isConnected) { | |
| 660 | + return true; | |
| 661 | + } | |
| 662 | + } | |
| 663 | + } | |
| 664 | + return false; | |
| 665 | +} | |
| 666 | +function sortByDocumentPosition(a, b) { | |
| 667 | + return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1; | |
| 668 | +} | |
| 669 | + | |
| 670 | +// node_modules/@base-ui/react/internals/useRenderElement.mjs | |
| 671 | +var React9 = __toESM(require_react(), 1); | |
| 672 | + | |
| 673 | +// node_modules/@base-ui/utils/useMergedRefs.mjs | |
| 674 | +function useMergedRefs(a, b, c, d) { | |
| 675 | + const forkRef = useRefWithInit(createForkRef).current; | |
| 676 | + if (didChange(forkRef, a, b, c, d)) { | |
| 677 | + update(forkRef, [a, b, c, d]); | |
| 678 | + } | |
| 679 | + return forkRef.callback; | |
| 680 | +} | |
| 681 | +function useMergedRefsN(refs) { | |
| 682 | + const forkRef = useRefWithInit(createForkRef).current; | |
| 683 | + if (didChangeN(forkRef, refs)) { | |
| 684 | + update(forkRef, refs); | |
| 685 | + } | |
| 686 | + return forkRef.callback; | |
| 687 | +} | |
| 688 | +function createForkRef() { | |
| 689 | + return { | |
| 690 | + callback: null, | |
| 691 | + cleanup: null, | |
| 692 | + refs: [] | |
| 693 | + }; | |
| 694 | +} | |
| 695 | +function didChange(forkRef, a, b, c, d) { | |
| 696 | + return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d; | |
| 697 | +} | |
| 698 | +function didChangeN(forkRef, newRefs) { | |
| 699 | + return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]); | |
| 700 | +} | |
| 701 | +function update(forkRef, refs) { | |
| 702 | + forkRef.refs = refs; | |
| 703 | + if (refs.every((ref) => ref == null)) { | |
| 704 | + forkRef.callback = null; | |
| 705 | + return; | |
| 706 | + } | |
| 707 | + forkRef.callback = (instance) => { | |
| 708 | + if (forkRef.cleanup) { | |
| 709 | + forkRef.cleanup(); | |
| 710 | + forkRef.cleanup = null; | |
| 711 | + } | |
| 712 | + if (instance != null) { | |
| 713 | + const cleanupCallbacks = Array(refs.length).fill(null); | |
| 714 | + for (let i = 0; i < refs.length; i += 1) { | |
| 715 | + const ref = refs[i]; | |
| 716 | + if (ref == null) { | |
| 717 | + continue; | |
| 718 | + } | |
| 719 | + switch (typeof ref) { | |
| 720 | + case "function": { | |
| 721 | + const refCleanup = ref(instance); | |
| 722 | + if (typeof refCleanup === "function") { | |
| 723 | + cleanupCallbacks[i] = refCleanup; | |
| 724 | + } | |
| 725 | + break; | |
| 168 | 726 | } |
| 727 | + case "object": { | |
| 728 | + ref.current = instance; | |
| 729 | + break; | |
| 730 | + } | |
| 731 | + default: | |
| 169 | 732 | } |
| 733 | + } | |
| 734 | + forkRef.cleanup = () => { | |
| 735 | + for (let i = 0; i < refs.length; i += 1) { | |
| 736 | + const ref = refs[i]; | |
| 737 | + if (ref == null) { | |
| 738 | + continue; | |
| 739 | + } | |
| 740 | + switch (typeof ref) { | |
| 741 | + case "function": { | |
| 742 | + const cleanupCallback = cleanupCallbacks[i]; | |
| 743 | + if (typeof cleanupCallback === "function") { | |
| 744 | + cleanupCallback(); | |
| 745 | + } else { | |
| 746 | + void ref(null); | |
| 747 | + } | |
| 748 | + break; | |
| 749 | + } | |
| 750 | + case "object": { | |
| 751 | + ref.current = null; | |
| 752 | + break; | |
| 753 | + } | |
| 754 | + default: | |
| 755 | + } | |
| 756 | + } | |
| 170 | 757 | }; |
| 171 | 758 | } |
| 172 | 759 | }; |
| 173 | 760 | } |
| 174 | -function useComposedRefs(...refs) { | |
| 175 | - return React.useCallback(composeRefs(...refs), refs); | |
| 761 | + | |
| 762 | +// node_modules/@base-ui/utils/getReactElementRef.mjs | |
| 763 | +var React8 = __toESM(require_react(), 1); | |
| 764 | + | |
| 765 | +// node_modules/@base-ui/utils/reactVersion.mjs | |
| 766 | +var React7 = __toESM(require_react(), 1); | |
| 767 | +var majorVersion = parseInt(React7.version, 10); | |
| 768 | +function isReactVersionAtLeast(reactVersionToCheck) { | |
| 769 | + return majorVersion >= reactVersionToCheck; | |
| 176 | 770 | } |
| 177 | 771 | |
| 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 }); | |
| 772 | +// node_modules/@base-ui/utils/getReactElementRef.mjs | |
| 773 | +function getReactElementRef(element) { | |
| 774 | + if (!/* @__PURE__ */ React8.isValidElement(element)) { | |
| 775 | + return null; | |
| 776 | + } | |
| 777 | + const reactElement = element; | |
| 778 | + const propsWithRef = reactElement.props; | |
| 779 | + return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; | |
| 780 | +} | |
| 781 | + | |
| 782 | +// node_modules/@base-ui/utils/mergeObjects.mjs | |
| 783 | +function mergeObjects(a, b) { | |
| 784 | + if (a && !b) { | |
| 785 | + return a; | |
| 786 | + } | |
| 787 | + if (!a && b) { | |
| 788 | + return b; | |
| 789 | + } | |
| 790 | + if (a || b) { | |
| 791 | + return { | |
| 792 | + ...a, | |
| 793 | + ...b | |
| 794 | + }; | |
| 795 | + } | |
| 796 | + return void 0; | |
| 797 | +} | |
| 798 | + | |
| 799 | +// node_modules/@base-ui/react/internals/getStateAttributesProps.mjs | |
| 800 | +function getStateAttributesProps(state, customMapping) { | |
| 801 | + const props = {}; | |
| 802 | + for (const key in state) { | |
| 803 | + const value = state[key]; | |
| 804 | + if (customMapping?.hasOwnProperty(key)) { | |
| 805 | + const customProps = customMapping[key](value); | |
| 806 | + if (customProps != null) { | |
| 807 | + Object.assign(props, customProps); | |
| 808 | + } | |
| 809 | + continue; | |
| 810 | + } | |
| 811 | + if (value === true) { | |
| 812 | + props[`data-${key.toLowerCase()}`] = ""; | |
| 813 | + } else if (value) { | |
| 814 | + props[`data-${key.toLowerCase()}`] = value.toString(); | |
| 815 | + } | |
| 816 | + } | |
| 817 | + return props; | |
| 818 | +} | |
| 819 | + | |
| 820 | +// node_modules/@base-ui/react/utils/resolveClassName.mjs | |
| 821 | +function resolveClassName(className, state) { | |
| 822 | + return typeof className === "function" ? className(state) : className; | |
| 823 | +} | |
| 824 | + | |
| 825 | +// node_modules/@base-ui/react/utils/resolveStyle.mjs | |
| 826 | +function resolveStyle(style, state) { | |
| 827 | + return typeof style === "function" ? style(state) : style; | |
| 828 | +} | |
| 829 | + | |
| 830 | +// node_modules/@base-ui/react/merge-props/mergeProps.mjs | |
| 831 | +var EMPTY_PROPS = {}; | |
| 832 | +function mergeProps(a, b, c, d, e) { | |
| 833 | + if (!c && !d && !e && !a) { | |
| 834 | + return createInitialMergedProps(b); | |
| 835 | + } | |
| 836 | + let merged = createInitialMergedProps(a); | |
| 837 | + if (b) { | |
| 838 | + merged = mergeInto(merged, b); | |
| 839 | + } | |
| 840 | + if (c) { | |
| 841 | + merged = mergeInto(merged, c); | |
| 842 | + } | |
| 843 | + if (d) { | |
| 844 | + merged = mergeInto(merged, d); | |
| 845 | + } | |
| 846 | + if (e) { | |
| 847 | + merged = mergeInto(merged, e); | |
| 848 | + } | |
| 849 | + return merged; | |
| 850 | +} | |
| 851 | +function mergePropsN(props) { | |
| 852 | + if (props.length === 0) { | |
| 853 | + return EMPTY_PROPS; | |
| 854 | + } | |
| 855 | + if (props.length === 1) { | |
| 856 | + return createInitialMergedProps(props[0]); | |
| 857 | + } | |
| 858 | + let merged = createInitialMergedProps(props[0]); | |
| 859 | + for (let i = 1; i < props.length; i += 1) { | |
| 860 | + merged = mergeInto(merged, props[i]); | |
| 861 | + } | |
| 862 | + return merged; | |
| 863 | +} | |
| 864 | +function createInitialMergedProps(inputProps) { | |
| 865 | + if (isPropsGetter(inputProps)) { | |
| 866 | + return { | |
| 867 | + ...resolvePropsGetter(inputProps, EMPTY_PROPS) | |
| 868 | + }; | |
| 869 | + } | |
| 870 | + return copyInitialProps(inputProps); | |
| 871 | +} | |
| 872 | +function mergeInto(merged, inputProps) { | |
| 873 | + if (isPropsGetter(inputProps)) { | |
| 874 | + return resolvePropsGetter(inputProps, merged); | |
| 875 | + } | |
| 876 | + return mutablyMergeInto(merged, inputProps); | |
| 877 | +} | |
| 878 | +function copyInitialProps(inputProps) { | |
| 879 | + const copiedProps = { | |
| 880 | + ...inputProps | |
| 187 | 881 | }; |
| 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}\``); | |
| 882 | + for (const propName in copiedProps) { | |
| 883 | + const propValue = copiedProps[propName]; | |
| 884 | + if (isEventHandler(propName, propValue)) { | |
| 885 | + copiedProps[propName] = wrapEventHandler(propValue); | |
| 886 | + } | |
| 194 | 887 | } |
| 195 | - return [Provider, useContext22]; | |
| 888 | + return copiedProps; | |
| 196 | 889 | } |
| 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 }); | |
| 890 | +function mutablyMergeInto(mergedProps, externalProps) { | |
| 891 | + if (!externalProps) { | |
| 892 | + return mergedProps; | |
| 893 | + } | |
| 894 | + for (const propName in externalProps) { | |
| 895 | + const externalPropValue = externalProps[propName]; | |
| 896 | + switch (propName) { | |
| 897 | + case "style": { | |
| 898 | + mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); | |
| 899 | + break; | |
| 900 | + } | |
| 901 | + case "className": { | |
| 902 | + mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); | |
| 903 | + break; | |
| 904 | + } | |
| 905 | + default: { | |
| 906 | + if (isEventHandler(propName, externalPropValue)) { | |
| 907 | + mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); | |
| 908 | + } else { | |
| 909 | + mergedProps[propName] = externalPropValue; | |
| 910 | + } | |
| 911 | + } | |
| 912 | + } | |
| 913 | + } | |
| 914 | + return mergedProps; | |
| 915 | +} | |
| 916 | +function isEventHandler(key, value) { | |
| 917 | + const code0 = key.charCodeAt(0); | |
| 918 | + const code1 = key.charCodeAt(1); | |
| 919 | + const code2 = key.charCodeAt(2); | |
| 920 | + return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); | |
| 921 | +} | |
| 922 | +function isPropsGetter(inputProps) { | |
| 923 | + return typeof inputProps === "function"; | |
| 924 | +} | |
| 925 | +function resolvePropsGetter(inputProps, previousProps) { | |
| 926 | + if (isPropsGetter(inputProps)) { | |
| 927 | + return inputProps(previousProps); | |
| 928 | + } | |
| 929 | + return inputProps ?? EMPTY_PROPS; | |
| 930 | +} | |
| 931 | +function mergeEventHandlers(ourHandler, theirHandler) { | |
| 932 | + if (!theirHandler) { | |
| 933 | + return ourHandler; | |
| 934 | + } | |
| 935 | + if (!ourHandler) { | |
| 936 | + return wrapEventHandler(theirHandler); | |
| 937 | + } | |
| 938 | + return (...args) => { | |
| 939 | + const event = args[0]; | |
| 940 | + if (isSyntheticEvent(event)) { | |
| 941 | + const baseUIEvent = event; | |
| 942 | + makeEventPreventable(baseUIEvent); | |
| 943 | + const result2 = theirHandler(...args); | |
| 944 | + if (!baseUIEvent.baseUIHandlerPrevented) { | |
| 945 | + ourHandler?.(...args); | |
| 946 | + } | |
| 947 | + return result2; | |
| 948 | + } | |
| 949 | + const result = theirHandler(...args); | |
| 950 | + ourHandler?.(...args); | |
| 951 | + return result; | |
| 952 | + }; | |
| 953 | +} | |
| 954 | +function wrapEventHandler(handler) { | |
| 955 | + if (!handler) { | |
| 956 | + return handler; | |
| 957 | + } | |
| 958 | + return (...args) => { | |
| 959 | + const event = args[0]; | |
| 960 | + if (isSyntheticEvent(event)) { | |
| 961 | + makeEventPreventable(event); | |
| 962 | + } | |
| 963 | + return handler(...args); | |
| 964 | + }; | |
| 965 | +} | |
| 966 | +function makeEventPreventable(event) { | |
| 967 | + event.preventBaseUIHandler = () => { | |
| 968 | + event.baseUIHandlerPrevented = true; | |
| 969 | + }; | |
| 970 | + return event; | |
| 971 | +} | |
| 972 | +function mergeClassNames(ourClassName, theirClassName) { | |
| 973 | + if (theirClassName) { | |
| 974 | + if (ourClassName) { | |
| 975 | + return theirClassName + " " + ourClassName; | |
| 976 | + } | |
| 977 | + return theirClassName; | |
| 978 | + } | |
| 979 | + return ourClassName; | |
| 980 | +} | |
| 981 | +function isSyntheticEvent(event) { | |
| 982 | + return event != null && typeof event === "object" && "nativeEvent" in event; | |
| 983 | +} | |
| 984 | + | |
| 985 | +// node_modules/@base-ui/react/internals/useRenderElement.mjs | |
| 986 | +var import_react = __toESM(require_react(), 1); | |
| 987 | +function useRenderElement(element, componentProps, params = {}) { | |
| 988 | + let renderProp = componentProps.render; | |
| 989 | + if (params.enabled !== false) { | |
| 990 | + renderProp = unwrapLazyRenderProp(renderProp); | |
| 991 | + } | |
| 992 | + const outProps = useRenderElementProps(componentProps, params, renderProp); | |
| 993 | + if (params.enabled === false) { | |
| 994 | + return null; | |
| 995 | + } | |
| 996 | + const state = params.state ?? EMPTY_OBJECT; | |
| 997 | + return evaluateRenderProp(element, renderProp, outProps, state); | |
| 998 | +} | |
| 999 | +function useRenderElementProps(componentProps, params, renderProp) { | |
| 1000 | + const { | |
| 1001 | + className: classNameProp, | |
| 1002 | + style: styleProp | |
| 1003 | + } = componentProps; | |
| 1004 | + const { | |
| 1005 | + state = EMPTY_OBJECT, | |
| 1006 | + ref, | |
| 1007 | + props, | |
| 1008 | + stateAttributesMapping: stateAttributesMapping5, | |
| 1009 | + enabled = true | |
| 1010 | + } = params; | |
| 1011 | + const className = enabled ? resolveClassName(classNameProp, state) : void 0; | |
| 1012 | + const style = enabled ? resolveStyle(styleProp, state) : void 0; | |
| 1013 | + const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping5) : EMPTY_OBJECT; | |
| 1014 | + const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; | |
| 1015 | + const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; | |
| 1016 | + if (typeof document !== "undefined") { | |
| 1017 | + if (!enabled) { | |
| 1018 | + void useMergedRefs(null, null); | |
| 1019 | + } else if (Array.isArray(ref)) { | |
| 1020 | + outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); | |
| 1021 | + } else { | |
| 1022 | + outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); | |
| 1023 | + } | |
| 1024 | + } | |
| 1025 | + if (!enabled) { | |
| 1026 | + return EMPTY_OBJECT; | |
| 1027 | + } | |
| 1028 | + if (className !== void 0) { | |
| 1029 | + outProps.className = mergeClassNames(outProps.className, className); | |
| 1030 | + } | |
| 1031 | + if (style !== void 0) { | |
| 1032 | + outProps.style = mergeObjects(outProps.style, style); | |
| 1033 | + } | |
| 1034 | + return outProps; | |
| 1035 | +} | |
| 1036 | +function resolveRenderFunctionProps(props) { | |
| 1037 | + if (Array.isArray(props)) { | |
| 1038 | + return mergePropsN(props); | |
| 1039 | + } | |
| 1040 | + return mergeProps(void 0, props); | |
| 1041 | +} | |
| 1042 | +var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); | |
| 1043 | +var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; | |
| 1044 | +var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; | |
| 1045 | +function unwrapLazyRenderProp(render) { | |
| 1046 | + if (render?.$$typeof !== REACT_LAZY_TYPE) { | |
| 1047 | + return render; | |
| 1048 | + } | |
| 1049 | + const unwrapped = React9.Children.toArray(render)[0]; | |
| 1050 | + return /* @__PURE__ */ React9.isValidElement(unwrapped) ? unwrapped : render; | |
| 1051 | +} | |
| 1052 | +function evaluateRenderProp(element, render, props, state) { | |
| 1053 | + if (render) { | |
| 1054 | + if (typeof render === "function") { | |
| 1055 | + if (true) { | |
| 1056 | + warnIfRenderPropLooksLikeComponent(render); | |
| 1057 | + } | |
| 1058 | + return render(props, state); | |
| 1059 | + } | |
| 1060 | + const mergedProps = mergeProps(props, render.props); | |
| 1061 | + mergedProps.ref = props.ref; | |
| 1062 | + if (true) { | |
| 1063 | + if (!/* @__PURE__ */ React9.isValidElement(render)) { | |
| 1064 | + throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.", "A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.", "https://base-ui.com/r/invalid-render-prop"].join("\n")); | |
| 1065 | + } | |
| 1066 | + } | |
| 1067 | + return /* @__PURE__ */ React9.cloneElement(render, mergedProps); | |
| 1068 | + } | |
| 1069 | + if (element) { | |
| 1070 | + if (typeof element === "string") { | |
| 1071 | + return renderTag(element, props); | |
| 1072 | + } | |
| 1073 | + } | |
| 1074 | + throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8)); | |
| 1075 | +} | |
| 1076 | +function warnIfRenderPropLooksLikeComponent(renderFn) { | |
| 1077 | + const functionName = renderFn.name; | |
| 1078 | + if (functionName.length === 0) { | |
| 1079 | + return; | |
| 1080 | + } | |
| 1081 | + if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { | |
| 1082 | + return; | |
| 1083 | + } | |
| 1084 | + if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { | |
| 1085 | + return; | |
| 1086 | + } | |
| 1087 | + warn(`The \`render\` prop received a function named \`${functionName}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop"); | |
| 1088 | +} | |
| 1089 | +function renderTag(Tag, props) { | |
| 1090 | + if (Tag === "button") { | |
| 1091 | + return /* @__PURE__ */ (0, import_react.createElement)("button", { | |
| 1092 | + type: "button", | |
| 1093 | + ...props, | |
| 1094 | + key: props.key | |
| 1095 | + }); | |
| 1096 | + } | |
| 1097 | + if (Tag === "img") { | |
| 1098 | + return /* @__PURE__ */ (0, import_react.createElement)("img", { | |
| 1099 | + alt: "", | |
| 1100 | + ...props, | |
| 1101 | + key: props.key | |
| 1102 | + }); | |
| 1103 | + } | |
| 1104 | + return /* @__PURE__ */ React9.createElement(Tag, props); | |
| 1105 | +} | |
| 1106 | + | |
| 1107 | +// node_modules/@base-ui/utils/useId.mjs | |
| 1108 | +var React10 = __toESM(require_react(), 1); | |
| 1109 | +var globalId = 0; | |
| 1110 | +function useGlobalId(idOverride, prefix = "mui") { | |
| 1111 | + const [defaultId, setDefaultId] = React10.useState(idOverride); | |
| 1112 | + const id = idOverride || defaultId; | |
| 1113 | + React10.useEffect(() => { | |
| 1114 | + if (defaultId == null) { | |
| 1115 | + globalId += 1; | |
| 1116 | + setDefaultId(`${prefix}-${globalId}`); | |
| 1117 | + } | |
| 1118 | + }, [defaultId, prefix]); | |
| 1119 | + return id; | |
| 1120 | +} | |
| 1121 | +var maybeReactUseId = SafeReact.useId; | |
| 1122 | +function useId(idOverride, prefix) { | |
| 1123 | + if (maybeReactUseId !== void 0) { | |
| 1124 | + const reactId = maybeReactUseId(); | |
| 1125 | + return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId); | |
| 1126 | + } | |
| 1127 | + return useGlobalId(idOverride, prefix); | |
| 1128 | +} | |
| 1129 | + | |
| 1130 | +// node_modules/@base-ui/react/internals/useBaseUiId.mjs | |
| 1131 | +function useBaseUiId(idOverride) { | |
| 1132 | + return useId(idOverride, "base-ui"); | |
| 1133 | +} | |
| 1134 | + | |
| 1135 | +// node_modules/@base-ui/react/internals/reason-parts.mjs | |
| 1136 | +var reason_parts_exports = {}; | |
| 1137 | +__export(reason_parts_exports, { | |
| 1138 | + cancelOpen: () => cancelOpen, | |
| 1139 | + chipRemovePress: () => chipRemovePress, | |
| 1140 | + clearPress: () => clearPress, | |
| 1141 | + closePress: () => closePress, | |
| 1142 | + closeWatcher: () => closeWatcher, | |
| 1143 | + decrementPress: () => decrementPress, | |
| 1144 | + disabled: () => disabled, | |
| 1145 | + drag: () => drag, | |
| 1146 | + escapeKey: () => escapeKey, | |
| 1147 | + focusOut: () => focusOut, | |
| 1148 | + imperativeAction: () => imperativeAction, | |
| 1149 | + incrementPress: () => incrementPress, | |
| 1150 | + initial: () => initial, | |
| 1151 | + inputBlur: () => inputBlur, | |
| 1152 | + inputChange: () => inputChange, | |
| 1153 | + inputClear: () => inputClear, | |
| 1154 | + inputPaste: () => inputPaste, | |
| 1155 | + inputPress: () => inputPress, | |
| 1156 | + itemPress: () => itemPress, | |
| 1157 | + keyboard: () => keyboard, | |
| 1158 | + linkPress: () => linkPress, | |
| 1159 | + listNavigation: () => listNavigation, | |
| 1160 | + missing: () => missing, | |
| 1161 | + none: () => none, | |
| 1162 | + outsidePress: () => outsidePress, | |
| 1163 | + pointer: () => pointer, | |
| 1164 | + scrub: () => scrub, | |
| 1165 | + siblingOpen: () => siblingOpen, | |
| 1166 | + swipe: () => swipe, | |
| 1167 | + trackPress: () => trackPress, | |
| 1168 | + triggerFocus: () => triggerFocus, | |
| 1169 | + triggerHover: () => triggerHover, | |
| 1170 | + triggerPress: () => triggerPress, | |
| 1171 | + wheel: () => wheel, | |
| 1172 | + windowResize: () => windowResize | |
| 1173 | +}); | |
| 1174 | +var none = "none"; | |
| 1175 | +var triggerPress = "trigger-press"; | |
| 1176 | +var triggerHover = "trigger-hover"; | |
| 1177 | +var triggerFocus = "trigger-focus"; | |
| 1178 | +var outsidePress = "outside-press"; | |
| 1179 | +var itemPress = "item-press"; | |
| 1180 | +var closePress = "close-press"; | |
| 1181 | +var linkPress = "link-press"; | |
| 1182 | +var clearPress = "clear-press"; | |
| 1183 | +var chipRemovePress = "chip-remove-press"; | |
| 1184 | +var trackPress = "track-press"; | |
| 1185 | +var incrementPress = "increment-press"; | |
| 1186 | +var decrementPress = "decrement-press"; | |
| 1187 | +var inputChange = "input-change"; | |
| 1188 | +var inputClear = "input-clear"; | |
| 1189 | +var inputBlur = "input-blur"; | |
| 1190 | +var inputPaste = "input-paste"; | |
| 1191 | +var inputPress = "input-press"; | |
| 1192 | +var focusOut = "focus-out"; | |
| 1193 | +var escapeKey = "escape-key"; | |
| 1194 | +var closeWatcher = "close-watcher"; | |
| 1195 | +var listNavigation = "list-navigation"; | |
| 1196 | +var keyboard = "keyboard"; | |
| 1197 | +var pointer = "pointer"; | |
| 1198 | +var drag = "drag"; | |
| 1199 | +var wheel = "wheel"; | |
| 1200 | +var scrub = "scrub"; | |
| 1201 | +var cancelOpen = "cancel-open"; | |
| 1202 | +var siblingOpen = "sibling-open"; | |
| 1203 | +var disabled = "disabled"; | |
| 1204 | +var missing = "missing"; | |
| 1205 | +var initial = "initial"; | |
| 1206 | +var imperativeAction = "imperative-action"; | |
| 1207 | +var swipe = "swipe"; | |
| 1208 | +var windowResize = "window-resize"; | |
| 1209 | + | |
| 1210 | +// node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs | |
| 1211 | +function createChangeEventDetails(reason, event, trigger, customProperties) { | |
| 1212 | + let canceled = false; | |
| 1213 | + let allowPropagation = false; | |
| 1214 | + const custom = customProperties ?? EMPTY_OBJECT; | |
| 1215 | + const details = { | |
| 1216 | + reason, | |
| 1217 | + event: event ?? new Event("base-ui"), | |
| 1218 | + cancel() { | |
| 1219 | + canceled = true; | |
| 1220 | + }, | |
| 1221 | + allowPropagation() { | |
| 1222 | + allowPropagation = true; | |
| 1223 | + }, | |
| 1224 | + get isCanceled() { | |
| 1225 | + return canceled; | |
| 1226 | + }, | |
| 1227 | + get isPropagationAllowed() { | |
| 1228 | + return allowPropagation; | |
| 1229 | + }, | |
| 1230 | + trigger, | |
| 1231 | + ...custom | |
| 1232 | + }; | |
| 1233 | + return details; | |
| 1234 | +} | |
| 1235 | +function createGenericEventDetails(reason, event, customProperties) { | |
| 1236 | + const custom = customProperties ?? EMPTY_OBJECT; | |
| 1237 | + const details = { | |
| 1238 | + reason, | |
| 1239 | + event: event ?? new Event("base-ui"), | |
| 1240 | + ...custom | |
| 1241 | + }; | |
| 1242 | + return details; | |
| 1243 | +} | |
| 1244 | + | |
| 1245 | +// node_modules/@base-ui/react/internals/useTransitionStatus.mjs | |
| 1246 | +var React12 = __toESM(require_react(), 1); | |
| 1247 | + | |
| 1248 | +// node_modules/@base-ui/utils/useOnMount.mjs | |
| 1249 | +var React11 = __toESM(require_react(), 1); | |
| 1250 | +function useOnMount(fn) { | |
| 1251 | + React11.useEffect(fn, EMPTY_ARRAY); | |
| 1252 | +} | |
| 1253 | + | |
| 1254 | +// node_modules/@base-ui/utils/useAnimationFrame.mjs | |
| 1255 | +var EMPTY = null; | |
| 1256 | +var LAST_RAF = globalThis.requestAnimationFrame; | |
| 1257 | +var Scheduler = class { | |
| 1258 | + /* This implementation uses an array as a backing data-structure for frame callbacks. | |
| 1259 | + * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it | |
| 1260 | + * never calls the native `cancelAnimationFrame` if there are no frames left. This can | |
| 1261 | + * be much more efficient if there is a call pattern that alterns as | |
| 1262 | + * "request-cancel-request-cancel-…". | |
| 1263 | + * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation | |
| 1264 | + * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */ | |
| 1265 | + callbacks = []; | |
| 1266 | + callbacksCount = 0; | |
| 1267 | + nextId = 1; | |
| 1268 | + startId = 1; | |
| 1269 | + isScheduled = false; | |
| 1270 | + tick = (timestamp) => { | |
| 1271 | + this.isScheduled = false; | |
| 1272 | + const currentCallbacks = this.callbacks; | |
| 1273 | + const currentCallbacksCount = this.callbacksCount; | |
| 1274 | + this.callbacks = []; | |
| 1275 | + this.callbacksCount = 0; | |
| 1276 | + this.startId = this.nextId; | |
| 1277 | + if (currentCallbacksCount > 0) { | |
| 1278 | + for (let i = 0; i < currentCallbacks.length; i += 1) { | |
| 1279 | + currentCallbacks[i]?.(timestamp); | |
| 1280 | + } | |
| 1281 | + } | |
| 1282 | + }; | |
| 1283 | + request(fn) { | |
| 1284 | + const id = this.nextId; | |
| 1285 | + this.nextId += 1; | |
| 1286 | + this.callbacks.push(fn); | |
| 1287 | + this.callbacksCount += 1; | |
| 1288 | + const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true); | |
| 1289 | + if (!this.isScheduled || didRAFChange) { | |
| 1290 | + requestAnimationFrame(this.tick); | |
| 1291 | + this.isScheduled = true; | |
| 1292 | + } | |
| 1293 | + return id; | |
| 1294 | + } | |
| 1295 | + cancel(id) { | |
| 1296 | + const index2 = id - this.startId; | |
| 1297 | + if (index2 < 0 || index2 >= this.callbacks.length) { | |
| 1298 | + return; | |
| 1299 | + } | |
| 1300 | + if (this.callbacks[index2] === null) { | |
| 1301 | + return; | |
| 1302 | + } | |
| 1303 | + this.callbacks[index2] = null; | |
| 1304 | + this.callbacksCount -= 1; | |
| 1305 | + } | |
| 1306 | +}; | |
| 1307 | +var scheduler = new Scheduler(); | |
| 1308 | +var AnimationFrame = class _AnimationFrame { | |
| 1309 | + static create() { | |
| 1310 | + return new _AnimationFrame(); | |
| 1311 | + } | |
| 1312 | + static request(fn) { | |
| 1313 | + return scheduler.request(fn); | |
| 1314 | + } | |
| 1315 | + static cancel(id) { | |
| 1316 | + return scheduler.cancel(id); | |
| 1317 | + } | |
| 1318 | + currentId = EMPTY; | |
| 1319 | + /** | |
| 1320 | + * Executes `fn` after `delay`, clearing any previously scheduled call. | |
| 1321 | + */ | |
| 1322 | + request(fn) { | |
| 1323 | + this.cancel(); | |
| 1324 | + this.currentId = scheduler.request(() => { | |
| 1325 | + this.currentId = EMPTY; | |
| 1326 | + fn(); | |
| 1327 | + }); | |
| 1328 | + } | |
| 1329 | + cancel = () => { | |
| 1330 | + if (this.currentId !== EMPTY) { | |
| 1331 | + scheduler.cancel(this.currentId); | |
| 1332 | + this.currentId = EMPTY; | |
| 1333 | + } | |
| 1334 | + }; | |
| 1335 | + disposeEffect = () => { | |
| 1336 | + return this.cancel; | |
| 1337 | + }; | |
| 1338 | +}; | |
| 1339 | +function useAnimationFrame() { | |
| 1340 | + const timeout = useRefWithInit(AnimationFrame.create).current; | |
| 1341 | + useOnMount(timeout.disposeEffect); | |
| 1342 | + return timeout; | |
| 1343 | +} | |
| 1344 | + | |
| 1345 | +// node_modules/@base-ui/react/internals/useTransitionStatus.mjs | |
| 1346 | +function useTransitionStatus(open2, enableIdleState = false, deferEndingState = false, animateInitialOpen = false) { | |
| 1347 | + const [transitionStatus, setTransitionStatus] = React12.useState(open2 && enableIdleState ? "idle" : void 0); | |
| 1348 | + const [mounted, setMounted] = React12.useState(open2 && !animateInitialOpen); | |
| 1349 | + if (open2 && !mounted) { | |
| 1350 | + setMounted(true); | |
| 1351 | + setTransitionStatus("starting"); | |
| 1352 | + } | |
| 1353 | + if (!open2 && mounted && transitionStatus !== "ending" && !deferEndingState) { | |
| 1354 | + setTransitionStatus("ending"); | |
| 1355 | + } | |
| 1356 | + if (!open2 && !mounted && transitionStatus === "ending") { | |
| 1357 | + setTransitionStatus(void 0); | |
| 1358 | + } | |
| 1359 | + useIsoLayoutEffect(() => { | |
| 1360 | + if (!open2 && mounted && transitionStatus !== "ending" && deferEndingState) { | |
| 1361 | + const frame = AnimationFrame.request(() => { | |
| 1362 | + setTransitionStatus("ending"); | |
| 1363 | + }); | |
| 1364 | + return () => { | |
| 1365 | + AnimationFrame.cancel(frame); | |
| 1366 | + }; | |
| 1367 | + } | |
| 1368 | + return void 0; | |
| 1369 | + }, [open2, mounted, transitionStatus, deferEndingState]); | |
| 1370 | + useIsoLayoutEffect(() => { | |
| 1371 | + if (!open2 || enableIdleState) { | |
| 1372 | + return void 0; | |
| 1373 | + } | |
| 1374 | + const frame = AnimationFrame.request(() => { | |
| 1375 | + setTransitionStatus(void 0); | |
| 1376 | + }); | |
| 1377 | + return () => { | |
| 1378 | + AnimationFrame.cancel(frame); | |
| 208 | 1379 | }; |
| 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}\``); | |
| 1380 | + }, [enableIdleState, open2]); | |
| 1381 | + useIsoLayoutEffect(() => { | |
| 1382 | + if (!open2 || !enableIdleState) { | |
| 1383 | + return void 0; | |
| 216 | 1384 | } |
| 217 | - return [Provider, useContext22]; | |
| 218 | - } | |
| 219 | - const createScope = () => { | |
| 220 | - const scopeContexts = defaultContexts.map((defaultContext) => { | |
| 221 | - return React2.createContext(defaultContext); | |
| 1385 | + if (open2 && mounted && transitionStatus !== "idle") { | |
| 1386 | + setTransitionStatus("starting"); | |
| 1387 | + } | |
| 1388 | + const frame = AnimationFrame.request(() => { | |
| 1389 | + setTransitionStatus("idle"); | |
| 222 | 1390 | }); |
| 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 | - ); | |
| 1391 | + return () => { | |
| 1392 | + AnimationFrame.cancel(frame); | |
| 229 | 1393 | }; |
| 1394 | + }, [enableIdleState, open2, mounted, transitionStatus]); | |
| 1395 | + return { | |
| 1396 | + mounted, | |
| 1397 | + setMounted, | |
| 1398 | + transitionStatus | |
| 230 | 1399 | }; |
| 231 | - createScope.scopeName = scopeName; | |
| 232 | - return [createContext32, composeContextScopes(createScope, ...createContextScopeDeps)]; | |
| 233 | 1400 | } |
| 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]); | |
| 1401 | + | |
| 1402 | +// node_modules/@base-ui/react/internals/composite/list/useCompositeListItem.mjs | |
| 1403 | +var React13 = __toESM(require_react(), 1); | |
| 1404 | +function useCompositeListItem(params = {}) { | |
| 1405 | + const { | |
| 1406 | + guess, | |
| 1407 | + label, | |
| 1408 | + metadata, | |
| 1409 | + textRef, | |
| 1410 | + index: externalIndex | |
| 1411 | + } = params; | |
| 1412 | + const { | |
| 1413 | + register: register2, | |
| 1414 | + unregister, | |
| 1415 | + subscribeMapChange, | |
| 1416 | + nextIndexRef | |
| 1417 | + } = useCompositeListContext(); | |
| 1418 | + const indexRef = React13.useRef(-1); | |
| 1419 | + const [internalIndex, setInternalIndex] = React13.useState(externalIndex == null && guess ? () => { | |
| 1420 | + if (indexRef.current === -1) { | |
| 1421 | + const newIndex = nextIndexRef.current; | |
| 1422 | + nextIndexRef.current += 1; | |
| 1423 | + indexRef.current = newIndex; | |
| 1424 | + } | |
| 1425 | + return indexRef.current; | |
| 1426 | + } : -1); | |
| 1427 | + const index2 = externalIndex ?? internalIndex; | |
| 1428 | + const componentRef = React13.useRef(null); | |
| 1429 | + const ref = React13.useCallback((node) => { | |
| 1430 | + const previousNode = componentRef.current; | |
| 1431 | + if (previousNode) { | |
| 1432 | + unregister(previousNode); | |
| 1433 | + } | |
| 1434 | + componentRef.current = node; | |
| 1435 | + if (node) { | |
| 1436 | + register2(node, { | |
| 1437 | + metadata: metadata ?? null, | |
| 1438 | + index: externalIndex ?? null, | |
| 1439 | + label, | |
| 1440 | + textRef | |
| 1441 | + }); | |
| 1442 | + } | |
| 1443 | + }, [externalIndex, register2, unregister, metadata, label, textRef]); | |
| 1444 | + useIsoLayoutEffect(() => { | |
| 1445 | + if (externalIndex != null) { | |
| 1446 | + return void 0; | |
| 1447 | + } | |
| 1448 | + return subscribeMapChange((map) => { | |
| 1449 | + const i = componentRef.current ? map.get(componentRef.current)?.index : null; | |
| 1450 | + if (i != null) { | |
| 1451 | + setInternalIndex(i); | |
| 1452 | + } | |
| 1453 | + }); | |
| 1454 | + }, [externalIndex, subscribeMapChange]); | |
| 1455 | + return { | |
| 1456 | + ref, | |
| 1457 | + index: index2 | |
| 1458 | + }; | |
| 1459 | +} | |
| 1460 | + | |
| 1461 | +// node_modules/@base-ui/react/internals/TransitionStatusDataAttributes.mjs | |
| 1462 | +var startingStyle = "data-starting-style"; | |
| 1463 | +var endingStyle = "data-ending-style"; | |
| 1464 | + | |
| 1465 | +// node_modules/@base-ui/react/internals/stateAttributesMapping.mjs | |
| 1466 | +var STARTING_HOOK = { | |
| 1467 | + [startingStyle]: "" | |
| 1468 | +}; | |
| 1469 | +var ENDING_HOOK = { | |
| 1470 | + [endingStyle]: "" | |
| 1471 | +}; | |
| 1472 | +var transitionStatusMapping = { | |
| 1473 | + transitionStatus(value) { | |
| 1474 | + if (value === "starting") { | |
| 1475 | + return STARTING_HOOK; | |
| 1476 | + } | |
| 1477 | + if (value === "ending") { | |
| 1478 | + return ENDING_HOOK; | |
| 1479 | + } | |
| 1480 | + return null; | |
| 1481 | + } | |
| 1482 | +}; | |
| 1483 | + | |
| 1484 | +// node_modules/@base-ui/react/internals/use-button/useButton.mjs | |
| 1485 | +var React16 = __toESM(require_react(), 1); | |
| 1486 | + | |
| 1487 | +// node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs | |
| 1488 | +function hasWindow() { | |
| 1489 | + return typeof window !== "undefined"; | |
| 1490 | +} | |
| 1491 | +function getNodeName(node) { | |
| 1492 | + if (isNode(node)) { | |
| 1493 | + return (node.nodeName || "").toLowerCase(); | |
| 1494 | + } | |
| 1495 | + return "#document"; | |
| 1496 | +} | |
| 1497 | +function getWindow(node) { | |
| 1498 | + var _node$ownerDocument; | |
| 1499 | + return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; | |
| 1500 | +} | |
| 1501 | +function getDocumentElement(node) { | |
| 1502 | + var _ref; | |
| 1503 | + return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; | |
| 1504 | +} | |
| 1505 | +function isNode(value) { | |
| 1506 | + if (!hasWindow()) { | |
| 1507 | + return false; | |
| 1508 | + } | |
| 1509 | + return value instanceof Node || value instanceof getWindow(value).Node; | |
| 1510 | +} | |
| 1511 | +function isElement(value) { | |
| 1512 | + if (!hasWindow()) { | |
| 1513 | + return false; | |
| 1514 | + } | |
| 1515 | + return value instanceof Element || value instanceof getWindow(value).Element; | |
| 1516 | +} | |
| 1517 | +function isHTMLElement(value) { | |
| 1518 | + if (!hasWindow()) { | |
| 1519 | + return false; | |
| 1520 | + } | |
| 1521 | + return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; | |
| 1522 | +} | |
| 1523 | +function isShadowRoot(value) { | |
| 1524 | + if (!hasWindow() || typeof ShadowRoot === "undefined") { | |
| 1525 | + return false; | |
| 1526 | + } | |
| 1527 | + return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; | |
| 1528 | +} | |
| 1529 | +function isOverflowElement(element) { | |
| 1530 | + const { | |
| 1531 | + overflow, | |
| 1532 | + overflowX, | |
| 1533 | + overflowY, | |
| 1534 | + display | |
| 1535 | + } = getComputedStyle2(element); | |
| 1536 | + return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents"; | |
| 1537 | +} | |
| 1538 | +function isTableElement(element) { | |
| 1539 | + return /^(table|td|th)$/.test(getNodeName(element)); | |
| 1540 | +} | |
| 1541 | +function isTopLayer(element) { | |
| 1542 | + try { | |
| 1543 | + if (element.matches(":popover-open")) { | |
| 1544 | + return true; | |
| 1545 | + } | |
| 1546 | + } catch (_e) { | |
| 1547 | + } | |
| 1548 | + try { | |
| 1549 | + return element.matches(":modal"); | |
| 1550 | + } catch (_e) { | |
| 1551 | + return false; | |
| 1552 | + } | |
| 1553 | +} | |
| 1554 | +var willChangeRe = /transform|translate|scale|rotate|perspective|filter/; | |
| 1555 | +var containRe = /paint|layout|strict|content/; | |
| 1556 | +var isNotNone = (value) => !!value && value !== "none"; | |
| 1557 | +var isWebKitValue; | |
| 1558 | +function isContainingBlock(elementOrCss) { | |
| 1559 | + const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss; | |
| 1560 | + return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || ""); | |
| 1561 | +} | |
| 1562 | +function getContainingBlock(element) { | |
| 1563 | + let currentNode = getParentNode(element); | |
| 1564 | + while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { | |
| 1565 | + if (isContainingBlock(currentNode)) { | |
| 1566 | + return currentNode; | |
| 1567 | + } else if (isTopLayer(currentNode)) { | |
| 1568 | + return null; | |
| 1569 | + } | |
| 1570 | + currentNode = getParentNode(currentNode); | |
| 1571 | + } | |
| 1572 | + return null; | |
| 1573 | +} | |
| 1574 | +function isWebKit() { | |
| 1575 | + if (isWebKitValue == null) { | |
| 1576 | + isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"); | |
| 1577 | + } | |
| 1578 | + return isWebKitValue; | |
| 1579 | +} | |
| 1580 | +function isLastTraversableNode(node) { | |
| 1581 | + return /^(html|body|#document)$/.test(getNodeName(node)); | |
| 1582 | +} | |
| 1583 | +function getComputedStyle2(element) { | |
| 1584 | + return getWindow(element).getComputedStyle(element); | |
| 1585 | +} | |
| 1586 | +function getNodeScroll(element) { | |
| 1587 | + if (isElement(element)) { | |
| 1588 | + return { | |
| 1589 | + scrollLeft: element.scrollLeft, | |
| 1590 | + scrollTop: element.scrollTop | |
| 249 | 1591 | }; |
| 1592 | + } | |
| 1593 | + return { | |
| 1594 | + scrollLeft: element.scrollX, | |
| 1595 | + scrollTop: element.scrollY | |
| 250 | 1596 | }; |
| 251 | - createScope.scopeName = baseScope.scopeName; | |
| 252 | - return createScope; | |
| 253 | 1597 | } |
| 1598 | +function getParentNode(node) { | |
| 1599 | + if (getNodeName(node) === "html") { | |
| 1600 | + return node; | |
| 1601 | + } | |
| 1602 | + const result = ( | |
| 1603 | + // Step into the shadow DOM of the parent of a slotted node. | |
| 1604 | + node.assignedSlot || // DOM Element detected. | |
| 1605 | + node.parentNode || // ShadowRoot detected. | |
| 1606 | + isShadowRoot(node) && node.host || // Fallback. | |
| 1607 | + getDocumentElement(node) | |
| 1608 | + ); | |
| 1609 | + return isShadowRoot(result) ? result.host : result; | |
| 1610 | +} | |
| 1611 | +function getNearestOverflowAncestor(node) { | |
| 1612 | + const parentNode = getParentNode(node); | |
| 1613 | + if (isLastTraversableNode(parentNode)) { | |
| 1614 | + return (node.ownerDocument || node).body; | |
| 1615 | + } | |
| 1616 | + if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { | |
| 1617 | + return parentNode; | |
| 1618 | + } | |
| 1619 | + return getNearestOverflowAncestor(parentNode); | |
| 1620 | +} | |
| 1621 | +function getOverflowAncestors(node, list, traverseIframes) { | |
| 1622 | + var _node$ownerDocument2; | |
| 1623 | + if (list === void 0) { | |
| 1624 | + list = []; | |
| 1625 | + } | |
| 1626 | + if (traverseIframes === void 0) { | |
| 1627 | + traverseIframes = true; | |
| 1628 | + } | |
| 1629 | + const scrollableAncestor = getNearestOverflowAncestor(node); | |
| 1630 | + const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); | |
| 1631 | + const win = getWindow(scrollableAncestor); | |
| 1632 | + if (isBody) { | |
| 1633 | + const frameElement = getFrameElement(win); | |
| 1634 | + return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); | |
| 1635 | + } else { | |
| 1636 | + return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); | |
| 1637 | + } | |
| 1638 | +} | |
| 1639 | +function getFrameElement(win) { | |
| 1640 | + return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; | |
| 1641 | +} | |
| 254 | 1642 | |
| 255 | -// node_modules/@radix-ui/react-id/dist/index.mjs | |
| 256 | -var React4 = __toESM(require_react(), 1); | |
| 1643 | +// node_modules/@base-ui/react/internals/composite/root/CompositeRootContext.mjs | |
| 1644 | +var React14 = __toESM(require_react(), 1); | |
| 1645 | +var CompositeRootContext = /* @__PURE__ */ React14.createContext(void 0); | |
| 1646 | +if (true) CompositeRootContext.displayName = "CompositeRootContext"; | |
| 1647 | +function useCompositeRootContext(optional = false) { | |
| 1648 | + const context = React14.useContext(CompositeRootContext); | |
| 1649 | + if (context === void 0 && !optional) { | |
| 1650 | + throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : formatErrorMessage_default(16)); | |
| 1651 | + } | |
| 1652 | + return context; | |
| 1653 | +} | |
| 257 | 1654 | |
| 258 | -// 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 | -}; | |
| 1655 | +// node_modules/@base-ui/react/utils/useFocusableWhenDisabled.mjs | |
| 1656 | +var React15 = __toESM(require_react(), 1); | |
| 1657 | +function useFocusableWhenDisabled(parameters) { | |
| 1658 | + const { | |
| 1659 | + focusableWhenDisabled, | |
| 1660 | + disabled: disabled2, | |
| 1661 | + composite = false, | |
| 1662 | + tabIndex: tabIndexProp = 0, | |
| 1663 | + isNativeButton | |
| 1664 | + } = parameters; | |
| 1665 | + const isFocusableComposite = composite && focusableWhenDisabled !== false; | |
| 1666 | + const isNonFocusableComposite = composite && focusableWhenDisabled === false; | |
| 1667 | + const props = React15.useMemo(() => { | |
| 1668 | + const additionalProps = { | |
| 1669 | + // allow Tabbing away from focusableWhenDisabled elements | |
| 1670 | + onKeyDown(event) { | |
| 1671 | + if (disabled2 && focusableWhenDisabled && event.key !== "Tab") { | |
| 1672 | + event.preventDefault(); | |
| 1673 | + } | |
| 1674 | + } | |
| 1675 | + }; | |
| 1676 | + if (!composite) { | |
| 1677 | + additionalProps.tabIndex = tabIndexProp; | |
| 1678 | + if (!isNativeButton && disabled2) { | |
| 1679 | + additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1; | |
| 1680 | + } | |
| 1681 | + } | |
| 1682 | + if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) { | |
| 1683 | + additionalProps["aria-disabled"] = disabled2; | |
| 1684 | + } | |
| 1685 | + if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) { | |
| 1686 | + additionalProps.disabled = disabled2; | |
| 1687 | + } | |
| 1688 | + return additionalProps; | |
| 1689 | + }, [composite, disabled2, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]); | |
| 1690 | + return { | |
| 1691 | + props | |
| 1692 | + }; | |
| 1693 | +} | |
| 262 | 1694 | |
| 263 | -// 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}` : ""); | |
| 1695 | +// node_modules/@base-ui/utils/owner.mjs | |
| 1696 | +function ownerDocument(node) { | |
| 1697 | + return node?.ownerDocument || document; | |
| 272 | 1698 | } |
| 273 | 1699 | |
| 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 | |
| 1700 | +// node_modules/@base-ui/react/utils/dispatchClickWithModifiers.mjs | |
| 1701 | +function dispatchClickWithModifiers(target, sourceEvent, { | |
| 1702 | + detail = 0 | |
| 1703 | +} = {}) { | |
| 1704 | + target.dispatchEvent(new (getWindow(target)).PointerEvent("click", { | |
| 1705 | + bubbles: true, | |
| 1706 | + cancelable: true, | |
| 1707 | + composed: true, | |
| 1708 | + detail, | |
| 1709 | + shiftKey: sourceEvent.shiftKey, | |
| 1710 | + ctrlKey: sourceEvent.ctrlKey, | |
| 1711 | + altKey: sourceEvent.altKey, | |
| 1712 | + metaKey: sourceEvent.metaKey | |
| 1713 | + })); | |
| 1714 | +} | |
| 1715 | + | |
| 1716 | +// node_modules/@base-ui/react/internals/use-button/useButton.mjs | |
| 1717 | +function useButton(parameters = {}) { | |
| 1718 | + const { | |
| 1719 | + disabled: disabled2 = false, | |
| 1720 | + focusableWhenDisabled, | |
| 1721 | + tabIndex = 0, | |
| 1722 | + native: isNativeButton = true, | |
| 1723 | + composite: compositeProp | |
| 1724 | + } = parameters; | |
| 1725 | + const elementRef = React16.useRef(null); | |
| 1726 | + const compositeRootContext = useCompositeRootContext(true); | |
| 1727 | + const isCompositeItem = compositeProp ?? compositeRootContext !== void 0; | |
| 1728 | + const { | |
| 1729 | + props: focusableWhenDisabledProps | |
| 1730 | + } = useFocusableWhenDisabled({ | |
| 1731 | + focusableWhenDisabled, | |
| 1732 | + disabled: disabled2, | |
| 1733 | + composite: isCompositeItem, | |
| 1734 | + tabIndex, | |
| 1735 | + isNativeButton | |
| 288 | 1736 | }); |
| 289 | - const isControlled = prop !== void 0; | |
| 290 | - const value = isControlled ? prop : uncontrolledProp; | |
| 291 | 1737 | 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 | - ); | |
| 1738 | + React16.useEffect(() => { | |
| 1739 | + if (!elementRef.current) { | |
| 1740 | + return; | |
| 301 | 1741 | } |
| 302 | - isControlledRef.current = isControlled; | |
| 303 | - }, [isControlled, caller]); | |
| 1742 | + const isButtonTag = isButtonElement(elementRef.current); | |
| 1743 | + if (isNativeButton) { | |
| 1744 | + if (!isButtonTag) { | |
| 1745 | + const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; | |
| 1746 | + const message = "A component that acts as a button expected a native <button> because the `nativeButton` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the `render` prop, or set `nativeButton` to `false`."; | |
| 1747 | + error(`${message}${ownerStackMessage}`); | |
| 1748 | + } | |
| 1749 | + } else if (isButtonTag) { | |
| 1750 | + const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; | |
| 1751 | + const message = "A component that acts as a button expected a non-<button> because the `nativeButton` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as `role` or `aria-disabled`). Use a non-<button> in the `render` prop, or set `nativeButton` to `true`."; | |
| 1752 | + error(`${message}${ownerStackMessage}`); | |
| 1753 | + } | |
| 1754 | + }, [isNativeButton]); | |
| 304 | 1755 | } |
| 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); | |
| 1756 | + const updateDisabled = React16.useCallback(() => { | |
| 1757 | + const element = elementRef.current; | |
| 1758 | + if (!isButtonElement(element)) { | |
| 1759 | + return; | |
| 1760 | + } | |
| 1761 | + if (isCompositeItem && disabled2 && focusableWhenDisabledProps.disabled === void 0 && element.disabled) { | |
| 1762 | + element.disabled = false; | |
| 1763 | + } | |
| 1764 | + }, [disabled2, focusableWhenDisabledProps.disabled, isCompositeItem]); | |
| 1765 | + useIsoLayoutEffect(updateDisabled, [updateDisabled]); | |
| 1766 | + const getButtonProps = React16.useCallback((externalProps = {}) => { | |
| 1767 | + const { | |
| 1768 | + onClick: externalOnClick, | |
| 1769 | + onMouseDown: externalOnMouseDown, | |
| 1770 | + onKeyUp: externalOnKeyUp, | |
| 1771 | + onKeyDown: externalOnKeyDown, | |
| 1772 | + onPointerDown: externalOnPointerDown, | |
| 1773 | + ...otherExternalProps | |
| 1774 | + } = externalProps; | |
| 1775 | + return mergeProps({ | |
| 1776 | + onClick(event) { | |
| 1777 | + if (disabled2) { | |
| 1778 | + event.preventDefault(); | |
| 1779 | + return; | |
| 311 | 1780 | } |
| 312 | - } else { | |
| 313 | - setUncontrolledProp(nextValue); | |
| 1781 | + externalOnClick?.(event); | |
| 1782 | + }, | |
| 1783 | + onMouseDown(event) { | |
| 1784 | + if (!disabled2) { | |
| 1785 | + externalOnMouseDown?.(event); | |
| 1786 | + } | |
| 1787 | + }, | |
| 1788 | + onKeyDown(event) { | |
| 1789 | + if (disabled2) { | |
| 1790 | + return; | |
| 1791 | + } | |
| 1792 | + makeEventPreventable(event); | |
| 1793 | + externalOnKeyDown?.(event); | |
| 1794 | + if (event.baseUIHandlerPrevented) { | |
| 1795 | + return; | |
| 1796 | + } | |
| 1797 | + const isCurrentTarget = event.target === event.currentTarget; | |
| 1798 | + const currentTarget = event.currentTarget; | |
| 1799 | + const isButton = isButtonElement(currentTarget); | |
| 1800 | + const isLink = !isNativeButton && isValidLinkElement(currentTarget); | |
| 1801 | + const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink); | |
| 1802 | + const isEnterKey = event.key === "Enter"; | |
| 1803 | + const isSpaceKey = event.key === " "; | |
| 1804 | + const role = currentTarget.getAttribute("role"); | |
| 1805 | + const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell"; | |
| 1806 | + if (isCurrentTarget && isCompositeItem && isSpaceKey) { | |
| 1807 | + if (event.defaultPrevented && isTextNavigationRole) { | |
| 1808 | + return; | |
| 1809 | + } | |
| 1810 | + event.preventDefault(); | |
| 1811 | + if (!isNativeButton || isButton) { | |
| 1812 | + event.preventBaseUIHandler(); | |
| 1813 | + dispatchClickWithModifiers(currentTarget, event); | |
| 1814 | + } | |
| 1815 | + return; | |
| 1816 | + } | |
| 1817 | + if (!shouldClick || isNativeButton || !isSpaceKey && !isEnterKey) { | |
| 1818 | + if (isCurrentTarget && isLink && isSpaceKey) { | |
| 1819 | + event.preventDefault(); | |
| 1820 | + } | |
| 1821 | + return; | |
| 1822 | + } | |
| 1823 | + if (event.defaultPrevented) { | |
| 1824 | + return; | |
| 1825 | + } | |
| 1826 | + event.preventDefault(); | |
| 1827 | + if (isEnterKey) { | |
| 1828 | + event.preventBaseUIHandler(); | |
| 1829 | + dispatchClickWithModifiers(currentTarget, event); | |
| 1830 | + } | |
| 1831 | + }, | |
| 1832 | + onKeyUp(event) { | |
| 1833 | + if (disabled2) { | |
| 1834 | + return; | |
| 1835 | + } | |
| 1836 | + makeEventPreventable(event); | |
| 1837 | + externalOnKeyUp?.(event); | |
| 1838 | + if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") { | |
| 1839 | + event.preventDefault(); | |
| 1840 | + return; | |
| 1841 | + } | |
| 1842 | + if (event.baseUIHandlerPrevented) { | |
| 1843 | + return; | |
| 1844 | + } | |
| 1845 | + if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && !event.defaultPrevented && event.key === " ") { | |
| 1846 | + event.preventBaseUIHandler(); | |
| 1847 | + dispatchClickWithModifiers(event.currentTarget, event); | |
| 1848 | + } | |
| 1849 | + }, | |
| 1850 | + onPointerDown(event) { | |
| 1851 | + if (disabled2) { | |
| 1852 | + event.preventDefault(); | |
| 1853 | + return; | |
| 1854 | + } | |
| 1855 | + externalOnPointerDown?.(event); | |
| 314 | 1856 | } |
| 315 | - }, | |
| 316 | - [isControlled, prop, setUncontrolledProp, onChangeRef] | |
| 317 | - ); | |
| 318 | - return [value, setValue]; | |
| 1857 | + }, isNativeButton ? { | |
| 1858 | + type: "button" | |
| 1859 | + } : { | |
| 1860 | + role: "button" | |
| 1861 | + }, focusableWhenDisabledProps, otherExternalProps); | |
| 1862 | + }, [disabled2, focusableWhenDisabledProps, isCompositeItem, isNativeButton]); | |
| 1863 | + const buttonRef = useStableCallback((element) => { | |
| 1864 | + elementRef.current = element; | |
| 1865 | + updateDisabled(); | |
| 1866 | + }); | |
| 1867 | + return { | |
| 1868 | + getButtonProps, | |
| 1869 | + buttonRef | |
| 1870 | + }; | |
| 319 | 1871 | } |
| 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; | |
| 1872 | +function isButtonElement(elem) { | |
| 1873 | + return isHTMLElement(elem) && elem.tagName === "BUTTON"; | |
| 1874 | +} | |
| 1875 | +function isValidLinkElement(elem) { | |
| 1876 | + return isHTMLElement(elem) && elem.tagName === "A" && Boolean(elem.href); | |
| 1877 | +} | |
| 1878 | + | |
| 1879 | +// node_modules/@base-ui/utils/addEventListener.mjs | |
| 1880 | +function addEventListener(target, type, listener, options) { | |
| 1881 | + target.addEventListener(type, listener, options); | |
| 1882 | + return () => { | |
| 1883 | + target.removeEventListener(type, listener, options); | |
| 1884 | + }; | |
| 1885 | +} | |
| 1886 | + | |
| 1887 | +// node_modules/@base-ui/utils/useValueAsRef.mjs | |
| 1888 | +function useValueAsRef(value) { | |
| 1889 | + const latest = useRefWithInit(createLatestRef, value).current; | |
| 1890 | + latest.next = value; | |
| 1891 | + useIsoLayoutEffect(latest.effect); | |
| 1892 | + return latest; | |
| 1893 | +} | |
| 1894 | +function createLatestRef(value) { | |
| 1895 | + const latest = { | |
| 1896 | + current: value, | |
| 1897 | + next: value, | |
| 1898 | + effect: () => { | |
| 1899 | + latest.current = latest.next; | |
| 334 | 1900 | } |
| 335 | - }, [value, prevValueRef]); | |
| 336 | - return [value, setValue, onChangeRef]; | |
| 1901 | + }; | |
| 1902 | + return latest; | |
| 337 | 1903 | } |
| 338 | -function isFunction(value) { | |
| 339 | - return typeof value === "function"; | |
| 340 | -} | |
| 341 | 1904 | |
| 342 | -// node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs | |
| 343 | -var React10 = __toESM(require_react(), 1); | |
| 1905 | +// node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs | |
| 1906 | +var React17 = __toESM(require_react(), 1); | |
| 344 | 1907 | |
| 345 | -// node_modules/@radix-ui/react-primitive/dist/index.mjs | |
| 346 | -var React7 = __toESM(require_react(), 1); | |
| 1908 | +// node_modules/@base-ui/react/internals/useAnimationsFinished.mjs | |
| 347 | 1909 | var ReactDOM = __toESM(require_react_dom(), 1); |
| 348 | 1910 | |
| 349 | -// node_modules/@radix-ui/react-slot/dist/index.mjs | |
| 350 | -var React6 = __toESM(require_react(), 1); | |
| 351 | -var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); | |
| 352 | -// @__NO_SIDE_EFFECTS__ | |
| 353 | -function createSlot(ownerName) { | |
| 354 | - const SlotClone = /* @__PURE__ */ createSlotClone(ownerName); | |
| 355 | - const Slot2 = React6.forwardRef((props, forwardedRef) => { | |
| 356 | - const { children, ...slotProps } = props; | |
| 357 | - const childrenArray = React6.Children.toArray(children); | |
| 358 | - const slottable = childrenArray.find(isSlottable); | |
| 359 | - if (slottable) { | |
| 360 | - const newElement = slottable.props.children; | |
| 361 | - const newChildren = childrenArray.map((child) => { | |
| 362 | - if (child === slottable) { | |
| 363 | - if (React6.Children.count(newElement) > 1) return React6.Children.only(null); | |
| 364 | - return React6.isValidElement(newElement) ? newElement.props.children : null; | |
| 365 | - } else { | |
| 366 | - return child; | |
| 1911 | +// node_modules/@base-ui/react/utils/resolveRef.mjs | |
| 1912 | +function resolveRef(maybeRef) { | |
| 1913 | + if (maybeRef == null) { | |
| 1914 | + return maybeRef; | |
| 1915 | + } | |
| 1916 | + return "current" in maybeRef ? maybeRef.current : maybeRef; | |
| 1917 | +} | |
| 1918 | + | |
| 1919 | +// node_modules/@base-ui/react/internals/useAnimationsFinished.mjs | |
| 1920 | +var pendingCallbacks = null; | |
| 1921 | +function flushBeforePaint(fn) { | |
| 1922 | + if (!pendingCallbacks) { | |
| 1923 | + const callbacks = []; | |
| 1924 | + pendingCallbacks = callbacks; | |
| 1925 | + queueMicrotask(() => { | |
| 1926 | + pendingCallbacks = null; | |
| 1927 | + ReactDOM.flushSync(() => { | |
| 1928 | + for (const callback of callbacks) { | |
| 1929 | + callback(); | |
| 367 | 1930 | } |
| 368 | 1931 | }); |
| 369 | - return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children: React6.isValidElement(newElement) ? React6.cloneElement(newElement, void 0, newChildren) : null }); | |
| 1932 | + }); | |
| 1933 | + } | |
| 1934 | + pendingCallbacks.push(fn); | |
| 1935 | +} | |
| 1936 | +function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, batch = false) { | |
| 1937 | + const frame = useAnimationFrame(); | |
| 1938 | + return useStableCallback((fnToExecute, signal = null) => { | |
| 1939 | + frame.cancel(); | |
| 1940 | + const element = resolveRef(elementOrRef); | |
| 1941 | + if (element == null) { | |
| 1942 | + return; | |
| 370 | 1943 | } |
| 371 | - return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children }); | |
| 1944 | + const resolvedElement = element; | |
| 1945 | + const done = () => { | |
| 1946 | + if (!batch) { | |
| 1947 | + ReactDOM.flushSync(fnToExecute); | |
| 1948 | + return; | |
| 1949 | + } | |
| 1950 | + flushBeforePaint(() => { | |
| 1951 | + if (!signal?.aborted) { | |
| 1952 | + fnToExecute(); | |
| 1953 | + } | |
| 1954 | + }); | |
| 1955 | + }; | |
| 1956 | + if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) { | |
| 1957 | + fnToExecute(); | |
| 1958 | + return; | |
| 1959 | + } | |
| 1960 | + function exec() { | |
| 1961 | + Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => { | |
| 1962 | + if (!signal?.aborted) { | |
| 1963 | + done(); | |
| 1964 | + } | |
| 1965 | + }, () => { | |
| 1966 | + if (signal?.aborted) { | |
| 1967 | + return; | |
| 1968 | + } | |
| 1969 | + const currentAnimations = resolvedElement.getAnimations(); | |
| 1970 | + if (currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) { | |
| 1971 | + exec(); | |
| 1972 | + return; | |
| 1973 | + } | |
| 1974 | + done(); | |
| 1975 | + }); | |
| 1976 | + } | |
| 1977 | + if (waitForStartingStyleRemoved) { | |
| 1978 | + const startingStyleAttribute = startingStyle; | |
| 1979 | + if (!resolvedElement.hasAttribute(startingStyleAttribute)) { | |
| 1980 | + frame.request(exec); | |
| 1981 | + return; | |
| 1982 | + } | |
| 1983 | + const attributeObserver = new MutationObserver(() => { | |
| 1984 | + if (!resolvedElement.hasAttribute(startingStyleAttribute)) { | |
| 1985 | + attributeObserver.disconnect(); | |
| 1986 | + exec(); | |
| 1987 | + } | |
| 1988 | + }); | |
| 1989 | + attributeObserver.observe(resolvedElement, { | |
| 1990 | + attributes: true, | |
| 1991 | + attributeFilter: [startingStyleAttribute] | |
| 1992 | + }); | |
| 1993 | + signal?.addEventListener("abort", () => attributeObserver.disconnect(), { | |
| 1994 | + once: true | |
| 1995 | + }); | |
| 1996 | + return; | |
| 1997 | + } | |
| 1998 | + frame.request(exec); | |
| 372 | 1999 | }); |
| 373 | - Slot2.displayName = `${ownerName}.Slot`; | |
| 374 | - return Slot2; | |
| 375 | 2000 | } |
| 376 | -// @__NO_SIDE_EFFECTS__ | |
| 377 | -function createSlotClone(ownerName) { | |
| 378 | - const SlotClone = React6.forwardRef((props, forwardedRef) => { | |
| 379 | - const { children, ...slotProps } = props; | |
| 380 | - if (React6.isValidElement(children)) { | |
| 381 | - const childrenRef = getElementRef(children); | |
| 382 | - const props2 = mergeProps(slotProps, children.props); | |
| 383 | - if (children.type !== React6.Fragment) { | |
| 384 | - props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef; | |
| 385 | - } | |
| 386 | - return React6.cloneElement(children, props2); | |
| 2001 | + | |
| 2002 | +// node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs | |
| 2003 | +function useOpenChangeComplete(parameters) { | |
| 2004 | + const { | |
| 2005 | + enabled = true, | |
| 2006 | + open: open2, | |
| 2007 | + ref, | |
| 2008 | + batch = false, | |
| 2009 | + onComplete: onCompleteParam | |
| 2010 | + } = parameters; | |
| 2011 | + const onComplete = useStableCallback(onCompleteParam); | |
| 2012 | + const runOnceAnimationsFinish = useAnimationsFinished(ref, open2, batch); | |
| 2013 | + React17.useEffect(() => { | |
| 2014 | + if (!enabled) { | |
| 2015 | + return void 0; | |
| 387 | 2016 | } |
| 388 | - return React6.Children.count(children) > 1 ? React6.Children.only(null) : null; | |
| 2017 | + const abortController = new AbortController(); | |
| 2018 | + runOnceAnimationsFinish(onComplete, abortController.signal); | |
| 2019 | + return () => { | |
| 2020 | + abortController.abort(); | |
| 2021 | + }; | |
| 2022 | + }, [enabled, open2, onComplete, runOnceAnimationsFinish]); | |
| 2023 | +} | |
| 2024 | + | |
| 2025 | +// node_modules/@base-ui/utils/platform/parts.mjs | |
| 2026 | +var parts_exports = {}; | |
| 2027 | +__export(parts_exports, { | |
| 2028 | + engine: () => engine_exports, | |
| 2029 | + env: () => env_exports, | |
| 2030 | + mediaQuery: () => media_query_exports, | |
| 2031 | + os: () => os_exports, | |
| 2032 | + screenReader: () => screen_reader_exports | |
| 2033 | +}); | |
| 2034 | + | |
| 2035 | +// node_modules/@base-ui/utils/platform/os.mjs | |
| 2036 | +var os_exports = {}; | |
| 2037 | +__export(os_exports, { | |
| 2038 | + android: () => android, | |
| 2039 | + apple: () => apple, | |
| 2040 | + ios: () => ios, | |
| 2041 | + linux: () => linux, | |
| 2042 | + mac: () => mac, | |
| 2043 | + windows: () => windows | |
| 2044 | +}); | |
| 2045 | + | |
| 2046 | +// node_modules/@base-ui/utils/platform/shared.mjs | |
| 2047 | +function readRawData() { | |
| 2048 | + if (typeof navigator === "undefined") { | |
| 2049 | + return { | |
| 2050 | + userAgent: "", | |
| 2051 | + platform: "", | |
| 2052 | + maxTouchPoints: 0 | |
| 2053 | + }; | |
| 2054 | + } | |
| 2055 | + if (true) { | |
| 2056 | + const uaData = navigator.userAgentData; | |
| 2057 | + if (uaData && Array.isArray(uaData.brands)) { | |
| 2058 | + return { | |
| 2059 | + userAgent: uaData.brands.map(({ | |
| 2060 | + brand, | |
| 2061 | + version: version2 | |
| 2062 | + }) => `${brand}/${version2}`).join(" "), | |
| 2063 | + platform: uaData.platform ?? navigator.platform ?? "", | |
| 2064 | + maxTouchPoints: navigator.maxTouchPoints ?? 0 | |
| 2065 | + }; | |
| 2066 | + } | |
| 2067 | + } | |
| 2068 | + return { | |
| 2069 | + userAgent: navigator.userAgent, | |
| 2070 | + platform: navigator.platform ?? "", | |
| 2071 | + maxTouchPoints: navigator.maxTouchPoints ?? 0 | |
| 2072 | + }; | |
| 2073 | +} | |
| 2074 | +var { | |
| 2075 | + userAgent, | |
| 2076 | + platform, | |
| 2077 | + maxTouchPoints | |
| 2078 | +} = readRawData(); | |
| 2079 | +var lowerUserAgent = userAgent.toLowerCase(); | |
| 2080 | +var lowerPlatform = platform.toLowerCase(); | |
| 2081 | + | |
| 2082 | +// node_modules/@base-ui/utils/platform/os.mjs | |
| 2083 | +var ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === "macintel" && maxTouchPoints > 1; | |
| 2084 | +var ANDROID_STRING = "android"; | |
| 2085 | +var android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING); | |
| 2086 | +var mac = !ios && lowerPlatform.startsWith("mac"); | |
| 2087 | +var windows = lowerPlatform.startsWith("win"); | |
| 2088 | +var linux = !android && /^(linux|chrome os)/.test(lowerPlatform); | |
| 2089 | +var apple = mac || ios; | |
| 2090 | + | |
| 2091 | +// node_modules/@base-ui/utils/platform/engine.mjs | |
| 2092 | +var engine_exports = {}; | |
| 2093 | +__export(engine_exports, { | |
| 2094 | + blink: () => blink, | |
| 2095 | + gecko: () => gecko, | |
| 2096 | + webkit: () => webkit | |
| 2097 | +}); | |
| 2098 | +var webkit = typeof CSS !== "undefined" && !!CSS.supports?.("-webkit-backdrop-filter:none"); | |
| 2099 | +var gecko = !webkit && lowerUserAgent.includes("firefox"); | |
| 2100 | +var blink = !webkit && lowerUserAgent.includes("chrom"); | |
| 2101 | + | |
| 2102 | +// node_modules/@base-ui/utils/platform/screen-reader.mjs | |
| 2103 | +var screen_reader_exports = {}; | |
| 2104 | +__export(screen_reader_exports, { | |
| 2105 | + voiceOver: () => voiceOver | |
| 2106 | +}); | |
| 2107 | +var voiceOver = apple; | |
| 2108 | + | |
| 2109 | +// node_modules/@base-ui/utils/platform/env.mjs | |
| 2110 | +var env_exports = {}; | |
| 2111 | +__export(env_exports, { | |
| 2112 | + jsdom: () => jsdom | |
| 2113 | +}); | |
| 2114 | +var jsdom = /jsdom|happydom/.test(lowerUserAgent); | |
| 2115 | + | |
| 2116 | +// node_modules/@base-ui/utils/platform/media-query.mjs | |
| 2117 | +var media_query_exports = {}; | |
| 2118 | +__export(media_query_exports, { | |
| 2119 | + iOS: () => iOS | |
| 2120 | +}); | |
| 2121 | +var iOS = "@supports (-webkit-touch-callout: none)"; | |
| 2122 | + | |
| 2123 | +// node_modules/@base-ui/utils/useTimeout.mjs | |
| 2124 | +var EMPTY2 = 0; | |
| 2125 | +var Timeout = class _Timeout { | |
| 2126 | + static create() { | |
| 2127 | + return new _Timeout(); | |
| 2128 | + } | |
| 2129 | + currentId = EMPTY2; | |
| 2130 | + /** | |
| 2131 | + * Executes `fn` after `delay`, clearing any previously scheduled call. | |
| 2132 | + */ | |
| 2133 | + start(delay, fn) { | |
| 2134 | + this.clear(); | |
| 2135 | + this.currentId = setTimeout(() => { | |
| 2136 | + this.currentId = EMPTY2; | |
| 2137 | + fn(); | |
| 2138 | + }, delay); | |
| 2139 | + } | |
| 2140 | + isStarted() { | |
| 2141 | + return this.currentId !== EMPTY2; | |
| 2142 | + } | |
| 2143 | + clear = () => { | |
| 2144 | + if (this.currentId !== EMPTY2) { | |
| 2145 | + clearTimeout(this.currentId); | |
| 2146 | + this.currentId = EMPTY2; | |
| 2147 | + } | |
| 2148 | + }; | |
| 2149 | + disposeEffect = () => { | |
| 2150 | + return this.clear; | |
| 2151 | + }; | |
| 2152 | +}; | |
| 2153 | +function useTimeout() { | |
| 2154 | + const timeout = useRefWithInit(Timeout.create).current; | |
| 2155 | + useOnMount(timeout.disposeEffect); | |
| 2156 | + return timeout; | |
| 2157 | +} | |
| 2158 | + | |
| 2159 | +// node_modules/@base-ui/utils/useScrollLock.mjs | |
| 2160 | +var originalHtmlStyles = {}; | |
| 2161 | +var originalBodyStyles = {}; | |
| 2162 | +var originalHtmlScrollBehavior = ""; | |
| 2163 | +function getViewportScroller(html, body) { | |
| 2164 | + return isOverflowElement(html) ? html : body; | |
| 2165 | +} | |
| 2166 | +function isPageScrollLocked(win, html, body) { | |
| 2167 | + return /hidden|clip/.test(win.getComputedStyle(getViewportScroller(html, body)).overflowY); | |
| 2168 | +} | |
| 2169 | +function hasInsetScrollbars(referenceElement) { | |
| 2170 | + if (typeof document === "undefined") { | |
| 2171 | + return false; | |
| 2172 | + } | |
| 2173 | + const doc = ownerDocument(referenceElement); | |
| 2174 | + const win = getWindow(doc); | |
| 2175 | + return win.innerWidth - doc.documentElement.clientWidth > 0; | |
| 2176 | +} | |
| 2177 | +function supportsStableScrollbarGutter(referenceElement) { | |
| 2178 | + const supported = typeof CSS !== "undefined" && CSS.supports && CSS.supports("scrollbar-gutter", "stable"); | |
| 2179 | + if (!supported || typeof document === "undefined") { | |
| 2180 | + return false; | |
| 2181 | + } | |
| 2182 | + const doc = ownerDocument(referenceElement); | |
| 2183 | + const html = doc.documentElement; | |
| 2184 | + const body = doc.body; | |
| 2185 | + const scrollContainer = getViewportScroller(html, body); | |
| 2186 | + const originalScrollContainerOverflowY = scrollContainer.style.overflowY; | |
| 2187 | + const originalHtmlStyleGutter = html.style.scrollbarGutter; | |
| 2188 | + html.style.scrollbarGutter = "stable"; | |
| 2189 | + scrollContainer.style.overflowY = "scroll"; | |
| 2190 | + const before = scrollContainer.offsetWidth; | |
| 2191 | + scrollContainer.style.overflowY = "hidden"; | |
| 2192 | + const after = scrollContainer.offsetWidth; | |
| 2193 | + scrollContainer.style.overflowY = originalScrollContainerOverflowY; | |
| 2194 | + html.style.scrollbarGutter = originalHtmlStyleGutter; | |
| 2195 | + return before === after; | |
| 2196 | +} | |
| 2197 | +function preventScrollOverlayScrollbars(referenceElement) { | |
| 2198 | + const doc = ownerDocument(referenceElement); | |
| 2199 | + const html = doc.documentElement; | |
| 2200 | + const body = doc.body; | |
| 2201 | + const elementToLock = getViewportScroller(html, body); | |
| 2202 | + const originalElementToLockStyles = { | |
| 2203 | + overflowY: elementToLock.style.overflowY, | |
| 2204 | + overflowX: elementToLock.style.overflowX | |
| 2205 | + }; | |
| 2206 | + Object.assign(elementToLock.style, { | |
| 2207 | + overflowY: "hidden", | |
| 2208 | + overflowX: "hidden" | |
| 389 | 2209 | }); |
| 390 | - SlotClone.displayName = `${ownerName}.SlotClone`; | |
| 391 | - return SlotClone; | |
| 2210 | + return () => { | |
| 2211 | + Object.assign(elementToLock.style, originalElementToLockStyles); | |
| 2212 | + }; | |
| 392 | 2213 | } |
| 393 | -var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable"); | |
| 394 | -function isSlottable(child) { | |
| 395 | - return React6.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER; | |
| 2214 | +function preventScrollInsetScrollbars(referenceElement) { | |
| 2215 | + const doc = ownerDocument(referenceElement); | |
| 2216 | + const html = doc.documentElement; | |
| 2217 | + const body = doc.body; | |
| 2218 | + const win = getWindow(html); | |
| 2219 | + let scrollTop = 0; | |
| 2220 | + let scrollLeft = 0; | |
| 2221 | + let updateGutterOnly = false; | |
| 2222 | + const resizeFrame = AnimationFrame.create(); | |
| 2223 | + if (parts_exports.engine.webkit && (win.visualViewport?.scale ?? 1) !== 1) { | |
| 2224 | + return () => { | |
| 2225 | + }; | |
| 2226 | + } | |
| 2227 | + function lockScroll() { | |
| 2228 | + const htmlStyles = win.getComputedStyle(html); | |
| 2229 | + const bodyStyles = win.getComputedStyle(body); | |
| 2230 | + const htmlScrollbarGutterValue = htmlStyles.scrollbarGutter || ""; | |
| 2231 | + const hasBothEdges = htmlScrollbarGutterValue.includes("both-edges"); | |
| 2232 | + const scrollbarGutterValue = hasBothEdges ? "stable both-edges" : "stable"; | |
| 2233 | + scrollTop = html.scrollTop; | |
| 2234 | + scrollLeft = html.scrollLeft; | |
| 2235 | + originalHtmlStyles = { | |
| 2236 | + scrollbarGutter: html.style.scrollbarGutter, | |
| 2237 | + overflowY: html.style.overflowY, | |
| 2238 | + overflowX: html.style.overflowX | |
| 2239 | + }; | |
| 2240 | + originalHtmlScrollBehavior = html.style.scrollBehavior; | |
| 2241 | + originalBodyStyles = { | |
| 2242 | + position: body.style.position, | |
| 2243 | + height: body.style.height, | |
| 2244 | + width: body.style.width, | |
| 2245 | + boxSizing: body.style.boxSizing, | |
| 2246 | + overflowY: body.style.overflowY, | |
| 2247 | + overflowX: body.style.overflowX, | |
| 2248 | + scrollBehavior: body.style.scrollBehavior | |
| 2249 | + }; | |
| 2250 | + const isScrollableY2 = html.scrollHeight > html.clientHeight; | |
| 2251 | + const isScrollableX = html.scrollWidth > html.clientWidth; | |
| 2252 | + const hasConstantOverflowY = htmlStyles.overflowY === "scroll" || bodyStyles.overflowY === "scroll"; | |
| 2253 | + const hasConstantOverflowX = htmlStyles.overflowX === "scroll" || bodyStyles.overflowX === "scroll"; | |
| 2254 | + const scrollbarWidth = Math.max(0, win.innerWidth - body.clientWidth); | |
| 2255 | + const scrollbarHeight = Math.max(0, win.innerHeight - body.clientHeight); | |
| 2256 | + const marginY = parseFloat(bodyStyles.marginTop) + parseFloat(bodyStyles.marginBottom); | |
| 2257 | + const marginX = parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight); | |
| 2258 | + const elementToLock = getViewportScroller(html, body); | |
| 2259 | + updateGutterOnly = supportsStableScrollbarGutter(referenceElement); | |
| 2260 | + if (updateGutterOnly) { | |
| 2261 | + html.style.scrollbarGutter = scrollbarGutterValue; | |
| 2262 | + elementToLock.style.overflowY = "hidden"; | |
| 2263 | + elementToLock.style.overflowX = "hidden"; | |
| 2264 | + return; | |
| 2265 | + } | |
| 2266 | + Object.assign(html.style, { | |
| 2267 | + scrollbarGutter: scrollbarGutterValue, | |
| 2268 | + overflowY: "hidden", | |
| 2269 | + overflowX: "hidden" | |
| 2270 | + }); | |
| 2271 | + if (isScrollableY2 || hasConstantOverflowY) { | |
| 2272 | + html.style.overflowY = "scroll"; | |
| 2273 | + } | |
| 2274 | + if (isScrollableX || hasConstantOverflowX) { | |
| 2275 | + html.style.overflowX = "scroll"; | |
| 2276 | + } | |
| 2277 | + Object.assign(body.style, { | |
| 2278 | + position: "relative", | |
| 2279 | + height: marginY || scrollbarHeight ? `calc(100dvh - ${marginY + scrollbarHeight}px)` : "100dvh", | |
| 2280 | + width: marginX || scrollbarWidth ? `calc(100vw - ${marginX + scrollbarWidth}px)` : "100vw", | |
| 2281 | + boxSizing: "border-box", | |
| 2282 | + // Assign the longhands that `cleanup` restores, so nothing is left behind. | |
| 2283 | + overflowY: "hidden", | |
| 2284 | + overflowX: "hidden", | |
| 2285 | + scrollBehavior: "unset" | |
| 2286 | + }); | |
| 2287 | + body.scrollTop = scrollTop; | |
| 2288 | + body.scrollLeft = scrollLeft; | |
| 2289 | + html.setAttribute("data-base-ui-scroll-locked", ""); | |
| 2290 | + html.style.scrollBehavior = "unset"; | |
| 2291 | + } | |
| 2292 | + function cleanup() { | |
| 2293 | + Object.assign(html.style, originalHtmlStyles); | |
| 2294 | + Object.assign(body.style, originalBodyStyles); | |
| 2295 | + if (!updateGutterOnly) { | |
| 2296 | + html.scrollTop = scrollTop; | |
| 2297 | + html.scrollLeft = scrollLeft; | |
| 2298 | + html.removeAttribute("data-base-ui-scroll-locked"); | |
| 2299 | + html.style.scrollBehavior = originalHtmlScrollBehavior; | |
| 2300 | + } | |
| 2301 | + } | |
| 2302 | + function handleResize() { | |
| 2303 | + cleanup(); | |
| 2304 | + resizeFrame.request(lockScroll); | |
| 2305 | + } | |
| 2306 | + lockScroll(); | |
| 2307 | + const unsubscribeResize = addEventListener(win, "resize", handleResize); | |
| 2308 | + return () => { | |
| 2309 | + resizeFrame.cancel(); | |
| 2310 | + cleanup(); | |
| 2311 | + if (typeof win.removeEventListener === "function") { | |
| 2312 | + unsubscribeResize(); | |
| 2313 | + } | |
| 2314 | + }; | |
| 396 | 2315 | } |
| 397 | -function mergeProps(slotProps, childProps) { | |
| 398 | - const overrideProps = { ...childProps }; | |
| 399 | - for (const propName in childProps) { | |
| 400 | - const slotPropValue = slotProps[propName]; | |
| 401 | - const childPropValue = childProps[propName]; | |
| 402 | - const isHandler = /^on[A-Z]/.test(propName); | |
| 403 | - if (isHandler) { | |
| 404 | - if (slotPropValue && childPropValue) { | |
| 405 | - overrideProps[propName] = (...args) => { | |
| 406 | - const result = childPropValue(...args); | |
| 407 | - slotPropValue(...args); | |
| 408 | - return result; | |
| 409 | - }; | |
| 410 | - } else if (slotPropValue) { | |
| 411 | - overrideProps[propName] = slotPropValue; | |
| 2316 | +var ScrollLocker = class { | |
| 2317 | + lockCount = 0; | |
| 2318 | + restore = null; | |
| 2319 | + timeoutLock = Timeout.create(); | |
| 2320 | + timeoutUnlock = Timeout.create(); | |
| 2321 | + acquire(referenceElement) { | |
| 2322 | + this.lockCount += 1; | |
| 2323 | + if (this.lockCount === 1 && this.restore === null) { | |
| 2324 | + this.timeoutLock.start(0, () => this.lock(referenceElement)); | |
| 2325 | + } | |
| 2326 | + return this.release; | |
| 2327 | + } | |
| 2328 | + release = () => { | |
| 2329 | + this.lockCount -= 1; | |
| 2330 | + if (this.lockCount === 0 && this.restore) { | |
| 2331 | + this.timeoutUnlock.start(0, this.unlock); | |
| 2332 | + } | |
| 2333 | + }; | |
| 2334 | + unlock = () => { | |
| 2335 | + if (this.lockCount === 0 && this.restore) { | |
| 2336 | + this.restore?.(); | |
| 2337 | + this.restore = null; | |
| 2338 | + } | |
| 2339 | + }; | |
| 2340 | + lock(referenceElement) { | |
| 2341 | + if (this.lockCount === 0 || this.restore !== null) { | |
| 2342 | + return; | |
| 2343 | + } | |
| 2344 | + const doc = ownerDocument(referenceElement); | |
| 2345 | + const html = doc.documentElement; | |
| 2346 | + const body = doc.body; | |
| 2347 | + const win = getWindow(html); | |
| 2348 | + if (isPageScrollLocked(win, html, body)) { | |
| 2349 | + const observer = new win.MutationObserver(() => { | |
| 2350 | + if (isPageScrollLocked(win, html, body)) { | |
| 2351 | + return; | |
| 2352 | + } | |
| 2353 | + observer.disconnect(); | |
| 2354 | + this.restore = null; | |
| 2355 | + this.lock(referenceElement); | |
| 2356 | + }); | |
| 2357 | + const options = { | |
| 2358 | + attributes: true | |
| 2359 | + }; | |
| 2360 | + observer.observe(html, options); | |
| 2361 | + observer.observe(body, options); | |
| 2362 | + this.restore = () => observer.disconnect(); | |
| 2363 | + return; | |
| 2364 | + } | |
| 2365 | + const hasOverlayScrollbars = parts_exports.os.ios || !hasInsetScrollbars(referenceElement); | |
| 2366 | + this.restore = hasOverlayScrollbars ? preventScrollOverlayScrollbars(referenceElement) : preventScrollInsetScrollbars(referenceElement); | |
| 2367 | + } | |
| 2368 | +}; | |
| 2369 | +var SCROLL_LOCKER = new ScrollLocker(); | |
| 2370 | +function useScrollLock(enabled = true, referenceElement = null) { | |
| 2371 | + useIsoLayoutEffect(() => { | |
| 2372 | + if (!enabled) { | |
| 2373 | + return void 0; | |
| 2374 | + } | |
| 2375 | + return SCROLL_LOCKER.acquire(referenceElement); | |
| 2376 | + }, [enabled, referenceElement]); | |
| 2377 | +} | |
| 2378 | + | |
| 2379 | +// node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs | |
| 2380 | +var React18 = __toESM(require_react(), 1); | |
| 2381 | + | |
| 2382 | +// node_modules/@base-ui/react/floating-ui-react/utils/event.mjs | |
| 2383 | +function stopEvent(event) { | |
| 2384 | + event.preventDefault(); | |
| 2385 | + event.stopPropagation(); | |
| 2386 | +} | |
| 2387 | +function isReactEvent(event) { | |
| 2388 | + return "nativeEvent" in event; | |
| 2389 | +} | |
| 2390 | +function isVirtualClick(event) { | |
| 2391 | + if (event.pointerType === "" && event.isTrusted) { | |
| 2392 | + return true; | |
| 2393 | + } | |
| 2394 | + if (parts_exports.os.android && event.pointerType) { | |
| 2395 | + return event.type === "click" && event.buttons === 1; | |
| 2396 | + } | |
| 2397 | + return event.detail === 0 && !event.pointerType; | |
| 2398 | +} | |
| 2399 | +function isVirtualPointerEvent(event) { | |
| 2400 | + if (parts_exports.env.jsdom) { | |
| 2401 | + return false; | |
| 2402 | + } | |
| 2403 | + return !parts_exports.os.android && event.width === 0 && event.height === 0 || parts_exports.os.android && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height. | |
| 2404 | + event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "touch"; | |
| 2405 | +} | |
| 2406 | +function isMouseLikePointerType(pointerType, strict) { | |
| 2407 | + const values = ["mouse", "pen"]; | |
| 2408 | + if (!strict) { | |
| 2409 | + values.push("", void 0); | |
| 2410 | + } | |
| 2411 | + return values.includes(pointerType); | |
| 2412 | +} | |
| 2413 | +function isClickLikeEvent(event) { | |
| 2414 | + const type = event.type; | |
| 2415 | + return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup"; | |
| 2416 | +} | |
| 2417 | + | |
| 2418 | +// node_modules/@base-ui/utils/shadowDom.mjs | |
| 2419 | +function activeElement(doc) { | |
| 2420 | + let element = doc.activeElement; | |
| 2421 | + while (element?.shadowRoot?.activeElement != null) { | |
| 2422 | + element = element.shadowRoot.activeElement; | |
| 2423 | + } | |
| 2424 | + return element; | |
| 2425 | +} | |
| 2426 | +function contains(parent, child) { | |
| 2427 | + if (!parent || !child) { | |
| 2428 | + return false; | |
| 2429 | + } | |
| 2430 | + const rootNode = child.getRootNode?.(); | |
| 2431 | + if (parent.contains(child)) { | |
| 2432 | + return true; | |
| 2433 | + } | |
| 2434 | + if (rootNode && isShadowRoot(rootNode)) { | |
| 2435 | + let next = child; | |
| 2436 | + while (next) { | |
| 2437 | + if (parent === next) { | |
| 2438 | + return true; | |
| 412 | 2439 | } |
| 413 | - } else if (propName === "style") { | |
| 414 | - overrideProps[propName] = { ...slotPropValue, ...childPropValue }; | |
| 415 | - } else if (propName === "className") { | |
| 416 | - overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" "); | |
| 2440 | + next = next.parentNode || next.host; | |
| 417 | 2441 | } |
| 418 | 2442 | } |
| 419 | - return { ...slotProps, ...overrideProps }; | |
| 2443 | + return false; | |
| 420 | 2444 | } |
| 421 | -function getElementRef(element) { | |
| 422 | - let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get; | |
| 423 | - let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning; | |
| 424 | - if (mayWarn) { | |
| 425 | - return element.ref; | |
| 2445 | +function getTarget(event) { | |
| 2446 | + if ("composedPath" in event) { | |
| 2447 | + return event.composedPath()[0] ?? event.target; | |
| 426 | 2448 | } |
| 427 | - getter = Object.getOwnPropertyDescriptor(element, "ref")?.get; | |
| 428 | - mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning; | |
| 429 | - if (mayWarn) { | |
| 430 | - return element.props.ref; | |
| 2449 | + return event.target; | |
| 2450 | +} | |
| 2451 | + | |
| 2452 | +// node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs | |
| 2453 | +var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable"; | |
| 2454 | +var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; | |
| 2455 | +var ARROW_LEFT = "ArrowLeft"; | |
| 2456 | +var ARROW_RIGHT = "ArrowRight"; | |
| 2457 | +var ARROW_UP = "ArrowUp"; | |
| 2458 | +var ARROW_DOWN = "ArrowDown"; | |
| 2459 | + | |
| 2460 | +// node_modules/@base-ui/react/utils/CommonPopupDataAttributes.mjs | |
| 2461 | +var open = "data-open"; | |
| 2462 | +var closed = "data-closed"; | |
| 2463 | +var anchorHidden = "data-anchor-hidden"; | |
| 2464 | + | |
| 2465 | +// node_modules/@base-ui/react/utils/CommonTriggerDataAttributes.mjs | |
| 2466 | +var CommonTriggerDataAttributes_exports = {}; | |
| 2467 | +__export(CommonTriggerDataAttributes_exports, { | |
| 2468 | + popupOpen: () => popupOpen, | |
| 2469 | + pressed: () => pressed | |
| 2470 | +}); | |
| 2471 | +var popupOpen = "data-popup-open"; | |
| 2472 | +var pressed = "data-pressed"; | |
| 2473 | + | |
| 2474 | +// node_modules/@base-ui/react/utils/popupStateMapping.mjs | |
| 2475 | +var TRIGGER_HOOK = { | |
| 2476 | + [popupOpen]: "" | |
| 2477 | +}; | |
| 2478 | +var PRESSABLE_TRIGGER_HOOK = { | |
| 2479 | + [popupOpen]: "", | |
| 2480 | + [pressed]: "" | |
| 2481 | +}; | |
| 2482 | +var POPUP_OPEN_HOOK = { | |
| 2483 | + [open]: "" | |
| 2484 | +}; | |
| 2485 | +var POPUP_CLOSED_HOOK = { | |
| 2486 | + [closed]: "" | |
| 2487 | +}; | |
| 2488 | +var ANCHOR_HIDDEN_HOOK = { | |
| 2489 | + [anchorHidden]: "" | |
| 2490 | +}; | |
| 2491 | +var triggerOpenStateMapping = { | |
| 2492 | + open(value) { | |
| 2493 | + if (value) { | |
| 2494 | + return TRIGGER_HOOK; | |
| 2495 | + } | |
| 2496 | + return null; | |
| 431 | 2497 | } |
| 432 | - return element.props.ref || element.ref; | |
| 2498 | +}; | |
| 2499 | +var pressableTriggerOpenStateMapping = { | |
| 2500 | + open(value) { | |
| 2501 | + if (value) { | |
| 2502 | + return PRESSABLE_TRIGGER_HOOK; | |
| 2503 | + } | |
| 2504 | + return null; | |
| 2505 | + } | |
| 2506 | +}; | |
| 2507 | +var popupStateMapping = { | |
| 2508 | + open(value) { | |
| 2509 | + if (value) { | |
| 2510 | + return POPUP_OPEN_HOOK; | |
| 2511 | + } | |
| 2512 | + return POPUP_CLOSED_HOOK; | |
| 2513 | + }, | |
| 2514 | + anchorHidden(value) { | |
| 2515 | + if (value) { | |
| 2516 | + return ANCHOR_HIDDEN_HOOK; | |
| 2517 | + } | |
| 2518 | + return null; | |
| 2519 | + } | |
| 2520 | +}; | |
| 2521 | +var popupTransitionStateMapping = { | |
| 2522 | + ...popupStateMapping, | |
| 2523 | + ...transitionStatusMapping | |
| 2524 | +}; | |
| 2525 | + | |
| 2526 | +// node_modules/@base-ui/react/tooltip/trigger/TooltipTriggerDataAttributes.mjs | |
| 2527 | +var popupOpen2 = CommonTriggerDataAttributes_exports.popupOpen; | |
| 2528 | +var triggerDisabled = "data-trigger-disabled"; | |
| 2529 | + | |
| 2530 | +// node_modules/@base-ui/react/floating-ui-react/utils/element.mjs | |
| 2531 | +function isTargetInsideEnabledTrigger(target, triggerElements) { | |
| 2532 | + if (!isElement(target)) { | |
| 2533 | + return false; | |
| 2534 | + } | |
| 2535 | + const targetElement = target; | |
| 2536 | + if (triggerElements.hasElement(targetElement)) { | |
| 2537 | + return !targetElement.hasAttribute(triggerDisabled); | |
| 2538 | + } | |
| 2539 | + for (const [, trigger] of triggerElements.entries()) { | |
| 2540 | + if (contains(trigger, targetElement)) { | |
| 2541 | + return !trigger.hasAttribute(triggerDisabled); | |
| 2542 | + } | |
| 2543 | + } | |
| 2544 | + return false; | |
| 433 | 2545 | } |
| 2546 | +function isEventTargetWithin(event, node) { | |
| 2547 | + if (node == null) { | |
| 2548 | + return false; | |
| 2549 | + } | |
| 2550 | + if ("composedPath" in event) { | |
| 2551 | + return event.composedPath().includes(node); | |
| 2552 | + } | |
| 2553 | + const eventAgain = event; | |
| 2554 | + return eventAgain.target != null && node.contains(eventAgain.target); | |
| 2555 | +} | |
| 2556 | +function isRootElement(element) { | |
| 2557 | + return element.matches("html,body"); | |
| 2558 | +} | |
| 2559 | +function isTypeableElement(element) { | |
| 2560 | + return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR); | |
| 2561 | +} | |
| 2562 | +function isInteractiveElement(element) { | |
| 2563 | + return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${TYPEABLE_SELECTOR}`) != null; | |
| 2564 | +} | |
| 2565 | +function isTypeableCombobox(element) { | |
| 2566 | + if (!element) { | |
| 2567 | + return false; | |
| 2568 | + } | |
| 2569 | + return element.getAttribute("role") === "combobox" && isTypeableElement(element); | |
| 2570 | +} | |
| 2571 | +function matchesFocusVisible(element) { | |
| 2572 | + if (!element || parts_exports.env.jsdom) { | |
| 2573 | + return true; | |
| 2574 | + } | |
| 2575 | + try { | |
| 2576 | + return element.matches(":focus-visible"); | |
| 2577 | + } catch (_e) { | |
| 2578 | + return true; | |
| 2579 | + } | |
| 2580 | +} | |
| 2581 | +function getFloatingFocusElement(floatingElement) { | |
| 2582 | + if (!floatingElement) { | |
| 2583 | + return null; | |
| 2584 | + } | |
| 2585 | + return floatingElement.hasAttribute(FOCUSABLE_ATTRIBUTE) ? floatingElement : floatingElement.querySelector(`[${FOCUSABLE_ATTRIBUTE}]`) || floatingElement; | |
| 2586 | +} | |
| 434 | 2587 | |
| 435 | -// node_modules/@radix-ui/react-primitive/dist/index.mjs | |
| 2588 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs | |
| 2589 | +function resolveValue(value, pointerType) { | |
| 2590 | + if (pointerType != null && !isMouseLikePointerType(pointerType)) { | |
| 2591 | + return 0; | |
| 2592 | + } | |
| 2593 | + if (typeof value === "function") { | |
| 2594 | + return value(); | |
| 2595 | + } | |
| 2596 | + return value; | |
| 2597 | +} | |
| 2598 | +function getDelay(value, prop, pointerType) { | |
| 2599 | + const result = resolveValue(value, pointerType); | |
| 2600 | + if (typeof result === "number") { | |
| 2601 | + return result; | |
| 2602 | + } | |
| 2603 | + return result?.[prop]; | |
| 2604 | +} | |
| 2605 | +function getRestMs(value) { | |
| 2606 | + if (typeof value === "function") { | |
| 2607 | + return value(); | |
| 2608 | + } | |
| 2609 | + return value; | |
| 2610 | +} | |
| 2611 | +function isClickLikeOpenEvent(openEventType, interactedInside) { | |
| 2612 | + return interactedInside || openEventType === "click" || openEventType === "mousedown"; | |
| 2613 | +} | |
| 2614 | +function isHoverOpenEvent(openEventType) { | |
| 2615 | + return openEventType?.includes("mouse") && openEventType !== "mousedown"; | |
| 2616 | +} | |
| 2617 | + | |
| 2618 | +// node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs | |
| 2619 | +var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); | |
| 2620 | +var FloatingDelayGroupContext = /* @__PURE__ */ React18.createContext({ | |
| 2621 | + hasProvider: false, | |
| 2622 | + timeoutMs: 0, | |
| 2623 | + delayRef: { | |
| 2624 | + current: 0 | |
| 2625 | + }, | |
| 2626 | + initialDelayRef: { | |
| 2627 | + current: 0 | |
| 2628 | + }, | |
| 2629 | + timeout: new Timeout(), | |
| 2630 | + currentIdRef: { | |
| 2631 | + current: null | |
| 2632 | + }, | |
| 2633 | + currentContextRef: { | |
| 2634 | + current: null | |
| 2635 | + } | |
| 2636 | +}); | |
| 2637 | +if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext"; | |
| 2638 | +function resetDelayRef(delayRef, initialDelayRef) { | |
| 2639 | + delayRef.current = initialDelayRef.current; | |
| 2640 | +} | |
| 2641 | +function FloatingDelayGroup(props) { | |
| 2642 | + const { | |
| 2643 | + children, | |
| 2644 | + delay, | |
| 2645 | + timeoutMs = 0 | |
| 2646 | + } = props; | |
| 2647 | + const delayRef = React18.useRef(delay); | |
| 2648 | + const initialDelayRef = React18.useRef(delay); | |
| 2649 | + const currentIdRef = React18.useRef(null); | |
| 2650 | + const currentContextRef = React18.useRef(null); | |
| 2651 | + const timeout = useTimeout(); | |
| 2652 | + useIsoLayoutEffect(() => { | |
| 2653 | + initialDelayRef.current = delay; | |
| 2654 | + if (!currentIdRef.current) { | |
| 2655 | + delayRef.current = delay; | |
| 2656 | + return; | |
| 2657 | + } | |
| 2658 | + delayRef.current = { | |
| 2659 | + open: getDelay(delayRef.current, "open"), | |
| 2660 | + close: getDelay(delay, "close") | |
| 2661 | + }; | |
| 2662 | + }, [delay, currentIdRef, delayRef, initialDelayRef]); | |
| 2663 | + return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FloatingDelayGroupContext.Provider, { | |
| 2664 | + value: React18.useMemo(() => ({ | |
| 2665 | + hasProvider: true, | |
| 2666 | + delayRef, | |
| 2667 | + initialDelayRef, | |
| 2668 | + currentIdRef, | |
| 2669 | + timeoutMs, | |
| 2670 | + currentContextRef, | |
| 2671 | + timeout | |
| 2672 | + }), [timeoutMs, timeout]), | |
| 2673 | + children | |
| 2674 | + }); | |
| 2675 | +} | |
| 2676 | +function useDelayGroup(context, options = { | |
| 2677 | + open: false | |
| 2678 | +}) { | |
| 2679 | + const { | |
| 2680 | + open: open2 | |
| 2681 | + } = options; | |
| 2682 | + const store = "rootStore" in context ? context.rootStore : context; | |
| 2683 | + const floatingId = store.useState("floatingId"); | |
| 2684 | + const groupContext = React18.useContext(FloatingDelayGroupContext); | |
| 2685 | + const { | |
| 2686 | + currentIdRef, | |
| 2687 | + delayRef, | |
| 2688 | + timeoutMs, | |
| 2689 | + initialDelayRef, | |
| 2690 | + currentContextRef, | |
| 2691 | + hasProvider, | |
| 2692 | + timeout | |
| 2693 | + } = groupContext; | |
| 2694 | + const [isInstantPhase, setIsInstantPhase] = React18.useState(false); | |
| 2695 | + const openRef = React18.useRef(open2); | |
| 2696 | + useIsoLayoutEffect(() => { | |
| 2697 | + openRef.current = open2; | |
| 2698 | + }, [open2]); | |
| 2699 | + useIsoLayoutEffect(() => { | |
| 2700 | + function unset() { | |
| 2701 | + currentContextRef.current?.setIsInstantPhase(false); | |
| 2702 | + currentIdRef.current = null; | |
| 2703 | + currentContextRef.current = null; | |
| 2704 | + delayRef.current = initialDelayRef.current; | |
| 2705 | + timeout.clear(); | |
| 2706 | + } | |
| 2707 | + if (!currentIdRef.current) { | |
| 2708 | + return void 0; | |
| 2709 | + } | |
| 2710 | + if (!open2 && currentIdRef.current === floatingId) { | |
| 2711 | + setIsInstantPhase(false); | |
| 2712 | + if (timeoutMs) { | |
| 2713 | + const closingId = floatingId; | |
| 2714 | + timeout.start(timeoutMs, () => { | |
| 2715 | + if (store.select("open") || currentIdRef.current && currentIdRef.current !== closingId) { | |
| 2716 | + return; | |
| 2717 | + } | |
| 2718 | + unset(); | |
| 2719 | + }); | |
| 2720 | + return () => { | |
| 2721 | + if (openRef.current || currentIdRef.current !== closingId) { | |
| 2722 | + timeout.clear(); | |
| 2723 | + } | |
| 2724 | + }; | |
| 2725 | + } | |
| 2726 | + unset(); | |
| 2727 | + } | |
| 2728 | + return void 0; | |
| 2729 | + }, [open2, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store]); | |
| 2730 | + useIsoLayoutEffect(() => { | |
| 2731 | + if (!open2) { | |
| 2732 | + return; | |
| 2733 | + } | |
| 2734 | + const prevContext = currentContextRef.current; | |
| 2735 | + const prevId = currentIdRef.current; | |
| 2736 | + timeout.clear(); | |
| 2737 | + currentContextRef.current = { | |
| 2738 | + onOpenChange: store.setOpen, | |
| 2739 | + setIsInstantPhase | |
| 2740 | + }; | |
| 2741 | + currentIdRef.current = floatingId; | |
| 2742 | + delayRef.current = { | |
| 2743 | + open: 0, | |
| 2744 | + close: getDelay(initialDelayRef.current, "close") | |
| 2745 | + }; | |
| 2746 | + if (prevId !== null && prevId !== floatingId) { | |
| 2747 | + setIsInstantPhase(true); | |
| 2748 | + prevContext?.setIsInstantPhase(true); | |
| 2749 | + prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none)); | |
| 2750 | + } else { | |
| 2751 | + setIsInstantPhase(false); | |
| 2752 | + prevContext?.setIsInstantPhase(false); | |
| 2753 | + } | |
| 2754 | + }, [open2, floatingId, store, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]); | |
| 2755 | + useIsoLayoutEffect(() => { | |
| 2756 | + return () => { | |
| 2757 | + if (currentIdRef.current === floatingId) { | |
| 2758 | + currentContextRef.current = null; | |
| 2759 | + if (!openRef.current) { | |
| 2760 | + return; | |
| 2761 | + } | |
| 2762 | + currentIdRef.current = null; | |
| 2763 | + resetDelayRef(delayRef, initialDelayRef); | |
| 2764 | + timeout.clear(); | |
| 2765 | + } | |
| 2766 | + }; | |
| 2767 | + }, [currentContextRef, currentIdRef, delayRef, floatingId, initialDelayRef, timeout]); | |
| 2768 | + return React18.useMemo(() => ({ | |
| 2769 | + activeIdRef: currentIdRef, | |
| 2770 | + hasProvider, | |
| 2771 | + delayRef, | |
| 2772 | + isInstantPhase | |
| 2773 | + }), [currentIdRef, hasProvider, delayRef, isInstantPhase]); | |
| 2774 | +} | |
| 2775 | + | |
| 2776 | +// node_modules/@base-ui/react/floating-ui-react/components/FloatingFocusManager.mjs | |
| 2777 | +var React22 = __toESM(require_react(), 1); | |
| 2778 | + | |
| 2779 | +// node_modules/@base-ui/utils/mergeCleanups.mjs | |
| 2780 | +function mergeCleanups(...cleanups) { | |
| 2781 | + return () => { | |
| 2782 | + for (let i = 0; i < cleanups.length; i += 1) { | |
| 2783 | + const cleanup = cleanups[i]; | |
| 2784 | + if (cleanup) { | |
| 2785 | + cleanup(); | |
| 2786 | + } | |
| 2787 | + } | |
| 2788 | + }; | |
| 2789 | +} | |
| 2790 | + | |
| 2791 | +// node_modules/@base-ui/react/utils/FocusGuard.mjs | |
| 2792 | +var React19 = __toESM(require_react(), 1); | |
| 2793 | + | |
| 2794 | +// node_modules/@base-ui/utils/visuallyHidden.mjs | |
| 2795 | +var visuallyHiddenBase = { | |
| 2796 | + clipPath: "inset(50%)", | |
| 2797 | + overflow: "hidden", | |
| 2798 | + whiteSpace: "nowrap", | |
| 2799 | + border: 0, | |
| 2800 | + padding: 0, | |
| 2801 | + width: 1, | |
| 2802 | + height: 1, | |
| 2803 | + margin: -1 | |
| 2804 | +}; | |
| 2805 | +var visuallyHidden = { | |
| 2806 | + ...visuallyHiddenBase, | |
| 2807 | + position: "fixed", | |
| 2808 | + top: 0, | |
| 2809 | + left: 0 | |
| 2810 | +}; | |
| 2811 | +var visuallyHiddenInput = { | |
| 2812 | + ...visuallyHiddenBase, | |
| 2813 | + position: "absolute" | |
| 2814 | +}; | |
| 2815 | + | |
| 2816 | +// node_modules/@base-ui/react/utils/FocusGuard.mjs | |
| 436 | 2817 | var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); |
| 437 | -var NODES = [ | |
| 438 | - "a", | |
| 439 | - "button", | |
| 440 | - "div", | |
| 441 | - "form", | |
| 442 | - "h2", | |
| 443 | - "h3", | |
| 444 | - "img", | |
| 445 | - "input", | |
| 446 | - "label", | |
| 447 | - "li", | |
| 448 | - "nav", | |
| 449 | - "ol", | |
| 450 | - "p", | |
| 451 | - "select", | |
| 452 | - "span", | |
| 453 | - "svg", | |
| 454 | - "ul" | |
| 455 | -]; | |
| 456 | -var Primitive = NODES.reduce((primitive, node) => { | |
| 457 | - const Slot2 = createSlot(`Primitive.${node}`); | |
| 458 | - const Node2 = React7.forwardRef((props, forwardedRef) => { | |
| 459 | - const { asChild, ...primitiveProps } = props; | |
| 460 | - const Comp = asChild ? Slot2 : node; | |
| 461 | - if (typeof window !== "undefined") { | |
| 462 | - window[/* @__PURE__ */ Symbol.for("radix-ui")] = true; | |
| 2818 | +var FocusGuard = /* @__PURE__ */ React19.forwardRef(function FocusGuard2(props, ref) { | |
| 2819 | + const [role, setRole] = React19.useState(); | |
| 2820 | + useIsoLayoutEffect(() => { | |
| 2821 | + if (parts_exports.screenReader.voiceOver && parts_exports.engine.webkit) { | |
| 2822 | + setRole("button"); | |
| 463 | 2823 | } |
| 464 | - return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Comp, { ...primitiveProps, ref: forwardedRef }); | |
| 2824 | + }, []); | |
| 2825 | + const restProps = { | |
| 2826 | + tabIndex: 0, | |
| 2827 | + // Role is only for VoiceOver | |
| 2828 | + role | |
| 2829 | + }; | |
| 2830 | + return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { | |
| 2831 | + ...props, | |
| 2832 | + ref, | |
| 2833 | + style: visuallyHidden, | |
| 2834 | + "aria-hidden": role ? void 0 : true, | |
| 2835 | + ...restProps, | |
| 2836 | + "data-base-ui-focus-guard": "" | |
| 465 | 2837 | }); |
| 466 | - Node2.displayName = `Primitive.${node}`; | |
| 467 | - return { ...primitive, [node]: Node2 }; | |
| 468 | -}, {}); | |
| 469 | -function dispatchDiscreteCustomEvent(target, event) { | |
| 470 | - if (target) ReactDOM.flushSync(() => target.dispatchEvent(event)); | |
| 2838 | +}); | |
| 2839 | +if (true) FocusGuard.displayName = "FocusGuard"; | |
| 2840 | + | |
| 2841 | +// node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs | |
| 2842 | +var min = Math.min; | |
| 2843 | +var max = Math.max; | |
| 2844 | +var round = Math.round; | |
| 2845 | +var floor = Math.floor; | |
| 2846 | +var createCoords = (v) => ({ | |
| 2847 | + x: v, | |
| 2848 | + y: v | |
| 2849 | +}); | |
| 2850 | +var oppositeSideMap = { | |
| 2851 | + left: "right", | |
| 2852 | + right: "left", | |
| 2853 | + bottom: "top", | |
| 2854 | + top: "bottom" | |
| 2855 | +}; | |
| 2856 | +function clamp(start, value, end) { | |
| 2857 | + return max(start, min(value, end)); | |
| 471 | 2858 | } |
| 2859 | +function evaluate(value, param) { | |
| 2860 | + return typeof value === "function" ? value(param) : value; | |
| 2861 | +} | |
| 2862 | +function getSide(placement) { | |
| 2863 | + return placement.split("-")[0]; | |
| 2864 | +} | |
| 2865 | +function getAlignment(placement) { | |
| 2866 | + return placement.split("-")[1]; | |
| 2867 | +} | |
| 2868 | +function getOppositeAxis(axis) { | |
| 2869 | + return axis === "x" ? "y" : "x"; | |
| 2870 | +} | |
| 2871 | +function getAxisLength(axis) { | |
| 2872 | + return axis === "y" ? "height" : "width"; | |
| 2873 | +} | |
| 2874 | +function getSideAxis(placement) { | |
| 2875 | + const firstChar = placement[0]; | |
| 2876 | + return firstChar === "t" || firstChar === "b" ? "y" : "x"; | |
| 2877 | +} | |
| 2878 | +function getAlignmentAxis(placement) { | |
| 2879 | + return getOppositeAxis(getSideAxis(placement)); | |
| 2880 | +} | |
| 2881 | +function getAlignmentSides(placement, rects, rtl) { | |
| 2882 | + if (rtl === void 0) { | |
| 2883 | + rtl = false; | |
| 2884 | + } | |
| 2885 | + const alignment = getAlignment(placement); | |
| 2886 | + const alignmentAxis = getAlignmentAxis(placement); | |
| 2887 | + const length = getAxisLength(alignmentAxis); | |
| 2888 | + let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; | |
| 2889 | + if (rects.reference[length] > rects.floating[length]) { | |
| 2890 | + mainAlignmentSide = getOppositePlacement(mainAlignmentSide); | |
| 2891 | + } | |
| 2892 | + return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; | |
| 2893 | +} | |
| 2894 | +function getExpandedPlacements(placement) { | |
| 2895 | + const oppositePlacement = getOppositePlacement(placement); | |
| 2896 | + return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; | |
| 2897 | +} | |
| 2898 | +function getOppositeAlignmentPlacement(placement) { | |
| 2899 | + return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start"); | |
| 2900 | +} | |
| 2901 | +var lrPlacement = ["left", "right"]; | |
| 2902 | +var rlPlacement = ["right", "left"]; | |
| 2903 | +var tbPlacement = ["top", "bottom"]; | |
| 2904 | +var btPlacement = ["bottom", "top"]; | |
| 2905 | +function getSideList(side, isStart, rtl) { | |
| 2906 | + switch (side) { | |
| 2907 | + case "top": | |
| 2908 | + case "bottom": | |
| 2909 | + if (rtl) return isStart ? rlPlacement : lrPlacement; | |
| 2910 | + return isStart ? lrPlacement : rlPlacement; | |
| 2911 | + case "left": | |
| 2912 | + case "right": | |
| 2913 | + return isStart ? tbPlacement : btPlacement; | |
| 2914 | + default: | |
| 2915 | + return []; | |
| 2916 | + } | |
| 2917 | +} | |
| 2918 | +function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { | |
| 2919 | + const alignment = getAlignment(placement); | |
| 2920 | + let list = getSideList(getSide(placement), direction === "start", rtl); | |
| 2921 | + if (alignment) { | |
| 2922 | + list = list.map((side) => side + "-" + alignment); | |
| 2923 | + if (flipAlignment) { | |
| 2924 | + list = list.concat(list.map(getOppositeAlignmentPlacement)); | |
| 2925 | + } | |
| 2926 | + } | |
| 2927 | + return list; | |
| 2928 | +} | |
| 2929 | +function getOppositePlacement(placement) { | |
| 2930 | + const side = getSide(placement); | |
| 2931 | + return oppositeSideMap[side] + placement.slice(side.length); | |
| 2932 | +} | |
| 2933 | +function expandPaddingObject(padding) { | |
| 2934 | + var _padding$top, _padding$right, _padding$bottom, _padding$left; | |
| 2935 | + return { | |
| 2936 | + top: (_padding$top = padding.top) != null ? _padding$top : 0, | |
| 2937 | + right: (_padding$right = padding.right) != null ? _padding$right : 0, | |
| 2938 | + bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0, | |
| 2939 | + left: (_padding$left = padding.left) != null ? _padding$left : 0 | |
| 2940 | + }; | |
| 2941 | +} | |
| 2942 | +function getPaddingObject(padding) { | |
| 2943 | + return typeof padding !== "number" ? expandPaddingObject(padding) : { | |
| 2944 | + top: padding, | |
| 2945 | + right: padding, | |
| 2946 | + bottom: padding, | |
| 2947 | + left: padding | |
| 2948 | + }; | |
| 2949 | +} | |
| 2950 | +function rectToClientRect(rect) { | |
| 2951 | + const { | |
| 2952 | + x, | |
| 2953 | + y, | |
| 2954 | + width, | |
| 2955 | + height | |
| 2956 | + } = rect; | |
| 2957 | + return { | |
| 2958 | + width, | |
| 2959 | + height, | |
| 2960 | + top: y, | |
| 2961 | + left: x, | |
| 2962 | + right: x + width, | |
| 2963 | + bottom: y + height, | |
| 2964 | + x, | |
| 2965 | + y | |
| 2966 | + }; | |
| 2967 | +} | |
| 472 | 2968 | |
| 473 | -// node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs | |
| 474 | -var React8 = __toESM(require_react(), 1); | |
| 475 | -function useCallbackRef(callback) { | |
| 476 | - const callbackRef = React8.useRef(callback); | |
| 477 | - React8.useEffect(() => { | |
| 478 | - callbackRef.current = callback; | |
| 2969 | +// node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs | |
| 2970 | +function isDifferentGridRow(index2, cols, prevRow) { | |
| 2971 | + return Math.floor(index2 / cols) !== prevRow; | |
| 2972 | +} | |
| 2973 | +function isIndexOutOfListBounds(list, index2) { | |
| 2974 | + return index2 < 0 || index2 >= list.length; | |
| 2975 | +} | |
| 2976 | +function getMinListIndex(listRef, disabledIndices) { | |
| 2977 | + return findNonDisabledListIndex(listRef.current, { | |
| 2978 | + disabledIndices | |
| 479 | 2979 | }); |
| 480 | - return React8.useMemo(() => (...args) => callbackRef.current?.(...args), []); | |
| 481 | 2980 | } |
| 2981 | +function getMaxListIndex(listRef, disabledIndices) { | |
| 2982 | + return findNonDisabledListIndex(listRef.current, { | |
| 2983 | + decrement: true, | |
| 2984 | + startingIndex: listRef.current.length, | |
| 2985 | + disabledIndices | |
| 2986 | + }); | |
| 2987 | +} | |
| 2988 | +function findNonDisabledListIndex(list, { | |
| 2989 | + startingIndex = -1, | |
| 2990 | + decrement = false, | |
| 2991 | + disabledIndices, | |
| 2992 | + amount = 1 | |
| 2993 | +} = {}) { | |
| 2994 | + let index2 = startingIndex; | |
| 2995 | + do { | |
| 2996 | + index2 += decrement ? -amount : amount; | |
| 2997 | + } while (index2 >= 0 && index2 <= list.length - 1 && isListIndexDisabled(list, index2, disabledIndices)); | |
| 2998 | + return index2; | |
| 2999 | +} | |
| 3000 | +function getGridNavigatedIndex(list, { | |
| 3001 | + event, | |
| 3002 | + orientation, | |
| 3003 | + loopFocus, | |
| 3004 | + onLoop, | |
| 3005 | + rtl, | |
| 3006 | + cols, | |
| 3007 | + disabledIndices, | |
| 3008 | + minIndex, | |
| 3009 | + maxIndex, | |
| 3010 | + prevIndex, | |
| 3011 | + stopEvent: stop = false | |
| 3012 | +}) { | |
| 3013 | + let nextIndex = prevIndex; | |
| 3014 | + let verticalDirection; | |
| 3015 | + if (event.key === ARROW_UP) { | |
| 3016 | + verticalDirection = "up"; | |
| 3017 | + } else if (event.key === ARROW_DOWN) { | |
| 3018 | + verticalDirection = "down"; | |
| 3019 | + } | |
| 3020 | + if (verticalDirection) { | |
| 3021 | + const rows = []; | |
| 3022 | + const rowIndexMap = []; | |
| 3023 | + let hasRoleRow = false; | |
| 3024 | + let visibleItemCount = 0; | |
| 3025 | + { | |
| 3026 | + let currentRowEl = null; | |
| 3027 | + let currentRowIndex = -1; | |
| 3028 | + list.forEach((el, idx) => { | |
| 3029 | + if (el == null) { | |
| 3030 | + return; | |
| 3031 | + } | |
| 3032 | + visibleItemCount += 1; | |
| 3033 | + const rowEl = el.closest('[role="row"]'); | |
| 3034 | + if (rowEl) { | |
| 3035 | + hasRoleRow = true; | |
| 3036 | + } | |
| 3037 | + if (rowEl !== currentRowEl || currentRowIndex === -1) { | |
| 3038 | + currentRowEl = rowEl; | |
| 3039 | + currentRowIndex += 1; | |
| 3040 | + rows[currentRowIndex] = []; | |
| 3041 | + } | |
| 3042 | + rows[currentRowIndex].push(idx); | |
| 3043 | + rowIndexMap[idx] = currentRowIndex; | |
| 3044 | + }); | |
| 3045 | + } | |
| 3046 | + let hasDomRows = false; | |
| 3047 | + let inferredDomCols = 0; | |
| 3048 | + if (hasRoleRow) { | |
| 3049 | + for (const row of rows) { | |
| 3050 | + const rowLength = row.length; | |
| 3051 | + if (rowLength > inferredDomCols) { | |
| 3052 | + inferredDomCols = rowLength; | |
| 3053 | + } | |
| 3054 | + if (rowLength !== cols) { | |
| 3055 | + hasDomRows = true; | |
| 3056 | + } | |
| 3057 | + } | |
| 3058 | + } | |
| 3059 | + const hasVirtualizedGaps = hasDomRows && visibleItemCount < list.length; | |
| 3060 | + const verticalCols = inferredDomCols || cols; | |
| 3061 | + const navigateVertically = (direction) => { | |
| 3062 | + if (!hasDomRows || prevIndex === -1) { | |
| 3063 | + return void 0; | |
| 3064 | + } | |
| 3065 | + const currentRow = rowIndexMap[prevIndex]; | |
| 3066 | + if (currentRow == null) { | |
| 3067 | + return void 0; | |
| 3068 | + } | |
| 3069 | + const colInRow = rows[currentRow].indexOf(prevIndex); | |
| 3070 | + const step = direction === "up" ? -1 : 1; | |
| 3071 | + for (let nextRow = currentRow + step, i = 0; i < rows.length; i += 1, nextRow += step) { | |
| 3072 | + if (nextRow < 0 || nextRow >= rows.length) { | |
| 3073 | + if (!loopFocus || hasVirtualizedGaps) { | |
| 3074 | + return void 0; | |
| 3075 | + } | |
| 3076 | + nextRow = nextRow < 0 ? rows.length - 1 : 0; | |
| 3077 | + if (onLoop) { | |
| 3078 | + const clampedCol = Math.min(colInRow, rows[nextRow].length - 1); | |
| 3079 | + const targetItemIndex = rows[nextRow][clampedCol] ?? rows[nextRow][0]; | |
| 3080 | + const returnedItemIndex = onLoop(event, prevIndex, targetItemIndex); | |
| 3081 | + nextRow = rowIndexMap[returnedItemIndex] ?? nextRow; | |
| 3082 | + } | |
| 3083 | + } | |
| 3084 | + const targetRow = rows[nextRow]; | |
| 3085 | + for (let col = Math.min(colInRow, targetRow.length - 1); col >= 0; col -= 1) { | |
| 3086 | + const candidate = targetRow[col]; | |
| 3087 | + if (!isListIndexDisabled(list, candidate, disabledIndices)) { | |
| 3088 | + return candidate; | |
| 3089 | + } | |
| 3090 | + } | |
| 3091 | + } | |
| 3092 | + return void 0; | |
| 3093 | + }; | |
| 3094 | + const navigateVerticallyWithInferredRows = (direction) => { | |
| 3095 | + if (!hasVirtualizedGaps || prevIndex === -1) { | |
| 3096 | + return void 0; | |
| 3097 | + } | |
| 3098 | + const colInRow = prevIndex % verticalCols; | |
| 3099 | + const rowStep = direction === "up" ? -verticalCols : verticalCols; | |
| 3100 | + const lastRowStart = maxIndex - maxIndex % verticalCols; | |
| 3101 | + const rowCount = floor(maxIndex / verticalCols) + 1; | |
| 3102 | + for (let rowStart = prevIndex - colInRow + rowStep, i = 0; i < rowCount; i += 1, rowStart += rowStep) { | |
| 3103 | + if (rowStart < 0 || rowStart > maxIndex) { | |
| 3104 | + if (!loopFocus) { | |
| 3105 | + return void 0; | |
| 3106 | + } | |
| 3107 | + rowStart = rowStart < 0 ? lastRowStart : 0; | |
| 3108 | + } | |
| 3109 | + const rowEnd = Math.min(rowStart + verticalCols - 1, maxIndex); | |
| 3110 | + for (let candidate = Math.min(rowStart + colInRow, rowEnd); candidate >= rowStart; candidate -= 1) { | |
| 3111 | + if (!isListIndexDisabled(list, candidate, disabledIndices)) { | |
| 3112 | + return candidate; | |
| 3113 | + } | |
| 3114 | + } | |
| 3115 | + } | |
| 3116 | + return void 0; | |
| 3117 | + }; | |
| 3118 | + if (stop) { | |
| 3119 | + stopEvent(event); | |
| 3120 | + } | |
| 3121 | + const verticalCandidate = navigateVertically(verticalDirection) ?? navigateVerticallyWithInferredRows(verticalDirection); | |
| 3122 | + if (verticalCandidate !== void 0) { | |
| 3123 | + nextIndex = verticalCandidate; | |
| 3124 | + } else if (prevIndex === -1) { | |
| 3125 | + nextIndex = verticalDirection === "up" ? maxIndex : minIndex; | |
| 3126 | + } else { | |
| 3127 | + nextIndex = findNonDisabledListIndex(list, { | |
| 3128 | + startingIndex: prevIndex, | |
| 3129 | + amount: verticalCols, | |
| 3130 | + decrement: verticalDirection === "up", | |
| 3131 | + disabledIndices | |
| 3132 | + }); | |
| 3133 | + if (loopFocus) { | |
| 3134 | + if (verticalDirection === "up" && (prevIndex - verticalCols < minIndex || nextIndex < 0)) { | |
| 3135 | + const col = prevIndex % verticalCols; | |
| 3136 | + const maxCol = maxIndex % verticalCols; | |
| 3137 | + const offset4 = maxIndex - (maxCol - col); | |
| 3138 | + if (maxCol === col) { | |
| 3139 | + nextIndex = maxIndex; | |
| 3140 | + } else { | |
| 3141 | + nextIndex = maxCol > col ? offset4 : offset4 - verticalCols; | |
| 3142 | + } | |
| 3143 | + if (onLoop) { | |
| 3144 | + nextIndex = onLoop(event, prevIndex, nextIndex); | |
| 3145 | + } | |
| 3146 | + } | |
| 3147 | + if (verticalDirection === "down" && prevIndex + verticalCols > maxIndex) { | |
| 3148 | + nextIndex = findNonDisabledListIndex(list, { | |
| 3149 | + startingIndex: prevIndex % verticalCols - verticalCols, | |
| 3150 | + amount: verticalCols, | |
| 3151 | + disabledIndices | |
| 3152 | + }); | |
| 3153 | + if (onLoop) { | |
| 3154 | + nextIndex = onLoop(event, prevIndex, nextIndex); | |
| 3155 | + } | |
| 3156 | + } | |
| 3157 | + } | |
| 3158 | + } | |
| 3159 | + if (isIndexOutOfListBounds(list, nextIndex)) { | |
| 3160 | + nextIndex = prevIndex; | |
| 3161 | + } | |
| 3162 | + } | |
| 3163 | + if (orientation === "both") { | |
| 3164 | + const prevRow = floor(prevIndex / cols); | |
| 3165 | + if (event.key === (rtl ? ARROW_LEFT : ARROW_RIGHT)) { | |
| 3166 | + if (stop) { | |
| 3167 | + stopEvent(event); | |
| 3168 | + } | |
| 3169 | + if (prevIndex % cols !== cols - 1) { | |
| 3170 | + nextIndex = findNonDisabledListIndex(list, { | |
| 3171 | + startingIndex: prevIndex, | |
| 3172 | + disabledIndices | |
| 3173 | + }); | |
| 3174 | + if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) { | |
| 3175 | + nextIndex = findNonDisabledListIndex(list, { | |
| 3176 | + startingIndex: prevIndex - prevIndex % cols - 1, | |
| 3177 | + disabledIndices | |
| 3178 | + }); | |
| 3179 | + if (onLoop) { | |
| 3180 | + nextIndex = onLoop(event, prevIndex, nextIndex); | |
| 3181 | + } | |
| 3182 | + } | |
| 3183 | + } else if (loopFocus) { | |
| 3184 | + nextIndex = findNonDisabledListIndex(list, { | |
| 3185 | + startingIndex: prevIndex - prevIndex % cols - 1, | |
| 3186 | + disabledIndices | |
| 3187 | + }); | |
| 3188 | + if (onLoop) { | |
| 3189 | + nextIndex = onLoop(event, prevIndex, nextIndex); | |
| 3190 | + } | |
| 3191 | + } | |
| 3192 | + if (isDifferentGridRow(nextIndex, cols, prevRow)) { | |
| 3193 | + nextIndex = prevIndex; | |
| 3194 | + } | |
| 3195 | + } | |
| 3196 | + if (event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT)) { | |
| 3197 | + if (stop) { | |
| 3198 | + stopEvent(event); | |
| 3199 | + } | |
| 3200 | + if (prevIndex % cols !== 0) { | |
| 3201 | + nextIndex = findNonDisabledListIndex(list, { | |
| 3202 | + startingIndex: prevIndex, | |
| 3203 | + decrement: true, | |
| 3204 | + disabledIndices | |
| 3205 | + }); | |
| 3206 | + if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) { | |
| 3207 | + nextIndex = findNonDisabledListIndex(list, { | |
| 3208 | + startingIndex: prevIndex + (cols - prevIndex % cols), | |
| 3209 | + decrement: true, | |
| 3210 | + disabledIndices | |
| 3211 | + }); | |
| 3212 | + if (onLoop) { | |
| 3213 | + nextIndex = onLoop(event, prevIndex, nextIndex); | |
| 3214 | + } | |
| 3215 | + } | |
| 3216 | + } else if (loopFocus) { | |
| 3217 | + nextIndex = findNonDisabledListIndex(list, { | |
| 3218 | + startingIndex: prevIndex + (cols - prevIndex % cols), | |
| 3219 | + decrement: true, | |
| 3220 | + disabledIndices | |
| 3221 | + }); | |
| 3222 | + if (onLoop) { | |
| 3223 | + nextIndex = onLoop(event, prevIndex, nextIndex); | |
| 3224 | + } | |
| 3225 | + } | |
| 3226 | + if (isDifferentGridRow(nextIndex, cols, prevRow)) { | |
| 3227 | + nextIndex = prevIndex; | |
| 3228 | + } | |
| 3229 | + } | |
| 3230 | + const lastRow = floor(maxIndex / cols) === prevRow; | |
| 3231 | + if (isIndexOutOfListBounds(list, nextIndex)) { | |
| 3232 | + if (loopFocus && lastRow) { | |
| 3233 | + nextIndex = event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT) ? maxIndex : findNonDisabledListIndex(list, { | |
| 3234 | + startingIndex: prevIndex - prevIndex % cols - 1, | |
| 3235 | + disabledIndices | |
| 3236 | + }); | |
| 3237 | + if (onLoop) { | |
| 3238 | + nextIndex = onLoop(event, prevIndex, nextIndex); | |
| 3239 | + } | |
| 3240 | + } else { | |
| 3241 | + nextIndex = prevIndex; | |
| 3242 | + } | |
| 3243 | + } | |
| 3244 | + } | |
| 3245 | + return nextIndex; | |
| 3246 | +} | |
| 3247 | +function isListIndexDisabled(list, index2, disabledIndices) { | |
| 3248 | + const isExplicitlyDisabled = typeof disabledIndices === "function" ? disabledIndices(index2) : disabledIndices?.includes(index2) ?? false; | |
| 3249 | + if (isExplicitlyDisabled) { | |
| 3250 | + return true; | |
| 3251 | + } | |
| 3252 | + const element = list[index2]; | |
| 3253 | + if (!element) { | |
| 3254 | + return false; | |
| 3255 | + } | |
| 3256 | + if (!isElementVisible(element)) { | |
| 3257 | + return true; | |
| 3258 | + } | |
| 3259 | + if (element.matches(":disabled")) { | |
| 3260 | + return true; | |
| 3261 | + } | |
| 3262 | + return !disabledIndices && (element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true"); | |
| 3263 | +} | |
| 3264 | +function isHiddenByStyles(styles) { | |
| 3265 | + return styles.visibility === "hidden" || styles.visibility === "collapse"; | |
| 3266 | +} | |
| 3267 | +function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) { | |
| 3268 | + if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) { | |
| 3269 | + return false; | |
| 3270 | + } | |
| 3271 | + if (typeof element.checkVisibility === "function") { | |
| 3272 | + return element.checkVisibility(); | |
| 3273 | + } | |
| 3274 | + return styles.display !== "none" && styles.display !== "contents"; | |
| 3275 | +} | |
| 482 | 3276 | |
| 483 | -// node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs | |
| 484 | -var React9 = __toESM(require_react(), 1); | |
| 485 | -function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) { | |
| 486 | - const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp); | |
| 487 | - React9.useEffect(() => { | |
| 488 | - const handleKeyDown = (event) => { | |
| 489 | - if (event.key === "Escape") { | |
| 490 | - onEscapeKeyDown(event); | |
| 3277 | +// node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs | |
| 3278 | +var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]'; | |
| 3279 | +function getParentElement(element) { | |
| 3280 | + const assignedSlot = element.assignedSlot; | |
| 3281 | + if (assignedSlot) { | |
| 3282 | + return assignedSlot; | |
| 3283 | + } | |
| 3284 | + if (element.parentElement) { | |
| 3285 | + return element.parentElement; | |
| 3286 | + } | |
| 3287 | + const rootNode = element.getRootNode(); | |
| 3288 | + return isShadowRoot(rootNode) ? rootNode.host : null; | |
| 3289 | +} | |
| 3290 | +function getDetailsSummary(details) { | |
| 3291 | + for (const child of Array.from(details.children)) { | |
| 3292 | + if (getNodeName(child) === "summary") { | |
| 3293 | + return child; | |
| 3294 | + } | |
| 3295 | + } | |
| 3296 | + return null; | |
| 3297 | +} | |
| 3298 | +function isWithinOpenDetailsSummary(element, details) { | |
| 3299 | + const summary = getDetailsSummary(details); | |
| 3300 | + return !!summary && (element === summary || contains(summary, element)); | |
| 3301 | +} | |
| 3302 | +function isFocusableCandidate(element) { | |
| 3303 | + const nodeName = element ? getNodeName(element) : ""; | |
| 3304 | + return element != null && element.matches(CANDIDATE_SELECTOR) && (nodeName !== "summary" || element.parentElement != null && getNodeName(element.parentElement) === "details" && getDetailsSummary(element.parentElement) === element) && (nodeName !== "details" || getDetailsSummary(element) == null) && (nodeName !== "input" || element.type !== "hidden"); | |
| 3305 | +} | |
| 3306 | +function isFocusableElement(element) { | |
| 3307 | + if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) { | |
| 3308 | + return false; | |
| 3309 | + } | |
| 3310 | + for (let current = element; current; current = getParentElement(current)) { | |
| 3311 | + const isAncestor = current !== element; | |
| 3312 | + const isSlot = getNodeName(current) === "slot"; | |
| 3313 | + if (current.hasAttribute("inert")) { | |
| 3314 | + return false; | |
| 3315 | + } | |
| 3316 | + if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) { | |
| 3317 | + return false; | |
| 3318 | + } | |
| 3319 | + } | |
| 3320 | + return true; | |
| 3321 | +} | |
| 3322 | +function isVisibleInTabbableTree(element, isAncestor) { | |
| 3323 | + const styles = getComputedStyle2(element); | |
| 3324 | + if (!isAncestor) { | |
| 3325 | + return isElementVisible(element, styles); | |
| 3326 | + } | |
| 3327 | + return styles.display !== "none"; | |
| 3328 | +} | |
| 3329 | +function getTabIndex(element) { | |
| 3330 | + const tabIndex = element.tabIndex; | |
| 3331 | + if (tabIndex < 0) { | |
| 3332 | + const nodeName = getNodeName(element); | |
| 3333 | + if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) { | |
| 3334 | + return 0; | |
| 3335 | + } | |
| 3336 | + } | |
| 3337 | + return tabIndex; | |
| 3338 | +} | |
| 3339 | +function getNamedRadioInput(element) { | |
| 3340 | + if (getNodeName(element) !== "input") { | |
| 3341 | + return null; | |
| 3342 | + } | |
| 3343 | + const input = element; | |
| 3344 | + return input.type === "radio" && input.name !== "" ? input : null; | |
| 3345 | +} | |
| 3346 | +function isTabbableRadio(element, candidates) { | |
| 3347 | + const input = getNamedRadioInput(element); | |
| 3348 | + if (!input) { | |
| 3349 | + return true; | |
| 3350 | + } | |
| 3351 | + const checkedRadio = candidates.find((candidate) => { | |
| 3352 | + const radio = getNamedRadioInput(candidate); | |
| 3353 | + return radio?.name === input.name && radio.form === input.form && radio.checked; | |
| 3354 | + }); | |
| 3355 | + if (checkedRadio) { | |
| 3356 | + return checkedRadio === input; | |
| 3357 | + } | |
| 3358 | + return candidates.find((candidate) => { | |
| 3359 | + const radio = getNamedRadioInput(candidate); | |
| 3360 | + return radio?.name === input.name && radio.form === input.form; | |
| 3361 | + }) === input; | |
| 3362 | +} | |
| 3363 | +function getComposedChildren(container) { | |
| 3364 | + if (isHTMLElement(container) && getNodeName(container) === "slot") { | |
| 3365 | + const assignedElements = container.assignedElements({ | |
| 3366 | + flatten: true | |
| 3367 | + }); | |
| 3368 | + if (assignedElements.length > 0) { | |
| 3369 | + return assignedElements; | |
| 3370 | + } | |
| 3371 | + } | |
| 3372 | + if (isHTMLElement(container) && container.shadowRoot) { | |
| 3373 | + return Array.from(container.shadowRoot.children); | |
| 3374 | + } | |
| 3375 | + return Array.from(container.children); | |
| 3376 | +} | |
| 3377 | +function appendCandidates(container, list) { | |
| 3378 | + getComposedChildren(container).forEach((child) => { | |
| 3379 | + if (isFocusableCandidate(child)) { | |
| 3380 | + list.push(child); | |
| 3381 | + } | |
| 3382 | + appendCandidates(child, list); | |
| 3383 | + }); | |
| 3384 | +} | |
| 3385 | +function appendMatchingElements(container, selector, list) { | |
| 3386 | + getComposedChildren(container).forEach((child) => { | |
| 3387 | + if (isHTMLElement(child) && child.matches(selector)) { | |
| 3388 | + list.push(child); | |
| 3389 | + } | |
| 3390 | + appendMatchingElements(child, selector, list); | |
| 3391 | + }); | |
| 3392 | +} | |
| 3393 | +function isTabbable(element) { | |
| 3394 | + return isFocusableElement(element) && getTabIndex(element) >= 0; | |
| 3395 | +} | |
| 3396 | +function focusable(container) { | |
| 3397 | + const candidates = []; | |
| 3398 | + appendCandidates(container, candidates); | |
| 3399 | + return candidates.filter(isFocusableElement); | |
| 3400 | +} | |
| 3401 | +function tabbable(container) { | |
| 3402 | + const candidates = focusable(container); | |
| 3403 | + return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates)); | |
| 3404 | +} | |
| 3405 | +function getTabbableIn(container, dir) { | |
| 3406 | + const list = tabbable(container); | |
| 3407 | + const len = list.length; | |
| 3408 | + if (len === 0) { | |
| 3409 | + return void 0; | |
| 3410 | + } | |
| 3411 | + const active = activeElement(ownerDocument(container)); | |
| 3412 | + const index2 = list.indexOf(active); | |
| 3413 | + const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir; | |
| 3414 | + return list[nextIndex]; | |
| 3415 | +} | |
| 3416 | +function getNextTabbable(referenceElement) { | |
| 3417 | + return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement; | |
| 3418 | +} | |
| 3419 | +function getPreviousTabbable(referenceElement) { | |
| 3420 | + return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement; | |
| 3421 | +} | |
| 3422 | +function isOutsideEvent(event, container) { | |
| 3423 | + const containerElement = container || event.currentTarget; | |
| 3424 | + const relatedTarget = event.relatedTarget; | |
| 3425 | + return !relatedTarget || !contains(containerElement, relatedTarget); | |
| 3426 | +} | |
| 3427 | +function disableFocusInside(container) { | |
| 3428 | + const tabbableElements = tabbable(container); | |
| 3429 | + tabbableElements.forEach((element) => { | |
| 3430 | + element.dataset.tabindex = element.getAttribute("tabindex") || ""; | |
| 3431 | + element.setAttribute("tabindex", "-1"); | |
| 3432 | + }); | |
| 3433 | +} | |
| 3434 | +function enableFocusInside(container) { | |
| 3435 | + const elements = []; | |
| 3436 | + appendMatchingElements(container, "[data-tabindex]", elements); | |
| 3437 | + elements.forEach((element) => { | |
| 3438 | + const tabindex = element.dataset.tabindex; | |
| 3439 | + delete element.dataset.tabindex; | |
| 3440 | + if (tabindex) { | |
| 3441 | + element.setAttribute("tabindex", tabindex); | |
| 3442 | + } else { | |
| 3443 | + element.removeAttribute("tabindex"); | |
| 3444 | + } | |
| 3445 | + }); | |
| 3446 | +} | |
| 3447 | + | |
| 3448 | +// node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs | |
| 3449 | +function getNodeChildren(nodes, id, onlyOpenChildren = true) { | |
| 3450 | + const directChildren = nodes.filter((node) => node.parentId === id); | |
| 3451 | + return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]); | |
| 3452 | +} | |
| 3453 | +function getNodeAncestors(nodes, id) { | |
| 3454 | + let allAncestors = []; | |
| 3455 | + let currentParentId = nodes.find((node) => node.id === id)?.parentId; | |
| 3456 | + while (currentParentId) { | |
| 3457 | + const currentNode = nodes.find((node) => node.id === currentParentId); | |
| 3458 | + currentParentId = currentNode?.parentId; | |
| 3459 | + if (currentNode) { | |
| 3460 | + allAncestors = allAncestors.concat(currentNode); | |
| 3461 | + } | |
| 3462 | + } | |
| 3463 | + return allAncestors; | |
| 3464 | +} | |
| 3465 | + | |
| 3466 | +// node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs | |
| 3467 | +function createAttribute(name) { | |
| 3468 | + return `data-base-ui-${name}`; | |
| 3469 | +} | |
| 3470 | + | |
| 3471 | +// node_modules/@base-ui/react/floating-ui-react/utils/enqueueFocus.mjs | |
| 3472 | +var rafId = 0; | |
| 3473 | +function enqueueFocus(el, options = {}) { | |
| 3474 | + const { | |
| 3475 | + preventScroll = false, | |
| 3476 | + sync = false, | |
| 3477 | + shouldFocus | |
| 3478 | + } = options; | |
| 3479 | + cancelAnimationFrame(rafId); | |
| 3480 | + function exec() { | |
| 3481 | + if (shouldFocus && !shouldFocus()) { | |
| 3482 | + return; | |
| 3483 | + } | |
| 3484 | + el?.focus({ | |
| 3485 | + preventScroll | |
| 3486 | + }); | |
| 3487 | + } | |
| 3488 | + if (sync) { | |
| 3489 | + exec(); | |
| 3490 | + return NOOP; | |
| 3491 | + } | |
| 3492 | + const currentRafId = requestAnimationFrame(exec); | |
| 3493 | + rafId = currentRafId; | |
| 3494 | + return () => { | |
| 3495 | + if (rafId === currentRafId) { | |
| 3496 | + cancelAnimationFrame(currentRafId); | |
| 3497 | + rafId = 0; | |
| 3498 | + } | |
| 3499 | + }; | |
| 3500 | +} | |
| 3501 | + | |
| 3502 | +// node_modules/@base-ui/react/floating-ui-react/utils/markOthers.mjs | |
| 3503 | +var counters = { | |
| 3504 | + inert: /* @__PURE__ */ new WeakMap(), | |
| 3505 | + "aria-hidden": /* @__PURE__ */ new WeakMap() | |
| 3506 | +}; | |
| 3507 | +var markerName = "data-base-ui-inert"; | |
| 3508 | +var uncontrolledElementsSets = { | |
| 3509 | + inert: /* @__PURE__ */ new WeakSet(), | |
| 3510 | + "aria-hidden": /* @__PURE__ */ new WeakSet() | |
| 3511 | +}; | |
| 3512 | +var markerCounterMap = /* @__PURE__ */ new WeakMap(); | |
| 3513 | +var lockCount = 0; | |
| 3514 | +function getUncontrolledElementsSet(controlAttribute) { | |
| 3515 | + return uncontrolledElementsSets[controlAttribute]; | |
| 3516 | +} | |
| 3517 | +function unwrapHost(node) { | |
| 3518 | + if (!node) { | |
| 3519 | + return null; | |
| 3520 | + } | |
| 3521 | + return isShadowRoot(node) ? node.host : unwrapHost(node.parentNode); | |
| 3522 | +} | |
| 3523 | +var correctElements = (parent, targets) => targets.map((target) => { | |
| 3524 | + if (parent.contains(target)) { | |
| 3525 | + return target; | |
| 3526 | + } | |
| 3527 | + const correctedTarget = unwrapHost(target); | |
| 3528 | + if (parent.contains(correctedTarget)) { | |
| 3529 | + return correctedTarget; | |
| 3530 | + } | |
| 3531 | + return null; | |
| 3532 | +}).filter((x) => x != null); | |
| 3533 | +var buildKeepSet = (targets) => { | |
| 3534 | + const keep = /* @__PURE__ */ new Set(); | |
| 3535 | + targets.forEach((target) => { | |
| 3536 | + let node = target; | |
| 3537 | + while (node && !keep.has(node)) { | |
| 3538 | + keep.add(node); | |
| 3539 | + node = node.parentNode; | |
| 3540 | + } | |
| 3541 | + }); | |
| 3542 | + return keep; | |
| 3543 | +}; | |
| 3544 | +var collectOutsideElements = (root2, keepElements, stopElements) => { | |
| 3545 | + const outside = []; | |
| 3546 | + const walk = (parent) => { | |
| 3547 | + if (!parent || stopElements.has(parent)) { | |
| 3548 | + return; | |
| 3549 | + } | |
| 3550 | + Array.from(parent.children).forEach((node) => { | |
| 3551 | + if (getNodeName(node) === "script") { | |
| 3552 | + return; | |
| 491 | 3553 | } |
| 492 | - }; | |
| 493 | - ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true }); | |
| 494 | - return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true }); | |
| 495 | - }, [onEscapeKeyDown, ownerDocument]); | |
| 3554 | + if (keepElements.has(node)) { | |
| 3555 | + walk(node); | |
| 3556 | + } else { | |
| 3557 | + outside.push(node); | |
| 3558 | + } | |
| 3559 | + }); | |
| 3560 | + }; | |
| 3561 | + walk(root2); | |
| 3562 | + return outside; | |
| 3563 | +}; | |
| 3564 | +function applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, inert, { | |
| 3565 | + mark = true | |
| 3566 | +}) { | |
| 3567 | + let controlAttribute = null; | |
| 3568 | + if (inert) { | |
| 3569 | + controlAttribute = "inert"; | |
| 3570 | + } else if (ariaHidden) { | |
| 3571 | + controlAttribute = "aria-hidden"; | |
| 3572 | + } | |
| 3573 | + let counterMap = null; | |
| 3574 | + let uncontrolledElementsSet = null; | |
| 3575 | + const avoidElements = correctElements(body, uncorrectedAvoidElements); | |
| 3576 | + const markerTargets = mark ? collectOutsideElements(body, buildKeepSet(avoidElements), new Set(avoidElements)) : []; | |
| 3577 | + const hiddenElements = []; | |
| 3578 | + const markedElements = []; | |
| 3579 | + if (controlAttribute) { | |
| 3580 | + const map = counters[controlAttribute]; | |
| 3581 | + const currentUncontrolledElementsSet = getUncontrolledElementsSet(controlAttribute); | |
| 3582 | + uncontrolledElementsSet = currentUncontrolledElementsSet; | |
| 3583 | + counterMap = map; | |
| 3584 | + const ariaLiveElements = correctElements(body, Array.from(body.querySelectorAll("[aria-live]"))); | |
| 3585 | + const controlElements = avoidElements.concat(ariaLiveElements); | |
| 3586 | + const controlTargets = collectOutsideElements(body, buildKeepSet(controlElements), new Set(controlElements)); | |
| 3587 | + controlTargets.forEach((node) => { | |
| 3588 | + const attr2 = node.getAttribute(controlAttribute); | |
| 3589 | + const alreadyHidden = attr2 !== null && attr2 !== "false"; | |
| 3590 | + const counterValue = (map.get(node) || 0) + 1; | |
| 3591 | + map.set(node, counterValue); | |
| 3592 | + hiddenElements.push(node); | |
| 3593 | + if (counterValue === 1 && alreadyHidden) { | |
| 3594 | + currentUncontrolledElementsSet.add(node); | |
| 3595 | + } | |
| 3596 | + if (!alreadyHidden) { | |
| 3597 | + node.setAttribute(controlAttribute, controlAttribute === "inert" ? "" : "true"); | |
| 3598 | + } | |
| 3599 | + }); | |
| 3600 | + } | |
| 3601 | + if (mark) { | |
| 3602 | + markerTargets.forEach((node) => { | |
| 3603 | + const markerValue = (markerCounterMap.get(node) || 0) + 1; | |
| 3604 | + markerCounterMap.set(node, markerValue); | |
| 3605 | + markedElements.push(node); | |
| 3606 | + if (markerValue === 1) { | |
| 3607 | + node.setAttribute(markerName, ""); | |
| 3608 | + } | |
| 3609 | + }); | |
| 3610 | + } | |
| 3611 | + lockCount += 1; | |
| 3612 | + return () => { | |
| 3613 | + if (counterMap) { | |
| 3614 | + hiddenElements.forEach((element) => { | |
| 3615 | + const currentCounterValue = counterMap.get(element) || 0; | |
| 3616 | + const counterValue = currentCounterValue - 1; | |
| 3617 | + counterMap.set(element, counterValue); | |
| 3618 | + if (!counterValue) { | |
| 3619 | + if (!uncontrolledElementsSet?.has(element) && controlAttribute) { | |
| 3620 | + element.removeAttribute(controlAttribute); | |
| 3621 | + } | |
| 3622 | + uncontrolledElementsSet?.delete(element); | |
| 3623 | + } | |
| 3624 | + }); | |
| 3625 | + } | |
| 3626 | + if (mark) { | |
| 3627 | + markedElements.forEach((element) => { | |
| 3628 | + const markerValue = (markerCounterMap.get(element) || 0) - 1; | |
| 3629 | + markerCounterMap.set(element, markerValue); | |
| 3630 | + if (!markerValue) { | |
| 3631 | + element.removeAttribute(markerName); | |
| 3632 | + } | |
| 3633 | + }); | |
| 3634 | + } | |
| 3635 | + lockCount -= 1; | |
| 3636 | + if (!lockCount) { | |
| 3637 | + counters.inert = /* @__PURE__ */ new WeakMap(); | |
| 3638 | + counters["aria-hidden"] = /* @__PURE__ */ new WeakMap(); | |
| 3639 | + uncontrolledElementsSets.inert = /* @__PURE__ */ new WeakSet(); | |
| 3640 | + uncontrolledElementsSets["aria-hidden"] = /* @__PURE__ */ new WeakSet(); | |
| 3641 | + markerCounterMap = /* @__PURE__ */ new WeakMap(); | |
| 3642 | + } | |
| 3643 | + }; | |
| 496 | 3644 | } |
| 3645 | +function markOthers(avoidElements, options = {}) { | |
| 3646 | + const { | |
| 3647 | + ariaHidden = false, | |
| 3648 | + inert = false, | |
| 3649 | + mark = true | |
| 3650 | + } = options; | |
| 3651 | + const body = ownerDocument(avoidElements[0]).body; | |
| 3652 | + return applyAttributeToOthers(avoidElements, body, ariaHidden, inert, { | |
| 3653 | + mark | |
| 3654 | + }); | |
| 3655 | +} | |
| 497 | 3656 | |
| 498 | -// node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs | |
| 3657 | +// node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs | |
| 3658 | +var React20 = __toESM(require_react(), 1); | |
| 3659 | +var ReactDOM2 = __toESM(require_react_dom(), 1); | |
| 3660 | + | |
| 3661 | +// node_modules/@base-ui/react/internals/constants.mjs | |
| 3662 | +var DISABLED_TRANSITIONS_STYLE = { | |
| 3663 | + style: { | |
| 3664 | + transition: "none" | |
| 3665 | + } | |
| 3666 | +}; | |
| 3667 | +var CLICK_TRIGGER_IDENTIFIER = "data-base-ui-click-trigger"; | |
| 3668 | +var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore"; | |
| 3669 | +var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore"; | |
| 3670 | +var BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`; | |
| 3671 | +var LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`; | |
| 3672 | +var DROPDOWN_COLLISION_AVOIDANCE = { | |
| 3673 | + fallbackAxisSide: "none" | |
| 3674 | +}; | |
| 3675 | +var POPUP_COLLISION_AVOIDANCE = { | |
| 3676 | + fallbackAxisSide: "end" | |
| 3677 | +}; | |
| 3678 | +var ownerVisuallyHidden = { | |
| 3679 | + clipPath: "inset(50%)", | |
| 3680 | + position: "fixed", | |
| 3681 | + top: 0, | |
| 3682 | + left: 0 | |
| 3683 | +}; | |
| 3684 | + | |
| 3685 | +// node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs | |
| 499 | 3686 | var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); |
| 500 | -var DISMISSABLE_LAYER_NAME = "DismissableLayer"; | |
| 501 | -var CONTEXT_UPDATE = "dismissableLayer.update"; | |
| 502 | -var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside"; | |
| 503 | -var FOCUS_OUTSIDE = "dismissableLayer.focusOutside"; | |
| 504 | -var originalBodyPointerEvents; | |
| 505 | -var DismissableLayerContext = React10.createContext({ | |
| 506 | - layers: /* @__PURE__ */ new Set(), | |
| 507 | - layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(), | |
| 508 | - branches: /* @__PURE__ */ new Set() | |
| 3687 | +var PortalContext = /* @__PURE__ */ React20.createContext(null); | |
| 3688 | +if (true) PortalContext.displayName = "PortalContext"; | |
| 3689 | +var usePortalContext = () => React20.useContext(PortalContext); | |
| 3690 | +var attr = createAttribute("portal"); | |
| 3691 | +function useFloatingPortalNode(props = {}) { | |
| 3692 | + const { | |
| 3693 | + ref, | |
| 3694 | + container: containerProp, | |
| 3695 | + componentProps = EMPTY_OBJECT, | |
| 3696 | + elementProps | |
| 3697 | + } = props; | |
| 3698 | + const uniqueId = useId(); | |
| 3699 | + const portalContext = usePortalContext(); | |
| 3700 | + const parentPortalNode = portalContext?.portalNode; | |
| 3701 | + const [containerElement, setContainerElement] = React20.useState(null); | |
| 3702 | + const [portalNode, setPortalNode] = React20.useState(null); | |
| 3703 | + const setPortalNodeRef = useStableCallback((node) => { | |
| 3704 | + if (node !== null) { | |
| 3705 | + setPortalNode(node); | |
| 3706 | + } | |
| 3707 | + }); | |
| 3708 | + const containerRef = React20.useRef(null); | |
| 3709 | + useIsoLayoutEffect(() => { | |
| 3710 | + if (containerProp === null) { | |
| 3711 | + if (containerRef.current) { | |
| 3712 | + containerRef.current = null; | |
| 3713 | + setPortalNode(null); | |
| 3714 | + setContainerElement(null); | |
| 3715 | + } | |
| 3716 | + return; | |
| 3717 | + } | |
| 3718 | + const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body; | |
| 3719 | + if (resolvedContainer == null) { | |
| 3720 | + if (containerRef.current) { | |
| 3721 | + containerRef.current = null; | |
| 3722 | + setPortalNode(null); | |
| 3723 | + setContainerElement(null); | |
| 3724 | + } | |
| 3725 | + return; | |
| 3726 | + } | |
| 3727 | + if (containerRef.current !== resolvedContainer) { | |
| 3728 | + containerRef.current = resolvedContainer; | |
| 3729 | + setPortalNode(null); | |
| 3730 | + setContainerElement(resolvedContainer); | |
| 3731 | + } | |
| 3732 | + }, [containerProp, parentPortalNode]); | |
| 3733 | + const portalElement = useRenderElement("div", componentProps, { | |
| 3734 | + ref: [ref, setPortalNodeRef], | |
| 3735 | + props: [{ | |
| 3736 | + id: uniqueId, | |
| 3737 | + [attr]: "" | |
| 3738 | + }, elementProps] | |
| 3739 | + }); | |
| 3740 | + const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null; | |
| 3741 | + return { | |
| 3742 | + node: portalNode, | |
| 3743 | + // `id` and `render` props can override or remove the generated ID. Use the exact | |
| 3744 | + // rendered value so `aria-owns` never points at an ID absent from the DOM. | |
| 3745 | + nodeId: /* @__PURE__ */ React20.isValidElement(portalElement) ? portalElement.props.id : void 0, | |
| 3746 | + subtree: portalSubtree | |
| 3747 | + }; | |
| 3748 | +} | |
| 3749 | +var FloatingPortal = /* @__PURE__ */ React20.forwardRef(function FloatingPortal2(componentProps, forwardedRef) { | |
| 3750 | + const { | |
| 3751 | + render, | |
| 3752 | + className, | |
| 3753 | + style, | |
| 3754 | + children, | |
| 3755 | + container, | |
| 3756 | + portalOwnerRole, | |
| 3757 | + ...elementProps | |
| 3758 | + } = componentProps; | |
| 3759 | + const { | |
| 3760 | + node: portalNode, | |
| 3761 | + nodeId: portalNodeId, | |
| 3762 | + subtree: portalSubtree | |
| 3763 | + } = useFloatingPortalNode({ | |
| 3764 | + container, | |
| 3765 | + ref: forwardedRef, | |
| 3766 | + componentProps, | |
| 3767 | + elementProps | |
| 3768 | + }); | |
| 3769 | + const beforeOutsideRef = React20.useRef(null); | |
| 3770 | + const afterOutsideRef = React20.useRef(null); | |
| 3771 | + const beforeInsideRef = React20.useRef(null); | |
| 3772 | + const afterInsideRef = React20.useRef(null); | |
| 3773 | + const [focusManagerState, setFocusManagerState] = React20.useState(null); | |
| 3774 | + const focusInsideDisabledRef = React20.useRef(false); | |
| 3775 | + const modal = focusManagerState?.modal; | |
| 3776 | + const open2 = focusManagerState?.open; | |
| 3777 | + const shouldRenderGuards = !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode; | |
| 3778 | + React20.useEffect(() => { | |
| 3779 | + if (!portalNode || modal) { | |
| 3780 | + return void 0; | |
| 3781 | + } | |
| 3782 | + function onFocus(event) { | |
| 3783 | + if (portalNode && event.relatedTarget && isOutsideEvent(event)) { | |
| 3784 | + if (event.type === "focusin") { | |
| 3785 | + if (focusInsideDisabledRef.current) { | |
| 3786 | + enableFocusInside(portalNode); | |
| 3787 | + focusInsideDisabledRef.current = false; | |
| 3788 | + } | |
| 3789 | + } else { | |
| 3790 | + disableFocusInside(portalNode); | |
| 3791 | + focusInsideDisabledRef.current = true; | |
| 3792 | + } | |
| 3793 | + } | |
| 3794 | + } | |
| 3795 | + return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true)); | |
| 3796 | + }, [portalNode, modal]); | |
| 3797 | + useIsoLayoutEffect(() => { | |
| 3798 | + if (!portalNode || open2 !== true || !focusInsideDisabledRef.current) { | |
| 3799 | + return; | |
| 3800 | + } | |
| 3801 | + enableFocusInside(portalNode); | |
| 3802 | + focusInsideDisabledRef.current = false; | |
| 3803 | + }, [open2, portalNode]); | |
| 3804 | + const portalContextValue = React20.useMemo(() => ({ | |
| 3805 | + beforeOutsideRef, | |
| 3806 | + afterOutsideRef, | |
| 3807 | + beforeInsideRef, | |
| 3808 | + afterInsideRef, | |
| 3809 | + portalNode, | |
| 3810 | + setFocusManagerState | |
| 3811 | + }), [portalNode]); | |
| 3812 | + return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(React20.Fragment, { | |
| 3813 | + children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(PortalContext.Provider, { | |
| 3814 | + value: portalContextValue, | |
| 3815 | + children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FocusGuard, { | |
| 3816 | + "data-type": "outside", | |
| 3817 | + ref: beforeOutsideRef, | |
| 3818 | + onFocus: (event) => { | |
| 3819 | + if (isOutsideEvent(event, portalNode)) { | |
| 3820 | + beforeInsideRef.current?.focus(); | |
| 3821 | + } else { | |
| 3822 | + const domReference = focusManagerState ? focusManagerState.domReference : null; | |
| 3823 | + const prevTabbable = getPreviousTabbable(domReference); | |
| 3824 | + prevTabbable?.focus(); | |
| 3825 | + } | |
| 3826 | + } | |
| 3827 | + }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { | |
| 3828 | + role: portalOwnerRole, | |
| 3829 | + "aria-owns": portalNodeId, | |
| 3830 | + style: ownerVisuallyHidden | |
| 3831 | + }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FocusGuard, { | |
| 3832 | + "data-type": "outside", | |
| 3833 | + ref: afterOutsideRef, | |
| 3834 | + onFocus: (event) => { | |
| 3835 | + if (isOutsideEvent(event, portalNode)) { | |
| 3836 | + afterInsideRef.current?.focus(); | |
| 3837 | + } else { | |
| 3838 | + const domReference = focusManagerState ? focusManagerState.domReference : null; | |
| 3839 | + const nextTabbable = getNextTabbable(domReference); | |
| 3840 | + nextTabbable?.focus(); | |
| 3841 | + if (focusManagerState?.closeOnFocusOut) { | |
| 3842 | + focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent)); | |
| 3843 | + } | |
| 3844 | + } | |
| 3845 | + } | |
| 3846 | + })] | |
| 3847 | + })] | |
| 3848 | + }); | |
| 509 | 3849 | }); |
| 510 | -var DismissableLayer = React10.forwardRef( | |
| 511 | - (props, forwardedRef) => { | |
| 512 | - const { | |
| 513 | - disableOutsidePointerEvents = false, | |
| 514 | - onEscapeKeyDown, | |
| 515 | - onPointerDownOutside, | |
| 516 | - onFocusOutside, | |
| 517 | - onInteractOutside, | |
| 518 | - onDismiss, | |
| 519 | - ...layerProps | |
| 520 | - } = props; | |
| 521 | - const context = React10.useContext(DismissableLayerContext); | |
| 522 | - const [node, setNode] = React10.useState(null); | |
| 523 | - const ownerDocument = node?.ownerDocument ?? globalThis?.document; | |
| 524 | - const [, force] = React10.useState({}); | |
| 525 | - const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2)); | |
| 526 | - const layers = Array.from(context.layers); | |
| 527 | - const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1); | |
| 528 | - const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled); | |
| 529 | - const index = node ? layers.indexOf(node) : -1; | |
| 530 | - const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0; | |
| 531 | - const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex; | |
| 532 | - const pointerDownOutside = usePointerDownOutside((event) => { | |
| 533 | - const target = event.target; | |
| 534 | - const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target)); | |
| 535 | - if (!isPointerEventsEnabled || isPointerDownOnBranch) return; | |
| 536 | - onPointerDownOutside?.(event); | |
| 537 | - onInteractOutside?.(event); | |
| 538 | - if (!event.defaultPrevented) onDismiss?.(); | |
| 539 | - }, ownerDocument); | |
| 540 | - const focusOutside = useFocusOutside((event) => { | |
| 541 | - const target = event.target; | |
| 542 | - const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target)); | |
| 543 | - if (isFocusInBranch) return; | |
| 544 | - onFocusOutside?.(event); | |
| 545 | - onInteractOutside?.(event); | |
| 546 | - if (!event.defaultPrevented) onDismiss?.(); | |
| 547 | - }, ownerDocument); | |
| 548 | - useEscapeKeydown((event) => { | |
| 549 | - const isHighestLayer = index === context.layers.size - 1; | |
| 550 | - if (!isHighestLayer) return; | |
| 551 | - onEscapeKeyDown?.(event); | |
| 552 | - if (!event.defaultPrevented && onDismiss) { | |
| 553 | - event.preventDefault(); | |
| 554 | - onDismiss(); | |
| 3850 | +if (true) FloatingPortal.displayName = "FloatingPortal"; | |
| 3851 | + | |
| 3852 | +// node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs | |
| 3853 | +var React21 = __toESM(require_react(), 1); | |
| 3854 | + | |
| 3855 | +// node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs | |
| 3856 | +function createEventEmitter() { | |
| 3857 | + const map = /* @__PURE__ */ new Map(); | |
| 3858 | + return { | |
| 3859 | + emit(event, data) { | |
| 3860 | + map.get(event)?.forEach((listener) => listener(data)); | |
| 3861 | + }, | |
| 3862 | + on(event, listener) { | |
| 3863 | + if (!map.has(event)) { | |
| 3864 | + map.set(event, /* @__PURE__ */ new Set()); | |
| 555 | 3865 | } |
| 556 | - }, ownerDocument); | |
| 557 | - React10.useEffect(() => { | |
| 558 | - if (!node) return; | |
| 559 | - if (disableOutsidePointerEvents) { | |
| 560 | - if (context.layersWithOutsidePointerEventsDisabled.size === 0) { | |
| 561 | - originalBodyPointerEvents = ownerDocument.body.style.pointerEvents; | |
| 562 | - ownerDocument.body.style.pointerEvents = "none"; | |
| 3866 | + map.get(event).add(listener); | |
| 3867 | + }, | |
| 3868 | + off(event, listener) { | |
| 3869 | + map.get(event)?.delete(listener); | |
| 3870 | + } | |
| 3871 | + }; | |
| 3872 | +} | |
| 3873 | + | |
| 3874 | +// node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs | |
| 3875 | +var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); | |
| 3876 | +var FloatingNodeContext = /* @__PURE__ */ React21.createContext(null); | |
| 3877 | +if (true) FloatingNodeContext.displayName = "FloatingNodeContext"; | |
| 3878 | +var FloatingTreeContext = /* @__PURE__ */ React21.createContext(null); | |
| 3879 | +if (true) FloatingTreeContext.displayName = "FloatingTreeContext"; | |
| 3880 | +var useFloatingParentNodeId = () => React21.useContext(FloatingNodeContext)?.id || null; | |
| 3881 | +var useFloatingTree = (externalTree) => { | |
| 3882 | + const contextTree = React21.useContext(FloatingTreeContext); | |
| 3883 | + return externalTree ?? contextTree; | |
| 3884 | +}; | |
| 3885 | + | |
| 3886 | +// node_modules/@base-ui/react/floating-ui-react/components/FloatingFocusManager.mjs | |
| 3887 | +var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); | |
| 3888 | +function getEventType(event, lastInteractionType) { | |
| 3889 | + const win = getWindow(getTarget(event)); | |
| 3890 | + if (event instanceof win.KeyboardEvent) { | |
| 3891 | + return "keyboard"; | |
| 3892 | + } | |
| 3893 | + if (event instanceof win.FocusEvent) { | |
| 3894 | + return lastInteractionType || "keyboard"; | |
| 3895 | + } | |
| 3896 | + if ("pointerType" in event) { | |
| 3897 | + return event.pointerType || "keyboard"; | |
| 3898 | + } | |
| 3899 | + if ("touches" in event) { | |
| 3900 | + return "touch"; | |
| 3901 | + } | |
| 3902 | + if (event instanceof win.MouseEvent) { | |
| 3903 | + return lastInteractionType || (event.detail === 0 ? "keyboard" : "mouse"); | |
| 3904 | + } | |
| 3905 | + return ""; | |
| 3906 | +} | |
| 3907 | +var LIST_LIMIT = 20; | |
| 3908 | +var previouslyFocusedElements = []; | |
| 3909 | +function clearDisconnectedPreviouslyFocusedElements() { | |
| 3910 | + previouslyFocusedElements = previouslyFocusedElements.filter((entry) => { | |
| 3911 | + return entry.deref()?.isConnected; | |
| 3912 | + }); | |
| 3913 | +} | |
| 3914 | +function addPreviouslyFocusedElement(element) { | |
| 3915 | + clearDisconnectedPreviouslyFocusedElements(); | |
| 3916 | + if (element && getNodeName(element) !== "body") { | |
| 3917 | + previouslyFocusedElements.push(new WeakRef(element)); | |
| 3918 | + if (previouslyFocusedElements.length > LIST_LIMIT) { | |
| 3919 | + previouslyFocusedElements = previouslyFocusedElements.slice(-LIST_LIMIT); | |
| 3920 | + } | |
| 3921 | + } | |
| 3922 | +} | |
| 3923 | +function getPreviouslyFocusedElement() { | |
| 3924 | + clearDisconnectedPreviouslyFocusedElements(); | |
| 3925 | + return previouslyFocusedElements[previouslyFocusedElements.length - 1]?.deref(); | |
| 3926 | +} | |
| 3927 | +function getFirstTabbableElement(container) { | |
| 3928 | + if (!container) { | |
| 3929 | + return null; | |
| 3930 | + } | |
| 3931 | + if (isTabbable(container)) { | |
| 3932 | + return container; | |
| 3933 | + } | |
| 3934 | + return tabbable(container)[0] || container; | |
| 3935 | +} | |
| 3936 | +function handleTabIndex(floatingFocusElement) { | |
| 3937 | + if (floatingFocusElement.hasAttribute("tabindex") && !floatingFocusElement.hasAttribute("data-tabindex")) { | |
| 3938 | + return; | |
| 3939 | + } | |
| 3940 | + if (!floatingFocusElement.getAttribute("role")?.includes("dialog")) { | |
| 3941 | + return; | |
| 3942 | + } | |
| 3943 | + const focusableElements = focusable(floatingFocusElement); | |
| 3944 | + const tabbableContent = focusableElements.filter((element) => { | |
| 3945 | + const dataTabIndex = element.getAttribute("data-tabindex") || ""; | |
| 3946 | + return isTabbable(element) || element.hasAttribute("data-tabindex") && !dataTabIndex.startsWith("-"); | |
| 3947 | + }); | |
| 3948 | + const tabIndex = floatingFocusElement.getAttribute("tabindex"); | |
| 3949 | + if (tabbableContent.length === 0) { | |
| 3950 | + if (tabIndex !== "0") { | |
| 3951 | + floatingFocusElement.setAttribute("tabindex", "0"); | |
| 3952 | + floatingFocusElement.setAttribute("data-tabindex", "0"); | |
| 3953 | + } | |
| 3954 | + } else if (tabIndex !== "-1" || floatingFocusElement.hasAttribute("data-tabindex") && floatingFocusElement.getAttribute("data-tabindex") !== "-1") { | |
| 3955 | + floatingFocusElement.setAttribute("tabindex", "-1"); | |
| 3956 | + floatingFocusElement.setAttribute("data-tabindex", "-1"); | |
| 3957 | + } | |
| 3958 | +} | |
| 3959 | +function FloatingFocusManager(props) { | |
| 3960 | + const { | |
| 3961 | + context, | |
| 3962 | + children, | |
| 3963 | + disabled: disabled2 = false, | |
| 3964 | + initialFocus = true, | |
| 3965 | + returnFocus = true, | |
| 3966 | + restoreFocus = false, | |
| 3967 | + modal = true, | |
| 3968 | + closeOnFocusOut = true, | |
| 3969 | + openInteractionType = "", | |
| 3970 | + nextFocusableElement, | |
| 3971 | + previousFocusableElement, | |
| 3972 | + beforeContentFocusGuardRef, | |
| 3973 | + externalTree, | |
| 3974 | + getInsideElements | |
| 3975 | + } = props; | |
| 3976 | + const store = "rootStore" in context ? context.rootStore : context; | |
| 3977 | + const open2 = store.useState("open"); | |
| 3978 | + const domReference = store.useState("domReferenceElement"); | |
| 3979 | + const floating = store.useState("floatingElement"); | |
| 3980 | + const { | |
| 3981 | + events, | |
| 3982 | + dataRef | |
| 3983 | + } = store.context; | |
| 3984 | + const getNodeId = useStableCallback(() => dataRef.current.floatingContext?.nodeId); | |
| 3985 | + const ignoreInitialFocus = initialFocus === false; | |
| 3986 | + const isUntrappedTypeableCombobox = isTypeableCombobox(domReference) && ignoreInitialFocus; | |
| 3987 | + const initialFocusRef = useValueAsRef(initialFocus); | |
| 3988 | + const returnFocusRef = useValueAsRef(returnFocus); | |
| 3989 | + const openInteractionTypeRef = useValueAsRef(openInteractionType); | |
| 3990 | + const openRef = useValueAsRef(open2); | |
| 3991 | + const tree = useFloatingTree(externalTree); | |
| 3992 | + const portalContext = usePortalContext(); | |
| 3993 | + const preventReturnFocusRef = React22.useRef(false); | |
| 3994 | + const isPointerDownRef = React22.useRef(false); | |
| 3995 | + const pointerDownOutsideRef = React22.useRef(false); | |
| 3996 | + const lastFocusedTabbableRef = React22.useRef(null); | |
| 3997 | + const closeTypeRef = React22.useRef(""); | |
| 3998 | + const lastInteractionTypeRef = React22.useRef(""); | |
| 3999 | + const beforeGuardRef = React22.useRef(null); | |
| 4000 | + const afterGuardRef = React22.useRef(null); | |
| 4001 | + const mergedBeforeGuardRef = useMergedRefs(beforeGuardRef, beforeContentFocusGuardRef, portalContext?.beforeInsideRef); | |
| 4002 | + const mergedAfterGuardRef = useMergedRefs(afterGuardRef, portalContext?.afterInsideRef); | |
| 4003 | + const blurTimeout = useTimeout(); | |
| 4004 | + const pointerDownTimeout = useTimeout(); | |
| 4005 | + const restoreFocusFrame = useAnimationFrame(); | |
| 4006 | + const isInsidePortal = portalContext != null; | |
| 4007 | + const floatingFocusElement = getFloatingFocusElement(floating); | |
| 4008 | + const getTabbableContent = useStableCallback((container = floatingFocusElement) => { | |
| 4009 | + return container ? tabbable(container) : []; | |
| 4010 | + }); | |
| 4011 | + const getResolvedInsideElements = useStableCallback(() => getInsideElements?.().filter((element) => element != null) ?? []); | |
| 4012 | + React22.useEffect(() => { | |
| 4013 | + if (disabled2 || !modal) { | |
| 4014 | + return void 0; | |
| 4015 | + } | |
| 4016 | + function onKeyDown(event) { | |
| 4017 | + if (event.key === "Tab") { | |
| 4018 | + if (contains(floatingFocusElement, activeElement(ownerDocument(floatingFocusElement))) && getTabbableContent().length === 0 && !isUntrappedTypeableCombobox) { | |
| 4019 | + stopEvent(event); | |
| 563 | 4020 | } |
| 564 | - context.layersWithOutsidePointerEventsDisabled.add(node); | |
| 565 | 4021 | } |
| 566 | - context.layers.add(node); | |
| 567 | - dispatchUpdate(); | |
| 568 | - return () => { | |
| 569 | - if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) { | |
| 570 | - ownerDocument.body.style.pointerEvents = originalBodyPointerEvents; | |
| 4022 | + } | |
| 4023 | + const doc = ownerDocument(floatingFocusElement); | |
| 4024 | + return addEventListener(doc, "keydown", onKeyDown); | |
| 4025 | + }, [disabled2, floatingFocusElement, modal, isUntrappedTypeableCombobox, getTabbableContent]); | |
| 4026 | + React22.useEffect(() => { | |
| 4027 | + if (disabled2 || !open2) { | |
| 4028 | + return void 0; | |
| 4029 | + } | |
| 4030 | + const doc = ownerDocument(floatingFocusElement); | |
| 4031 | + function clearPointerDownOutside() { | |
| 4032 | + pointerDownOutsideRef.current = false; | |
| 4033 | + } | |
| 4034 | + function onPointerDown(event) { | |
| 4035 | + const target = getTarget(event); | |
| 4036 | + const insideElements = getResolvedInsideElements(); | |
| 4037 | + const pointerTargetInside = contains(floating, target) || contains(domReference, target) || contains(portalContext?.portalNode, target) || insideElements.some((element) => element === target || contains(element, target)); | |
| 4038 | + pointerDownOutsideRef.current = !pointerTargetInside; | |
| 4039 | + lastInteractionTypeRef.current = event.pointerType || "keyboard"; | |
| 4040 | + if (target?.closest(`[${CLICK_TRIGGER_IDENTIFIER}]`)) { | |
| 4041 | + isPointerDownRef.current = true; | |
| 4042 | + pointerDownTimeout.start(0, () => { | |
| 4043 | + isPointerDownRef.current = false; | |
| 4044 | + }); | |
| 4045 | + } | |
| 4046 | + } | |
| 4047 | + function onKeyDown() { | |
| 4048 | + lastInteractionTypeRef.current = "keyboard"; | |
| 4049 | + } | |
| 4050 | + return mergeCleanups( | |
| 4051 | + addEventListener(doc, "pointerdown", onPointerDown, true), | |
| 4052 | + addEventListener(doc, "pointerup", clearPointerDownOutside, true), | |
| 4053 | + addEventListener(doc, "pointercancel", clearPointerDownOutside, true), | |
| 4054 | + addEventListener(doc, "keydown", onKeyDown, true), | |
| 4055 | + // Avoid a stale `true` leaking into the next open (e.g. keep-mounted popups) | |
| 4056 | + // if the popup dismissed between pointerdown and pointerup. | |
| 4057 | + clearPointerDownOutside | |
| 4058 | + ); | |
| 4059 | + }, [disabled2, floating, domReference, floatingFocusElement, open2, portalContext, pointerDownTimeout, getResolvedInsideElements]); | |
| 4060 | + React22.useEffect(() => { | |
| 4061 | + if (disabled2 || !closeOnFocusOut) { | |
| 4062 | + return void 0; | |
| 4063 | + } | |
| 4064 | + const doc = ownerDocument(floatingFocusElement); | |
| 4065 | + function handlePointerDown() { | |
| 4066 | + isPointerDownRef.current = true; | |
| 4067 | + pointerDownTimeout.start(0, () => { | |
| 4068 | + isPointerDownRef.current = false; | |
| 4069 | + }); | |
| 4070 | + } | |
| 4071 | + function handleFocusIn(event) { | |
| 4072 | + const target = getTarget(event); | |
| 4073 | + if (isTabbable(target)) { | |
| 4074 | + lastFocusedTabbableRef.current = target; | |
| 4075 | + } | |
| 4076 | + } | |
| 4077 | + function handleFocusOutside(event) { | |
| 4078 | + const relatedTarget = event.relatedTarget; | |
| 4079 | + const currentTarget = event.currentTarget; | |
| 4080 | + const target = getTarget(event); | |
| 4081 | + if (modal && relatedTarget == null && target != null && contains(floating, target)) { | |
| 4082 | + addPreviouslyFocusedElement(target); | |
| 4083 | + } | |
| 4084 | + queueMicrotask(() => { | |
| 4085 | + const nodeId = getNodeId(); | |
| 4086 | + const triggers = store.context.triggerElements; | |
| 4087 | + const insideElements = getResolvedInsideElements(); | |
| 4088 | + const isRelatedFocusGuard = relatedTarget?.hasAttribute(createAttribute("focus-guard")) && [beforeGuardRef.current, afterGuardRef.current, portalContext?.beforeInsideRef.current, portalContext?.afterInsideRef.current, portalContext?.beforeOutsideRef.current, portalContext?.afterOutsideRef.current, resolveRef(previousFocusableElement), resolveRef(nextFocusableElement)].includes(relatedTarget); | |
| 4089 | + const movedToUnrelatedNode = !(contains(domReference, relatedTarget) || contains(floating, relatedTarget) || contains(relatedTarget, floating) || contains(portalContext?.portalNode, relatedTarget) || insideElements.some((element) => element === relatedTarget || contains(element, relatedTarget)) || triggers.hasMatchingElement((trigger) => contains(trigger, relatedTarget)) || isRelatedFocusGuard || tree && (getNodeChildren(tree.nodesRef.current, nodeId).find((node) => contains(node.context?.elements.floating, relatedTarget) || contains(node.context?.elements.domReference, relatedTarget)) || getNodeAncestors(tree.nodesRef.current, nodeId).find((node) => [node.context?.elements.floating, getFloatingFocusElement(node.context?.elements.floating)].includes(relatedTarget) || node.context?.elements.domReference === relatedTarget))); | |
| 4090 | + if (currentTarget === domReference && floatingFocusElement) { | |
| 4091 | + handleTabIndex(floatingFocusElement); | |
| 571 | 4092 | } |
| 4093 | + if (restoreFocus && currentTarget !== domReference && !isElementVisible(target) && activeElement(doc) === doc.body) { | |
| 4094 | + if (isHTMLElement(floatingFocusElement)) { | |
| 4095 | + floatingFocusElement.focus(); | |
| 4096 | + if (restoreFocus === "popup") { | |
| 4097 | + restoreFocusFrame.request(() => { | |
| 4098 | + floatingFocusElement.focus(); | |
| 4099 | + }); | |
| 4100 | + return; | |
| 4101 | + } | |
| 4102 | + } | |
| 4103 | + const tabbableContent = getTabbableContent(); | |
| 4104 | + const prevTabbable = lastFocusedTabbableRef.current; | |
| 4105 | + const nodeToFocus = (prevTabbable && tabbableContent.includes(prevTabbable) ? prevTabbable : null) || tabbableContent[tabbableContent.length - 1] || floatingFocusElement; | |
| 4106 | + if (isHTMLElement(nodeToFocus)) { | |
| 4107 | + nodeToFocus.focus(); | |
| 4108 | + } | |
| 4109 | + } | |
| 4110 | + if (dataRef.current.insideReactTree) { | |
| 4111 | + dataRef.current.insideReactTree = false; | |
| 4112 | + return; | |
| 4113 | + } | |
| 4114 | + if ((isUntrappedTypeableCombobox ? true : !modal) && relatedTarget && movedToUnrelatedNode && !isPointerDownRef.current && // Fix React 18 Strict Mode returnFocus due to double rendering. | |
| 4115 | + // For an "untrapped" typeable combobox (input role=combobox with | |
| 4116 | + // initialFocus=false), re-opening the popup and tabbing out should still close it even | |
| 4117 | + // when the previously focused element (e.g. the next tabbable outside the popup) is | |
| 4118 | + // focused again. Otherwise, the popup remains open on the second Tab sequence: | |
| 4119 | + // click input -> Tab (closes) -> click input -> Tab. | |
| 4120 | + // Allow closing when `isUntrappedTypeableCombobox` regardless of the previously focused element. | |
| 4121 | + (isUntrappedTypeableCombobox || relatedTarget !== getPreviouslyFocusedElement())) { | |
| 4122 | + preventReturnFocusRef.current = true; | |
| 4123 | + store.setOpen(false, createChangeEventDetails(reason_parts_exports.focusOut, event)); | |
| 4124 | + } | |
| 4125 | + }); | |
| 4126 | + } | |
| 4127 | + function markInsideReactTree() { | |
| 4128 | + if (pointerDownOutsideRef.current) { | |
| 4129 | + return; | |
| 4130 | + } | |
| 4131 | + dataRef.current.insideReactTree = true; | |
| 4132 | + blurTimeout.start(0, () => { | |
| 4133 | + dataRef.current.insideReactTree = false; | |
| 4134 | + }); | |
| 4135 | + } | |
| 4136 | + const domReferenceElement = isHTMLElement(domReference) ? domReference : null; | |
| 4137 | + if (!floating && !domReferenceElement) { | |
| 4138 | + return void 0; | |
| 4139 | + } | |
| 4140 | + return mergeCleanups(domReferenceElement && addEventListener(domReferenceElement, "focusout", handleFocusOutside), domReferenceElement && addEventListener(domReferenceElement, "pointerdown", handlePointerDown), floating && addEventListener(floating, "focusin", handleFocusIn), floating && addEventListener(floating, "focusout", handleFocusOutside), floating && portalContext && addEventListener(floating, "focusout", markInsideReactTree, true)); | |
| 4141 | + }, [disabled2, domReference, floating, floatingFocusElement, modal, tree, portalContext, store, closeOnFocusOut, restoreFocus, getTabbableContent, isUntrappedTypeableCombobox, getNodeId, dataRef, blurTimeout, pointerDownTimeout, restoreFocusFrame, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]); | |
| 4142 | + React22.useEffect(() => { | |
| 4143 | + if (disabled2 || !floating || !open2) { | |
| 4144 | + return void 0; | |
| 4145 | + } | |
| 4146 | + const portalNodes = Array.from(portalContext?.portalNode?.querySelectorAll(`[${createAttribute("portal")}]`) || []); | |
| 4147 | + const ancestors = tree ? getNodeAncestors(tree.nodesRef.current, getNodeId()) : []; | |
| 4148 | + const rootAncestorComboboxDomReference = ancestors.find((node) => isTypeableCombobox(node.context?.elements.domReference || null))?.context?.elements.domReference; | |
| 4149 | + const controlInsideElements = [floating, ...portalNodes, beforeGuardRef.current, afterGuardRef.current, portalContext?.beforeOutsideRef.current, portalContext?.afterOutsideRef.current, ...getResolvedInsideElements()]; | |
| 4150 | + const insideElements = [...controlInsideElements, rootAncestorComboboxDomReference, resolveRef(previousFocusableElement), resolveRef(nextFocusableElement), isUntrappedTypeableCombobox ? domReference : null].filter((x) => x != null); | |
| 4151 | + const ariaHiddenCleanup = markOthers(insideElements, { | |
| 4152 | + ariaHidden: modal || isUntrappedTypeableCombobox, | |
| 4153 | + mark: false | |
| 4154 | + }); | |
| 4155 | + const markerInsideElements = [floating, ...portalNodes].filter((x) => x != null); | |
| 4156 | + const markerCleanup = markOthers(markerInsideElements); | |
| 4157 | + return () => { | |
| 4158 | + markerCleanup(); | |
| 4159 | + ariaHiddenCleanup(); | |
| 4160 | + }; | |
| 4161 | + }, [open2, disabled2, domReference, floating, modal, portalContext, isUntrappedTypeableCombobox, tree, getNodeId, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]); | |
| 4162 | + useIsoLayoutEffect(() => { | |
| 4163 | + if (!open2 || disabled2 || !isHTMLElement(floatingFocusElement)) { | |
| 4164 | + return; | |
| 4165 | + } | |
| 4166 | + closeTypeRef.current = ""; | |
| 4167 | + lastInteractionTypeRef.current = ""; | |
| 4168 | + const doc = ownerDocument(floatingFocusElement); | |
| 4169 | + const previouslyFocusedElement = activeElement(doc); | |
| 4170 | + queueMicrotask(() => { | |
| 4171 | + const initialFocusValueOrFn = initialFocusRef.current; | |
| 4172 | + const resolvedInitialFocus = typeof initialFocusValueOrFn === "function" ? initialFocusValueOrFn(openInteractionTypeRef.current || "") : initialFocusValueOrFn; | |
| 4173 | + if (resolvedInitialFocus === void 0 || resolvedInitialFocus === false) { | |
| 4174 | + return; | |
| 4175 | + } | |
| 4176 | + const focusAlreadyInsideFloatingEl = contains(floatingFocusElement, previouslyFocusedElement); | |
| 4177 | + if (focusAlreadyInsideFloatingEl) { | |
| 4178 | + return; | |
| 4179 | + } | |
| 4180 | + let focusableElements = null; | |
| 4181 | + const getDefaultFocusElement = () => { | |
| 4182 | + if (focusableElements == null) { | |
| 4183 | + focusableElements = getTabbableContent(floatingFocusElement); | |
| 4184 | + } | |
| 4185 | + return focusableElements[0] || floatingFocusElement; | |
| 572 | 4186 | }; |
| 573 | - }, [node, ownerDocument, disableOutsidePointerEvents, context]); | |
| 574 | - React10.useEffect(() => { | |
| 575 | - return () => { | |
| 576 | - if (!node) return; | |
| 577 | - context.layers.delete(node); | |
| 578 | - context.layersWithOutsidePointerEventsDisabled.delete(node); | |
| 579 | - dispatchUpdate(); | |
| 580 | - }; | |
| 581 | - }, [node, context]); | |
| 582 | - React10.useEffect(() => { | |
| 583 | - const handleUpdate = () => force({}); | |
| 584 | - document.addEventListener(CONTEXT_UPDATE, handleUpdate); | |
| 585 | - return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate); | |
| 586 | - }, []); | |
| 587 | - return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)( | |
| 588 | - Primitive.div, | |
| 589 | - { | |
| 590 | - ...layerProps, | |
| 591 | - ref: composedRefs, | |
| 592 | - style: { | |
| 593 | - pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0, | |
| 594 | - ...props.style | |
| 595 | - }, | |
| 596 | - onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture), | |
| 597 | - onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture), | |
| 598 | - onPointerDownCapture: composeEventHandlers( | |
| 599 | - props.onPointerDownCapture, | |
| 600 | - pointerDownOutside.onPointerDownCapture | |
| 601 | - ) | |
| 4187 | + let elToFocus; | |
| 4188 | + if (resolvedInitialFocus === true || resolvedInitialFocus === null) { | |
| 4189 | + elToFocus = getDefaultFocusElement(); | |
| 4190 | + } else { | |
| 4191 | + elToFocus = resolveRef(resolvedInitialFocus); | |
| 602 | 4192 | } |
| 603 | - ); | |
| 604 | - } | |
| 605 | -); | |
| 606 | -DismissableLayer.displayName = DISMISSABLE_LAYER_NAME; | |
| 607 | -var BRANCH_NAME = "DismissableLayerBranch"; | |
| 608 | -var DismissableLayerBranch = React10.forwardRef((props, forwardedRef) => { | |
| 609 | - const context = React10.useContext(DismissableLayerContext); | |
| 610 | - const ref = React10.useRef(null); | |
| 611 | - const composedRefs = useComposedRefs(forwardedRef, ref); | |
| 612 | - React10.useEffect(() => { | |
| 613 | - const node = ref.current; | |
| 614 | - if (node) { | |
| 615 | - context.branches.add(node); | |
| 616 | - return () => { | |
| 617 | - context.branches.delete(node); | |
| 618 | - }; | |
| 4193 | + elToFocus = elToFocus || getDefaultFocusElement(); | |
| 4194 | + const hadFocusInside = contains(floatingFocusElement, activeElement(doc)); | |
| 4195 | + void enqueueFocus(elToFocus, { | |
| 4196 | + preventScroll: elToFocus === floatingFocusElement, | |
| 4197 | + shouldFocus() { | |
| 4198 | + if (!openRef.current) { | |
| 4199 | + return false; | |
| 4200 | + } | |
| 4201 | + if (hadFocusInside) { | |
| 4202 | + return true; | |
| 4203 | + } | |
| 4204 | + const currentActiveElement = activeElement(doc); | |
| 4205 | + const focusMovedInside = currentActiveElement !== elToFocus && contains(floatingFocusElement, currentActiveElement); | |
| 4206 | + return !focusMovedInside; | |
| 4207 | + } | |
| 4208 | + }); | |
| 4209 | + }); | |
| 4210 | + }, [disabled2, open2, floatingFocusElement, getTabbableContent, initialFocusRef, openInteractionTypeRef, openRef]); | |
| 4211 | + useIsoLayoutEffect(() => { | |
| 4212 | + if (disabled2 || !floatingFocusElement) { | |
| 4213 | + return void 0; | |
| 619 | 4214 | } |
| 620 | - }, [context.branches]); | |
| 621 | - return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Primitive.div, { ...props, ref: composedRefs }); | |
| 622 | -}); | |
| 623 | -DismissableLayerBranch.displayName = BRANCH_NAME; | |
| 624 | -function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) { | |
| 625 | - const handlePointerDownOutside = useCallbackRef(onPointerDownOutside); | |
| 626 | - const isPointerInsideReactTreeRef = React10.useRef(false); | |
| 627 | - const handleClickRef = React10.useRef(() => { | |
| 628 | - }); | |
| 629 | - React10.useEffect(() => { | |
| 630 | - const handlePointerDown = (event) => { | |
| 631 | - if (event.target && !isPointerInsideReactTreeRef.current) { | |
| 632 | - let handleAndDispatchPointerDownOutsideEvent2 = function() { | |
| 633 | - handleAndDispatchCustomEvent( | |
| 634 | - POINTER_DOWN_OUTSIDE, | |
| 635 | - handlePointerDownOutside, | |
| 636 | - eventDetail, | |
| 637 | - { discrete: true } | |
| 638 | - ); | |
| 639 | - }; | |
| 640 | - var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2; | |
| 641 | - const eventDetail = { originalEvent: event }; | |
| 642 | - if (event.pointerType === "touch") { | |
| 643 | - ownerDocument.removeEventListener("click", handleClickRef.current); | |
| 644 | - handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2; | |
| 645 | - ownerDocument.addEventListener("click", handleClickRef.current, { once: true }); | |
| 4215 | + const doc = ownerDocument(floatingFocusElement); | |
| 4216 | + const elementFocusedBeforeOpen = activeElement(doc); | |
| 4217 | + const preferPreviousFocus = openInteractionTypeRef.current == null; | |
| 4218 | + addPreviouslyFocusedElement(elementFocusedBeforeOpen); | |
| 4219 | + function onOpenChangeLocal(details) { | |
| 4220 | + if (!details.open) { | |
| 4221 | + closeTypeRef.current = getEventType(details.nativeEvent, lastInteractionTypeRef.current); | |
| 4222 | + } | |
| 4223 | + if (details.reason === reason_parts_exports.triggerHover && details.nativeEvent.type === "mouseleave") { | |
| 4224 | + preventReturnFocusRef.current = true; | |
| 4225 | + } | |
| 4226 | + if (details.reason !== reason_parts_exports.outsidePress) { | |
| 4227 | + return; | |
| 4228 | + } | |
| 4229 | + if (details.nested) { | |
| 4230 | + preventReturnFocusRef.current = false; | |
| 4231 | + } else if (isVirtualClick(details.nativeEvent) || isVirtualPointerEvent(details.nativeEvent)) { | |
| 4232 | + preventReturnFocusRef.current = false; | |
| 4233 | + } else { | |
| 4234 | + let isPreventScrollSupported = false; | |
| 4235 | + ownerDocument(floatingFocusElement).createElement("div").focus({ | |
| 4236 | + get preventScroll() { | |
| 4237 | + isPreventScrollSupported = true; | |
| 4238 | + return false; | |
| 4239 | + } | |
| 4240 | + }); | |
| 4241 | + if (isPreventScrollSupported) { | |
| 4242 | + preventReturnFocusRef.current = false; | |
| 646 | 4243 | } else { |
| 647 | - handleAndDispatchPointerDownOutsideEvent2(); | |
| 4244 | + preventReturnFocusRef.current = true; | |
| 648 | 4245 | } |
| 649 | - } else { | |
| 650 | - ownerDocument.removeEventListener("click", handleClickRef.current); | |
| 651 | 4246 | } |
| 652 | - isPointerInsideReactTreeRef.current = false; | |
| 4247 | + } | |
| 4248 | + events.on("openchange", onOpenChangeLocal); | |
| 4249 | + function getReturnElement(closeType) { | |
| 4250 | + const returnFocusValueOrFn = returnFocusRef.current; | |
| 4251 | + let resolvedReturnFocusValue = typeof returnFocusValueOrFn === "function" ? returnFocusValueOrFn(closeType) : returnFocusValueOrFn; | |
| 4252 | + if (resolvedReturnFocusValue === void 0 || resolvedReturnFocusValue === false) { | |
| 4253 | + return null; | |
| 4254 | + } | |
| 4255 | + if (resolvedReturnFocusValue === null) { | |
| 4256 | + resolvedReturnFocusValue = true; | |
| 4257 | + } | |
| 4258 | + const referenceReturnElement = domReference?.isConnected ? domReference : null; | |
| 4259 | + const previousReturnElement = elementFocusedBeforeOpen?.isConnected && getNodeName(elementFocusedBeforeOpen) !== "body" ? elementFocusedBeforeOpen : null; | |
| 4260 | + let defaultReturnElement = preferPreviousFocus ? previousReturnElement || referenceReturnElement : referenceReturnElement || previousReturnElement; | |
| 4261 | + if (!defaultReturnElement) { | |
| 4262 | + defaultReturnElement = getPreviouslyFocusedElement() || null; | |
| 4263 | + } | |
| 4264 | + if (typeof resolvedReturnFocusValue === "boolean") { | |
| 4265 | + return defaultReturnElement; | |
| 4266 | + } | |
| 4267 | + return resolveRef(resolvedReturnFocusValue) || defaultReturnElement || null; | |
| 4268 | + } | |
| 4269 | + return () => { | |
| 4270 | + events.off("openchange", onOpenChangeLocal); | |
| 4271 | + const activeEl = activeElement(doc); | |
| 4272 | + const insideElements = getResolvedInsideElements(); | |
| 4273 | + const isFocusInsideFloatingTree = contains(floating, activeEl) || insideElements.some((element) => element === activeEl || contains(element, activeEl)) || tree && getNodeChildren(tree.nodesRef.current, getNodeId(), false).some((node) => contains(node.context?.elements.floating, activeEl)); | |
| 4274 | + const returnFocusValueOrFn = returnFocusRef.current; | |
| 4275 | + const closeType = closeTypeRef.current; | |
| 4276 | + const returnElement = getReturnElement(closeType); | |
| 4277 | + queueMicrotask(() => { | |
| 4278 | + const tabbableReturnElement = getFirstTabbableElement(returnElement); | |
| 4279 | + const hasExplicitReturnFocus = typeof returnFocusValueOrFn !== "boolean"; | |
| 4280 | + if (returnFocusValueOrFn && !preventReturnFocusRef.current && isHTMLElement(tabbableReturnElement) && // If the focus moved somewhere else after mount, avoid returning focus | |
| 4281 | + // since it likely entered a different element which should be | |
| 4282 | + // respected: https://github.com/floating-ui/floating-ui/issues/2607 | |
| 4283 | + (!hasExplicitReturnFocus && tabbableReturnElement !== activeEl && activeEl !== doc.body ? isFocusInsideFloatingTree : true)) { | |
| 4284 | + const focusOptions = { | |
| 4285 | + preventScroll: true | |
| 4286 | + }; | |
| 4287 | + if (closeType === "keyboard") { | |
| 4288 | + focusOptions.focusVisible = true; | |
| 4289 | + } | |
| 4290 | + tabbableReturnElement.focus(focusOptions); | |
| 4291 | + } | |
| 4292 | + preventReturnFocusRef.current = false; | |
| 4293 | + }); | |
| 653 | 4294 | }; |
| 654 | - const timerId = window.setTimeout(() => { | |
| 655 | - ownerDocument.addEventListener("pointerdown", handlePointerDown); | |
| 656 | - }, 0); | |
| 4295 | + }, [disabled2, floating, floatingFocusElement, returnFocusRef, openInteractionTypeRef, events, tree, domReference, getNodeId, getResolvedInsideElements]); | |
| 4296 | + useIsoLayoutEffect(() => { | |
| 4297 | + if (!parts_exports.engine.webkit || open2 || !floating) { | |
| 4298 | + return; | |
| 4299 | + } | |
| 4300 | + const activeEl = activeElement(ownerDocument(floating)); | |
| 4301 | + if (!isHTMLElement(activeEl) || !isTypeableElement(activeEl)) { | |
| 4302 | + return; | |
| 4303 | + } | |
| 4304 | + if (contains(floating, activeEl)) { | |
| 4305 | + activeEl.blur(); | |
| 4306 | + } | |
| 4307 | + }, [open2, floating]); | |
| 4308 | + useIsoLayoutEffect(() => { | |
| 4309 | + if (disabled2 || !portalContext) { | |
| 4310 | + return void 0; | |
| 4311 | + } | |
| 4312 | + portalContext.setFocusManagerState({ | |
| 4313 | + modal, | |
| 4314 | + closeOnFocusOut, | |
| 4315 | + open: open2, | |
| 4316 | + onOpenChange: store.setOpen, | |
| 4317 | + domReference | |
| 4318 | + }); | |
| 657 | 4319 | return () => { |
| 658 | - window.clearTimeout(timerId); | |
| 659 | - ownerDocument.removeEventListener("pointerdown", handlePointerDown); | |
| 660 | - ownerDocument.removeEventListener("click", handleClickRef.current); | |
| 4320 | + portalContext.setFocusManagerState(null); | |
| 661 | 4321 | }; |
| 662 | - }, [ownerDocument, handlePointerDownOutside]); | |
| 663 | - return { | |
| 664 | - // ensures we check React component tree (not just DOM tree) | |
| 665 | - onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true | |
| 666 | - }; | |
| 4322 | + }, [disabled2, portalContext, modal, open2, store, closeOnFocusOut, domReference]); | |
| 4323 | + useIsoLayoutEffect(() => { | |
| 4324 | + if (disabled2 || !floatingFocusElement) { | |
| 4325 | + return void 0; | |
| 4326 | + } | |
| 4327 | + handleTabIndex(floatingFocusElement); | |
| 4328 | + return () => { | |
| 4329 | + queueMicrotask(clearDisconnectedPreviouslyFocusedElements); | |
| 4330 | + }; | |
| 4331 | + }, [disabled2, floatingFocusElement]); | |
| 4332 | + const shouldRenderGuards = !disabled2 && (modal ? !isUntrappedTypeableCombobox : true) && (isInsidePortal || modal); | |
| 4333 | + return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(React22.Fragment, { | |
| 4334 | + children: [shouldRenderGuards && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FocusGuard, { | |
| 4335 | + "data-type": "inside", | |
| 4336 | + ref: mergedBeforeGuardRef, | |
| 4337 | + onFocus: (event) => { | |
| 4338 | + if (modal) { | |
| 4339 | + const els = getTabbableContent(); | |
| 4340 | + void enqueueFocus(els[els.length - 1]); | |
| 4341 | + } else if (portalContext?.portalNode) { | |
| 4342 | + preventReturnFocusRef.current = false; | |
| 4343 | + if (isOutsideEvent(event, portalContext.portalNode)) { | |
| 4344 | + const nextTabbable = getNextTabbable(domReference); | |
| 4345 | + nextTabbable?.focus(); | |
| 4346 | + } else { | |
| 4347 | + resolveRef(previousFocusableElement ?? portalContext.beforeOutsideRef)?.focus(); | |
| 4348 | + } | |
| 4349 | + } | |
| 4350 | + } | |
| 4351 | + }), children, shouldRenderGuards && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FocusGuard, { | |
| 4352 | + "data-type": "inside", | |
| 4353 | + ref: mergedAfterGuardRef, | |
| 4354 | + onFocus: (event) => { | |
| 4355 | + if (modal) { | |
| 4356 | + void enqueueFocus(getTabbableContent()[0]); | |
| 4357 | + } else if (portalContext?.portalNode) { | |
| 4358 | + if (closeOnFocusOut) { | |
| 4359 | + preventReturnFocusRef.current = true; | |
| 4360 | + } | |
| 4361 | + if (isOutsideEvent(event, portalContext.portalNode)) { | |
| 4362 | + const prevTabbable = getPreviousTabbable(domReference); | |
| 4363 | + prevTabbable?.focus(); | |
| 4364 | + } else { | |
| 4365 | + resolveRef(nextFocusableElement ?? portalContext.afterOutsideRef)?.focus(); | |
| 4366 | + } | |
| 4367 | + } | |
| 4368 | + } | |
| 4369 | + })] | |
| 4370 | + }); | |
| 667 | 4371 | } |
| 668 | -function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) { | |
| 669 | - const handleFocusOutside = useCallbackRef(onFocusOutside); | |
| 670 | - const isFocusInsideReactTreeRef = React10.useRef(false); | |
| 671 | - React10.useEffect(() => { | |
| 672 | - const handleFocus = (event) => { | |
| 673 | - if (event.target && !isFocusInsideReactTreeRef.current) { | |
| 674 | - const eventDetail = { originalEvent: event }; | |
| 675 | - handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, { | |
| 676 | - discrete: false | |
| 4372 | + | |
| 4373 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useClick.mjs | |
| 4374 | +var React23 = __toESM(require_react(), 1); | |
| 4375 | +function useClick(context, props = {}) { | |
| 4376 | + const { | |
| 4377 | + enabled = true, | |
| 4378 | + event: eventOption = "click", | |
| 4379 | + toggle = true, | |
| 4380 | + ignoreMouse = false, | |
| 4381 | + stickIfOpen = true, | |
| 4382 | + touchOpenDelay = 0, | |
| 4383 | + reason = reason_parts_exports.triggerPress | |
| 4384 | + } = props; | |
| 4385 | + const store = "rootStore" in context ? context.rootStore : context; | |
| 4386 | + const dataRef = store.context.dataRef; | |
| 4387 | + const pointerTypeRef = React23.useRef(void 0); | |
| 4388 | + const frame = useAnimationFrame(); | |
| 4389 | + const touchOpenTimeout = useTimeout(); | |
| 4390 | + const reference = React23.useMemo(() => { | |
| 4391 | + function setOpenWithTouchDelay(nextOpen, nativeEvent, target, pointerType) { | |
| 4392 | + const details = createChangeEventDetails(reason, nativeEvent, target); | |
| 4393 | + if (nextOpen && pointerType === "touch" && touchOpenDelay > 0) { | |
| 4394 | + touchOpenTimeout.start(touchOpenDelay, () => { | |
| 4395 | + store.setOpen(true, details); | |
| 677 | 4396 | }); |
| 4397 | + } else { | |
| 4398 | + store.setOpen(nextOpen, details); | |
| 678 | 4399 | } |
| 4400 | + } | |
| 4401 | + function getNextOpen(open2, currentTarget, isClickLikeOpenEvent2) { | |
| 4402 | + const openEvent = dataRef.current.openEvent; | |
| 4403 | + const hasClickedOnInactiveTrigger = store.select("domReferenceElement") !== currentTarget; | |
| 4404 | + if (open2 && hasClickedOnInactiveTrigger) { | |
| 4405 | + return true; | |
| 4406 | + } | |
| 4407 | + if (!open2) { | |
| 4408 | + return true; | |
| 4409 | + } | |
| 4410 | + if (!toggle) { | |
| 4411 | + return true; | |
| 4412 | + } | |
| 4413 | + if (openEvent && stickIfOpen) { | |
| 4414 | + return !isClickLikeOpenEvent2(openEvent.type); | |
| 4415 | + } | |
| 4416 | + return false; | |
| 4417 | + } | |
| 4418 | + return { | |
| 4419 | + onPointerDown(event) { | |
| 4420 | + pointerTypeRef.current = isMouseLikePointerType(event.pointerType, true) && isVirtualPointerEvent(event.nativeEvent) ? "virtual" : event.pointerType; | |
| 4421 | + }, | |
| 4422 | + onMouseDown(event) { | |
| 4423 | + const pointerType = pointerTypeRef.current; | |
| 4424 | + const nativeEvent = event.nativeEvent; | |
| 4425 | + const open2 = store.select("open"); | |
| 4426 | + if (event.button !== 0 || eventOption === "click" || isMouseLikePointerType(pointerType, true) && ignoreMouse) { | |
| 4427 | + return; | |
| 4428 | + } | |
| 4429 | + const nextOpen = getNextOpen(open2, event.currentTarget, (openEventType) => openEventType === "click" || openEventType === "mousedown"); | |
| 4430 | + const target = getTarget(nativeEvent); | |
| 4431 | + if (isTypeableElement(target)) { | |
| 4432 | + setOpenWithTouchDelay(nextOpen, nativeEvent, target, pointerType); | |
| 4433 | + return; | |
| 4434 | + } | |
| 4435 | + const eventCurrentTarget = event.currentTarget; | |
| 4436 | + frame.request(() => { | |
| 4437 | + setOpenWithTouchDelay(nextOpen, nativeEvent, eventCurrentTarget, pointerType); | |
| 4438 | + }); | |
| 4439 | + }, | |
| 4440 | + onClick(event) { | |
| 4441 | + if (eventOption === "mousedown-only") { | |
| 4442 | + return; | |
| 4443 | + } | |
| 4444 | + const pointerType = pointerTypeRef.current; | |
| 4445 | + if (eventOption === "mousedown" && pointerType) { | |
| 4446 | + pointerTypeRef.current = void 0; | |
| 4447 | + return; | |
| 4448 | + } | |
| 4449 | + if (isMouseLikePointerType(pointerType, true) && ignoreMouse) { | |
| 4450 | + return; | |
| 4451 | + } | |
| 4452 | + const open2 = store.select("open"); | |
| 4453 | + const nextOpen = getNextOpen(open2, event.currentTarget, (openEventType) => openEventType === "click" || openEventType === "mousedown" || openEventType === "keydown" || openEventType === "keyup"); | |
| 4454 | + setOpenWithTouchDelay(nextOpen, event.nativeEvent, event.currentTarget, pointerType); | |
| 4455 | + }, | |
| 4456 | + onKeyDown() { | |
| 4457 | + pointerTypeRef.current = void 0; | |
| 4458 | + } | |
| 679 | 4459 | }; |
| 680 | - ownerDocument.addEventListener("focusin", handleFocus); | |
| 681 | - return () => ownerDocument.removeEventListener("focusin", handleFocus); | |
| 682 | - }, [ownerDocument, handleFocusOutside]); | |
| 4460 | + }, [dataRef, eventOption, ignoreMouse, reason, store, stickIfOpen, toggle, frame, touchOpenTimeout, touchOpenDelay]); | |
| 4461 | + return React23.useMemo(() => enabled ? { | |
| 4462 | + reference | |
| 4463 | + } : EMPTY_OBJECT, [enabled, reference]); | |
| 4464 | +} | |
| 4465 | + | |
| 4466 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useClientPoint.mjs | |
| 4467 | +var React24 = __toESM(require_react(), 1); | |
| 4468 | +function createVirtualElement(domElement, data) { | |
| 4469 | + let offsetX = null; | |
| 4470 | + let offsetY = null; | |
| 4471 | + let isAutoUpdateEvent = false; | |
| 683 | 4472 | return { |
| 684 | - onFocusCapture: () => isFocusInsideReactTreeRef.current = true, | |
| 685 | - onBlurCapture: () => isFocusInsideReactTreeRef.current = false | |
| 4473 | + contextElement: domElement || void 0, | |
| 4474 | + getBoundingClientRect() { | |
| 4475 | + const domRect = domElement?.getBoundingClientRect() || { | |
| 4476 | + width: 0, | |
| 4477 | + height: 0, | |
| 4478 | + x: 0, | |
| 4479 | + y: 0 | |
| 4480 | + }; | |
| 4481 | + const isXAxis = data.axis === "x" || data.axis === "both"; | |
| 4482 | + const isYAxis = data.axis === "y" || data.axis === "both"; | |
| 4483 | + const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch"; | |
| 4484 | + let width = domRect.width; | |
| 4485 | + let height = domRect.height; | |
| 4486 | + let x = domRect.x; | |
| 4487 | + let y = domRect.y; | |
| 4488 | + if (offsetX == null && data.x && isXAxis) { | |
| 4489 | + offsetX = domRect.x - data.x; | |
| 4490 | + } | |
| 4491 | + if (offsetY == null && data.y && isYAxis) { | |
| 4492 | + offsetY = domRect.y - data.y; | |
| 4493 | + } | |
| 4494 | + x -= offsetX || 0; | |
| 4495 | + y -= offsetY || 0; | |
| 4496 | + width = 0; | |
| 4497 | + height = 0; | |
| 4498 | + if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) { | |
| 4499 | + width = data.axis === "y" ? domRect.width : 0; | |
| 4500 | + height = data.axis === "x" ? domRect.height : 0; | |
| 4501 | + x = isXAxis && data.x != null ? data.x : x; | |
| 4502 | + y = isYAxis && data.y != null ? data.y : y; | |
| 4503 | + } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) { | |
| 4504 | + height = data.axis === "x" ? domRect.height : height; | |
| 4505 | + width = data.axis === "y" ? domRect.width : width; | |
| 4506 | + } | |
| 4507 | + isAutoUpdateEvent = true; | |
| 4508 | + return { | |
| 4509 | + width, | |
| 4510 | + height, | |
| 4511 | + x, | |
| 4512 | + y, | |
| 4513 | + top: y, | |
| 4514 | + right: x + width, | |
| 4515 | + bottom: y + height, | |
| 4516 | + left: x | |
| 4517 | + }; | |
| 4518 | + } | |
| 686 | 4519 | }; |
| 687 | 4520 | } |
| 688 | -function dispatchUpdate() { | |
| 689 | - const event = new CustomEvent(CONTEXT_UPDATE); | |
| 690 | - document.dispatchEvent(event); | |
| 4521 | +function isMouseBasedEvent(event) { | |
| 4522 | + return event != null && event.clientX != null; | |
| 691 | 4523 | } |
| 692 | -function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) { | |
| 693 | - const target = detail.originalEvent.target; | |
| 694 | - const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail }); | |
| 695 | - if (handler) target.addEventListener(name, handler, { once: true }); | |
| 696 | - if (discrete) { | |
| 697 | - dispatchDiscreteCustomEvent(target, event); | |
| 698 | - } else { | |
| 699 | - target.dispatchEvent(event); | |
| 700 | - } | |
| 4524 | +function useClientPoint(context, props = {}) { | |
| 4525 | + const { | |
| 4526 | + enabled = true, | |
| 4527 | + axis = "both" | |
| 4528 | + } = props; | |
| 4529 | + const store = "rootStore" in context ? context.rootStore : context; | |
| 4530 | + const open2 = store.useState("open"); | |
| 4531 | + const floating = store.useState("floatingElement"); | |
| 4532 | + const domReference = store.useState("domReferenceElement"); | |
| 4533 | + const dataRef = store.context.dataRef; | |
| 4534 | + const initialRef = React24.useRef(false); | |
| 4535 | + const cleanupListenerRef = React24.useRef(null); | |
| 4536 | + const [pointerType, setPointerType] = React24.useState(); | |
| 4537 | + const [reactive, setReactive] = React24.useState([]); | |
| 4538 | + const resetReference = useStableCallback((reference2) => { | |
| 4539 | + store.set("positionReference", reference2); | |
| 4540 | + }); | |
| 4541 | + const setReference = useStableCallback((newX, newY, referenceElement) => { | |
| 4542 | + if (initialRef.current) { | |
| 4543 | + return; | |
| 4544 | + } | |
| 4545 | + if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) { | |
| 4546 | + return; | |
| 4547 | + } | |
| 4548 | + store.set("positionReference", createVirtualElement(referenceElement ?? domReference, { | |
| 4549 | + x: newX, | |
| 4550 | + y: newY, | |
| 4551 | + axis, | |
| 4552 | + dataRef, | |
| 4553 | + pointerType | |
| 4554 | + })); | |
| 4555 | + }); | |
| 4556 | + const handleReferenceEnterOrMove = useStableCallback((event) => { | |
| 4557 | + if (!open2) { | |
| 4558 | + setReference(event.clientX, event.clientY, event.currentTarget); | |
| 4559 | + } else if (!cleanupListenerRef.current) { | |
| 4560 | + setReference(event.clientX, event.clientY, event.currentTarget); | |
| 4561 | + setReactive([]); | |
| 4562 | + } | |
| 4563 | + }); | |
| 4564 | + const openCheck = isMouseLikePointerType(pointerType) ? floating : open2; | |
| 4565 | + React24.useEffect(() => { | |
| 4566 | + if (!enabled) { | |
| 4567 | + resetReference(domReference); | |
| 4568 | + return void 0; | |
| 4569 | + } | |
| 4570 | + if (!openCheck) { | |
| 4571 | + return void 0; | |
| 4572 | + } | |
| 4573 | + function cleanupListener() { | |
| 4574 | + cleanupListenerRef.current?.(); | |
| 4575 | + cleanupListenerRef.current = null; | |
| 4576 | + } | |
| 4577 | + const win = getWindow(floating); | |
| 4578 | + function handleMouseMove(event) { | |
| 4579 | + const target = getTarget(event); | |
| 4580 | + if (!contains(floating, target)) { | |
| 4581 | + setReference(event.clientX, event.clientY); | |
| 4582 | + } else { | |
| 4583 | + cleanupListener(); | |
| 4584 | + } | |
| 4585 | + } | |
| 4586 | + if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) { | |
| 4587 | + cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove); | |
| 4588 | + } else { | |
| 4589 | + resetReference(domReference); | |
| 4590 | + } | |
| 4591 | + return cleanupListener; | |
| 4592 | + }, [openCheck, enabled, floating, dataRef, domReference, store, setReference, resetReference, reactive]); | |
| 4593 | + React24.useEffect(() => () => { | |
| 4594 | + store.set("positionReference", null); | |
| 4595 | + }, [store]); | |
| 4596 | + React24.useEffect(() => { | |
| 4597 | + if (enabled && !floating) { | |
| 4598 | + initialRef.current = false; | |
| 4599 | + } | |
| 4600 | + }, [enabled, floating]); | |
| 4601 | + React24.useEffect(() => { | |
| 4602 | + if (!enabled && open2) { | |
| 4603 | + initialRef.current = true; | |
| 4604 | + } | |
| 4605 | + }, [enabled, open2]); | |
| 4606 | + const reference = React24.useMemo(() => { | |
| 4607 | + function setPointerTypeRef(event) { | |
| 4608 | + setPointerType(event.pointerType); | |
| 4609 | + } | |
| 4610 | + return { | |
| 4611 | + onPointerDown: setPointerTypeRef, | |
| 4612 | + onPointerEnter: setPointerTypeRef, | |
| 4613 | + onMouseMove: handleReferenceEnterOrMove, | |
| 4614 | + onMouseEnter: handleReferenceEnterOrMove | |
| 4615 | + }; | |
| 4616 | + }, [handleReferenceEnterOrMove]); | |
| 4617 | + return React24.useMemo(() => enabled ? { | |
| 4618 | + reference, | |
| 4619 | + trigger: reference | |
| 4620 | + } : {}, [enabled, reference]); | |
| 701 | 4621 | } |
| 702 | 4622 | |
| 703 | -// node_modules/@radix-ui/react-focus-scope/dist/index.mjs | |
| 704 | -var React11 = __toESM(require_react(), 1); | |
| 705 | -var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); | |
| 706 | -var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount"; | |
| 707 | -var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount"; | |
| 708 | -var EVENT_OPTIONS = { bubbles: false, cancelable: true }; | |
| 709 | -var FOCUS_SCOPE_NAME = "FocusScope"; | |
| 710 | -var FocusScope = React11.forwardRef((props, forwardedRef) => { | |
| 4623 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs | |
| 4624 | +var React25 = __toESM(require_react(), 1); | |
| 4625 | +function alwaysFalse() { | |
| 4626 | + return false; | |
| 4627 | +} | |
| 4628 | +function normalizeProp(normalizable) { | |
| 4629 | + return { | |
| 4630 | + escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false, | |
| 4631 | + outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true | |
| 4632 | + }; | |
| 4633 | +} | |
| 4634 | +function useDismiss(context, props = {}) { | |
| 711 | 4635 | const { |
| 712 | - loop = false, | |
| 713 | - trapped = false, | |
| 714 | - onMountAutoFocus: onMountAutoFocusProp, | |
| 715 | - onUnmountAutoFocus: onUnmountAutoFocusProp, | |
| 716 | - ...scopeProps | |
| 4636 | + enabled = true, | |
| 4637 | + escapeKey: escapeKey2 = true, | |
| 4638 | + outsidePress: outsidePressProp = true, | |
| 4639 | + outsidePressEvent = "sloppy", | |
| 4640 | + referencePress = alwaysFalse, | |
| 4641 | + bubbles, | |
| 4642 | + externalTree | |
| 717 | 4643 | } = props; |
| 718 | - const [container, setContainer] = React11.useState(null); | |
| 719 | - const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp); | |
| 720 | - const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp); | |
| 721 | - const lastFocusedElementRef = React11.useRef(null); | |
| 722 | - const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node)); | |
| 723 | - const focusScope = React11.useRef({ | |
| 724 | - paused: false, | |
| 725 | - pause() { | |
| 726 | - this.paused = true; | |
| 727 | - }, | |
| 728 | - resume() { | |
| 729 | - this.paused = false; | |
| 4644 | + const store = "rootStore" in context ? context.rootStore : context; | |
| 4645 | + const open2 = store.useState("open"); | |
| 4646 | + const floatingElement = store.useState("floatingElement"); | |
| 4647 | + const { | |
| 4648 | + dataRef, | |
| 4649 | + events | |
| 4650 | + } = store.context; | |
| 4651 | + const tree = useFloatingTree(externalTree); | |
| 4652 | + const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false); | |
| 4653 | + const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp; | |
| 4654 | + const outsidePressEnabled = outsidePress2 !== false; | |
| 4655 | + const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent); | |
| 4656 | + const { | |
| 4657 | + escapeKey: escapeKeyBubbles, | |
| 4658 | + outsidePress: outsidePressBubbles | |
| 4659 | + } = normalizeProp(bubbles); | |
| 4660 | + const pressStartedInsideRef = React25.useRef(false); | |
| 4661 | + const pressStartPreventedRef = React25.useRef(false); | |
| 4662 | + const suppressNextOutsideClickRef = React25.useRef(false); | |
| 4663 | + const sawPressWhileOpenRef = React25.useRef(false); | |
| 4664 | + const isComposingRef = React25.useRef(false); | |
| 4665 | + const currentPointerTypeRef = React25.useRef(""); | |
| 4666 | + const touchStateRef = React25.useRef(null); | |
| 4667 | + const cancelDismissOnEndTimeout = useTimeout(); | |
| 4668 | + const clearInsideReactTreeTimeout = useTimeout(); | |
| 4669 | + const clearInsideReactTree = useStableCallback(() => { | |
| 4670 | + clearInsideReactTreeTimeout.clear(); | |
| 4671 | + dataRef.current.insideReactTree = false; | |
| 4672 | + }); | |
| 4673 | + const hasBlockingChild = useStableCallback((bubbleKey) => { | |
| 4674 | + const nodeId = dataRef.current.floatingContext?.nodeId; | |
| 4675 | + const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : []; | |
| 4676 | + return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]); | |
| 4677 | + }); | |
| 4678 | + const isEventWithinOwnElements = useStableCallback((event) => { | |
| 4679 | + return isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement")); | |
| 4680 | + }); | |
| 4681 | + const closeOnReferencePress = useStableCallback((event) => { | |
| 4682 | + if (!referencePress()) { | |
| 4683 | + return; | |
| 730 | 4684 | } |
| 731 | - }).current; | |
| 732 | - React11.useEffect(() => { | |
| 733 | - if (trapped) { | |
| 734 | - let handleFocusIn2 = function(event) { | |
| 735 | - if (focusScope.paused || !container) return; | |
| 736 | - const target = event.target; | |
| 737 | - if (container.contains(target)) { | |
| 738 | - lastFocusedElementRef.current = target; | |
| 4685 | + store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent)); | |
| 4686 | + }); | |
| 4687 | + const closeOnEscapeKeyDown = useStableCallback((event) => { | |
| 4688 | + if (!open2 || !enabled || !escapeKey2 || event.key !== "Escape") { | |
| 4689 | + return; | |
| 4690 | + } | |
| 4691 | + if (isComposingRef.current) { | |
| 4692 | + return; | |
| 4693 | + } | |
| 4694 | + if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) { | |
| 4695 | + return; | |
| 4696 | + } | |
| 4697 | + const native = isReactEvent(event) ? event.nativeEvent : event; | |
| 4698 | + const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native); | |
| 4699 | + store.setOpen(false, eventDetails); | |
| 4700 | + if (!eventDetails.isCanceled) { | |
| 4701 | + event.preventDefault(); | |
| 4702 | + } | |
| 4703 | + if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) { | |
| 4704 | + event.stopPropagation(); | |
| 4705 | + } | |
| 4706 | + }); | |
| 4707 | + const markInsideReactTree = useStableCallback(() => { | |
| 4708 | + dataRef.current.insideReactTree = true; | |
| 4709 | + clearInsideReactTreeTimeout.start(0, clearInsideReactTree); | |
| 4710 | + }); | |
| 4711 | + const markPressStartedInsideReactTree = useStableCallback((event) => { | |
| 4712 | + if (!open2 || !enabled || event.button !== 0) { | |
| 4713 | + return; | |
| 4714 | + } | |
| 4715 | + const target = getTarget(event.nativeEvent); | |
| 4716 | + if (!contains(store.select("floatingElement"), target)) { | |
| 4717 | + return; | |
| 4718 | + } | |
| 4719 | + if (!pressStartedInsideRef.current) { | |
| 4720 | + pressStartedInsideRef.current = true; | |
| 4721 | + pressStartPreventedRef.current = false; | |
| 4722 | + } | |
| 4723 | + }); | |
| 4724 | + const markInsidePressStartPrevented = useStableCallback((event) => { | |
| 4725 | + if (!open2 || !enabled) { | |
| 4726 | + return; | |
| 4727 | + } | |
| 4728 | + if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) { | |
| 4729 | + return; | |
| 4730 | + } | |
| 4731 | + if (pressStartedInsideRef.current) { | |
| 4732 | + pressStartPreventedRef.current = true; | |
| 4733 | + } | |
| 4734 | + }); | |
| 4735 | + React25.useEffect(() => { | |
| 4736 | + function handleOpenChange(details) { | |
| 4737 | + if (!details.open) { | |
| 4738 | + sawPressWhileOpenRef.current = false; | |
| 4739 | + } | |
| 4740 | + } | |
| 4741 | + events.on("openchange", handleOpenChange); | |
| 4742 | + return () => { | |
| 4743 | + events.off("openchange", handleOpenChange); | |
| 4744 | + }; | |
| 4745 | + }, [events]); | |
| 4746 | + React25.useEffect(() => { | |
| 4747 | + if (!open2 || !enabled) { | |
| 4748 | + if (!open2) { | |
| 4749 | + sawPressWhileOpenRef.current = false; | |
| 4750 | + } | |
| 4751 | + return clearInsideReactTree; | |
| 4752 | + } | |
| 4753 | + dataRef.current.__escapeKeyBubbles = escapeKeyBubbles; | |
| 4754 | + dataRef.current.__outsidePressBubbles = outsidePressBubbles; | |
| 4755 | + const compositionTimeout = new Timeout(); | |
| 4756 | + const preventedPressSuppressionTimeout = new Timeout(); | |
| 4757 | + const doc = ownerDocument(floatingElement); | |
| 4758 | + function handleCompositionStart() { | |
| 4759 | + compositionTimeout.clear(); | |
| 4760 | + isComposingRef.current = true; | |
| 4761 | + } | |
| 4762 | + function handleCompositionEnd() { | |
| 4763 | + compositionTimeout.start( | |
| 4764 | + // 0ms or 1ms don't work in Safari. 5ms appears to consistently work. | |
| 4765 | + // Only apply to WebKit for the test to remain 0ms. | |
| 4766 | + parts_exports.engine.webkit ? 5 : 0, | |
| 4767 | + () => { | |
| 4768 | + isComposingRef.current = false; | |
| 4769 | + } | |
| 4770 | + ); | |
| 4771 | + } | |
| 4772 | + function suppressImmediateOutsideClickAfterPreventedStart() { | |
| 4773 | + suppressNextOutsideClickRef.current = true; | |
| 4774 | + preventedPressSuppressionTimeout.start(0, () => { | |
| 4775 | + suppressNextOutsideClickRef.current = false; | |
| 4776 | + }); | |
| 4777 | + } | |
| 4778 | + function resetPressStartState() { | |
| 4779 | + pressStartedInsideRef.current = false; | |
| 4780 | + pressStartPreventedRef.current = false; | |
| 4781 | + } | |
| 4782 | + function getOutsidePressEvent() { | |
| 4783 | + const type = currentPointerTypeRef.current; | |
| 4784 | + const computedType = type === "pen" || !type ? "mouse" : type; | |
| 4785 | + const outsidePressEventValue = getOutsidePressEventProp(); | |
| 4786 | + const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue; | |
| 4787 | + if (typeof resolved === "string") { | |
| 4788 | + return resolved; | |
| 4789 | + } | |
| 4790 | + return resolved[computedType]; | |
| 4791 | + } | |
| 4792 | + function shouldIgnoreEvent(event) { | |
| 4793 | + const computedOutsidePressEvent = getOutsidePressEvent(); | |
| 4794 | + return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click"; | |
| 4795 | + } | |
| 4796 | + function isEventWithinFloatingTree(event) { | |
| 4797 | + const nodeId = dataRef.current.floatingContext?.nodeId; | |
| 4798 | + const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating)); | |
| 4799 | + return isEventWithinOwnElements(event) || targetIsInsideChildren; | |
| 4800 | + } | |
| 4801 | + function closeOnPressOutside(event) { | |
| 4802 | + if (shouldIgnoreEvent(event)) { | |
| 4803 | + if (event.type !== "click" && !isEventWithinOwnElements(event)) { | |
| 4804 | + preventedPressSuppressionTimeout.clear(); | |
| 4805 | + suppressNextOutsideClickRef.current = false; | |
| 4806 | + } | |
| 4807 | + clearInsideReactTree(); | |
| 4808 | + return; | |
| 4809 | + } | |
| 4810 | + if (dataRef.current.insideReactTree) { | |
| 4811 | + clearInsideReactTree(); | |
| 4812 | + return; | |
| 4813 | + } | |
| 4814 | + const target = getTarget(event); | |
| 4815 | + const inertSelector = `[${createAttribute("inert")}]`; | |
| 4816 | + const targetRoot = isElement(target) ? target.getRootNode() : null; | |
| 4817 | + const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store.select("floatingElement"))).querySelectorAll(inertSelector)); | |
| 4818 | + const triggers = store.context.triggerElements; | |
| 4819 | + if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) { | |
| 4820 | + return; | |
| 4821 | + } | |
| 4822 | + let targetRootAncestor = isElement(target) ? target : null; | |
| 4823 | + while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) { | |
| 4824 | + const nextParent = getParentNode(targetRootAncestor); | |
| 4825 | + if (isLastTraversableNode(nextParent) || !isElement(nextParent)) { | |
| 4826 | + break; | |
| 4827 | + } | |
| 4828 | + targetRootAncestor = nextParent; | |
| 4829 | + } | |
| 4830 | + if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay). | |
| 4831 | + !contains(target, store.select("floatingElement")) && // If the target root element contains none of the markers, then the | |
| 4832 | + // element was injected after the floating element rendered. | |
| 4833 | + markers.every((marker) => !contains(targetRootAncestor, marker))) { | |
| 4834 | + return; | |
| 4835 | + } | |
| 4836 | + if (isHTMLElement(target) && !("touches" in event)) { | |
| 4837 | + const lastTraversableNode = isLastTraversableNode(target); | |
| 4838 | + const style = getComputedStyle2(target); | |
| 4839 | + const scrollRe = /auto|scroll/; | |
| 4840 | + const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX); | |
| 4841 | + const isScrollableY2 = lastTraversableNode || scrollRe.test(style.overflowY); | |
| 4842 | + const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth; | |
| 4843 | + const canScrollY = isScrollableY2 && target.clientHeight > 0 && target.scrollHeight > target.clientHeight; | |
| 4844 | + const isRTL4 = style.direction === "rtl"; | |
| 4845 | + const pressedVerticalScrollbar = canScrollY && (isRTL4 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth); | |
| 4846 | + const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight; | |
| 4847 | + if (pressedVerticalScrollbar || pressedHorizontalScrollbar) { | |
| 4848 | + return; | |
| 4849 | + } | |
| 4850 | + } | |
| 4851 | + if (isEventWithinFloatingTree(event)) { | |
| 4852 | + return; | |
| 4853 | + } | |
| 4854 | + if (getOutsidePressEvent() === "intentional") { | |
| 4855 | + if (event.detail !== 0 && !isVirtualClick(event) && !sawPressWhileOpenRef.current) { | |
| 4856 | + return; | |
| 4857 | + } | |
| 4858 | + if (suppressNextOutsideClickRef.current) { | |
| 4859 | + preventedPressSuppressionTimeout.clear(); | |
| 4860 | + suppressNextOutsideClickRef.current = false; | |
| 4861 | + return; | |
| 4862 | + } | |
| 4863 | + } | |
| 4864 | + if (typeof outsidePress2 === "function" && !outsidePress2(event)) { | |
| 4865 | + return; | |
| 4866 | + } | |
| 4867 | + if (hasBlockingChild("__outsidePressBubbles")) { | |
| 4868 | + return; | |
| 4869 | + } | |
| 4870 | + store.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event)); | |
| 4871 | + clearInsideReactTree(); | |
| 4872 | + } | |
| 4873 | + function handlePointerDown(event) { | |
| 4874 | + if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store.select("open") || !enabled || isEventWithinOwnElements(event)) { | |
| 4875 | + return; | |
| 4876 | + } | |
| 4877 | + closeOnPressOutside(event); | |
| 4878 | + } | |
| 4879 | + function handleTouchStart(event) { | |
| 4880 | + if (getOutsidePressEvent() !== "sloppy" || !store.select("open") || !enabled || isEventWithinOwnElements(event)) { | |
| 4881 | + return; | |
| 4882 | + } | |
| 4883 | + const touch = event.touches[0]; | |
| 4884 | + if (touch) { | |
| 4885 | + touchStateRef.current = { | |
| 4886 | + startTime: Date.now(), | |
| 4887 | + startX: touch.clientX, | |
| 4888 | + startY: touch.clientY, | |
| 4889 | + dismissOnTouchEnd: false, | |
| 4890 | + dismissOnMouseDown: true | |
| 4891 | + }; | |
| 4892 | + cancelDismissOnEndTimeout.start(1e3, () => { | |
| 4893 | + if (touchStateRef.current) { | |
| 4894 | + touchStateRef.current.dismissOnTouchEnd = false; | |
| 4895 | + touchStateRef.current.dismissOnMouseDown = false; | |
| 4896 | + } | |
| 4897 | + }); | |
| 4898 | + } | |
| 4899 | + } | |
| 4900 | + function addTargetEventListenerOnce(event, listener) { | |
| 4901 | + const target = getTarget(event); | |
| 4902 | + if (!target) { | |
| 4903 | + return; | |
| 4904 | + } | |
| 4905 | + const unsubscribe2 = addEventListener(target, event.type, () => { | |
| 4906 | + listener(event); | |
| 4907 | + unsubscribe2(); | |
| 4908 | + }); | |
| 4909 | + } | |
| 4910 | + function handleTouchStartCapture(event) { | |
| 4911 | + currentPointerTypeRef.current = "touch"; | |
| 4912 | + addTargetEventListenerOnce(event, handleTouchStart); | |
| 4913 | + } | |
| 4914 | + function closeOnPressOutsideCapture(event) { | |
| 4915 | + cancelDismissOnEndTimeout.clear(); | |
| 4916 | + if (event.type === "pointerdown") { | |
| 4917 | + if (event.button === 0) { | |
| 4918 | + sawPressWhileOpenRef.current = true; | |
| 4919 | + } | |
| 4920 | + currentPointerTypeRef.current = event.pointerType; | |
| 4921 | + } | |
| 4922 | + if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) { | |
| 4923 | + return; | |
| 4924 | + } | |
| 4925 | + addTargetEventListenerOnce(event, (targetEvent) => { | |
| 4926 | + if (targetEvent.type === "pointerdown") { | |
| 4927 | + handlePointerDown(targetEvent); | |
| 739 | 4928 | } else { |
| 740 | - focus(lastFocusedElementRef.current, { select: true }); | |
| 4929 | + closeOnPressOutside(targetEvent); | |
| 741 | 4930 | } |
| 742 | - }, handleFocusOut2 = function(event) { | |
| 743 | - if (focusScope.paused || !container) return; | |
| 744 | - const relatedTarget = event.relatedTarget; | |
| 745 | - if (relatedTarget === null) return; | |
| 746 | - if (!container.contains(relatedTarget)) { | |
| 747 | - focus(lastFocusedElementRef.current, { select: true }); | |
| 4931 | + }); | |
| 4932 | + } | |
| 4933 | + function handlePressEndCapture(event) { | |
| 4934 | + if (event.type === "pointercancel") { | |
| 4935 | + sawPressWhileOpenRef.current = false; | |
| 4936 | + } | |
| 4937 | + if (!pressStartedInsideRef.current) { | |
| 4938 | + return; | |
| 4939 | + } | |
| 4940 | + const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current; | |
| 4941 | + resetPressStartState(); | |
| 4942 | + if (getOutsidePressEvent() !== "intentional") { | |
| 4943 | + return; | |
| 4944 | + } | |
| 4945 | + if (event.type === "pointercancel") { | |
| 4946 | + if (pressStartedInsideDefaultPrevented) { | |
| 4947 | + suppressImmediateOutsideClickAfterPreventedStart(); | |
| 748 | 4948 | } |
| 749 | - }, handleMutations2 = function(mutations) { | |
| 750 | - const focusedElement = document.activeElement; | |
| 751 | - if (focusedElement !== document.body) return; | |
| 752 | - for (const mutation of mutations) { | |
| 753 | - if (mutation.removedNodes.length > 0) focus(container); | |
| 754 | - } | |
| 4949 | + return; | |
| 4950 | + } | |
| 4951 | + if (isEventWithinFloatingTree(event)) { | |
| 4952 | + return; | |
| 4953 | + } | |
| 4954 | + if (pressStartedInsideDefaultPrevented) { | |
| 4955 | + suppressImmediateOutsideClickAfterPreventedStart(); | |
| 4956 | + return; | |
| 4957 | + } | |
| 4958 | + if (typeof outsidePress2 === "function" && !outsidePress2(event)) { | |
| 4959 | + return; | |
| 4960 | + } | |
| 4961 | + preventedPressSuppressionTimeout.clear(); | |
| 4962 | + suppressNextOutsideClickRef.current = true; | |
| 4963 | + clearInsideReactTree(); | |
| 4964 | + } | |
| 4965 | + function handleTouchMove(event) { | |
| 4966 | + if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { | |
| 4967 | + return; | |
| 4968 | + } | |
| 4969 | + const touch = event.touches[0]; | |
| 4970 | + if (!touch) { | |
| 4971 | + return; | |
| 4972 | + } | |
| 4973 | + const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX); | |
| 4974 | + const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY); | |
| 4975 | + const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); | |
| 4976 | + if (distance > 5) { | |
| 4977 | + touchStateRef.current.dismissOnTouchEnd = true; | |
| 4978 | + } | |
| 4979 | + if (distance > 10) { | |
| 4980 | + closeOnPressOutside(event); | |
| 4981 | + cancelDismissOnEndTimeout.clear(); | |
| 4982 | + touchStateRef.current = null; | |
| 4983 | + } | |
| 4984 | + } | |
| 4985 | + function handleTouchMoveCapture(event) { | |
| 4986 | + addTargetEventListenerOnce(event, handleTouchMove); | |
| 4987 | + } | |
| 4988 | + function handleTouchEnd(event) { | |
| 4989 | + if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { | |
| 4990 | + return; | |
| 4991 | + } | |
| 4992 | + if (touchStateRef.current.dismissOnTouchEnd) { | |
| 4993 | + closeOnPressOutside(event); | |
| 4994 | + } | |
| 4995 | + cancelDismissOnEndTimeout.clear(); | |
| 4996 | + touchStateRef.current = null; | |
| 4997 | + } | |
| 4998 | + function handleTouchEndCapture(event) { | |
| 4999 | + addTargetEventListenerOnce(event, handleTouchEnd); | |
| 5000 | + } | |
| 5001 | + const unsubscribe = mergeCleanups(escapeKey2 && mergeCleanups(addEventListener(doc, "keydown", closeOnEscapeKeyDown), addEventListener(doc, "compositionstart", handleCompositionStart), addEventListener(doc, "compositionend", handleCompositionEnd)), outsidePressEnabled && mergeCleanups(addEventListener(doc, "click", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerdown", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerup", handlePressEndCapture, true), addEventListener(doc, "pointercancel", handlePressEndCapture, true), addEventListener(doc, "mousedown", closeOnPressOutsideCapture, true), addEventListener(doc, "mouseup", handlePressEndCapture, true), addEventListener(doc, "touchstart", handleTouchStartCapture, { | |
| 5002 | + capture: true, | |
| 5003 | + passive: true | |
| 5004 | + }), addEventListener(doc, "touchmove", handleTouchMoveCapture, { | |
| 5005 | + capture: true, | |
| 5006 | + passive: true | |
| 5007 | + }), addEventListener(doc, "touchend", handleTouchEndCapture, { | |
| 5008 | + capture: true, | |
| 5009 | + passive: true | |
| 5010 | + }))); | |
| 5011 | + return () => { | |
| 5012 | + unsubscribe(); | |
| 5013 | + compositionTimeout.clear(); | |
| 5014 | + preventedPressSuppressionTimeout.clear(); | |
| 5015 | + resetPressStartState(); | |
| 5016 | + suppressNextOutsideClickRef.current = false; | |
| 5017 | + clearInsideReactTree(); | |
| 5018 | + }; | |
| 5019 | + }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open2, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store, cancelDismissOnEndTimeout]); | |
| 5020 | + const reference = React25.useMemo(() => ({ | |
| 5021 | + onKeyDown: closeOnEscapeKeyDown, | |
| 5022 | + onPointerDown: closeOnReferencePress, | |
| 5023 | + onClick: closeOnReferencePress | |
| 5024 | + }), [closeOnEscapeKeyDown, closeOnReferencePress]); | |
| 5025 | + const floating = React25.useMemo(() => ({ | |
| 5026 | + onKeyDown: closeOnEscapeKeyDown, | |
| 5027 | + // `onMouseDown` may be blocked if `event.preventDefault()` is called in | |
| 5028 | + // `onPointerDown`, such as with <NumberField.ScrubArea>. | |
| 5029 | + // See https://github.com/mui/base-ui/pull/3379 | |
| 5030 | + onPointerDown: markInsidePressStartPrevented, | |
| 5031 | + onMouseDown: markInsidePressStartPrevented, | |
| 5032 | + onClickCapture: markInsideReactTree, | |
| 5033 | + onMouseDownCapture(event) { | |
| 5034 | + markInsideReactTree(); | |
| 5035 | + markPressStartedInsideReactTree(event); | |
| 5036 | + }, | |
| 5037 | + onPointerDownCapture(event) { | |
| 5038 | + markInsideReactTree(); | |
| 5039 | + markPressStartedInsideReactTree(event); | |
| 5040 | + }, | |
| 5041 | + onMouseUpCapture: markInsideReactTree, | |
| 5042 | + onTouchEndCapture: markInsideReactTree, | |
| 5043 | + onTouchMoveCapture: markInsideReactTree | |
| 5044 | + }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]); | |
| 5045 | + return React25.useMemo(() => enabled ? { | |
| 5046 | + reference, | |
| 5047 | + floating, | |
| 5048 | + trigger: reference | |
| 5049 | + } : {}, [enabled, reference, floating]); | |
| 5050 | +} | |
| 5051 | + | |
| 5052 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs | |
| 5053 | +var React33 = __toESM(require_react(), 1); | |
| 5054 | + | |
| 5055 | +// node_modules/@floating-ui/core/dist/floating-ui.core.mjs | |
| 5056 | +function computeCoordsFromPlacement(_ref, placement, rtl) { | |
| 5057 | + let { | |
| 5058 | + reference, | |
| 5059 | + floating | |
| 5060 | + } = _ref; | |
| 5061 | + const sideAxis = getSideAxis(placement); | |
| 5062 | + const alignmentAxis = getAlignmentAxis(placement); | |
| 5063 | + const alignLength = getAxisLength(alignmentAxis); | |
| 5064 | + const side = getSide(placement); | |
| 5065 | + const isVertical = sideAxis === "y"; | |
| 5066 | + const commonX = reference.x + reference.width / 2 - floating.width / 2; | |
| 5067 | + const commonY = reference.y + reference.height / 2 - floating.height / 2; | |
| 5068 | + const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; | |
| 5069 | + let coords; | |
| 5070 | + switch (side) { | |
| 5071 | + case "top": | |
| 5072 | + coords = { | |
| 5073 | + x: commonX, | |
| 5074 | + y: reference.y - floating.height | |
| 755 | 5075 | }; |
| 756 | - var handleFocusIn = handleFocusIn2, handleFocusOut = handleFocusOut2, handleMutations = handleMutations2; | |
| 757 | - document.addEventListener("focusin", handleFocusIn2); | |
| 758 | - document.addEventListener("focusout", handleFocusOut2); | |
| 759 | - const mutationObserver = new MutationObserver(handleMutations2); | |
| 760 | - if (container) mutationObserver.observe(container, { childList: true, subtree: true }); | |
| 761 | - return () => { | |
| 762 | - document.removeEventListener("focusin", handleFocusIn2); | |
| 763 | - document.removeEventListener("focusout", handleFocusOut2); | |
| 764 | - mutationObserver.disconnect(); | |
| 5076 | + break; | |
| 5077 | + case "bottom": | |
| 5078 | + coords = { | |
| 5079 | + x: commonX, | |
| 5080 | + y: reference.y + reference.height | |
| 765 | 5081 | }; |
| 5082 | + break; | |
| 5083 | + case "right": | |
| 5084 | + coords = { | |
| 5085 | + x: reference.x + reference.width, | |
| 5086 | + y: commonY | |
| 5087 | + }; | |
| 5088 | + break; | |
| 5089 | + case "left": | |
| 5090 | + coords = { | |
| 5091 | + x: reference.x - floating.width, | |
| 5092 | + y: commonY | |
| 5093 | + }; | |
| 5094 | + break; | |
| 5095 | + default: | |
| 5096 | + coords = { | |
| 5097 | + x: reference.x, | |
| 5098 | + y: reference.y | |
| 5099 | + }; | |
| 5100 | + } | |
| 5101 | + const alignment = getAlignment(placement); | |
| 5102 | + if (alignment) { | |
| 5103 | + coords[alignmentAxis] += commonAlign * (alignment === "end" ? 1 : -1) * (rtl && isVertical ? -1 : 1); | |
| 5104 | + } | |
| 5105 | + return coords; | |
| 5106 | +} | |
| 5107 | +async function detectOverflow(state, options) { | |
| 5108 | + var _await$platform$isEle; | |
| 5109 | + if (options === void 0) { | |
| 5110 | + options = {}; | |
| 5111 | + } | |
| 5112 | + const { | |
| 5113 | + x, | |
| 5114 | + y, | |
| 5115 | + platform: platform3, | |
| 5116 | + rects, | |
| 5117 | + elements, | |
| 5118 | + strategy | |
| 5119 | + } = state; | |
| 5120 | + const { | |
| 5121 | + boundary = "clippingAncestors", | |
| 5122 | + rootBoundary = "viewport", | |
| 5123 | + elementContext = "floating", | |
| 5124 | + altBoundary = false, | |
| 5125 | + padding = 0 | |
| 5126 | + } = evaluate(options, state); | |
| 5127 | + const paddingObject = getPaddingObject(padding); | |
| 5128 | + const altContext = elementContext === "floating" ? "reference" : "floating"; | |
| 5129 | + const element = elements[altBoundary ? altContext : elementContext]; | |
| 5130 | + const clippingClientRect = rectToClientRect(await platform3.getClippingRect({ | |
| 5131 | + element: ((_await$platform$isEle = await (platform3.isElement == null ? void 0 : platform3.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform3.getDocumentElement == null ? void 0 : platform3.getDocumentElement(elements.floating)), | |
| 5132 | + boundary, | |
| 5133 | + rootBoundary, | |
| 5134 | + strategy | |
| 5135 | + })); | |
| 5136 | + const rect = elementContext === "floating" ? { | |
| 5137 | + x, | |
| 5138 | + y, | |
| 5139 | + width: rects.floating.width, | |
| 5140 | + height: rects.floating.height | |
| 5141 | + } : rects.reference; | |
| 5142 | + const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating)); | |
| 5143 | + const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) && await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || { | |
| 5144 | + x: 1, | |
| 5145 | + y: 1 | |
| 5146 | + }; | |
| 5147 | + const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({ | |
| 5148 | + elements, | |
| 5149 | + rect, | |
| 5150 | + offsetParent, | |
| 5151 | + strategy | |
| 5152 | + }) : rect); | |
| 5153 | + return { | |
| 5154 | + top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, | |
| 5155 | + bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, | |
| 5156 | + left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, | |
| 5157 | + right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x | |
| 5158 | + }; | |
| 5159 | +} | |
| 5160 | +var MAX_RESET_COUNT = 50; | |
| 5161 | +var computePosition = async (reference, floating, config) => { | |
| 5162 | + const { | |
| 5163 | + placement = "bottom", | |
| 5164 | + strategy = "absolute", | |
| 5165 | + middleware = [], | |
| 5166 | + platform: platform3 | |
| 5167 | + } = config; | |
| 5168 | + const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : { | |
| 5169 | + ...platform3, | |
| 5170 | + detectOverflow | |
| 5171 | + }; | |
| 5172 | + const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating)); | |
| 5173 | + let rects = await platform3.getElementRects({ | |
| 5174 | + reference, | |
| 5175 | + floating, | |
| 5176 | + strategy | |
| 5177 | + }); | |
| 5178 | + let { | |
| 5179 | + x, | |
| 5180 | + y | |
| 5181 | + } = computeCoordsFromPlacement(rects, placement, rtl); | |
| 5182 | + let statefulPlacement = placement; | |
| 5183 | + let resetCount = 0; | |
| 5184 | + const middlewareData = {}; | |
| 5185 | + for (let i = 0; i < middleware.length; i++) { | |
| 5186 | + const currentMiddleware = middleware[i]; | |
| 5187 | + if (!currentMiddleware) { | |
| 5188 | + continue; | |
| 766 | 5189 | } |
| 767 | - }, [trapped, container, focusScope.paused]); | |
| 768 | - React11.useEffect(() => { | |
| 769 | - if (container) { | |
| 770 | - focusScopesStack.add(focusScope); | |
| 771 | - const previouslyFocusedElement = document.activeElement; | |
| 772 | - const hasFocusedCandidate = container.contains(previouslyFocusedElement); | |
| 773 | - if (!hasFocusedCandidate) { | |
| 774 | - const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS); | |
| 775 | - container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus); | |
| 776 | - container.dispatchEvent(mountEvent); | |
| 777 | - if (!mountEvent.defaultPrevented) { | |
| 778 | - focusFirst(removeLinks(getTabbableCandidates(container)), { select: true }); | |
| 779 | - if (document.activeElement === previouslyFocusedElement) { | |
| 780 | - focus(container); | |
| 5190 | + const { | |
| 5191 | + name, | |
| 5192 | + fn | |
| 5193 | + } = currentMiddleware; | |
| 5194 | + const { | |
| 5195 | + x: nextX, | |
| 5196 | + y: nextY, | |
| 5197 | + data, | |
| 5198 | + reset | |
| 5199 | + } = await fn({ | |
| 5200 | + x, | |
| 5201 | + y, | |
| 5202 | + initialPlacement: placement, | |
| 5203 | + placement: statefulPlacement, | |
| 5204 | + strategy, | |
| 5205 | + middlewareData, | |
| 5206 | + rects, | |
| 5207 | + platform: platformWithDetectOverflow, | |
| 5208 | + elements: { | |
| 5209 | + reference, | |
| 5210 | + floating | |
| 5211 | + } | |
| 5212 | + }); | |
| 5213 | + x = nextX != null ? nextX : x; | |
| 5214 | + y = nextY != null ? nextY : y; | |
| 5215 | + middlewareData[name] = { | |
| 5216 | + ...middlewareData[name], | |
| 5217 | + ...data | |
| 5218 | + }; | |
| 5219 | + if (reset && resetCount < MAX_RESET_COUNT) { | |
| 5220 | + resetCount++; | |
| 5221 | + if (typeof reset === "object") { | |
| 5222 | + if (reset.placement) { | |
| 5223 | + statefulPlacement = reset.placement; | |
| 5224 | + } | |
| 5225 | + if (reset.rects) { | |
| 5226 | + rects = reset.rects === true ? await platform3.getElementRects({ | |
| 5227 | + reference, | |
| 5228 | + floating, | |
| 5229 | + strategy | |
| 5230 | + }) : reset.rects; | |
| 5231 | + } | |
| 5232 | + ({ | |
| 5233 | + x, | |
| 5234 | + y | |
| 5235 | + } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); | |
| 5236 | + } | |
| 5237 | + i = -1; | |
| 5238 | + } | |
| 5239 | + } | |
| 5240 | + return { | |
| 5241 | + x, | |
| 5242 | + y, | |
| 5243 | + placement: statefulPlacement, | |
| 5244 | + strategy, | |
| 5245 | + middlewareData | |
| 5246 | + }; | |
| 5247 | +}; | |
| 5248 | +var flip = function(options) { | |
| 5249 | + if (options === void 0) { | |
| 5250 | + options = {}; | |
| 5251 | + } | |
| 5252 | + return { | |
| 5253 | + name: "flip", | |
| 5254 | + options, | |
| 5255 | + async fn(state) { | |
| 5256 | + var _middlewareData$arrow, _middlewareData$flip; | |
| 5257 | + const { | |
| 5258 | + placement, | |
| 5259 | + middlewareData, | |
| 5260 | + rects, | |
| 5261 | + initialPlacement, | |
| 5262 | + platform: platform3, | |
| 5263 | + elements | |
| 5264 | + } = state; | |
| 5265 | + const { | |
| 5266 | + mainAxis: checkMainAxis = true, | |
| 5267 | + crossAxis: checkCrossAxis = true, | |
| 5268 | + fallbackPlacements: specifiedFallbackPlacements, | |
| 5269 | + fallbackStrategy = "bestFit", | |
| 5270 | + fallbackAxisSideDirection = "none", | |
| 5271 | + flipAlignment = true, | |
| 5272 | + ...detectOverflowOptions | |
| 5273 | + } = evaluate(options, state); | |
| 5274 | + if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { | |
| 5275 | + return {}; | |
| 5276 | + } | |
| 5277 | + const side = getSide(placement); | |
| 5278 | + const initialSideAxis = getSideAxis(initialPlacement); | |
| 5279 | + const isBasePlacement = getSide(initialPlacement) === initialPlacement; | |
| 5280 | + const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); | |
| 5281 | + const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); | |
| 5282 | + const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none"; | |
| 5283 | + if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { | |
| 5284 | + fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); | |
| 5285 | + } | |
| 5286 | + const placements2 = [initialPlacement, ...fallbackPlacements]; | |
| 5287 | + const overflow = await platform3.detectOverflow(state, detectOverflowOptions); | |
| 5288 | + const overflows = []; | |
| 5289 | + let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; | |
| 5290 | + if (checkMainAxis) { | |
| 5291 | + overflows.push(overflow[side]); | |
| 5292 | + } | |
| 5293 | + if (checkCrossAxis) { | |
| 5294 | + const sides2 = getAlignmentSides(placement, rects, rtl); | |
| 5295 | + overflows.push(overflow[sides2[0]], overflow[sides2[1]]); | |
| 5296 | + } | |
| 5297 | + overflowsData = [...overflowsData, { | |
| 5298 | + placement, | |
| 5299 | + overflows | |
| 5300 | + }]; | |
| 5301 | + if (!overflows.every((side2) => side2 <= 0)) { | |
| 5302 | + var _middlewareData$flip2, _overflowsData$filter; | |
| 5303 | + const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; | |
| 5304 | + const nextPlacement = placements2[nextIndex]; | |
| 5305 | + if (nextPlacement) { | |
| 5306 | + const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false; | |
| 5307 | + if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis | |
| 5308 | + // overflows the main axis. | |
| 5309 | + overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) { | |
| 5310 | + return { | |
| 5311 | + data: { | |
| 5312 | + index: nextIndex, | |
| 5313 | + overflows: overflowsData | |
| 5314 | + }, | |
| 5315 | + reset: { | |
| 5316 | + placement: nextPlacement | |
| 5317 | + } | |
| 5318 | + }; | |
| 781 | 5319 | } |
| 782 | 5320 | } |
| 5321 | + let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement; | |
| 5322 | + if (!resetPlacement) { | |
| 5323 | + switch (fallbackStrategy) { | |
| 5324 | + case "bestFit": { | |
| 5325 | + var _overflowsData$filter2; | |
| 5326 | + const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => { | |
| 5327 | + if (hasFallbackAxisSideDirection) { | |
| 5328 | + const currentSideAxis = getSideAxis(d.placement); | |
| 5329 | + return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal | |
| 5330 | + // reading directions favoring greater width. | |
| 5331 | + currentSideAxis === "y"; | |
| 5332 | + } | |
| 5333 | + return true; | |
| 5334 | + }).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0]; | |
| 5335 | + if (placement2) { | |
| 5336 | + resetPlacement = placement2; | |
| 5337 | + } | |
| 5338 | + break; | |
| 5339 | + } | |
| 5340 | + case "initialPlacement": | |
| 5341 | + resetPlacement = initialPlacement; | |
| 5342 | + break; | |
| 5343 | + } | |
| 5344 | + } | |
| 5345 | + if (placement !== resetPlacement) { | |
| 5346 | + return { | |
| 5347 | + reset: { | |
| 5348 | + placement: resetPlacement | |
| 5349 | + } | |
| 5350 | + }; | |
| 5351 | + } | |
| 783 | 5352 | } |
| 784 | - return () => { | |
| 785 | - container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus); | |
| 786 | - setTimeout(() => { | |
| 787 | - const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS); | |
| 788 | - container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus); | |
| 789 | - container.dispatchEvent(unmountEvent); | |
| 790 | - if (!unmountEvent.defaultPrevented) { | |
| 791 | - focus(previouslyFocusedElement ?? document.body, { select: true }); | |
| 5353 | + return {}; | |
| 5354 | + } | |
| 5355 | + }; | |
| 5356 | +}; | |
| 5357 | +var originSides = /* @__PURE__ */ new Set(["left", "top"]); | |
| 5358 | +async function convertValueToCoords(state, options) { | |
| 5359 | + const { | |
| 5360 | + placement, | |
| 5361 | + platform: platform3, | |
| 5362 | + elements | |
| 5363 | + } = state; | |
| 5364 | + const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); | |
| 5365 | + const side = getSide(placement); | |
| 5366 | + const alignment = getAlignment(placement); | |
| 5367 | + const isVertical = getSideAxis(placement) === "y"; | |
| 5368 | + const mainAxisMulti = originSides.has(side) ? -1 : 1; | |
| 5369 | + const crossAxisMulti = rtl && isVertical ? -1 : 1; | |
| 5370 | + const rawValue = evaluate(options, state); | |
| 5371 | + let { | |
| 5372 | + mainAxis, | |
| 5373 | + crossAxis, | |
| 5374 | + alignmentAxis | |
| 5375 | + } = typeof rawValue === "number" ? { | |
| 5376 | + mainAxis: rawValue, | |
| 5377 | + crossAxis: 0, | |
| 5378 | + alignmentAxis: null | |
| 5379 | + } : { | |
| 5380 | + mainAxis: rawValue.mainAxis || 0, | |
| 5381 | + crossAxis: rawValue.crossAxis || 0, | |
| 5382 | + alignmentAxis: rawValue.alignmentAxis | |
| 5383 | + }; | |
| 5384 | + if (alignment && typeof alignmentAxis === "number") { | |
| 5385 | + crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; | |
| 5386 | + } | |
| 5387 | + return isVertical ? { | |
| 5388 | + x: crossAxis * crossAxisMulti, | |
| 5389 | + y: mainAxis * mainAxisMulti | |
| 5390 | + } : { | |
| 5391 | + x: mainAxis * mainAxisMulti, | |
| 5392 | + y: crossAxis * crossAxisMulti | |
| 5393 | + }; | |
| 5394 | +} | |
| 5395 | +var offset = function(options) { | |
| 5396 | + if (options === void 0) { | |
| 5397 | + options = 0; | |
| 5398 | + } | |
| 5399 | + return { | |
| 5400 | + name: "offset", | |
| 5401 | + options, | |
| 5402 | + async fn(state) { | |
| 5403 | + var _middlewareData$offse, _middlewareData$arrow; | |
| 5404 | + const { | |
| 5405 | + x, | |
| 5406 | + y, | |
| 5407 | + placement, | |
| 5408 | + middlewareData | |
| 5409 | + } = state; | |
| 5410 | + const diffCoords = await convertValueToCoords(state, options); | |
| 5411 | + if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { | |
| 5412 | + return {}; | |
| 5413 | + } | |
| 5414 | + return { | |
| 5415 | + x: x + diffCoords.x, | |
| 5416 | + y: y + diffCoords.y, | |
| 5417 | + data: { | |
| 5418 | + ...diffCoords, | |
| 5419 | + placement | |
| 5420 | + } | |
| 5421 | + }; | |
| 5422 | + } | |
| 5423 | + }; | |
| 5424 | +}; | |
| 5425 | +var shift = function(options) { | |
| 5426 | + if (options === void 0) { | |
| 5427 | + options = {}; | |
| 5428 | + } | |
| 5429 | + return { | |
| 5430 | + name: "shift", | |
| 5431 | + options, | |
| 5432 | + async fn(state) { | |
| 5433 | + const { | |
| 5434 | + x, | |
| 5435 | + y, | |
| 5436 | + placement, | |
| 5437 | + platform: platform3 | |
| 5438 | + } = state; | |
| 5439 | + const { | |
| 5440 | + mainAxis: checkMainAxis = true, | |
| 5441 | + crossAxis: checkCrossAxis = false, | |
| 5442 | + limiter = { | |
| 5443 | + fn: (_ref) => { | |
| 5444 | + let { | |
| 5445 | + x: x2, | |
| 5446 | + y: y2 | |
| 5447 | + } = _ref; | |
| 5448 | + return { | |
| 5449 | + x: x2, | |
| 5450 | + y: y2 | |
| 5451 | + }; | |
| 792 | 5452 | } |
| 793 | - container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus); | |
| 794 | - focusScopesStack.remove(focusScope); | |
| 795 | - }, 0); | |
| 5453 | + }, | |
| 5454 | + ...detectOverflowOptions | |
| 5455 | + } = evaluate(options, state); | |
| 5456 | + const coords = { | |
| 5457 | + x, | |
| 5458 | + y | |
| 796 | 5459 | }; |
| 5460 | + const overflow = await platform3.detectOverflow(state, detectOverflowOptions); | |
| 5461 | + const crossAxis = getSideAxis(placement); | |
| 5462 | + const mainAxis = getOppositeAxis(crossAxis); | |
| 5463 | + let mainAxisCoord = coords[mainAxis]; | |
| 5464 | + let crossAxisCoord = coords[crossAxis]; | |
| 5465 | + const clampCoord = (axis, coord) => clamp(coord + overflow[axis === "y" ? "top" : "left"], coord, coord - overflow[axis === "y" ? "bottom" : "right"]); | |
| 5466 | + if (checkMainAxis) { | |
| 5467 | + mainAxisCoord = clampCoord(mainAxis, mainAxisCoord); | |
| 5468 | + } | |
| 5469 | + if (checkCrossAxis) { | |
| 5470 | + crossAxisCoord = clampCoord(crossAxis, crossAxisCoord); | |
| 5471 | + } | |
| 5472 | + const limitedCoords = limiter.fn({ | |
| 5473 | + ...state, | |
| 5474 | + [mainAxis]: mainAxisCoord, | |
| 5475 | + [crossAxis]: crossAxisCoord | |
| 5476 | + }); | |
| 5477 | + return { | |
| 5478 | + ...limitedCoords, | |
| 5479 | + data: { | |
| 5480 | + x: limitedCoords.x - x, | |
| 5481 | + y: limitedCoords.y - y, | |
| 5482 | + enabled: { | |
| 5483 | + [mainAxis]: checkMainAxis, | |
| 5484 | + [crossAxis]: checkCrossAxis | |
| 5485 | + } | |
| 5486 | + } | |
| 5487 | + }; | |
| 797 | 5488 | } |
| 798 | - }, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]); | |
| 799 | - const handleKeyDown = React11.useCallback( | |
| 800 | - (event) => { | |
| 801 | - if (!loop && !trapped) return; | |
| 802 | - if (focusScope.paused) return; | |
| 803 | - const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey; | |
| 804 | - const focusedElement = document.activeElement; | |
| 805 | - if (isTabKey && focusedElement) { | |
| 806 | - const container2 = event.currentTarget; | |
| 807 | - const [first, last] = getTabbableEdges(container2); | |
| 808 | - const hasTabbableElementsInside = first && last; | |
| 809 | - if (!hasTabbableElementsInside) { | |
| 810 | - if (focusedElement === container2) event.preventDefault(); | |
| 5489 | + }; | |
| 5490 | +}; | |
| 5491 | +var limitShift = function(options) { | |
| 5492 | + if (options === void 0) { | |
| 5493 | + options = {}; | |
| 5494 | + } | |
| 5495 | + return { | |
| 5496 | + options, | |
| 5497 | + fn(state) { | |
| 5498 | + var _rawOffset$mainAxis, _rawOffset$crossAxis; | |
| 5499 | + const { | |
| 5500 | + x, | |
| 5501 | + y, | |
| 5502 | + placement, | |
| 5503 | + rects, | |
| 5504 | + middlewareData | |
| 5505 | + } = state; | |
| 5506 | + const { | |
| 5507 | + offset: offset4 = 0, | |
| 5508 | + mainAxis: checkMainAxis = true, | |
| 5509 | + crossAxis: checkCrossAxis = true | |
| 5510 | + } = evaluate(options, state); | |
| 5511 | + const coords = { | |
| 5512 | + x, | |
| 5513 | + y | |
| 5514 | + }; | |
| 5515 | + const crossAxis = getSideAxis(placement); | |
| 5516 | + const mainAxis = getOppositeAxis(crossAxis); | |
| 5517 | + let mainAxisCoord = coords[mainAxis]; | |
| 5518 | + let crossAxisCoord = coords[crossAxis]; | |
| 5519 | + const rawOffset = evaluate(offset4, state); | |
| 5520 | + const computedOffset = typeof rawOffset === "number" ? { | |
| 5521 | + mainAxis: rawOffset, | |
| 5522 | + crossAxis: 0 | |
| 5523 | + } : { | |
| 5524 | + mainAxis: (_rawOffset$mainAxis = rawOffset.mainAxis) != null ? _rawOffset$mainAxis : 0, | |
| 5525 | + crossAxis: (_rawOffset$crossAxis = rawOffset.crossAxis) != null ? _rawOffset$crossAxis : 0 | |
| 5526 | + }; | |
| 5527 | + if (checkMainAxis) { | |
| 5528 | + const len = mainAxis === "y" ? "height" : "width"; | |
| 5529 | + const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; | |
| 5530 | + const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; | |
| 5531 | + if (mainAxisCoord < limitMin) { | |
| 5532 | + mainAxisCoord = limitMin; | |
| 5533 | + } else if (mainAxisCoord > limitMax) { | |
| 5534 | + mainAxisCoord = limitMax; | |
| 5535 | + } | |
| 5536 | + } | |
| 5537 | + if (checkCrossAxis) { | |
| 5538 | + var _middlewareData$offse, _middlewareData$offse2; | |
| 5539 | + const len = mainAxis === "y" ? "width" : "height"; | |
| 5540 | + const isOriginSide = originSides.has(getSide(placement)); | |
| 5541 | + const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis); | |
| 5542 | + const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0); | |
| 5543 | + if (crossAxisCoord < limitMin) { | |
| 5544 | + crossAxisCoord = limitMin; | |
| 5545 | + } else if (crossAxisCoord > limitMax) { | |
| 5546 | + crossAxisCoord = limitMax; | |
| 5547 | + } | |
| 5548 | + } | |
| 5549 | + return { | |
| 5550 | + [mainAxis]: mainAxisCoord, | |
| 5551 | + [crossAxis]: crossAxisCoord | |
| 5552 | + }; | |
| 5553 | + } | |
| 5554 | + }; | |
| 5555 | +}; | |
| 5556 | +var size = function(options) { | |
| 5557 | + if (options === void 0) { | |
| 5558 | + options = {}; | |
| 5559 | + } | |
| 5560 | + return { | |
| 5561 | + name: "size", | |
| 5562 | + options, | |
| 5563 | + async fn(state) { | |
| 5564 | + const { | |
| 5565 | + placement, | |
| 5566 | + rects, | |
| 5567 | + platform: platform3, | |
| 5568 | + elements | |
| 5569 | + } = state; | |
| 5570 | + const { | |
| 5571 | + apply = () => { | |
| 5572 | + }, | |
| 5573 | + ...detectOverflowOptions | |
| 5574 | + } = evaluate(options, state); | |
| 5575 | + const overflow = await platform3.detectOverflow(state, detectOverflowOptions); | |
| 5576 | + const side = getSide(placement); | |
| 5577 | + const alignment = getAlignment(placement); | |
| 5578 | + const isYAxis = getSideAxis(placement) === "y"; | |
| 5579 | + const { | |
| 5580 | + width, | |
| 5581 | + height | |
| 5582 | + } = rects.floating; | |
| 5583 | + let heightSide; | |
| 5584 | + let widthSide; | |
| 5585 | + if (side === "top" || side === "bottom") { | |
| 5586 | + heightSide = side; | |
| 5587 | + widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right"; | |
| 5588 | + } else { | |
| 5589 | + widthSide = side; | |
| 5590 | + heightSide = alignment === "end" ? "top" : "bottom"; | |
| 5591 | + } | |
| 5592 | + const maximumClippingHeight = height - overflow.top - overflow.bottom; | |
| 5593 | + const maximumClippingWidth = width - overflow.left - overflow.right; | |
| 5594 | + const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight); | |
| 5595 | + const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth); | |
| 5596 | + const shiftData = state.middlewareData.shift; | |
| 5597 | + const noShift = !shiftData; | |
| 5598 | + let availableHeight2 = overflowAvailableHeight; | |
| 5599 | + let availableWidth2 = overflowAvailableWidth; | |
| 5600 | + if (shiftData != null && shiftData.enabled.x) { | |
| 5601 | + availableWidth2 = maximumClippingWidth; | |
| 5602 | + } | |
| 5603 | + if (shiftData != null && shiftData.enabled.y) { | |
| 5604 | + availableHeight2 = maximumClippingHeight; | |
| 5605 | + } | |
| 5606 | + if (noShift && !alignment) { | |
| 5607 | + if (isYAxis) { | |
| 5608 | + availableWidth2 = width - 2 * max(overflow.left, overflow.right); | |
| 811 | 5609 | } else { |
| 812 | - if (!event.shiftKey && focusedElement === last) { | |
| 813 | - event.preventDefault(); | |
| 814 | - if (loop) focus(first, { select: true }); | |
| 815 | - } else if (event.shiftKey && focusedElement === first) { | |
| 816 | - event.preventDefault(); | |
| 817 | - if (loop) focus(last, { select: true }); | |
| 5610 | + availableHeight2 = height - 2 * max(overflow.top, overflow.bottom); | |
| 5611 | + } | |
| 5612 | + } | |
| 5613 | + await apply({ | |
| 5614 | + ...state, | |
| 5615 | + availableWidth: availableWidth2, | |
| 5616 | + availableHeight: availableHeight2 | |
| 5617 | + }); | |
| 5618 | + const nextDimensions = await platform3.getDimensions(elements.floating); | |
| 5619 | + if (width !== nextDimensions.width || height !== nextDimensions.height) { | |
| 5620 | + return { | |
| 5621 | + reset: { | |
| 5622 | + rects: true | |
| 818 | 5623 | } |
| 819 | - } | |
| 5624 | + }; | |
| 820 | 5625 | } |
| 821 | - }, | |
| 822 | - [loop, trapped, focusScope.paused] | |
| 823 | - ); | |
| 824 | - return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown }); | |
| 825 | -}); | |
| 826 | -FocusScope.displayName = FOCUS_SCOPE_NAME; | |
| 827 | -function focusFirst(candidates, { select = false } = {}) { | |
| 828 | - const previouslyFocusedElement = document.activeElement; | |
| 829 | - for (const candidate of candidates) { | |
| 830 | - focus(candidate, { select }); | |
| 831 | - if (document.activeElement !== previouslyFocusedElement) return; | |
| 5626 | + return {}; | |
| 5627 | + } | |
| 5628 | + }; | |
| 5629 | +}; | |
| 5630 | + | |
| 5631 | +// node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs | |
| 5632 | +function getCssDimensions(element) { | |
| 5633 | + const css = getComputedStyle2(element); | |
| 5634 | + let width = parseFloat(css.width) || 0; | |
| 5635 | + let height = parseFloat(css.height) || 0; | |
| 5636 | + const hasOffset = isHTMLElement(element); | |
| 5637 | + const offsetWidth = hasOffset ? element.offsetWidth : width; | |
| 5638 | + const offsetHeight = hasOffset ? element.offsetHeight : height; | |
| 5639 | + const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; | |
| 5640 | + if (shouldFallback) { | |
| 5641 | + width = offsetWidth; | |
| 5642 | + height = offsetHeight; | |
| 832 | 5643 | } |
| 5644 | + return { | |
| 5645 | + width, | |
| 5646 | + height, | |
| 5647 | + $: shouldFallback | |
| 5648 | + }; | |
| 833 | 5649 | } |
| 834 | -function getTabbableEdges(container) { | |
| 835 | - const candidates = getTabbableCandidates(container); | |
| 836 | - const first = findVisible(candidates, container); | |
| 837 | - const last = findVisible(candidates.reverse(), container); | |
| 838 | - return [first, last]; | |
| 5650 | +function unwrapElement(element) { | |
| 5651 | + return !isElement(element) ? element.contextElement : element; | |
| 839 | 5652 | } |
| 840 | -function getTabbableCandidates(container) { | |
| 841 | - const nodes = []; | |
| 842 | - const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, { | |
| 843 | - acceptNode: (node) => { | |
| 844 | - const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden"; | |
| 845 | - if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; | |
| 846 | - return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; | |
| 5653 | +function getScale(element) { | |
| 5654 | + const domElement = unwrapElement(element); | |
| 5655 | + if (!isHTMLElement(domElement)) { | |
| 5656 | + return createCoords(1); | |
| 5657 | + } | |
| 5658 | + const rect = domElement.getBoundingClientRect(); | |
| 5659 | + const { | |
| 5660 | + width, | |
| 5661 | + height, | |
| 5662 | + $ | |
| 5663 | + } = getCssDimensions(domElement); | |
| 5664 | + let x = ($ ? round(rect.width) : rect.width) / width; | |
| 5665 | + let y = ($ ? round(rect.height) : rect.height) / height; | |
| 5666 | + if (!x || !Number.isFinite(x)) { | |
| 5667 | + x = 1; | |
| 5668 | + } | |
| 5669 | + if (!y || !Number.isFinite(y)) { | |
| 5670 | + y = 1; | |
| 5671 | + } | |
| 5672 | + return { | |
| 5673 | + x, | |
| 5674 | + y | |
| 5675 | + }; | |
| 5676 | +} | |
| 5677 | +var noOffsets = /* @__PURE__ */ createCoords(0); | |
| 5678 | +function getVisualOffsets(element) { | |
| 5679 | + const win = getWindow(element); | |
| 5680 | + if (!isWebKit() || !win.visualViewport) { | |
| 5681 | + return noOffsets; | |
| 5682 | + } | |
| 5683 | + return { | |
| 5684 | + x: win.visualViewport.offsetLeft, | |
| 5685 | + y: win.visualViewport.offsetTop | |
| 5686 | + }; | |
| 5687 | +} | |
| 5688 | +function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { | |
| 5689 | + if (isFixed === void 0) { | |
| 5690 | + isFixed = false; | |
| 5691 | + } | |
| 5692 | + return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element); | |
| 5693 | +} | |
| 5694 | +function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { | |
| 5695 | + if (includeScale === void 0) { | |
| 5696 | + includeScale = false; | |
| 5697 | + } | |
| 5698 | + if (isFixedStrategy === void 0) { | |
| 5699 | + isFixedStrategy = false; | |
| 5700 | + } | |
| 5701 | + const clientRect = element.getBoundingClientRect(); | |
| 5702 | + const domElement = unwrapElement(element); | |
| 5703 | + let scale = createCoords(1); | |
| 5704 | + if (includeScale) { | |
| 5705 | + if (offsetParent) { | |
| 5706 | + if (isElement(offsetParent)) { | |
| 5707 | + scale = getScale(offsetParent); | |
| 5708 | + } | |
| 5709 | + } else { | |
| 5710 | + scale = getScale(element); | |
| 847 | 5711 | } |
| 5712 | + } | |
| 5713 | + const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); | |
| 5714 | + let x = (clientRect.left + visualOffsets.x) / scale.x; | |
| 5715 | + let y = (clientRect.top + visualOffsets.y) / scale.y; | |
| 5716 | + let width = clientRect.width / scale.x; | |
| 5717 | + let height = clientRect.height / scale.y; | |
| 5718 | + if (domElement && offsetParent) { | |
| 5719 | + const win = getWindow(domElement); | |
| 5720 | + const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; | |
| 5721 | + let currentWin = win; | |
| 5722 | + let currentIFrame = getFrameElement(currentWin); | |
| 5723 | + while (currentIFrame && offsetWin !== currentWin) { | |
| 5724 | + const iframeScale = getScale(currentIFrame); | |
| 5725 | + const iframeRect = currentIFrame.getBoundingClientRect(); | |
| 5726 | + const css = getComputedStyle2(currentIFrame); | |
| 5727 | + const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; | |
| 5728 | + const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; | |
| 5729 | + x *= iframeScale.x; | |
| 5730 | + y *= iframeScale.y; | |
| 5731 | + width *= iframeScale.x; | |
| 5732 | + height *= iframeScale.y; | |
| 5733 | + x += left; | |
| 5734 | + y += top; | |
| 5735 | + currentWin = getWindow(currentIFrame); | |
| 5736 | + currentIFrame = getFrameElement(currentWin); | |
| 5737 | + } | |
| 5738 | + } | |
| 5739 | + return rectToClientRect({ | |
| 5740 | + width, | |
| 5741 | + height, | |
| 5742 | + x, | |
| 5743 | + y | |
| 848 | 5744 | }); |
| 849 | - while (walker.nextNode()) nodes.push(walker.currentNode); | |
| 850 | - return nodes; | |
| 851 | 5745 | } |
| 852 | -function findVisible(elements, container) { | |
| 853 | - for (const element of elements) { | |
| 854 | - if (!isHidden(element, { upTo: container })) return element; | |
| 5746 | +function getWindowScrollBarX(element, rect) { | |
| 5747 | + const leftScroll = getNodeScroll(element).scrollLeft; | |
| 5748 | + if (!rect) { | |
| 5749 | + return getBoundingClientRect(getDocumentElement(element)).left + leftScroll; | |
| 855 | 5750 | } |
| 5751 | + return rect.left + leftScroll; | |
| 856 | 5752 | } |
| 857 | -function isHidden(node, { upTo }) { | |
| 858 | - if (getComputedStyle(node).visibility === "hidden") return true; | |
| 859 | - while (node) { | |
| 860 | - if (upTo !== void 0 && node === upTo) return false; | |
| 861 | - if (getComputedStyle(node).display === "none") return true; | |
| 862 | - node = node.parentElement; | |
| 5753 | +function getHTMLOffset(documentElement, scroll) { | |
| 5754 | + const htmlRect = documentElement.getBoundingClientRect(); | |
| 5755 | + const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect); | |
| 5756 | + const y = htmlRect.top + scroll.scrollTop; | |
| 5757 | + return { | |
| 5758 | + x, | |
| 5759 | + y | |
| 5760 | + }; | |
| 5761 | +} | |
| 5762 | +function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { | |
| 5763 | + let { | |
| 5764 | + elements, | |
| 5765 | + rect, | |
| 5766 | + offsetParent, | |
| 5767 | + strategy | |
| 5768 | + } = _ref; | |
| 5769 | + const isFixed = strategy === "fixed"; | |
| 5770 | + const documentElement = getDocumentElement(offsetParent); | |
| 5771 | + const topLayer = elements ? isTopLayer(elements.floating) : false; | |
| 5772 | + if (offsetParent === documentElement || topLayer && isFixed) { | |
| 5773 | + return rect; | |
| 863 | 5774 | } |
| 864 | - return false; | |
| 5775 | + let scroll = { | |
| 5776 | + scrollLeft: 0, | |
| 5777 | + scrollTop: 0 | |
| 5778 | + }; | |
| 5779 | + let scale = createCoords(1); | |
| 5780 | + const offsets = createCoords(0); | |
| 5781 | + const isOffsetParentAnElement = isHTMLElement(offsetParent); | |
| 5782 | + if (isOffsetParentAnElement || !isFixed) { | |
| 5783 | + if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { | |
| 5784 | + scroll = getNodeScroll(offsetParent); | |
| 5785 | + } | |
| 5786 | + if (isOffsetParentAnElement) { | |
| 5787 | + const offsetRect = getBoundingClientRect(offsetParent); | |
| 5788 | + scale = getScale(offsetParent); | |
| 5789 | + offsets.x = offsetRect.x + offsetParent.clientLeft; | |
| 5790 | + offsets.y = offsetRect.y + offsetParent.clientTop; | |
| 5791 | + } | |
| 5792 | + } | |
| 5793 | + const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); | |
| 5794 | + return { | |
| 5795 | + width: rect.width * scale.x, | |
| 5796 | + height: rect.height * scale.y, | |
| 5797 | + x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, | |
| 5798 | + y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y | |
| 5799 | + }; | |
| 865 | 5800 | } |
| 866 | -function isSelectableInput(element) { | |
| 867 | - return element instanceof HTMLInputElement && "select" in element; | |
| 5801 | +function getClientRects(element) { | |
| 5802 | + return element.getClientRects ? Array.from(element.getClientRects()) : []; | |
| 868 | 5803 | } |
| 869 | -function focus(element, { select = false } = {}) { | |
| 870 | - if (element && element.focus) { | |
| 871 | - const previouslyFocusedElement = document.activeElement; | |
| 872 | - element.focus({ preventScroll: true }); | |
| 873 | - if (element !== previouslyFocusedElement && isSelectableInput(element) && select) | |
| 874 | - element.select(); | |
| 5804 | +function getDocumentRect(html) { | |
| 5805 | + const scroll = getNodeScroll(html); | |
| 5806 | + const body = html.ownerDocument.body; | |
| 5807 | + const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); | |
| 5808 | + const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); | |
| 5809 | + let x = -scroll.scrollLeft + getWindowScrollBarX(html); | |
| 5810 | + const y = -scroll.scrollTop; | |
| 5811 | + if (getComputedStyle2(body).direction === "rtl") { | |
| 5812 | + x += max(html.clientWidth, body.clientWidth) - width; | |
| 875 | 5813 | } |
| 5814 | + return { | |
| 5815 | + width, | |
| 5816 | + height, | |
| 5817 | + x, | |
| 5818 | + y | |
| 5819 | + }; | |
| 876 | 5820 | } |
| 877 | -var focusScopesStack = createFocusScopesStack(); | |
| 878 | -function createFocusScopesStack() { | |
| 879 | - let stack = []; | |
| 5821 | +var SCROLLBAR_MAX = 25; | |
| 5822 | +function getViewportRect(element, strategy, rootBoundary) { | |
| 5823 | + if (rootBoundary === void 0) { | |
| 5824 | + rootBoundary = "viewport"; | |
| 5825 | + } | |
| 5826 | + const isLayoutViewport = rootBoundary === "layoutViewport"; | |
| 5827 | + const win = getWindow(element); | |
| 5828 | + const html = getDocumentElement(element); | |
| 5829 | + const visualViewport = win.visualViewport; | |
| 5830 | + let width = html.clientWidth; | |
| 5831 | + let height = html.clientHeight; | |
| 5832 | + let x = 0; | |
| 5833 | + let y = 0; | |
| 5834 | + if (visualViewport) { | |
| 5835 | + const layoutRelativeClientCoords = !isWebKit() || strategy === "fixed"; | |
| 5836 | + if (isLayoutViewport) { | |
| 5837 | + if (!layoutRelativeClientCoords) { | |
| 5838 | + x = -visualViewport.offsetLeft; | |
| 5839 | + y = -visualViewport.offsetTop; | |
| 5840 | + } | |
| 5841 | + } else { | |
| 5842 | + width = visualViewport.width; | |
| 5843 | + height = visualViewport.height; | |
| 5844 | + if (layoutRelativeClientCoords) { | |
| 5845 | + x = visualViewport.offsetLeft; | |
| 5846 | + y = visualViewport.offsetTop; | |
| 5847 | + } | |
| 5848 | + } | |
| 5849 | + } | |
| 5850 | + const windowScrollbarX = getWindowScrollBarX(html); | |
| 5851 | + if (windowScrollbarX <= 0) { | |
| 5852 | + const doc = html.ownerDocument; | |
| 5853 | + const body = doc.body; | |
| 5854 | + const bodyStyles = getComputedStyle(body); | |
| 5855 | + const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0; | |
| 5856 | + const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline); | |
| 5857 | + const gutter = getComputedStyle(html).scrollbarGutter === "stable both-edges" ? reservedWidth / 2 : reservedWidth; | |
| 5858 | + if (gutter <= SCROLLBAR_MAX) { | |
| 5859 | + width -= gutter; | |
| 5860 | + } | |
| 5861 | + } | |
| 880 | 5862 | return { |
| 881 | - add(focusScope) { | |
| 882 | - const activeFocusScope = stack[0]; | |
| 883 | - if (focusScope !== activeFocusScope) { | |
| 884 | - activeFocusScope?.pause(); | |
| 5863 | + width, | |
| 5864 | + height, | |
| 5865 | + x, | |
| 5866 | + y | |
| 5867 | + }; | |
| 5868 | +} | |
| 5869 | +function getInnerBoundingClientRect(element, strategy) { | |
| 5870 | + const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); | |
| 5871 | + const top = clientRect.top + element.clientTop; | |
| 5872 | + const left = clientRect.left + element.clientLeft; | |
| 5873 | + const scale = getScale(element); | |
| 5874 | + const width = element.clientWidth * scale.x; | |
| 5875 | + const height = element.clientHeight * scale.y; | |
| 5876 | + const x = left * scale.x; | |
| 5877 | + const y = top * scale.y; | |
| 5878 | + return { | |
| 5879 | + width, | |
| 5880 | + height, | |
| 5881 | + x, | |
| 5882 | + y | |
| 5883 | + }; | |
| 5884 | +} | |
| 5885 | +function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { | |
| 5886 | + let rect; | |
| 5887 | + if (clippingAncestor === "viewport" || clippingAncestor === "layoutViewport") { | |
| 5888 | + rect = getViewportRect(element, strategy, clippingAncestor); | |
| 5889 | + } else if (clippingAncestor === "document") { | |
| 5890 | + rect = getDocumentRect(getDocumentElement(element)); | |
| 5891 | + } else if (isElement(clippingAncestor)) { | |
| 5892 | + rect = getInnerBoundingClientRect(clippingAncestor, strategy); | |
| 5893 | + } else { | |
| 5894 | + const visualOffsets = getVisualOffsets(element); | |
| 5895 | + rect = { | |
| 5896 | + x: clippingAncestor.x - visualOffsets.x, | |
| 5897 | + y: clippingAncestor.y - visualOffsets.y, | |
| 5898 | + width: clippingAncestor.width, | |
| 5899 | + height: clippingAncestor.height | |
| 5900 | + }; | |
| 5901 | + } | |
| 5902 | + return rectToClientRect(rect); | |
| 5903 | +} | |
| 5904 | +function getClippingElementAncestors(element, cache) { | |
| 5905 | + const cachedResult = cache.get(element); | |
| 5906 | + if (cachedResult) { | |
| 5907 | + return cachedResult; | |
| 5908 | + } | |
| 5909 | + let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); | |
| 5910 | + let lastKeptComputedStyle = null; | |
| 5911 | + const elementIsFixed = getComputedStyle2(element).position === "fixed"; | |
| 5912 | + let currentNode = elementIsFixed ? getParentNode(element) : element; | |
| 5913 | + while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { | |
| 5914 | + const computedStyle = getComputedStyle2(currentNode); | |
| 5915 | + const currentNodeIsContaining = isContainingBlock(currentNode); | |
| 5916 | + const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? "fixed" : ""; | |
| 5917 | + const shouldDropCurrentNode = !currentNodeIsContaining && (lastPosition === "fixed" || lastPosition === "absolute" && computedStyle.position === "static"); | |
| 5918 | + if (shouldDropCurrentNode) { | |
| 5919 | + result = result.filter((ancestor) => ancestor !== currentNode); | |
| 5920 | + } else { | |
| 5921 | + lastKeptComputedStyle = computedStyle; | |
| 5922 | + } | |
| 5923 | + currentNode = getParentNode(currentNode); | |
| 5924 | + } | |
| 5925 | + cache.set(element, result); | |
| 5926 | + return result; | |
| 5927 | +} | |
| 5928 | +function getClippingRect(_ref) { | |
| 5929 | + let { | |
| 5930 | + element, | |
| 5931 | + boundary, | |
| 5932 | + rootBoundary, | |
| 5933 | + strategy | |
| 5934 | + } = _ref; | |
| 5935 | + const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary); | |
| 5936 | + const clippingAncestors = [...elementClippingAncestors, rootBoundary]; | |
| 5937 | + const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy); | |
| 5938 | + let top = firstRect.top; | |
| 5939 | + let right = firstRect.right; | |
| 5940 | + let bottom = firstRect.bottom; | |
| 5941 | + let left = firstRect.left; | |
| 5942 | + for (let i = 1; i < clippingAncestors.length; i++) { | |
| 5943 | + const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy); | |
| 5944 | + top = max(rect.top, top); | |
| 5945 | + right = min(rect.right, right); | |
| 5946 | + bottom = min(rect.bottom, bottom); | |
| 5947 | + left = max(rect.left, left); | |
| 5948 | + } | |
| 5949 | + return { | |
| 5950 | + width: right - left, | |
| 5951 | + height: bottom - top, | |
| 5952 | + x: left, | |
| 5953 | + y: top | |
| 5954 | + }; | |
| 5955 | +} | |
| 5956 | +function getDimensions(element) { | |
| 5957 | + const { | |
| 5958 | + width, | |
| 5959 | + height | |
| 5960 | + } = getCssDimensions(element); | |
| 5961 | + return { | |
| 5962 | + width, | |
| 5963 | + height | |
| 5964 | + }; | |
| 5965 | +} | |
| 5966 | +function getRectRelativeToOffsetParent(element, offsetParent, strategy) { | |
| 5967 | + const isOffsetParentAnElement = isHTMLElement(offsetParent); | |
| 5968 | + const documentElement = getDocumentElement(offsetParent); | |
| 5969 | + const isFixed = strategy === "fixed"; | |
| 5970 | + const rect = getBoundingClientRect(element, true, isFixed, offsetParent); | |
| 5971 | + let scroll = { | |
| 5972 | + scrollLeft: 0, | |
| 5973 | + scrollTop: 0 | |
| 5974 | + }; | |
| 5975 | + const offsets = createCoords(0); | |
| 5976 | + if (isOffsetParentAnElement || !isFixed) { | |
| 5977 | + if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { | |
| 5978 | + scroll = getNodeScroll(offsetParent); | |
| 5979 | + } | |
| 5980 | + if (isOffsetParentAnElement) { | |
| 5981 | + const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); | |
| 5982 | + offsets.x = offsetRect.x + offsetParent.clientLeft; | |
| 5983 | + offsets.y = offsetRect.y + offsetParent.clientTop; | |
| 5984 | + } | |
| 5985 | + } | |
| 5986 | + if (!isOffsetParentAnElement && documentElement) { | |
| 5987 | + offsets.x = getWindowScrollBarX(documentElement); | |
| 5988 | + } | |
| 5989 | + const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); | |
| 5990 | + const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x; | |
| 5991 | + const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y; | |
| 5992 | + return { | |
| 5993 | + x, | |
| 5994 | + y, | |
| 5995 | + width: rect.width, | |
| 5996 | + height: rect.height | |
| 5997 | + }; | |
| 5998 | +} | |
| 5999 | +function isStaticPositioned(element) { | |
| 6000 | + return getComputedStyle2(element).position === "static"; | |
| 6001 | +} | |
| 6002 | +function getTrueOffsetParent(element, polyfill) { | |
| 6003 | + if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") { | |
| 6004 | + return null; | |
| 6005 | + } | |
| 6006 | + if (polyfill) { | |
| 6007 | + return polyfill(element); | |
| 6008 | + } | |
| 6009 | + let rawOffsetParent = element.offsetParent; | |
| 6010 | + if (getDocumentElement(element) === rawOffsetParent) { | |
| 6011 | + rawOffsetParent = rawOffsetParent.ownerDocument.body; | |
| 6012 | + } | |
| 6013 | + return rawOffsetParent; | |
| 6014 | +} | |
| 6015 | +function getOffsetParent(element, polyfill) { | |
| 6016 | + const win = getWindow(element); | |
| 6017 | + if (isTopLayer(element)) { | |
| 6018 | + return win; | |
| 6019 | + } | |
| 6020 | + if (!isHTMLElement(element)) { | |
| 6021 | + let svgOffsetParent = getParentNode(element); | |
| 6022 | + while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { | |
| 6023 | + if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { | |
| 6024 | + return svgOffsetParent; | |
| 885 | 6025 | } |
| 886 | - stack = arrayRemove(stack, focusScope); | |
| 887 | - stack.unshift(focusScope); | |
| 888 | - }, | |
| 889 | - remove(focusScope) { | |
| 890 | - stack = arrayRemove(stack, focusScope); | |
| 891 | - stack[0]?.resume(); | |
| 6026 | + svgOffsetParent = getParentNode(svgOffsetParent); | |
| 892 | 6027 | } |
| 6028 | + return win; | |
| 6029 | + } | |
| 6030 | + let offsetParent = getTrueOffsetParent(element, polyfill); | |
| 6031 | + while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) { | |
| 6032 | + offsetParent = getTrueOffsetParent(offsetParent, polyfill); | |
| 6033 | + } | |
| 6034 | + if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) { | |
| 6035 | + return win; | |
| 6036 | + } | |
| 6037 | + return offsetParent || getContainingBlock(element) || win; | |
| 6038 | +} | |
| 6039 | +var getElementRects = async function(data) { | |
| 6040 | + const getOffsetParentFn = this.getOffsetParent || getOffsetParent; | |
| 6041 | + const getDimensionsFn = this.getDimensions; | |
| 6042 | + const floatingDimensions = await getDimensionsFn(data.floating); | |
| 6043 | + return { | |
| 6044 | + reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), | |
| 6045 | + floating: { | |
| 6046 | + x: 0, | |
| 6047 | + y: 0, | |
| 6048 | + width: floatingDimensions.width, | |
| 6049 | + height: floatingDimensions.height | |
| 6050 | + } | |
| 893 | 6051 | }; |
| 6052 | +}; | |
| 6053 | +function isRTL(element) { | |
| 6054 | + return getComputedStyle2(element).direction === "rtl"; | |
| 894 | 6055 | } |
| 895 | -function arrayRemove(array, item) { | |
| 896 | - const updatedArray = [...array]; | |
| 897 | - const index = updatedArray.indexOf(item); | |
| 898 | - if (index !== -1) { | |
| 899 | - updatedArray.splice(index, 1); | |
| 6056 | +var platform2 = { | |
| 6057 | + convertOffsetParentRelativeRectToViewportRelativeRect, | |
| 6058 | + getDocumentElement, | |
| 6059 | + getClippingRect, | |
| 6060 | + getOffsetParent, | |
| 6061 | + getElementRects, | |
| 6062 | + getClientRects, | |
| 6063 | + getDimensions, | |
| 6064 | + getScale, | |
| 6065 | + isElement, | |
| 6066 | + isRTL | |
| 6067 | +}; | |
| 6068 | +function rectsAreEqual(a, b) { | |
| 6069 | + return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; | |
| 6070 | +} | |
| 6071 | +function observeMove(element, onMove, ancestorResize) { | |
| 6072 | + let io = null; | |
| 6073 | + let timeoutId; | |
| 6074 | + const root2 = getDocumentElement(element); | |
| 6075 | + function cleanup() { | |
| 6076 | + var _io; | |
| 6077 | + clearTimeout(timeoutId); | |
| 6078 | + (_io = io) == null || _io.disconnect(); | |
| 6079 | + io = null; | |
| 900 | 6080 | } |
| 901 | - return updatedArray; | |
| 6081 | + function refresh(skip, threshold) { | |
| 6082 | + if (skip === void 0) { | |
| 6083 | + skip = false; | |
| 6084 | + } | |
| 6085 | + if (threshold === void 0) { | |
| 6086 | + threshold = 1; | |
| 6087 | + } | |
| 6088 | + cleanup(); | |
| 6089 | + const elementRectForRootMargin = element.getBoundingClientRect(); | |
| 6090 | + const { | |
| 6091 | + left, | |
| 6092 | + top, | |
| 6093 | + width, | |
| 6094 | + height | |
| 6095 | + } = elementRectForRootMargin; | |
| 6096 | + if (!skip) { | |
| 6097 | + onMove(); | |
| 6098 | + } | |
| 6099 | + if (!width || !height) { | |
| 6100 | + return; | |
| 6101 | + } | |
| 6102 | + const insetTop = floor(top); | |
| 6103 | + const insetRight = floor(root2.clientWidth - (left + width)); | |
| 6104 | + const insetBottom = floor(root2.clientHeight - (top + height)); | |
| 6105 | + const insetLeft = floor(left); | |
| 6106 | + const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; | |
| 6107 | + const options = { | |
| 6108 | + rootMargin, | |
| 6109 | + threshold: max(0, min(1, threshold)) || 1 | |
| 6110 | + }; | |
| 6111 | + let isFirstUpdate = true; | |
| 6112 | + function handleObserve(entries) { | |
| 6113 | + const ratio = entries[0].intersectionRatio; | |
| 6114 | + if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) { | |
| 6115 | + return refresh(); | |
| 6116 | + } | |
| 6117 | + if (ratio !== threshold) { | |
| 6118 | + if (!isFirstUpdate) { | |
| 6119 | + return refresh(); | |
| 6120 | + } | |
| 6121 | + if (!ratio) { | |
| 6122 | + timeoutId = setTimeout(() => { | |
| 6123 | + refresh(false, 1e-7); | |
| 6124 | + }, 1e3); | |
| 6125 | + } else { | |
| 6126 | + refresh(false, ratio); | |
| 6127 | + } | |
| 6128 | + } | |
| 6129 | + isFirstUpdate = false; | |
| 6130 | + } | |
| 6131 | + try { | |
| 6132 | + io = new IntersectionObserver(handleObserve, { | |
| 6133 | + ...options, | |
| 6134 | + // Handle <iframe>s | |
| 6135 | + root: root2.ownerDocument | |
| 6136 | + }); | |
| 6137 | + } catch (_e) { | |
| 6138 | + io = new IntersectionObserver(handleObserve, options); | |
| 6139 | + } | |
| 6140 | + io.observe(element); | |
| 6141 | + } | |
| 6142 | + const win = getWindow(element); | |
| 6143 | + const handleResize = () => refresh(ancestorResize); | |
| 6144 | + win.addEventListener("resize", handleResize); | |
| 6145 | + refresh(true); | |
| 6146 | + return () => { | |
| 6147 | + win.removeEventListener("resize", handleResize); | |
| 6148 | + cleanup(); | |
| 6149 | + }; | |
| 902 | 6150 | } |
| 903 | -function removeLinks(items) { | |
| 904 | - return items.filter((item) => item.tagName !== "A"); | |
| 6151 | +function autoUpdate(reference, floating, update2, options) { | |
| 6152 | + if (options === void 0) { | |
| 6153 | + options = {}; | |
| 6154 | + } | |
| 6155 | + const { | |
| 6156 | + ancestorScroll = true, | |
| 6157 | + ancestorResize = true, | |
| 6158 | + elementResize = typeof ResizeObserver === "function", | |
| 6159 | + layoutShift = typeof IntersectionObserver === "function", | |
| 6160 | + animationFrame = false | |
| 6161 | + } = options; | |
| 6162 | + const referenceEl = unwrapElement(reference); | |
| 6163 | + const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : []; | |
| 6164 | + ancestors.forEach((ancestor) => { | |
| 6165 | + ancestorScroll && ancestor.addEventListener("scroll", update2); | |
| 6166 | + ancestorResize && ancestor.addEventListener("resize", update2); | |
| 6167 | + }); | |
| 6168 | + const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2, ancestorResize) : null; | |
| 6169 | + let reobserveFrame = -1; | |
| 6170 | + let resizeObserver = null; | |
| 6171 | + if (elementResize) { | |
| 6172 | + resizeObserver = new ResizeObserver((_ref) => { | |
| 6173 | + let [firstEntry] = _ref; | |
| 6174 | + if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) { | |
| 6175 | + resizeObserver.unobserve(floating); | |
| 6176 | + cancelAnimationFrame(reobserveFrame); | |
| 6177 | + reobserveFrame = requestAnimationFrame(() => { | |
| 6178 | + var _resizeObserver; | |
| 6179 | + (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); | |
| 6180 | + }); | |
| 6181 | + } | |
| 6182 | + update2(); | |
| 6183 | + }); | |
| 6184 | + if (referenceEl && !animationFrame) { | |
| 6185 | + resizeObserver.observe(referenceEl); | |
| 6186 | + } | |
| 6187 | + if (floating) { | |
| 6188 | + resizeObserver.observe(floating); | |
| 6189 | + } | |
| 6190 | + } | |
| 6191 | + let frameId; | |
| 6192 | + let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; | |
| 6193 | + if (animationFrame) { | |
| 6194 | + frameLoop(); | |
| 6195 | + } | |
| 6196 | + function frameLoop() { | |
| 6197 | + const nextRefRect = getBoundingClientRect(reference); | |
| 6198 | + if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) { | |
| 6199 | + update2(); | |
| 6200 | + } | |
| 6201 | + prevRefRect = nextRefRect; | |
| 6202 | + frameId = requestAnimationFrame(frameLoop); | |
| 6203 | + } | |
| 6204 | + update2(); | |
| 6205 | + return () => { | |
| 6206 | + var _resizeObserver2; | |
| 6207 | + ancestors.forEach((ancestor) => { | |
| 6208 | + ancestorScroll && ancestor.removeEventListener("scroll", update2); | |
| 6209 | + ancestorResize && ancestor.removeEventListener("resize", update2); | |
| 6210 | + }); | |
| 6211 | + cleanupIo == null || cleanupIo(); | |
| 6212 | + (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); | |
| 6213 | + resizeObserver = null; | |
| 6214 | + if (animationFrame) { | |
| 6215 | + cancelAnimationFrame(frameId); | |
| 6216 | + } | |
| 6217 | + }; | |
| 905 | 6218 | } |
| 6219 | +var offset2 = offset; | |
| 6220 | +var shift2 = shift; | |
| 6221 | +var flip2 = flip; | |
| 6222 | +var size2 = size; | |
| 6223 | +var limitShift2 = limitShift; | |
| 6224 | +var computePosition2 = (reference, floating, options) => { | |
| 6225 | + const cache = /* @__PURE__ */ new Map(); | |
| 6226 | + const mergedOptions = options != null ? options : {}; | |
| 6227 | + const platformWithCache = { | |
| 6228 | + ...platform2, | |
| 6229 | + ...mergedOptions.platform, | |
| 6230 | + _c: cache | |
| 6231 | + }; | |
| 6232 | + return computePosition(reference, floating, { | |
| 6233 | + ...mergedOptions, | |
| 6234 | + platform: platformWithCache | |
| 6235 | + }); | |
| 6236 | +}; | |
| 906 | 6237 | |
| 907 | -// node_modules/@radix-ui/react-portal/dist/index.mjs | |
| 908 | -var React12 = __toESM(require_react(), 1); | |
| 909 | -var import_react_dom = __toESM(require_react_dom(), 1); | |
| 910 | -var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); | |
| 911 | -var PORTAL_NAME = "Portal"; | |
| 912 | -var Portal = React12.forwardRef((props, forwardedRef) => { | |
| 913 | - const { container: containerProp, ...portalProps } = props; | |
| 914 | - const [mounted, setMounted] = React12.useState(false); | |
| 915 | - useLayoutEffect2(() => setMounted(true), []); | |
| 916 | - const container = containerProp || mounted && globalThis?.document?.body; | |
| 917 | - return container ? import_react_dom.default.createPortal(/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null; | |
| 918 | -}); | |
| 919 | -Portal.displayName = PORTAL_NAME; | |
| 920 | - | |
| 921 | -// node_modules/@radix-ui/react-presence/dist/index.mjs | |
| 922 | -var React23 = __toESM(require_react(), 1); | |
| 923 | -var React13 = __toESM(require_react(), 1); | |
| 924 | -function useStateMachine(initialState, machine) { | |
| 925 | - return React13.useReducer((state, event) => { | |
| 926 | - const nextState = machine[state][event]; | |
| 927 | - return nextState ?? state; | |
| 928 | - }, initialState); | |
| 929 | -} | |
| 930 | -var Presence = (props) => { | |
| 931 | - const { present, children } = props; | |
| 932 | - const presence = usePresence(present); | |
| 933 | - const child = typeof children === "function" ? children({ present: presence.isPresent }) : React23.Children.only(children); | |
| 934 | - const ref = useComposedRefs(presence.ref, getElementRef2(child)); | |
| 935 | - const forceMount = typeof children === "function"; | |
| 936 | - return forceMount || presence.isPresent ? React23.cloneElement(child, { ref }) : null; | |
| 6238 | +// node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs | |
| 6239 | +var React26 = __toESM(require_react(), 1); | |
| 6240 | +var import_react2 = __toESM(require_react(), 1); | |
| 6241 | +var ReactDOM3 = __toESM(require_react_dom(), 1); | |
| 6242 | +var isClient = typeof document !== "undefined"; | |
| 6243 | +var noop2 = function noop3() { | |
| 937 | 6244 | }; |
| 938 | -Presence.displayName = "Presence"; | |
| 939 | -function usePresence(present) { | |
| 940 | - const [node, setNode] = React23.useState(); | |
| 941 | - const stylesRef = React23.useRef(null); | |
| 942 | - const prevPresentRef = React23.useRef(present); | |
| 943 | - const prevAnimationNameRef = React23.useRef("none"); | |
| 944 | - const initialState = present ? "mounted" : "unmounted"; | |
| 945 | - const [state, send] = useStateMachine(initialState, { | |
| 946 | - mounted: { | |
| 947 | - UNMOUNT: "unmounted", | |
| 948 | - ANIMATION_OUT: "unmountSuspended" | |
| 949 | - }, | |
| 950 | - unmountSuspended: { | |
| 951 | - MOUNT: "mounted", | |
| 952 | - ANIMATION_END: "unmounted" | |
| 953 | - }, | |
| 954 | - unmounted: { | |
| 955 | - MOUNT: "mounted" | |
| 6245 | +var index = isClient ? import_react2.useLayoutEffect : noop2; | |
| 6246 | +function deepEqual(a, b) { | |
| 6247 | + if (a === b) { | |
| 6248 | + return true; | |
| 6249 | + } | |
| 6250 | + if (typeof a !== typeof b) { | |
| 6251 | + return false; | |
| 6252 | + } | |
| 6253 | + if (typeof a === "function" && a.toString() === b.toString()) { | |
| 6254 | + return true; | |
| 6255 | + } | |
| 6256 | + let length; | |
| 6257 | + let i; | |
| 6258 | + let keys; | |
| 6259 | + if (a && b && typeof a === "object") { | |
| 6260 | + if (Array.isArray(a)) { | |
| 6261 | + length = a.length; | |
| 6262 | + if (length !== b.length) return false; | |
| 6263 | + for (i = length; i-- !== 0; ) { | |
| 6264 | + if (!deepEqual(a[i], b[i])) { | |
| 6265 | + return false; | |
| 6266 | + } | |
| 6267 | + } | |
| 6268 | + return true; | |
| 956 | 6269 | } |
| 6270 | + keys = Object.keys(a); | |
| 6271 | + length = keys.length; | |
| 6272 | + if (length !== Object.keys(b).length) { | |
| 6273 | + return false; | |
| 6274 | + } | |
| 6275 | + for (i = length; i-- !== 0; ) { | |
| 6276 | + if (!{}.hasOwnProperty.call(b, keys[i])) { | |
| 6277 | + return false; | |
| 6278 | + } | |
| 6279 | + } | |
| 6280 | + for (i = length; i-- !== 0; ) { | |
| 6281 | + const key = keys[i]; | |
| 6282 | + if (key === "_owner" && a.$$typeof) { | |
| 6283 | + continue; | |
| 6284 | + } | |
| 6285 | + if (!deepEqual(a[key], b[key])) { | |
| 6286 | + return false; | |
| 6287 | + } | |
| 6288 | + } | |
| 6289 | + return true; | |
| 6290 | + } | |
| 6291 | + return a !== a && b !== b; | |
| 6292 | +} | |
| 6293 | +function getDPR(element) { | |
| 6294 | + if (typeof window === "undefined") { | |
| 6295 | + return 1; | |
| 6296 | + } | |
| 6297 | + const win = element.ownerDocument.defaultView || window; | |
| 6298 | + return win.devicePixelRatio || 1; | |
| 6299 | +} | |
| 6300 | +function roundByDPR(element, value) { | |
| 6301 | + const dpr = getDPR(element); | |
| 6302 | + return Math.round(value * dpr) / dpr; | |
| 6303 | +} | |
| 6304 | +function useLatestRef(value) { | |
| 6305 | + const ref = React26.useRef(value); | |
| 6306 | + index(() => { | |
| 6307 | + ref.current = value; | |
| 957 | 6308 | }); |
| 958 | - React23.useEffect(() => { | |
| 959 | - const currentAnimationName = getAnimationName(stylesRef.current); | |
| 960 | - prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none"; | |
| 961 | - }, [state]); | |
| 962 | - useLayoutEffect2(() => { | |
| 963 | - const styles = stylesRef.current; | |
| 964 | - const wasPresent = prevPresentRef.current; | |
| 965 | - const hasPresentChanged = wasPresent !== present; | |
| 966 | - if (hasPresentChanged) { | |
| 967 | - const prevAnimationName = prevAnimationNameRef.current; | |
| 968 | - const currentAnimationName = getAnimationName(styles); | |
| 969 | - if (present) { | |
| 970 | - send("MOUNT"); | |
| 971 | - } else if (currentAnimationName === "none" || styles?.display === "none") { | |
| 972 | - send("UNMOUNT"); | |
| 973 | - } else { | |
| 974 | - const isAnimating = prevAnimationName !== currentAnimationName; | |
| 975 | - if (wasPresent && isAnimating) { | |
| 976 | - send("ANIMATION_OUT"); | |
| 977 | - } else { | |
| 978 | - send("UNMOUNT"); | |
| 6309 | + return ref; | |
| 6310 | +} | |
| 6311 | +function useFloating(options) { | |
| 6312 | + if (options === void 0) { | |
| 6313 | + options = {}; | |
| 6314 | + } | |
| 6315 | + const { | |
| 6316 | + placement = "bottom", | |
| 6317 | + strategy = "absolute", | |
| 6318 | + middleware = [], | |
| 6319 | + platform: platform3, | |
| 6320 | + elements: { | |
| 6321 | + reference: externalReference, | |
| 6322 | + floating: externalFloating | |
| 6323 | + } = {}, | |
| 6324 | + transform = true, | |
| 6325 | + whileElementsMounted, | |
| 6326 | + open: open2 | |
| 6327 | + } = options; | |
| 6328 | + const [data, setData] = React26.useState({ | |
| 6329 | + x: 0, | |
| 6330 | + y: 0, | |
| 6331 | + strategy, | |
| 6332 | + placement, | |
| 6333 | + middlewareData: {}, | |
| 6334 | + isPositioned: false | |
| 6335 | + }); | |
| 6336 | + const [latestMiddleware, setLatestMiddleware] = React26.useState(middleware); | |
| 6337 | + if (!deepEqual(latestMiddleware, middleware)) { | |
| 6338 | + setLatestMiddleware(middleware); | |
| 6339 | + } | |
| 6340 | + const [_reference, _setReference] = React26.useState(null); | |
| 6341 | + const [_floating, _setFloating] = React26.useState(null); | |
| 6342 | + const setReference = React26.useCallback((node) => { | |
| 6343 | + if (node !== referenceRef.current) { | |
| 6344 | + referenceRef.current = node; | |
| 6345 | + _setReference(node); | |
| 6346 | + } | |
| 6347 | + }, []); | |
| 6348 | + const setFloating = React26.useCallback((node) => { | |
| 6349 | + if (node !== floatingRef.current) { | |
| 6350 | + floatingRef.current = node; | |
| 6351 | + _setFloating(node); | |
| 6352 | + } | |
| 6353 | + }, []); | |
| 6354 | + const referenceEl = externalReference || _reference; | |
| 6355 | + const floatingEl = externalFloating || _floating; | |
| 6356 | + const referenceRef = React26.useRef(null); | |
| 6357 | + const floatingRef = React26.useRef(null); | |
| 6358 | + const dataRef = React26.useRef(data); | |
| 6359 | + const hasWhileElementsMounted = whileElementsMounted != null; | |
| 6360 | + const whileElementsMountedRef = useLatestRef(whileElementsMounted); | |
| 6361 | + const platformRef = useLatestRef(platform3); | |
| 6362 | + const openRef = useLatestRef(open2); | |
| 6363 | + const update2 = React26.useCallback(() => { | |
| 6364 | + if (!referenceRef.current || !floatingRef.current) { | |
| 6365 | + return; | |
| 6366 | + } | |
| 6367 | + const config = { | |
| 6368 | + placement, | |
| 6369 | + strategy, | |
| 6370 | + middleware: latestMiddleware | |
| 6371 | + }; | |
| 6372 | + if (platformRef.current) { | |
| 6373 | + config.platform = platformRef.current; | |
| 6374 | + } | |
| 6375 | + computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => { | |
| 6376 | + const fullData = { | |
| 6377 | + ...data2, | |
| 6378 | + // The floating element's position may be recomputed while it's closed | |
| 6379 | + // but still mounted (such as when transitioning out). To ensure | |
| 6380 | + // `isPositioned` will be `false` initially on the next open, avoid | |
| 6381 | + // setting it to `true` when `open === false` (must be specified). | |
| 6382 | + isPositioned: openRef.current !== false | |
| 6383 | + }; | |
| 6384 | + if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { | |
| 6385 | + dataRef.current = fullData; | |
| 6386 | + ReactDOM3.flushSync(() => { | |
| 6387 | + setData(fullData); | |
| 6388 | + }); | |
| 6389 | + } | |
| 6390 | + }); | |
| 6391 | + }, [latestMiddleware, placement, strategy, platformRef, openRef]); | |
| 6392 | + index(() => { | |
| 6393 | + if (open2 === false && dataRef.current.isPositioned) { | |
| 6394 | + dataRef.current.isPositioned = false; | |
| 6395 | + setData((data2) => ({ | |
| 6396 | + ...data2, | |
| 6397 | + isPositioned: false | |
| 6398 | + })); | |
| 6399 | + } | |
| 6400 | + }, [open2]); | |
| 6401 | + const isMountedRef = React26.useRef(false); | |
| 6402 | + index(() => { | |
| 6403 | + isMountedRef.current = true; | |
| 6404 | + return () => { | |
| 6405 | + isMountedRef.current = false; | |
| 6406 | + }; | |
| 6407 | + }, []); | |
| 6408 | + index(() => { | |
| 6409 | + if (referenceEl) referenceRef.current = referenceEl; | |
| 6410 | + if (floatingEl) floatingRef.current = floatingEl; | |
| 6411 | + if (referenceEl && floatingEl) { | |
| 6412 | + if (whileElementsMountedRef.current) { | |
| 6413 | + return whileElementsMountedRef.current(referenceEl, floatingEl, update2); | |
| 6414 | + } | |
| 6415 | + update2(); | |
| 6416 | + } | |
| 6417 | + }, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]); | |
| 6418 | + const refs = React26.useMemo(() => ({ | |
| 6419 | + reference: referenceRef, | |
| 6420 | + floating: floatingRef, | |
| 6421 | + setReference, | |
| 6422 | + setFloating | |
| 6423 | + }), [setReference, setFloating]); | |
| 6424 | + const elements = React26.useMemo(() => ({ | |
| 6425 | + reference: referenceEl, | |
| 6426 | + floating: floatingEl | |
| 6427 | + }), [referenceEl, floatingEl]); | |
| 6428 | + const floatingStyles = React26.useMemo(() => { | |
| 6429 | + const initialStyles = { | |
| 6430 | + position: strategy, | |
| 6431 | + left: 0, | |
| 6432 | + top: 0 | |
| 6433 | + }; | |
| 6434 | + if (!elements.floating) { | |
| 6435 | + return initialStyles; | |
| 6436 | + } | |
| 6437 | + const x = roundByDPR(elements.floating, data.x); | |
| 6438 | + const y = roundByDPR(elements.floating, data.y); | |
| 6439 | + if (transform) { | |
| 6440 | + return { | |
| 6441 | + ...initialStyles, | |
| 6442 | + transform: "translate(" + x + "px, " + y + "px)", | |
| 6443 | + ...getDPR(elements.floating) >= 1.5 && { | |
| 6444 | + willChange: "transform" | |
| 979 | 6445 | } |
| 6446 | + }; | |
| 6447 | + } | |
| 6448 | + return { | |
| 6449 | + position: strategy, | |
| 6450 | + left: x, | |
| 6451 | + top: y | |
| 6452 | + }; | |
| 6453 | + }, [strategy, transform, elements.floating, data.x, data.y]); | |
| 6454 | + return React26.useMemo(() => ({ | |
| 6455 | + ...data, | |
| 6456 | + update: update2, | |
| 6457 | + refs, | |
| 6458 | + elements, | |
| 6459 | + floatingStyles | |
| 6460 | + }), [data, update2, refs, elements, floatingStyles]); | |
| 6461 | +} | |
| 6462 | +var offset3 = (options, deps) => { | |
| 6463 | + const result = offset2(options); | |
| 6464 | + return { | |
| 6465 | + name: result.name, | |
| 6466 | + fn: result.fn, | |
| 6467 | + options: [options, deps] | |
| 6468 | + }; | |
| 6469 | +}; | |
| 6470 | +var shift3 = (options, deps) => { | |
| 6471 | + const result = shift2(options); | |
| 6472 | + return { | |
| 6473 | + name: result.name, | |
| 6474 | + fn: result.fn, | |
| 6475 | + options: [options, deps] | |
| 6476 | + }; | |
| 6477 | +}; | |
| 6478 | +var limitShift3 = (options, deps) => { | |
| 6479 | + const result = limitShift2(options); | |
| 6480 | + return { | |
| 6481 | + fn: result.fn, | |
| 6482 | + options: [options, deps] | |
| 6483 | + }; | |
| 6484 | +}; | |
| 6485 | +var flip3 = (options, deps) => { | |
| 6486 | + const result = flip2(options); | |
| 6487 | + return { | |
| 6488 | + name: result.name, | |
| 6489 | + fn: result.fn, | |
| 6490 | + options: [options, deps] | |
| 6491 | + }; | |
| 6492 | +}; | |
| 6493 | +var size3 = (options, deps) => { | |
| 6494 | + const result = size2(options); | |
| 6495 | + return { | |
| 6496 | + name: result.name, | |
| 6497 | + fn: result.fn, | |
| 6498 | + options: [options, deps] | |
| 6499 | + }; | |
| 6500 | +}; | |
| 6501 | + | |
| 6502 | +// node_modules/@base-ui/react/utils/popups/popupHandle.mjs | |
| 6503 | +var BasePopupHandle = class { | |
| 6504 | + /** | |
| 6505 | + * Stores of every root currently using this handle, in attach order. A handle is meant to be used | |
| 6506 | + * by a single mounted root, but roots can transiently overlap (e.g. during an animated route | |
| 6507 | + * transition), so this stack lets `attachStore`'s cleanup restore the previous root instead of | |
| 6508 | + * leaving a still-mounted root uncontrollable when a newer overlapping root detaches first. | |
| 6509 | + */ | |
| 6510 | + attachedStores = []; | |
| 6511 | + /** | |
| 6512 | + * Store of the root that currently controls the handle: the most recently attached one still | |
| 6513 | + * mounted, or `null` when no root is attached. Imperative methods are no-ops while this is `null`. | |
| 6514 | + */ | |
| 6515 | + attachedStoreValue = null; | |
| 6516 | + /** | |
| 6517 | + * Listeners notified when `attachedStore` changes, so detached triggers can follow the store pointer. | |
| 6518 | + */ | |
| 6519 | + storeListeners = /* @__PURE__ */ new Set(); | |
| 6520 | + /** | |
| 6521 | + * Creates a handle backed by the store used while no root is attached. | |
| 6522 | + * | |
| 6523 | + * @param fallbackStore Inert, closed store handed to detached triggers while no root is attached, | |
| 6524 | + * so they can render and register without a mounted root. Triggers register into whichever store | |
| 6525 | + * `store` currently resolves to, so while detached they live in this store's trigger map and | |
| 6526 | + * migrate themselves to the root's store (and back) as it attaches/detaches. | |
| 6527 | + * @param componentName Component name used to prefix dev warnings, e.g. `'Menu'` produces | |
| 6528 | + * `MenuHandle.open()` in warning text. | |
| 6529 | + * @param throwOnMissingTrigger Whether `open(triggerId)` throws when no trigger with that id is | |
| 6530 | + * registered. Anchored popups (Menu, Popover, Tooltip, PreviewCard) need a trigger to anchor to, | |
| 6531 | + * so they throw; Dialog is not anchored and instead opens unassociated with a dev warning. | |
| 6532 | + */ | |
| 6533 | + constructor(fallbackStore, componentName, throwOnMissingTrigger = true) { | |
| 6534 | + this.fallbackStore = fallbackStore; | |
| 6535 | + this.componentName = componentName; | |
| 6536 | + this.throwOnMissingTrigger = throwOnMissingTrigger; | |
| 6537 | + } | |
| 6538 | + get attachedStore() { | |
| 6539 | + return this.attachedStoreValue; | |
| 6540 | + } | |
| 6541 | + /** | |
| 6542 | + * Store that detached triggers read from: the attached root's store, or an inert fallback store | |
| 6543 | + * used while no root is attached. | |
| 6544 | + * @internal | |
| 6545 | + */ | |
| 6546 | + get store() { | |
| 6547 | + return this.attachedStoreValue ?? this.fallbackStore; | |
| 6548 | + } | |
| 6549 | + /** | |
| 6550 | + * Stable fallback store used for server rendering and hydration. Root stores cannot be recorded on | |
| 6551 | + * the handle during render because a handle can be shared by concurrent server-rendered requests. | |
| 6552 | + * @internal | |
| 6553 | + */ | |
| 6554 | + get serverStore() { | |
| 6555 | + return this.fallbackStore; | |
| 6556 | + } | |
| 6557 | + /** | |
| 6558 | + * Subscribes to changes of the attached store pointer so detached triggers re-render and re-bind | |
| 6559 | + * when a root attaches or detaches. Returns a function that removes the listener. | |
| 6560 | + * @internal | |
| 6561 | + */ | |
| 6562 | + subscribeStore(listener) { | |
| 6563 | + this.storeListeners.add(listener); | |
| 6564 | + return () => { | |
| 6565 | + this.storeListeners.delete(listener); | |
| 6566 | + }; | |
| 6567 | + } | |
| 6568 | + /** | |
| 6569 | + * Points the handle at a root's store and notifies subscribers so detached triggers re-render and | |
| 6570 | + * re-register into it (their registration effect migrates them when the store pointer changes). | |
| 6571 | + * Returns a cleanup function that detaches the store again. | |
| 6572 | + * @internal | |
| 6573 | + */ | |
| 6574 | + attachStore(newStore) { | |
| 6575 | + this.attachedStores.push(newStore); | |
| 6576 | + this.setActiveStore(newStore); | |
| 6577 | + if (true) { | |
| 6578 | + if (this.attachedStores.length > 1) { | |
| 6579 | + const dev = this; | |
| 6580 | + (dev.overlapWarningFrame ??= AnimationFrame.create()).request(() => { | |
| 6581 | + if (this.attachedStores.length > 1) { | |
| 6582 | + console.warn("Base UI: A handle is attached to more than one mounted root at the same time. The most recently mounted root takes over and the previous one stops being controlled by the handle. A handle should be used by a single root that stays mounted for the lifetime of the handle."); | |
| 6583 | + } | |
| 6584 | + }); | |
| 980 | 6585 | } |
| 981 | - prevPresentRef.current = present; | |
| 982 | 6586 | } |
| 983 | - }, [present, send]); | |
| 984 | - useLayoutEffect2(() => { | |
| 985 | - if (node) { | |
| 986 | - let timeoutId; | |
| 987 | - const ownerWindow = node.ownerDocument.defaultView ?? window; | |
| 988 | - const handleAnimationEnd = (event) => { | |
| 989 | - const currentAnimationName = getAnimationName(stylesRef.current); | |
| 990 | - const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName)); | |
| 991 | - if (event.target === node && isCurrentAnimation) { | |
| 992 | - send("ANIMATION_END"); | |
| 993 | - if (!prevPresentRef.current) { | |
| 994 | - const currentFillMode = node.style.animationFillMode; | |
| 995 | - node.style.animationFillMode = "forwards"; | |
| 996 | - timeoutId = ownerWindow.setTimeout(() => { | |
| 997 | - if (node.style.animationFillMode === "forwards") { | |
| 998 | - node.style.animationFillMode = currentFillMode; | |
| 999 | - } | |
| 1000 | - }); | |
| 6587 | + return () => { | |
| 6588 | + const index2 = this.attachedStores.lastIndexOf(newStore); | |
| 6589 | + if (index2 !== -1) { | |
| 6590 | + this.attachedStores.splice(index2, 1); | |
| 6591 | + } | |
| 6592 | + this.setActiveStore(this.attachedStores[this.attachedStores.length - 1] ?? null); | |
| 6593 | + }; | |
| 6594 | + } | |
| 6595 | + /** | |
| 6596 | + * Sets the store that currently controls the handle and notifies subscribers when it changes, so | |
| 6597 | + * detached triggers re-render and migrate their registration to the new store. | |
| 6598 | + */ | |
| 6599 | + setActiveStore(store) { | |
| 6600 | + if (this.attachedStoreValue !== store) { | |
| 6601 | + this.attachedStoreValue = store; | |
| 6602 | + this.storeListeners.forEach((listener) => { | |
| 6603 | + listener(); | |
| 6604 | + }); | |
| 6605 | + } | |
| 6606 | + } | |
| 6607 | + /** | |
| 6608 | + * Opens the attached root's store and associates it with the trigger with the given id, or a | |
| 6609 | + * no-op (with a dev warning) while no root is attached. Shared by every concrete handle's public | |
| 6610 | + * `open()` method, which only narrows the parameter type. | |
| 6611 | + * | |
| 6612 | + * When a trigger id is given but no matching trigger is registered, anchored popups throw (see | |
| 6613 | + * `throwOnMissingTrigger`); Dialog opens unassociated with a dev warning instead. | |
| 6614 | + * | |
| 6615 | + * This method should only be called in an event handler or an effect (not during rendering). | |
| 6616 | + * | |
| 6617 | + * @param triggerId ID of the trigger to associate with the popup, or `null`/`undefined` to open | |
| 6618 | + * without associating any trigger. | |
| 6619 | + */ | |
| 6620 | + openByTrigger(triggerId) { | |
| 6621 | + const attachedStore = this.attachedStore; | |
| 6622 | + if (attachedStore === null) { | |
| 6623 | + if (true) { | |
| 6624 | + console.warn(`Base UI: ${this.componentName}Handle.open() was called while no root using this handle is mounted. The call was ignored; mount a root with this handle before opening it imperatively.`); | |
| 6625 | + } | |
| 6626 | + return; | |
| 6627 | + } | |
| 6628 | + let triggerElement; | |
| 6629 | + if (triggerId) { | |
| 6630 | + for (let i = this.attachedStores.length - 1; i >= 0 && !triggerElement; i -= 1) { | |
| 6631 | + triggerElement = this.attachedStores[i].context.triggerElements.getById(triggerId); | |
| 6632 | + } | |
| 6633 | + triggerElement ??= this.fallbackStore.context.triggerElements.getById(triggerId); | |
| 6634 | + } | |
| 6635 | + if (triggerId && !triggerElement) { | |
| 6636 | + if (this.throwOnMissingTrigger) { | |
| 6637 | + throw new Error(true ? `Base UI: ${this.componentName}Handle.open() was called with the trigger id "${triggerId}", but no matching trigger is registered with this handle. An anchored popup cannot open without a trigger to anchor to. Pass the id of a mounted ${this.componentName}.Trigger that has this handle set on its "handle" prop.` : formatErrorMessage_default(99, this.componentName, triggerId, this.componentName)); | |
| 6638 | + } | |
| 6639 | + if (true) { | |
| 6640 | + console.warn(`Base UI: ${this.componentName}Handle.open: No trigger found with id "${triggerId}". The popup will open, but the trigger will not be associated with it.`); | |
| 6641 | + } | |
| 6642 | + } | |
| 6643 | + attachedStore.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement)); | |
| 6644 | + } | |
| 6645 | + /** | |
| 6646 | + * Closes the popup by setting the attached root's store to closed, or a no-op (with a dev warning) | |
| 6647 | + * while no root is attached. Shared by every concrete handle's public `close()` method. | |
| 6648 | + * | |
| 6649 | + * This method should only be called in an event handler or an effect (not during rendering). | |
| 6650 | + */ | |
| 6651 | + closePopup() { | |
| 6652 | + const attachedStore = this.attachedStore; | |
| 6653 | + if (attachedStore === null) { | |
| 6654 | + if (true) { | |
| 6655 | + console.warn(`Base UI: ${this.componentName}Handle.close() was called while no root using this handle is mounted. The call was ignored.`); | |
| 6656 | + } | |
| 6657 | + return; | |
| 6658 | + } | |
| 6659 | + attachedStore.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)); | |
| 6660 | + } | |
| 6661 | +}; | |
| 6662 | + | |
| 6663 | +// node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs | |
| 6664 | +var React31 = __toESM(require_react(), 1); | |
| 6665 | +var ReactDOM4 = __toESM(require_react_dom(), 1); | |
| 6666 | + | |
| 6667 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs | |
| 6668 | +var React30 = __toESM(require_react(), 1); | |
| 6669 | + | |
| 6670 | +// node_modules/@base-ui/utils/store/useStore.mjs | |
| 6671 | +var React28 = __toESM(require_react(), 1); | |
| 6672 | +var import_shim = __toESM(require_shim(), 1); | |
| 6673 | +var import_with_selector = __toESM(require_with_selector(), 1); | |
| 6674 | + | |
| 6675 | +// node_modules/@base-ui/utils/fastHooks.mjs | |
| 6676 | +var React27 = __toESM(require_react(), 1); | |
| 6677 | +var hooks = []; | |
| 6678 | +var currentInstance = void 0; | |
| 6679 | +function getInstance() { | |
| 6680 | + return currentInstance; | |
| 6681 | +} | |
| 6682 | +function register(hook) { | |
| 6683 | + hooks.push(hook); | |
| 6684 | +} | |
| 6685 | +function fastComponent(fn) { | |
| 6686 | + const FastComponent = (props, forwardedRef) => { | |
| 6687 | + const instance = useRefWithInit(createInstance).current; | |
| 6688 | + let result; | |
| 6689 | + try { | |
| 6690 | + currentInstance = instance; | |
| 6691 | + for (const hook of hooks) { | |
| 6692 | + hook.before(instance); | |
| 6693 | + } | |
| 6694 | + result = fn(props, forwardedRef); | |
| 6695 | + for (const hook of hooks) { | |
| 6696 | + hook.after(instance); | |
| 6697 | + } | |
| 6698 | + instance.didInitialize = true; | |
| 6699 | + } finally { | |
| 6700 | + currentInstance = void 0; | |
| 6701 | + } | |
| 6702 | + return result; | |
| 6703 | + }; | |
| 6704 | + FastComponent.displayName = fn.displayName || fn.name; | |
| 6705 | + return FastComponent; | |
| 6706 | +} | |
| 6707 | +function fastComponentRef(fn) { | |
| 6708 | + return /* @__PURE__ */ React27.forwardRef(fastComponent(fn)); | |
| 6709 | +} | |
| 6710 | +function createInstance() { | |
| 6711 | + return { | |
| 6712 | + didInitialize: false | |
| 6713 | + }; | |
| 6714 | +} | |
| 6715 | + | |
| 6716 | +// node_modules/@base-ui/utils/store/useStore.mjs | |
| 6717 | +var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19); | |
| 6718 | +var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy; | |
| 6719 | +function useStore(store, selector, a1, a2, a3) { | |
| 6720 | + return useStoreImplementation(store, selector, a1, a2, a3); | |
| 6721 | +} | |
| 6722 | +function useStoreR19(store, selector, a1, a2, a3) { | |
| 6723 | + const getSelection = React28.useCallback(() => selector(store.getSnapshot(), a1, a2, a3), [store, selector, a1, a2, a3]); | |
| 6724 | + return (0, import_shim.useSyncExternalStore)(store.subscribe, getSelection, getSelection); | |
| 6725 | +} | |
| 6726 | +register({ | |
| 6727 | + before(instance) { | |
| 6728 | + instance.syncIndex = 0; | |
| 6729 | + if (!instance.didInitialize) { | |
| 6730 | + instance.syncTick = 1; | |
| 6731 | + instance.syncHooks = []; | |
| 6732 | + instance.didChangeStore = true; | |
| 6733 | + instance.getSnapshot = () => { | |
| 6734 | + let didChange2 = false; | |
| 6735 | + for (let i = 0; i < instance.syncHooks.length; i += 1) { | |
| 6736 | + const hook = instance.syncHooks[i]; | |
| 6737 | + const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3); | |
| 6738 | + if (!Object.is(hook.value, value)) { | |
| 6739 | + didChange2 = true; | |
| 6740 | + hook.value = value; | |
| 1001 | 6741 | } |
| 1002 | 6742 | } |
| 1003 | - }; | |
| 1004 | - const handleAnimationStart = (event) => { | |
| 1005 | - if (event.target === node) { | |
| 1006 | - prevAnimationNameRef.current = getAnimationName(stylesRef.current); | |
| 6743 | + if (didChange2) { | |
| 6744 | + instance.syncTick += 1; | |
| 1007 | 6745 | } |
| 6746 | + return instance.syncTick; | |
| 1008 | 6747 | }; |
| 1009 | - node.addEventListener("animationstart", handleAnimationStart); | |
| 1010 | - node.addEventListener("animationcancel", handleAnimationEnd); | |
| 1011 | - node.addEventListener("animationend", handleAnimationEnd); | |
| 6748 | + } | |
| 6749 | + }, | |
| 6750 | + after(instance) { | |
| 6751 | + if (instance.syncHooks.length > 0) { | |
| 6752 | + if (instance.didChangeStore) { | |
| 6753 | + instance.didChangeStore = false; | |
| 6754 | + instance.subscribe = (onStoreChange) => { | |
| 6755 | + const stores = /* @__PURE__ */ new Set(); | |
| 6756 | + for (const hook of instance.syncHooks) { | |
| 6757 | + stores.add(hook.store); | |
| 6758 | + } | |
| 6759 | + const unsubscribes = []; | |
| 6760 | + for (const store of stores) { | |
| 6761 | + unsubscribes.push(store.subscribe(onStoreChange)); | |
| 6762 | + } | |
| 6763 | + return () => { | |
| 6764 | + for (const unsubscribe of unsubscribes) { | |
| 6765 | + unsubscribe(); | |
| 6766 | + } | |
| 6767 | + }; | |
| 6768 | + }; | |
| 6769 | + } | |
| 6770 | + (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot); | |
| 6771 | + } | |
| 6772 | + } | |
| 6773 | +}); | |
| 6774 | +function useStoreFast(store, selector, a1, a2, a3) { | |
| 6775 | + const instance = getInstance(); | |
| 6776 | + if (!instance) { | |
| 6777 | + return useStoreR19(store, selector, a1, a2, a3); | |
| 6778 | + } | |
| 6779 | + const index2 = instance.syncIndex; | |
| 6780 | + instance.syncIndex += 1; | |
| 6781 | + let hook; | |
| 6782 | + if (!instance.didInitialize) { | |
| 6783 | + hook = { | |
| 6784 | + store, | |
| 6785 | + selector, | |
| 6786 | + a1, | |
| 6787 | + a2, | |
| 6788 | + a3, | |
| 6789 | + value: selector(store.getSnapshot(), a1, a2, a3) | |
| 6790 | + }; | |
| 6791 | + instance.syncHooks.push(hook); | |
| 6792 | + } else { | |
| 6793 | + hook = instance.syncHooks[index2]; | |
| 6794 | + if (hook.store !== store || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) { | |
| 6795 | + if (hook.store !== store) { | |
| 6796 | + instance.didChangeStore = true; | |
| 6797 | + } | |
| 6798 | + hook.store = store; | |
| 6799 | + hook.selector = selector; | |
| 6800 | + hook.a1 = a1; | |
| 6801 | + hook.a2 = a2; | |
| 6802 | + hook.a3 = a3; | |
| 6803 | + hook.value = selector(store.getSnapshot(), a1, a2, a3); | |
| 6804 | + } | |
| 6805 | + } | |
| 6806 | + return hook.value; | |
| 6807 | +} | |
| 6808 | +function useStoreLegacy(store, selector, a1, a2, a3) { | |
| 6809 | + return (0, import_with_selector.useSyncExternalStoreWithSelector)(store.subscribe, store.getSnapshot, store.getSnapshot, (state) => selector(state, a1, a2, a3)); | |
| 6810 | +} | |
| 6811 | + | |
| 6812 | +// node_modules/@base-ui/utils/store/Store.mjs | |
| 6813 | +var Store = class { | |
| 6814 | + /** | |
| 6815 | + * Creates a store with the given initial state, constructing the class it is called on. | |
| 6816 | + * Calling it on a generic base class (e.g. `ReactStore.create(...)`) constructs that | |
| 6817 | + * class but degrades the inferred instance type to `Store`; use `new` there instead. | |
| 6818 | + */ | |
| 6819 | + static create(state) { | |
| 6820 | + return new this(state); | |
| 6821 | + } | |
| 6822 | + /** | |
| 6823 | + * The current state of the store. | |
| 6824 | + * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}. | |
| 6825 | + * To subscribe to state changes, use the {@link useState} method. The value returned by {@link useState} is updated after the component renders (similarly to React's useState). | |
| 6826 | + * The values can be used directly (to avoid subscribing to the store) in effects or event handlers. | |
| 6827 | + * | |
| 6828 | + * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification. | |
| 6829 | + */ | |
| 6830 | + // Internal state to handle recursive `setState()` calls | |
| 6831 | + constructor(state) { | |
| 6832 | + this.state = state; | |
| 6833 | + this.listeners = /* @__PURE__ */ new Set(); | |
| 6834 | + this.updateTick = 0; | |
| 6835 | + } | |
| 6836 | + /** | |
| 6837 | + * Registers a listener that will be called whenever the store's state changes. | |
| 6838 | + * | |
| 6839 | + * @param fn The listener function to be called on state changes. | |
| 6840 | + * @returns A function to unsubscribe the listener. | |
| 6841 | + */ | |
| 6842 | + subscribe = (fn) => { | |
| 6843 | + this.listeners.add(fn); | |
| 6844 | + return () => { | |
| 6845 | + this.listeners.delete(fn); | |
| 6846 | + }; | |
| 6847 | + }; | |
| 6848 | + /** | |
| 6849 | + * Returns the current state of the store. | |
| 6850 | + */ | |
| 6851 | + getSnapshot = () => { | |
| 6852 | + return this.state; | |
| 6853 | + }; | |
| 6854 | + /** | |
| 6855 | + * Updates the entire store's state and notifies all registered listeners. | |
| 6856 | + * | |
| 6857 | + * @param newState The new state to set for the store. | |
| 6858 | + */ | |
| 6859 | + setState(newState) { | |
| 6860 | + if (this.state === newState) { | |
| 6861 | + return; | |
| 6862 | + } | |
| 6863 | + this.state = newState; | |
| 6864 | + this.updateTick += 1; | |
| 6865 | + const currentTick = this.updateTick; | |
| 6866 | + for (const listener of this.listeners) { | |
| 6867 | + if (currentTick !== this.updateTick) { | |
| 6868 | + return; | |
| 6869 | + } | |
| 6870 | + listener(newState); | |
| 6871 | + } | |
| 6872 | + } | |
| 6873 | + /** | |
| 6874 | + * Merges the provided changes into the current state and notifies listeners if there are changes. | |
| 6875 | + * Each value must match its state key. Pass an exact known subset rather than a broad | |
| 6876 | + * `Partial<State>`, which may contain `undefined` for required state fields. | |
| 6877 | + * | |
| 6878 | + * @param changes An object containing the changes to apply to the current state. | |
| 6879 | + */ | |
| 6880 | + update(changes) { | |
| 6881 | + for (const key in changes) { | |
| 6882 | + if (!Object.is(this.state[key], changes[key])) { | |
| 6883 | + this.setState({ | |
| 6884 | + ...this.state, | |
| 6885 | + ...changes | |
| 6886 | + }); | |
| 6887 | + return; | |
| 6888 | + } | |
| 6889 | + } | |
| 6890 | + } | |
| 6891 | + /** | |
| 6892 | + * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed. | |
| 6893 | + * | |
| 6894 | + * @param key The key in the store's state to update. | |
| 6895 | + * @param value The new value to set for the specified key. | |
| 6896 | + */ | |
| 6897 | + set(key, value) { | |
| 6898 | + if (!Object.is(this.state[key], value)) { | |
| 6899 | + this.setState({ | |
| 6900 | + ...this.state, | |
| 6901 | + [key]: value | |
| 6902 | + }); | |
| 6903 | + } | |
| 6904 | + } | |
| 6905 | + /** | |
| 6906 | + * Gives the state a new reference and updates all registered listeners. | |
| 6907 | + */ | |
| 6908 | + notifyAll() { | |
| 6909 | + const newState = { | |
| 6910 | + ...this.state | |
| 6911 | + }; | |
| 6912 | + this.setState(newState); | |
| 6913 | + } | |
| 6914 | + use(selector, a1, a2, a3) { | |
| 6915 | + return useStore(this, selector, a1, a2, a3); | |
| 6916 | + } | |
| 6917 | +}; | |
| 6918 | + | |
| 6919 | +// node_modules/@base-ui/utils/store/ReactStore.mjs | |
| 6920 | +var React29 = __toESM(require_react(), 1); | |
| 6921 | +var ReactStore = class extends Store { | |
| 6922 | + /** | |
| 6923 | + * Creates a new ReactStore instance. | |
| 6924 | + * | |
| 6925 | + * @param state Initial state of the store. | |
| 6926 | + * @param context Non-reactive context values. | |
| 6927 | + * @param selectors Optional selectors for use with `useState`. | |
| 6928 | + */ | |
| 6929 | + constructor(state, context = {}, selectors4) { | |
| 6930 | + super(state); | |
| 6931 | + this.context = context; | |
| 6932 | + this.selectors = selectors4; | |
| 6933 | + } | |
| 6934 | + /** | |
| 6935 | + * Non-reactive values such as refs, callbacks, etc. | |
| 6936 | + */ | |
| 6937 | + /** | |
| 6938 | + * Synchronizes a single external value into the store. | |
| 6939 | + * | |
| 6940 | + * Note that the while the value in `state` is updated immediately, the value returned | |
| 6941 | + * by `useState` is updated before the next render (similarly to React's `useState`). | |
| 6942 | + */ | |
| 6943 | + useSyncedValue(key, value) { | |
| 6944 | + React29.useDebugValue(key); | |
| 6945 | + const store = this; | |
| 6946 | + useIsoLayoutEffect(() => { | |
| 6947 | + if (store.state[key] !== value) { | |
| 6948 | + store.set(key, value); | |
| 6949 | + } | |
| 6950 | + }, [store, key, value]); | |
| 6951 | + } | |
| 6952 | + /** | |
| 6953 | + * Synchronizes a single external value into the store and | |
| 6954 | + * cleans it up (sets to `undefined`) on unmount. | |
| 6955 | + * | |
| 6956 | + * Note that the while the value in `state` is updated immediately, the value returned | |
| 6957 | + * by `useState` is updated before the next render (similarly to React's `useState`). | |
| 6958 | + */ | |
| 6959 | + useSyncedValueWithCleanup(key, value) { | |
| 6960 | + const store = this; | |
| 6961 | + useIsoLayoutEffect(() => { | |
| 6962 | + if (store.state[key] !== value) { | |
| 6963 | + store.set(key, value); | |
| 6964 | + } | |
| 1012 | 6965 | return () => { |
| 1013 | - ownerWindow.clearTimeout(timeoutId); | |
| 1014 | - node.removeEventListener("animationstart", handleAnimationStart); | |
| 1015 | - node.removeEventListener("animationcancel", handleAnimationEnd); | |
| 1016 | - node.removeEventListener("animationend", handleAnimationEnd); | |
| 6966 | + store.set(key, void 0); | |
| 1017 | 6967 | }; |
| 6968 | + }, [store, key, value]); | |
| 6969 | + } | |
| 6970 | + /** | |
| 6971 | + * Synchronizes multiple external values into the store. | |
| 6972 | + * Each value must match its state key. Pass an exact known subset rather than a broad | |
| 6973 | + * `Partial<State>`, which may contain `undefined` for required state fields. | |
| 6974 | + * | |
| 6975 | + * Note that the while the values in `state` are updated immediately, the values returned | |
| 6976 | + * by `useState` are updated before the next render (similarly to React's `useState`). | |
| 6977 | + * | |
| 6978 | + * @param statePart An exact subset of state fields to synchronize. Unknown keys are not accepted. | |
| 6979 | + */ | |
| 6980 | + useSyncedValues(statePart) { | |
| 6981 | + const store = this; | |
| 6982 | + if (true) { | |
| 6983 | + React29.useDebugValue(statePart, (p) => Object.keys(p)); | |
| 6984 | + const keys = React29.useRef(Object.keys(statePart)).current; | |
| 6985 | + const nextKeys = Object.keys(statePart); | |
| 6986 | + if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) { | |
| 6987 | + console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable."); | |
| 6988 | + } | |
| 6989 | + } | |
| 6990 | + const dependencies = Object.values(statePart); | |
| 6991 | + useIsoLayoutEffect(() => { | |
| 6992 | + store.update(statePart); | |
| 6993 | + }, [store, ...dependencies]); | |
| 6994 | + } | |
| 6995 | + /** | |
| 6996 | + * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled` | |
| 6997 | + * is non-undefined, the store's state at `key` is updated to match `controlled`. | |
| 6998 | + */ | |
| 6999 | + useControlledProp(key, controlled) { | |
| 7000 | + React29.useDebugValue(key); | |
| 7001 | + const store = this; | |
| 7002 | + const isControlled = controlled !== void 0; | |
| 7003 | + useIsoLayoutEffect(() => { | |
| 7004 | + if (isControlled && !Object.is(store.state[key], controlled)) { | |
| 7005 | + store.setState({ | |
| 7006 | + ...store.state, | |
| 7007 | + [key]: controlled | |
| 7008 | + }); | |
| 7009 | + } | |
| 7010 | + }, [store, key, controlled, isControlled]); | |
| 7011 | + if (true) { | |
| 7012 | + const cache = this.controlledValues ??= /* @__PURE__ */ new Map(); | |
| 7013 | + if (!cache.has(key)) { | |
| 7014 | + cache.set(key, isControlled); | |
| 7015 | + } | |
| 7016 | + const previouslyControlled = cache.get(key); | |
| 7017 | + if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) { | |
| 7018 | + console.error(`A component is changing the ${isControlled ? "" : "un"}controlled state of ${key.toString()} to be ${isControlled ? "un" : ""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`); | |
| 7019 | + } | |
| 7020 | + } | |
| 7021 | + } | |
| 7022 | + /** Gets the current value from the store using a selector with the provided key. | |
| 7023 | + * | |
| 7024 | + * @param key Key of the selector to use. | |
| 7025 | + */ | |
| 7026 | + select(key, a1, a2, a3) { | |
| 7027 | + const selector = this.selectors[key]; | |
| 7028 | + return selector(this.state, a1, a2, a3); | |
| 7029 | + } | |
| 7030 | + /** | |
| 7031 | + * Returns a value from the store's state using a selector function. | |
| 7032 | + * Used to subscribe to specific parts of the state. | |
| 7033 | + * This methods causes a rerender whenever the selected state changes. | |
| 7034 | + * | |
| 7035 | + * @param key Key of the selector to use. | |
| 7036 | + */ | |
| 7037 | + useState(key, a1, a2, a3) { | |
| 7038 | + React29.useDebugValue(key); | |
| 7039 | + return useStore(this, this.selectors[key], a1, a2, a3); | |
| 7040 | + } | |
| 7041 | + /** | |
| 7042 | + * Wraps a function with `useStableCallback` to ensure it has a stable reference | |
| 7043 | + * and assigns it to the context. | |
| 7044 | + * | |
| 7045 | + * @param key Key of the event callback. Must be a function in the context. | |
| 7046 | + * @param fn Function to assign. | |
| 7047 | + */ | |
| 7048 | + useContextCallback(key, fn) { | |
| 7049 | + React29.useDebugValue(key); | |
| 7050 | + const stableFunction = useStableCallback(fn ?? NOOP); | |
| 7051 | + this.context[key] = stableFunction; | |
| 7052 | + } | |
| 7053 | + /** | |
| 7054 | + * Returns a stable setter function for a specific key in the store's state. | |
| 7055 | + * It's commonly used to pass as a ref callback to React elements. | |
| 7056 | + * | |
| 7057 | + * @param key Key of the state to set. | |
| 7058 | + */ | |
| 7059 | + useStateSetter(key) { | |
| 7060 | + const ref = React29.useRef(void 0); | |
| 7061 | + if (ref.current === void 0) { | |
| 7062 | + ref.current = (value) => { | |
| 7063 | + this.set(key, value); | |
| 7064 | + }; | |
| 7065 | + } | |
| 7066 | + return ref.current; | |
| 7067 | + } | |
| 7068 | + /** | |
| 7069 | + * Observes changes derived from the store's selectors and calls the listener when the selected value changes. | |
| 7070 | + * | |
| 7071 | + * @param key Key of the selector to observe. | |
| 7072 | + * @param listener Listener function called when the selector result changes. | |
| 7073 | + */ | |
| 7074 | + observe(selector, listener) { | |
| 7075 | + let selectFn; | |
| 7076 | + if (typeof selector === "function") { | |
| 7077 | + selectFn = selector; | |
| 1018 | 7078 | } else { |
| 1019 | - send("ANIMATION_END"); | |
| 7079 | + selectFn = this.selectors[selector]; | |
| 1020 | 7080 | } |
| 1021 | - }, [node, send]); | |
| 7081 | + let prevValue = selectFn(this.state); | |
| 7082 | + listener(prevValue, prevValue, this); | |
| 7083 | + return this.subscribe((nextState) => { | |
| 7084 | + const nextValue = selectFn(nextState); | |
| 7085 | + if (!Object.is(prevValue, nextValue)) { | |
| 7086 | + const oldValue = prevValue; | |
| 7087 | + prevValue = nextValue; | |
| 7088 | + listener(nextValue, oldValue, this); | |
| 7089 | + } | |
| 7090 | + }); | |
| 7091 | + } | |
| 7092 | +}; | |
| 7093 | + | |
| 7094 | +// node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs | |
| 7095 | +var selectors = { | |
| 7096 | + open: (state) => state.open, | |
| 7097 | + transitionStatus: (state) => state.transitionStatus, | |
| 7098 | + domReferenceElement: (state) => state.domReferenceElement, | |
| 7099 | + referenceElement: (state) => state.positionReference ?? state.referenceElement, | |
| 7100 | + floatingElement: (state) => state.floatingElement, | |
| 7101 | + floatingId: (state) => state.floatingId | |
| 7102 | +}; | |
| 7103 | +var FloatingRootStore = class extends ReactStore { | |
| 7104 | + constructor(options) { | |
| 7105 | + const { | |
| 7106 | + syncOnly, | |
| 7107 | + nested, | |
| 7108 | + onOpenChange, | |
| 7109 | + triggerElements, | |
| 7110 | + ...initialState | |
| 7111 | + } = options; | |
| 7112 | + super({ | |
| 7113 | + ...initialState, | |
| 7114 | + positionReference: initialState.referenceElement, | |
| 7115 | + domReferenceElement: initialState.referenceElement | |
| 7116 | + }, { | |
| 7117 | + onOpenChange, | |
| 7118 | + dataRef: { | |
| 7119 | + current: {} | |
| 7120 | + }, | |
| 7121 | + events: createEventEmitter(), | |
| 7122 | + nested, | |
| 7123 | + triggerElements | |
| 7124 | + }, selectors); | |
| 7125 | + this.syncOnly = syncOnly; | |
| 7126 | + } | |
| 7127 | + /** | |
| 7128 | + * Syncs the event used by hover logic to distinguish hover-open from click-like interaction. | |
| 7129 | + */ | |
| 7130 | + syncOpenEvent = (newOpen, event) => { | |
| 7131 | + if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing | |
| 7132 | + // click events to upgrade a hover-open. | |
| 7133 | + event != null && isClickLikeEvent(event)) { | |
| 7134 | + this.context.dataRef.current.openEvent = newOpen ? event : void 0; | |
| 7135 | + } | |
| 7136 | + }; | |
| 7137 | + /** | |
| 7138 | + * Runs the root-owned side effects for an open state change. | |
| 7139 | + */ | |
| 7140 | + dispatchOpenChange = (newOpen, eventDetails) => { | |
| 7141 | + this.syncOpenEvent(newOpen, eventDetails.event); | |
| 7142 | + const details = { | |
| 7143 | + open: newOpen, | |
| 7144 | + reason: eventDetails.reason, | |
| 7145 | + nativeEvent: eventDetails.event, | |
| 7146 | + nested: this.context.nested, | |
| 7147 | + triggerElement: eventDetails.trigger | |
| 7148 | + }; | |
| 7149 | + this.context.events.emit("openchange", details); | |
| 7150 | + }; | |
| 7151 | + /** | |
| 7152 | + * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments. | |
| 7153 | + * | |
| 7154 | + * @param newOpen The new open state. | |
| 7155 | + * @param eventDetails Details about the event that triggered the open state change. | |
| 7156 | + */ | |
| 7157 | + setOpen = (newOpen, eventDetails) => { | |
| 7158 | + if (this.syncOnly) { | |
| 7159 | + this.context.onOpenChange?.(newOpen, eventDetails); | |
| 7160 | + return; | |
| 7161 | + } | |
| 7162 | + this.dispatchOpenChange(newOpen, eventDetails); | |
| 7163 | + this.context.onOpenChange?.(newOpen, eventDetails); | |
| 7164 | + }; | |
| 7165 | +}; | |
| 7166 | + | |
| 7167 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs | |
| 7168 | +function useSyncedFloatingRootContext(options) { | |
| 7169 | + const { | |
| 7170 | + popupStore, | |
| 7171 | + treatPopupAsFloatingElement = false, | |
| 7172 | + floatingRootContext: floatingRootContextProp, | |
| 7173 | + floatingId, | |
| 7174 | + nested, | |
| 7175 | + onOpenChange | |
| 7176 | + } = options; | |
| 7177 | + const open2 = popupStore.useState("open"); | |
| 7178 | + const referenceElement = popupStore.useState("activeTriggerElement"); | |
| 7179 | + const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement"); | |
| 7180 | + const triggerElements = popupStore.context.triggerElements; | |
| 7181 | + const handleOpenChange = onOpenChange; | |
| 7182 | + const internalStoreRef = React30.useRef(null); | |
| 7183 | + if (floatingRootContextProp === void 0 && internalStoreRef.current === null) { | |
| 7184 | + internalStoreRef.current = new FloatingRootStore({ | |
| 7185 | + open: open2, | |
| 7186 | + transitionStatus: void 0, | |
| 7187 | + referenceElement, | |
| 7188 | + floatingElement, | |
| 7189 | + triggerElements, | |
| 7190 | + onOpenChange: handleOpenChange, | |
| 7191 | + floatingId, | |
| 7192 | + syncOnly: true, | |
| 7193 | + nested | |
| 7194 | + }); | |
| 7195 | + } | |
| 7196 | + const store = floatingRootContextProp ?? internalStoreRef.current; | |
| 7197 | + popupStore.useSyncedValue("floatingId", floatingId); | |
| 7198 | + useIsoLayoutEffect(() => { | |
| 7199 | + const valuesToSync = { | |
| 7200 | + open: open2, | |
| 7201 | + floatingId, | |
| 7202 | + referenceElement, | |
| 7203 | + floatingElement | |
| 7204 | + }; | |
| 7205 | + if (isElement(referenceElement)) { | |
| 7206 | + valuesToSync.domReferenceElement = referenceElement; | |
| 7207 | + } | |
| 7208 | + if (store.state.positionReference === store.state.referenceElement) { | |
| 7209 | + valuesToSync.positionReference = referenceElement; | |
| 7210 | + } | |
| 7211 | + store.update(valuesToSync); | |
| 7212 | + }, [open2, floatingId, referenceElement, floatingElement, store]); | |
| 7213 | + store.context.onOpenChange = handleOpenChange; | |
| 7214 | + store.context.nested = nested; | |
| 7215 | + return store; | |
| 7216 | +} | |
| 7217 | + | |
| 7218 | +// node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs | |
| 7219 | +var FOCUSABLE_POPUP_PROPS = { | |
| 7220 | + tabIndex: -1, | |
| 7221 | + [FOCUSABLE_ATTRIBUTE]: "" | |
| 7222 | +}; | |
| 7223 | +function usePopupRootStore(createStore, treatPopupAsFloatingElement = false) { | |
| 7224 | + const floatingId = useId(); | |
| 7225 | + const nested = useFloatingParentNodeId() != null; | |
| 7226 | + const store = useRefWithInit(() => createStore(floatingId, nested)).current; | |
| 7227 | + useSyncedFloatingRootContext({ | |
| 7228 | + popupStore: store, | |
| 7229 | + treatPopupAsFloatingElement, | |
| 7230 | + floatingRootContext: store.state.floatingRootContext, | |
| 7231 | + floatingId, | |
| 7232 | + nested, | |
| 7233 | + onOpenChange: store.setOpen | |
| 7234 | + }); | |
| 7235 | + return store; | |
| 7236 | +} | |
| 7237 | +function PopupHandleAttachment({ | |
| 7238 | + handle, | |
| 7239 | + store | |
| 7240 | +}) { | |
| 7241 | + useIsoLayoutEffect(() => { | |
| 7242 | + return handle.attachStore(store); | |
| 7243 | + }, [handle, store]); | |
| 7244 | + return null; | |
| 7245 | +} | |
| 7246 | +function syncTriggerCount(store) { | |
| 7247 | + const triggerCount = store.context.triggerElements.size; | |
| 7248 | + if (store.select("open") && store.state.triggerCount !== triggerCount) { | |
| 7249 | + store.set("triggerCount", triggerCount); | |
| 7250 | + } | |
| 7251 | +} | |
| 7252 | +function useTriggerRegistration(id, store) { | |
| 7253 | + const registrationRef = React31.useRef(null); | |
| 7254 | + return useStableCallback((element) => { | |
| 7255 | + const registration = registrationRef.current; | |
| 7256 | + if (registration !== null) { | |
| 7257 | + if (registration.element === element && registration.store === store && registration.id === id) { | |
| 7258 | + return; | |
| 7259 | + } | |
| 7260 | + registrationRef.current = null; | |
| 7261 | + const registeredStore = registration.store; | |
| 7262 | + if (registeredStore.context.triggerElements.getById(registration.id) === registration.element) { | |
| 7263 | + registeredStore.context.triggerElements.delete(registration.id); | |
| 7264 | + syncTriggerCount(registeredStore); | |
| 7265 | + } | |
| 7266 | + } | |
| 7267 | + if (element !== null && id !== void 0) { | |
| 7268 | + registrationRef.current = { | |
| 7269 | + store, | |
| 7270 | + id, | |
| 7271 | + element | |
| 7272 | + }; | |
| 7273 | + store.context.triggerElements.add(id, element); | |
| 7274 | + syncTriggerCount(store); | |
| 7275 | + } | |
| 7276 | + }); | |
| 7277 | +} | |
| 7278 | +function createPopupOpenState(state, open2, trigger, preventUnmountOnClose = false) { | |
| 7279 | + let preventUnmountingOnClose = state.preventUnmountingOnClose; | |
| 7280 | + if (open2) { | |
| 7281 | + preventUnmountingOnClose = false; | |
| 7282 | + } else if (preventUnmountOnClose) { | |
| 7283 | + preventUnmountingOnClose = true; | |
| 7284 | + } | |
| 7285 | + const triggerId = trigger?.id ?? null; | |
| 7286 | + let activeTriggerId = state.activeTriggerId; | |
| 7287 | + let activeTriggerElement = state.activeTriggerElement; | |
| 7288 | + if (triggerId || open2) { | |
| 7289 | + activeTriggerId = triggerId; | |
| 7290 | + activeTriggerElement = trigger ?? null; | |
| 7291 | + } | |
| 1022 | 7292 | return { |
| 1023 | - isPresent: ["mounted", "unmountSuspended"].includes(state), | |
| 1024 | - ref: React23.useCallback((node2) => { | |
| 1025 | - stylesRef.current = node2 ? getComputedStyle(node2) : null; | |
| 1026 | - setNode(node2); | |
| 1027 | - }, []) | |
| 7293 | + open: open2, | |
| 7294 | + preventUnmountingOnClose, | |
| 7295 | + activeTriggerId, | |
| 7296 | + activeTriggerElement | |
| 1028 | 7297 | }; |
| 1029 | 7298 | } |
| 1030 | -function getAnimationName(styles) { | |
| 1031 | - return styles?.animationName || "none"; | |
| 7299 | +function attachPreventUnmountOnClose(eventDetails) { | |
| 7300 | + let preventUnmountOnClose = false; | |
| 7301 | + eventDetails.preventUnmountOnClose = () => { | |
| 7302 | + preventUnmountOnClose = true; | |
| 7303 | + }; | |
| 7304 | + return () => preventUnmountOnClose; | |
| 1032 | 7305 | } |
| 1033 | -function getElementRef2(element) { | |
| 1034 | - let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get; | |
| 1035 | - let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning; | |
| 1036 | - if (mayWarn) { | |
| 1037 | - return element.ref; | |
| 7306 | +function applyPopupOpenChange(store, nextOpen, eventDetails, options = {}) { | |
| 7307 | + const reason = eventDetails.reason; | |
| 7308 | + const isHover = reason === reason_parts_exports.triggerHover; | |
| 7309 | + const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus; | |
| 7310 | + const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey); | |
| 7311 | + const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails); | |
| 7312 | + store.context.onOpenChange?.(nextOpen, eventDetails); | |
| 7313 | + if (eventDetails.isCanceled) { | |
| 7314 | + return; | |
| 1038 | 7315 | } |
| 1039 | - getter = Object.getOwnPropertyDescriptor(element, "ref")?.get; | |
| 1040 | - mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning; | |
| 1041 | - if (mayWarn) { | |
| 1042 | - return element.props.ref; | |
| 7316 | + options.onBeforeDispatch?.(); | |
| 7317 | + store.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails); | |
| 7318 | + const changeState = () => { | |
| 7319 | + const popupOpenState = createPopupOpenState(store.state, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose()); | |
| 7320 | + const updatedState = { | |
| 7321 | + ...options.extraState, | |
| 7322 | + ...popupOpenState | |
| 7323 | + }; | |
| 7324 | + if (isFocusOpen) { | |
| 7325 | + updatedState.instantType = "focus"; | |
| 7326 | + } else if (isDismissClose) { | |
| 7327 | + updatedState.instantType = "dismiss"; | |
| 7328 | + } else if (isHover) { | |
| 7329 | + updatedState.instantType = void 0; | |
| 7330 | + } | |
| 7331 | + store.update(updatedState); | |
| 7332 | + }; | |
| 7333 | + if (isHover) { | |
| 7334 | + ReactDOM4.flushSync(changeState); | |
| 7335 | + } else { | |
| 7336 | + changeState(); | |
| 1043 | 7337 | } |
| 1044 | - return element.props.ref || element.ref; | |
| 1045 | 7338 | } |
| 1046 | - | |
| 1047 | -// node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-focus-guards/dist/index.mjs | |
| 1048 | -var React14 = __toESM(require_react(), 1); | |
| 1049 | -var count2 = 0; | |
| 1050 | -function useFocusGuards() { | |
| 1051 | - React14.useEffect(() => { | |
| 1052 | - const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]"); | |
| 1053 | - document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard()); | |
| 1054 | - document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard()); | |
| 1055 | - count2++; | |
| 1056 | - return () => { | |
| 1057 | - if (count2 === 1) { | |
| 1058 | - document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove()); | |
| 7339 | +function useTriggerDataForwarding(triggerId, triggerElementRef, store, stateUpdates) { | |
| 7340 | + const isMountedByThisTrigger = store.useState("isMountedByTrigger", triggerId); | |
| 7341 | + const baseRegisterTrigger = useTriggerRegistration(triggerId, store); | |
| 7342 | + const applyTriggerData = useStableCallback((element) => { | |
| 7343 | + const open2 = store.select("open"); | |
| 7344 | + const activeTriggerId = store.select("activeTriggerId"); | |
| 7345 | + if (activeTriggerId === triggerId) { | |
| 7346 | + const changes = { | |
| 7347 | + activeTriggerElement: element, | |
| 7348 | + ...open2 ? stateUpdates : null | |
| 7349 | + }; | |
| 7350 | + store.update(changes); | |
| 7351 | + return; | |
| 7352 | + } | |
| 7353 | + if (activeTriggerId == null && open2) { | |
| 7354 | + const changes = { | |
| 7355 | + activeTriggerId: triggerId ?? null, | |
| 7356 | + activeTriggerElement: element, | |
| 7357 | + ...stateUpdates | |
| 7358 | + }; | |
| 7359 | + store.update(changes); | |
| 7360 | + } | |
| 7361 | + }); | |
| 7362 | + const registerTrigger = useStableCallback((element) => { | |
| 7363 | + baseRegisterTrigger(element); | |
| 7364 | + if (element) { | |
| 7365 | + applyTriggerData(element); | |
| 7366 | + } | |
| 7367 | + }); | |
| 7368 | + useIsoLayoutEffect(() => { | |
| 7369 | + registerTrigger(triggerElementRef.current); | |
| 7370 | + return () => registerTrigger(null); | |
| 7371 | + }, [registerTrigger, triggerElementRef, store, triggerId]); | |
| 7372 | + useIsoLayoutEffect(() => { | |
| 7373 | + if (isMountedByThisTrigger) { | |
| 7374 | + const changes = { | |
| 7375 | + activeTriggerElement: triggerElementRef.current, | |
| 7376 | + ...stateUpdates | |
| 7377 | + }; | |
| 7378 | + store.update(changes); | |
| 7379 | + } | |
| 7380 | + }, [isMountedByThisTrigger, store, triggerElementRef, ...Object.values(stateUpdates)]); | |
| 7381 | + return { | |
| 7382 | + registerTrigger, | |
| 7383 | + isMountedByThisTrigger | |
| 7384 | + }; | |
| 7385 | +} | |
| 7386 | +function useImplicitActiveTrigger(store, options = {}) { | |
| 7387 | + const { | |
| 7388 | + closeOnActiveTriggerUnmount = false | |
| 7389 | + } = options; | |
| 7390 | + const resolvedActiveTriggerIdRef = React31.useRef(null); | |
| 7391 | + const open2 = store.useState("open"); | |
| 7392 | + const reactiveTriggerCount = store.useState("triggerCount"); | |
| 7393 | + const activeTriggerId = store.useState("activeTriggerId"); | |
| 7394 | + const reactiveActiveTriggerElement = store.useState("activeTriggerElement"); | |
| 7395 | + useIsoLayoutEffect(() => { | |
| 7396 | + if (!open2) { | |
| 7397 | + resolvedActiveTriggerIdRef.current = null; | |
| 7398 | + if (store.state.triggerCount !== 0) { | |
| 7399 | + store.set("triggerCount", 0); | |
| 1059 | 7400 | } |
| 1060 | - count2--; | |
| 1061 | - }; | |
| 1062 | - }, []); | |
| 7401 | + return; | |
| 7402 | + } | |
| 7403 | + const triggerCount = store.context.triggerElements.size; | |
| 7404 | + const stateUpdates = {}; | |
| 7405 | + if (store.state.triggerCount !== triggerCount) { | |
| 7406 | + stateUpdates.triggerCount = triggerCount; | |
| 7407 | + } | |
| 7408 | + const currentActiveTriggerId = store.select("activeTriggerId"); | |
| 7409 | + let lostActiveTriggerId = null; | |
| 7410 | + if (currentActiveTriggerId) { | |
| 7411 | + const activeTriggerElement = store.context.triggerElements.getById(currentActiveTriggerId); | |
| 7412 | + if (!activeTriggerElement) { | |
| 7413 | + for (const [triggerId, triggerElement] of store.context.triggerElements.entries()) { | |
| 7414 | + if (triggerElement === store.state.activeTriggerElement) { | |
| 7415 | + stateUpdates.activeTriggerId = triggerId; | |
| 7416 | + stateUpdates.activeTriggerElement = triggerElement; | |
| 7417 | + resolvedActiveTriggerIdRef.current = triggerId; | |
| 7418 | + break; | |
| 7419 | + } | |
| 7420 | + } | |
| 7421 | + if (stateUpdates.activeTriggerId === void 0) { | |
| 7422 | + if (resolvedActiveTriggerIdRef.current === currentActiveTriggerId) { | |
| 7423 | + lostActiveTriggerId = currentActiveTriggerId; | |
| 7424 | + } else { | |
| 7425 | + resolvedActiveTriggerIdRef.current = null; | |
| 7426 | + } | |
| 7427 | + } | |
| 7428 | + } else { | |
| 7429 | + resolvedActiveTriggerIdRef.current = currentActiveTriggerId; | |
| 7430 | + if (activeTriggerElement !== store.state.activeTriggerElement) { | |
| 7431 | + stateUpdates.activeTriggerElement = activeTriggerElement; | |
| 7432 | + } | |
| 7433 | + } | |
| 7434 | + } else { | |
| 7435 | + resolvedActiveTriggerIdRef.current = null; | |
| 7436 | + } | |
| 7437 | + if (!lostActiveTriggerId && !currentActiveTriggerId && triggerCount === 1) { | |
| 7438 | + const iteratorResult = store.context.triggerElements.entries().next(); | |
| 7439 | + if (!iteratorResult.done) { | |
| 7440 | + const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value; | |
| 7441 | + stateUpdates.activeTriggerId = implicitTriggerId; | |
| 7442 | + stateUpdates.activeTriggerElement = implicitTriggerElement; | |
| 7443 | + resolvedActiveTriggerIdRef.current = implicitTriggerId; | |
| 7444 | + } | |
| 7445 | + } | |
| 7446 | + if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0 || stateUpdates.activeTriggerElement !== void 0) { | |
| 7447 | + store.update(stateUpdates); | |
| 7448 | + } | |
| 7449 | + if (lostActiveTriggerId) { | |
| 7450 | + if (closeOnActiveTriggerUnmount) { | |
| 7451 | + queueMicrotask(() => { | |
| 7452 | + if (store.select("open") && store.select("activeTriggerId") === lostActiveTriggerId && !store.context.triggerElements.getById(lostActiveTriggerId)) { | |
| 7453 | + const eventDetails = createChangeEventDetails(reason_parts_exports.none); | |
| 7454 | + store.setOpen(false, eventDetails); | |
| 7455 | + if (!eventDetails.isCanceled) { | |
| 7456 | + store.update({ | |
| 7457 | + activeTriggerId: null, | |
| 7458 | + activeTriggerElement: null | |
| 7459 | + }); | |
| 7460 | + } | |
| 7461 | + } | |
| 7462 | + }); | |
| 7463 | + } | |
| 7464 | + } | |
| 7465 | + }, [open2, store, reactiveTriggerCount, activeTriggerId, reactiveActiveTriggerElement, closeOnActiveTriggerUnmount]); | |
| 1063 | 7466 | } |
| 1064 | -function createFocusGuard() { | |
| 1065 | - const element = document.createElement("span"); | |
| 1066 | - element.setAttribute("data-radix-focus-guard", ""); | |
| 1067 | - element.tabIndex = 0; | |
| 1068 | - element.style.outline = "none"; | |
| 1069 | - element.style.opacity = "0"; | |
| 1070 | - element.style.position = "fixed"; | |
| 1071 | - element.style.pointerEvents = "none"; | |
| 1072 | - return element; | |
| 7467 | +function useOpenStateTransitions(open2, store, onUnmount, animateInitialOpen) { | |
| 7468 | + const { | |
| 7469 | + mounted, | |
| 7470 | + setMounted, | |
| 7471 | + transitionStatus | |
| 7472 | + } = useTransitionStatus(open2, false, false, animateInitialOpen); | |
| 7473 | + const preventUnmountingOnClose = store.useState("preventUnmountingOnClose"); | |
| 7474 | + const syncedPreventUnmountingOnClose = open2 ? false : preventUnmountingOnClose; | |
| 7475 | + store.useSyncedValues({ | |
| 7476 | + mounted, | |
| 7477 | + transitionStatus, | |
| 7478 | + preventUnmountingOnClose: syncedPreventUnmountingOnClose | |
| 7479 | + }); | |
| 7480 | + const forceUnmount = useStableCallback(() => { | |
| 7481 | + setMounted(false); | |
| 7482 | + store.update({ | |
| 7483 | + activeTriggerId: null, | |
| 7484 | + activeTriggerElement: null, | |
| 7485 | + mounted: false, | |
| 7486 | + preventUnmountingOnClose: false | |
| 7487 | + }); | |
| 7488 | + onUnmount?.(); | |
| 7489 | + store.context.onOpenChangeComplete?.(false); | |
| 7490 | + }); | |
| 7491 | + useOpenChangeComplete({ | |
| 7492 | + enabled: mounted && !open2 && !syncedPreventUnmountingOnClose, | |
| 7493 | + open: open2, | |
| 7494 | + ref: store.context.popupRef, | |
| 7495 | + onComplete() { | |
| 7496 | + if (!open2) { | |
| 7497 | + forceUnmount(); | |
| 7498 | + } | |
| 7499 | + } | |
| 7500 | + }); | |
| 7501 | + return { | |
| 7502 | + forceUnmount, | |
| 7503 | + transitionStatus | |
| 7504 | + }; | |
| 1073 | 7505 | } |
| 7506 | +function usePopupInteractionProps(store, statePart) { | |
| 7507 | + store.useSyncedValues(statePart); | |
| 7508 | + useIsoLayoutEffect(() => () => { | |
| 7509 | + store.update({ | |
| 7510 | + activeTriggerProps: EMPTY_OBJECT, | |
| 7511 | + inactiveTriggerProps: EMPTY_OBJECT, | |
| 7512 | + popupProps: EMPTY_OBJECT | |
| 7513 | + }); | |
| 7514 | + }, [store]); | |
| 7515 | +} | |
| 1074 | 7516 | |
| 1075 | -// node_modules/tslib/tslib.es6.mjs | |
| 1076 | -var __assign = function() { | |
| 1077 | - __assign = Object.assign || function __assign2(t2) { | |
| 1078 | - for (var s, i = 1, n = arguments.length; i < n; i++) { | |
| 1079 | - s = arguments[i]; | |
| 1080 | - for (var p2 in s) if (Object.prototype.hasOwnProperty.call(s, p2)) t2[p2] = s[p2]; | |
| 7517 | +// node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs | |
| 7518 | +var devElementIdsByMap; | |
| 7519 | +function getDevElementIds(map) { | |
| 7520 | + devElementIdsByMap ??= /* @__PURE__ */ new WeakMap(); | |
| 7521 | + let elementIds = devElementIdsByMap.get(map); | |
| 7522 | + if (!elementIds) { | |
| 7523 | + elementIds = /* @__PURE__ */ new WeakMap(); | |
| 7524 | + devElementIdsByMap.set(map, elementIds); | |
| 7525 | + } | |
| 7526 | + return elementIds; | |
| 7527 | +} | |
| 7528 | +var PopupTriggerMap = class { | |
| 7529 | + constructor() { | |
| 7530 | + this.idMap = /* @__PURE__ */ new Map(); | |
| 7531 | + } | |
| 7532 | + /** | |
| 7533 | + * Adds a trigger element with the given ID. | |
| 7534 | + * | |
| 7535 | + * Note: The provided element is assumed to not be registered under multiple IDs. | |
| 7536 | + */ | |
| 7537 | + add(id, element) { | |
| 7538 | + if (true) { | |
| 7539 | + const elementIds = getDevElementIds(this); | |
| 7540 | + const existingId = elementIds.get(element); | |
| 7541 | + if (existingId !== void 0 && existingId !== id) { | |
| 7542 | + throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap."); | |
| 7543 | + } | |
| 7544 | + const previousElement = this.idMap.get(id); | |
| 7545 | + if (previousElement !== void 0 && previousElement !== element) { | |
| 7546 | + elementIds.delete(previousElement); | |
| 7547 | + } | |
| 7548 | + elementIds.set(element, id); | |
| 1081 | 7549 | } |
| 1082 | - return t2; | |
| 7550 | + this.idMap.set(id, element); | |
| 7551 | + } | |
| 7552 | + /** | |
| 7553 | + * Removes the trigger element with the given ID. | |
| 7554 | + */ | |
| 7555 | + delete(id) { | |
| 7556 | + if (true) { | |
| 7557 | + const element = this.idMap.get(id); | |
| 7558 | + if (element !== void 0) { | |
| 7559 | + devElementIdsByMap?.get(this)?.delete(element); | |
| 7560 | + } | |
| 7561 | + } | |
| 7562 | + this.idMap.delete(id); | |
| 7563 | + } | |
| 7564 | + /** | |
| 7565 | + * Whether the given element is registered as a trigger. | |
| 7566 | + */ | |
| 7567 | + hasElement(element) { | |
| 7568 | + for (const registered of this.idMap.values()) { | |
| 7569 | + if (registered === element) { | |
| 7570 | + return true; | |
| 7571 | + } | |
| 7572 | + } | |
| 7573 | + return false; | |
| 7574 | + } | |
| 7575 | + /** | |
| 7576 | + * Whether there is a registered trigger element matching the given predicate. | |
| 7577 | + */ | |
| 7578 | + hasMatchingElement(predicate) { | |
| 7579 | + for (const element of this.idMap.values()) { | |
| 7580 | + if (predicate(element)) { | |
| 7581 | + return true; | |
| 7582 | + } | |
| 7583 | + } | |
| 7584 | + return false; | |
| 7585 | + } | |
| 7586 | + /** | |
| 7587 | + * Returns the trigger element associated with the given ID, or undefined if no such element exists. | |
| 7588 | + */ | |
| 7589 | + getById(id) { | |
| 7590 | + return this.idMap.get(id); | |
| 7591 | + } | |
| 7592 | + /** | |
| 7593 | + * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element]. | |
| 7594 | + */ | |
| 7595 | + entries() { | |
| 7596 | + return this.idMap.entries(); | |
| 7597 | + } | |
| 7598 | + /** | |
| 7599 | + * Returns an iterable of all registered trigger elements. | |
| 7600 | + */ | |
| 7601 | + elements() { | |
| 7602 | + return this.idMap.values(); | |
| 7603 | + } | |
| 7604 | + /** | |
| 7605 | + * Returns the number of registered trigger elements. | |
| 7606 | + */ | |
| 7607 | + get size() { | |
| 7608 | + return this.idMap.size; | |
| 7609 | + } | |
| 7610 | +}; | |
| 7611 | + | |
| 7612 | +// node_modules/@base-ui/react/utils/popups/store.mjs | |
| 7613 | +function createInitialPopupStoreState(triggerElements, floatingId, nested = false) { | |
| 7614 | + return { | |
| 7615 | + open: false, | |
| 7616 | + openProp: void 0, | |
| 7617 | + mounted: false, | |
| 7618 | + transitionStatus: void 0, | |
| 7619 | + floatingRootContext: new FloatingRootStore({ | |
| 7620 | + open: false, | |
| 7621 | + transitionStatus: void 0, | |
| 7622 | + floatingElement: null, | |
| 7623 | + referenceElement: null, | |
| 7624 | + triggerElements, | |
| 7625 | + floatingId, | |
| 7626 | + syncOnly: true, | |
| 7627 | + nested, | |
| 7628 | + onOpenChange: void 0 | |
| 7629 | + }), | |
| 7630 | + floatingId, | |
| 7631 | + triggerCount: 0, | |
| 7632 | + preventUnmountingOnClose: false, | |
| 7633 | + payload: void 0, | |
| 7634 | + activeTriggerId: null, | |
| 7635 | + activeTriggerElement: null, | |
| 7636 | + triggerIdProp: void 0, | |
| 7637 | + popupElement: null, | |
| 7638 | + positionerElement: null, | |
| 7639 | + activeTriggerProps: EMPTY_OBJECT, | |
| 7640 | + inactiveTriggerProps: EMPTY_OBJECT, | |
| 7641 | + popupProps: EMPTY_OBJECT | |
| 1083 | 7642 | }; |
| 1084 | - return __assign.apply(this, arguments); | |
| 7643 | +} | |
| 7644 | +var activeTriggerIdSelector = (state) => state.triggerIdProp ?? state.activeTriggerId; | |
| 7645 | +var openSelector = (state) => state.openProp ?? state.open; | |
| 7646 | +var popupIdSelector = (state) => { | |
| 7647 | + const popupId = state.popupElement?.id ?? state.floatingId; | |
| 7648 | + return popupId || void 0; | |
| 1085 | 7649 | }; |
| 1086 | -function __rest(s, e) { | |
| 1087 | - var t2 = {}; | |
| 1088 | - for (var p2 in s) if (Object.prototype.hasOwnProperty.call(s, p2) && e.indexOf(p2) < 0) | |
| 1089 | - t2[p2] = s[p2]; | |
| 1090 | - if (s != null && typeof Object.getOwnPropertySymbols === "function") | |
| 1091 | - for (var i = 0, p2 = Object.getOwnPropertySymbols(s); i < p2.length; i++) { | |
| 1092 | - if (e.indexOf(p2[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p2[i])) | |
| 1093 | - t2[p2[i]] = s[p2[i]]; | |
| 7650 | +function triggerOwnsOpenPopup(state, triggerId) { | |
| 7651 | + return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId; | |
| 7652 | +} | |
| 7653 | +function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) { | |
| 7654 | + if (triggerOwnsOpenPopup(state, triggerId)) { | |
| 7655 | + return true; | |
| 7656 | + } | |
| 7657 | + return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1; | |
| 7658 | +} | |
| 7659 | +var popupStoreSelectors = { | |
| 7660 | + open: openSelector, | |
| 7661 | + mounted: (state) => state.mounted, | |
| 7662 | + transitionStatus: (state) => state.transitionStatus, | |
| 7663 | + floatingRootContext: (state) => state.floatingRootContext, | |
| 7664 | + triggerCount: (state) => state.triggerCount, | |
| 7665 | + preventUnmountingOnClose: (state) => state.preventUnmountingOnClose, | |
| 7666 | + payload: (state) => state.payload, | |
| 7667 | + activeTriggerId: activeTriggerIdSelector, | |
| 7668 | + activeTriggerElement: (state) => state.mounted ? state.activeTriggerElement : null, | |
| 7669 | + popupId: popupIdSelector, | |
| 7670 | + /** | |
| 7671 | + * Whether the trigger with the given ID was used to open the popup. | |
| 7672 | + */ | |
| 7673 | + isTriggerActive: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId, | |
| 7674 | + /** | |
| 7675 | + * Whether the popup is open and was activated by a trigger with the given ID. | |
| 7676 | + */ | |
| 7677 | + isOpenedByTrigger: (state, triggerId) => triggerOwnsOpenPopup(state, triggerId), | |
| 7678 | + /** | |
| 7679 | + * Whether the popup is mounted and was activated by a trigger with the given ID. | |
| 7680 | + */ | |
| 7681 | + isMountedByTrigger: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted, | |
| 7682 | + triggerProps: (state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps, | |
| 7683 | + /** | |
| 7684 | + * Popup id for the trigger that currently owns the open popup. | |
| 7685 | + */ | |
| 7686 | + triggerPopupId: (state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0, | |
| 7687 | + popupProps: (state) => state.popupProps, | |
| 7688 | + popupElement: (state) => state.popupElement, | |
| 7689 | + positionerElement: (state) => state.positionerElement | |
| 7690 | +}; | |
| 7691 | + | |
| 7692 | +// node_modules/@base-ui/react/utils/popups/usePopupHandleStore.mjs | |
| 7693 | +var React32 = __toESM(require_react(), 1); | |
| 7694 | +var import_shim2 = __toESM(require_shim(), 1); | |
| 7695 | +function usePopupHandleStore(handle) { | |
| 7696 | + const subscribe = React32.useCallback((listener) => { | |
| 7697 | + if (handle === void 0) { | |
| 7698 | + return NOOP; | |
| 1094 | 7699 | } |
| 1095 | - return t2; | |
| 7700 | + return handle.subscribeStore(listener); | |
| 7701 | + }, [handle]); | |
| 7702 | + const getSnapshot = React32.useCallback(() => { | |
| 7703 | + return handle === void 0 ? void 0 : handle.store; | |
| 7704 | + }, [handle]); | |
| 7705 | + return (0, import_shim2.useSyncExternalStore)(subscribe, getSnapshot, () => handle?.serverStore); | |
| 1096 | 7706 | } |
| 1097 | -function __spreadArray(to, from, pack) { | |
| 1098 | - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | |
| 1099 | - if (ar || !(i in from)) { | |
| 1100 | - if (!ar) ar = Array.prototype.slice.call(from, 0, i); | |
| 1101 | - ar[i] = from[i]; | |
| 7707 | + | |
| 7708 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useFloatingRootContext.mjs | |
| 7709 | +function useFloatingRootContext(options) { | |
| 7710 | + const { | |
| 7711 | + open: open2 = false, | |
| 7712 | + onOpenChange, | |
| 7713 | + elements = {} | |
| 7714 | + } = options; | |
| 7715 | + const floatingId = useId(); | |
| 7716 | + const nested = useFloatingParentNodeId() != null; | |
| 7717 | + if (true) { | |
| 7718 | + const optionDomReference = elements.reference; | |
| 7719 | + if (optionDomReference && !isElement(optionDomReference)) { | |
| 7720 | + console.error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `context.setPositionReference()`", "instead."); | |
| 1102 | 7721 | } |
| 1103 | 7722 | } |
| 1104 | - return to.concat(ar || Array.prototype.slice.call(from)); | |
| 7723 | + const store = useRefWithInit(() => new FloatingRootStore({ | |
| 7724 | + open: open2, | |
| 7725 | + transitionStatus: void 0, | |
| 7726 | + onOpenChange, | |
| 7727 | + referenceElement: elements.reference ?? null, | |
| 7728 | + floatingElement: elements.floating ?? null, | |
| 7729 | + triggerElements: new PopupTriggerMap(), | |
| 7730 | + floatingId, | |
| 7731 | + syncOnly: false, | |
| 7732 | + nested | |
| 7733 | + })).current; | |
| 7734 | + useIsoLayoutEffect(() => { | |
| 7735 | + const valuesToSync = { | |
| 7736 | + open: open2, | |
| 7737 | + floatingId | |
| 7738 | + }; | |
| 7739 | + if (elements.reference !== void 0) { | |
| 7740 | + valuesToSync.referenceElement = elements.reference; | |
| 7741 | + valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null; | |
| 7742 | + } | |
| 7743 | + if (elements.floating !== void 0) { | |
| 7744 | + valuesToSync.floatingElement = elements.floating; | |
| 7745 | + } | |
| 7746 | + store.update(valuesToSync); | |
| 7747 | + }, [open2, floatingId, elements.reference, elements.floating, store]); | |
| 7748 | + store.context.onOpenChange = onOpenChange; | |
| 7749 | + store.context.nested = nested; | |
| 7750 | + return store; | |
| 1105 | 7751 | } |
| 1106 | 7752 | |
| 1107 | -// node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/Combination.js | |
| 1108 | -var React21 = __toESM(require_react()); | |
| 7753 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs | |
| 7754 | +function useBaseUIFloating(options) { | |
| 7755 | + return useFloatingWithStore(options, options.rootContext); | |
| 7756 | +} | |
| 7757 | +function useFloatingWithStore(options, store) { | |
| 7758 | + const { | |
| 7759 | + nodeId, | |
| 7760 | + externalTree | |
| 7761 | + } = options; | |
| 7762 | + const referenceElement = store.useState("referenceElement"); | |
| 7763 | + const floatingElement = store.useState("floatingElement"); | |
| 7764 | + const domReferenceElement = store.useState("domReferenceElement"); | |
| 7765 | + const open2 = store.useState("open"); | |
| 7766 | + const floatingId = store.useState("floatingId"); | |
| 7767 | + const [positionReference, setPositionReferenceRaw] = React33.useState(null); | |
| 7768 | + const [localDomReference, setLocalDomReference] = React33.useState(void 0); | |
| 7769 | + const [localFloatingElement, setLocalFloatingElement] = React33.useState(void 0); | |
| 7770 | + const domReferenceRef = React33.useRef(null); | |
| 7771 | + const tree = useFloatingTree(externalTree); | |
| 7772 | + const storeElements = React33.useMemo(() => ({ | |
| 7773 | + reference: referenceElement, | |
| 7774 | + floating: floatingElement, | |
| 7775 | + domReference: domReferenceElement | |
| 7776 | + }), [referenceElement, floatingElement, domReferenceElement]); | |
| 7777 | + const position = useFloating({ | |
| 7778 | + ...options, | |
| 7779 | + elements: { | |
| 7780 | + ...storeElements, | |
| 7781 | + ...positionReference && { | |
| 7782 | + reference: positionReference | |
| 7783 | + } | |
| 7784 | + } | |
| 7785 | + }); | |
| 7786 | + const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null; | |
| 7787 | + const syncedFloatingElement = localFloatingElement === void 0 ? store.state.floatingElement : localFloatingElement; | |
| 7788 | + store.useSyncedValue("referenceElement", localDomReference ?? null); | |
| 7789 | + store.useSyncedValue("domReferenceElement", localDomReference === void 0 ? domReferenceElement : localDomReferenceElement); | |
| 7790 | + store.useSyncedValue("floatingElement", syncedFloatingElement); | |
| 7791 | + const setPositionReference = React33.useCallback((node) => { | |
| 7792 | + const computedPositionReference = isElement(node) ? { | |
| 7793 | + getBoundingClientRect: () => node.getBoundingClientRect(), | |
| 7794 | + getClientRects: () => node.getClientRects(), | |
| 7795 | + contextElement: node | |
| 7796 | + } : node; | |
| 7797 | + setPositionReferenceRaw(computedPositionReference); | |
| 7798 | + position.refs.setReference(computedPositionReference); | |
| 7799 | + }, [position.refs]); | |
| 7800 | + const setReference = React33.useCallback((node) => { | |
| 7801 | + if (isElement(node) || node === null) { | |
| 7802 | + domReferenceRef.current = node; | |
| 7803 | + setLocalDomReference(node); | |
| 7804 | + } | |
| 7805 | + if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to | |
| 7806 | + // `null` to support `positionReference` + an unstable `reference` | |
| 7807 | + // callback ref. | |
| 7808 | + node !== null && !isElement(node)) { | |
| 7809 | + position.refs.setReference(node); | |
| 7810 | + } | |
| 7811 | + }, [position.refs, setLocalDomReference]); | |
| 7812 | + const setFloating = React33.useCallback((node) => { | |
| 7813 | + setLocalFloatingElement(node); | |
| 7814 | + position.refs.setFloating(node); | |
| 7815 | + }, [position.refs]); | |
| 7816 | + const refs = React33.useMemo(() => ({ | |
| 7817 | + ...position.refs, | |
| 7818 | + setReference, | |
| 7819 | + setFloating, | |
| 7820 | + setPositionReference, | |
| 7821 | + domReference: domReferenceRef | |
| 7822 | + }), [position.refs, setReference, setFloating, setPositionReference]); | |
| 7823 | + const elements = React33.useMemo(() => ({ | |
| 7824 | + ...position.elements, | |
| 7825 | + domReference: domReferenceElement | |
| 7826 | + }), [position.elements, domReferenceElement]); | |
| 7827 | + const context = React33.useMemo(() => ({ | |
| 7828 | + ...position, | |
| 7829 | + dataRef: store.context.dataRef, | |
| 7830 | + open: open2, | |
| 7831 | + onOpenChange: store.setOpen, | |
| 7832 | + events: store.context.events, | |
| 7833 | + floatingId, | |
| 7834 | + refs, | |
| 7835 | + elements, | |
| 7836 | + nodeId, | |
| 7837 | + rootStore: store | |
| 7838 | + }), [position, refs, elements, nodeId, store, open2, floatingId]); | |
| 7839 | + useIsoLayoutEffect(() => { | |
| 7840 | + if (domReferenceElement) { | |
| 7841 | + domReferenceRef.current = domReferenceElement; | |
| 7842 | + } | |
| 7843 | + }, [domReferenceElement]); | |
| 7844 | + useIsoLayoutEffect(() => { | |
| 7845 | + store.context.dataRef.current.floatingContext = context; | |
| 7846 | + const node = tree?.nodesRef.current.find((n) => n.id === nodeId); | |
| 7847 | + if (node) { | |
| 7848 | + node.context = context; | |
| 7849 | + } | |
| 7850 | + }); | |
| 7851 | + return React33.useMemo(() => ({ | |
| 7852 | + ...position, | |
| 7853 | + context, | |
| 7854 | + refs, | |
| 7855 | + elements, | |
| 7856 | + rootStore: store | |
| 7857 | + }), [position, refs, elements, context, store]); | |
| 7858 | +} | |
| 1109 | 7859 | |
| 1110 | -// node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/UI.js | |
| 1111 | -var React17 = __toESM(require_react()); | |
| 7860 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs | |
| 7861 | +var React34 = __toESM(require_react(), 1); | |
| 7862 | +var isMacSafari = parts_exports.os.mac && parts_exports.engine.webkit; | |
| 7863 | +function useFocus(context, props = {}) { | |
| 7864 | + const { | |
| 7865 | + enabled = true, | |
| 7866 | + delay | |
| 7867 | + } = props; | |
| 7868 | + const store = "rootStore" in context ? context.rootStore : context; | |
| 7869 | + const { | |
| 7870 | + events, | |
| 7871 | + dataRef | |
| 7872 | + } = store.context; | |
| 7873 | + const blockFocusRef = React34.useRef(false); | |
| 7874 | + const blockedReferenceRef = React34.useRef(null); | |
| 7875 | + const keyboardModalityRef = React34.useRef(true); | |
| 7876 | + const timeout = useTimeout(); | |
| 7877 | + React34.useEffect(() => { | |
| 7878 | + const domReference = store.select("domReferenceElement"); | |
| 7879 | + if (!enabled) { | |
| 7880 | + return void 0; | |
| 7881 | + } | |
| 7882 | + const win = getWindow(domReference); | |
| 7883 | + function onBlur() { | |
| 7884 | + const currentDomReference = store.select("domReferenceElement"); | |
| 7885 | + if (!store.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) { | |
| 7886 | + blockFocusRef.current = true; | |
| 7887 | + blockedReferenceRef.current = currentDomReference; | |
| 7888 | + } | |
| 7889 | + } | |
| 7890 | + function onKeyDown() { | |
| 7891 | + keyboardModalityRef.current = true; | |
| 7892 | + } | |
| 7893 | + function onPointerDown() { | |
| 7894 | + keyboardModalityRef.current = false; | |
| 7895 | + } | |
| 7896 | + return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true)); | |
| 7897 | + }, [store, enabled]); | |
| 7898 | + React34.useEffect(() => { | |
| 7899 | + if (!enabled) { | |
| 7900 | + return void 0; | |
| 7901 | + } | |
| 7902 | + function onOpenChangeLocal(details) { | |
| 7903 | + if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) { | |
| 7904 | + const referenceElement = store.select("domReferenceElement"); | |
| 7905 | + if (isElement(referenceElement)) { | |
| 7906 | + blockedReferenceRef.current = referenceElement; | |
| 7907 | + blockFocusRef.current = true; | |
| 7908 | + } | |
| 7909 | + } | |
| 7910 | + } | |
| 7911 | + events.on("openchange", onOpenChangeLocal); | |
| 7912 | + return () => { | |
| 7913 | + events.off("openchange", onOpenChangeLocal); | |
| 7914 | + }; | |
| 7915 | + }, [events, enabled, store]); | |
| 7916 | + const reference = React34.useMemo(() => { | |
| 7917 | + function resetBlockedFocus() { | |
| 7918 | + blockFocusRef.current = false; | |
| 7919 | + blockedReferenceRef.current = null; | |
| 7920 | + } | |
| 7921 | + return { | |
| 7922 | + onMouseLeave() { | |
| 7923 | + resetBlockedFocus(); | |
| 7924 | + }, | |
| 7925 | + onFocus(event) { | |
| 7926 | + const focusTarget = event.currentTarget; | |
| 7927 | + if (blockFocusRef.current) { | |
| 7928 | + if (blockedReferenceRef.current === focusTarget) { | |
| 7929 | + return; | |
| 7930 | + } | |
| 7931 | + resetBlockedFocus(); | |
| 7932 | + } | |
| 7933 | + const target = getTarget(event.nativeEvent); | |
| 7934 | + if (isElement(target)) { | |
| 7935 | + if (isMacSafari && !event.relatedTarget) { | |
| 7936 | + if (!keyboardModalityRef.current && !isTypeableElement(target)) { | |
| 7937 | + return; | |
| 7938 | + } | |
| 7939 | + } else if (!matchesFocusVisible(target)) { | |
| 7940 | + return; | |
| 7941 | + } | |
| 7942 | + } | |
| 7943 | + const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements); | |
| 7944 | + const { | |
| 7945 | + nativeEvent, | |
| 7946 | + currentTarget | |
| 7947 | + } = event; | |
| 7948 | + const delayValue = typeof delay === "function" ? delay() : delay; | |
| 7949 | + if (store.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) { | |
| 7950 | + store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); | |
| 7951 | + return; | |
| 7952 | + } | |
| 7953 | + timeout.start(delayValue, () => { | |
| 7954 | + if (blockFocusRef.current) { | |
| 7955 | + return; | |
| 7956 | + } | |
| 7957 | + store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); | |
| 7958 | + }); | |
| 7959 | + }, | |
| 7960 | + onBlur(event) { | |
| 7961 | + resetBlockedFocus(); | |
| 7962 | + const relatedTarget = event.relatedTarget; | |
| 7963 | + const nativeEvent = event.nativeEvent; | |
| 7964 | + const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside"; | |
| 7965 | + timeout.start(0, () => { | |
| 7966 | + const domReference = store.select("domReferenceElement"); | |
| 7967 | + const activeEl = activeElement(ownerDocument(domReference)); | |
| 7968 | + if (!relatedTarget && activeEl === domReference) { | |
| 7969 | + return; | |
| 7970 | + } | |
| 7971 | + if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) { | |
| 7972 | + return; | |
| 7973 | + } | |
| 7974 | + const nextFocusedElement = relatedTarget ?? activeEl; | |
| 7975 | + if (isTargetInsideEnabledTrigger(nextFocusedElement, store.context.triggerElements)) { | |
| 7976 | + return; | |
| 7977 | + } | |
| 7978 | + store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent)); | |
| 7979 | + }); | |
| 7980 | + } | |
| 7981 | + }; | |
| 7982 | + }, [dataRef, delay, store, timeout]); | |
| 7983 | + return React34.useMemo(() => enabled ? { | |
| 7984 | + reference, | |
| 7985 | + trigger: reference | |
| 7986 | + } : {}, [enabled, reference]); | |
| 7987 | +} | |
| 1112 | 7988 | |
| 1113 | -// node_modules/react-remove-scroll-bar/dist/es2015/constants.js | |
| 1114 | -var zeroRightClassName = "right-scroll-bar-position"; | |
| 1115 | -var fullWidthClassName = "width-before-scroll-bar"; | |
| 1116 | -var noScrollbarsClassName = "with-scroll-bars-hidden"; | |
| 1117 | -var removedBarSizeVariable = "--removed-body-scroll-bar-size"; | |
| 7989 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs | |
| 7990 | +var React35 = __toESM(require_react(), 1); | |
| 1118 | 7991 | |
| 1119 | -// node_modules/use-callback-ref/dist/es2015/assignRef.js | |
| 1120 | -function assignRef(ref, value) { | |
| 1121 | - if (typeof ref === "function") { | |
| 1122 | - ref(value); | |
| 1123 | - } else if (ref) { | |
| 1124 | - ref.current = value; | |
| 7992 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs | |
| 7993 | +var HoverInteraction = class _HoverInteraction { | |
| 7994 | + constructor() { | |
| 7995 | + this.pointerType = void 0; | |
| 7996 | + this.interactedInside = false; | |
| 7997 | + this.handler = void 0; | |
| 7998 | + this.blockMouseMove = true; | |
| 7999 | + this.performedPointerEventsMutation = false; | |
| 8000 | + this.pointerEventsScopeElement = null; | |
| 8001 | + this.pointerEventsReferenceElement = null; | |
| 8002 | + this.pointerEventsFloatingElement = null; | |
| 8003 | + this.restTimeoutPending = false; | |
| 8004 | + this.openChangeTimeout = new Timeout(); | |
| 8005 | + this.restTimeout = new Timeout(); | |
| 8006 | + this.handleCloseOptions = void 0; | |
| 1125 | 8007 | } |
| 1126 | - return ref; | |
| 8008 | + static create() { | |
| 8009 | + return new _HoverInteraction(); | |
| 8010 | + } | |
| 8011 | + dispose = () => { | |
| 8012 | + this.openChangeTimeout.clear(); | |
| 8013 | + this.restTimeout.clear(); | |
| 8014 | + }; | |
| 8015 | + disposeEffect = () => { | |
| 8016 | + return this.dispose; | |
| 8017 | + }; | |
| 8018 | +}; | |
| 8019 | +var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap(); | |
| 8020 | +function clearSafePolygonPointerEventsMutation(instance) { | |
| 8021 | + if (!instance.performedPointerEventsMutation) { | |
| 8022 | + return; | |
| 8023 | + } | |
| 8024 | + const scopeElement = instance.pointerEventsScopeElement; | |
| 8025 | + if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) { | |
| 8026 | + instance.pointerEventsScopeElement?.style.removeProperty("pointer-events"); | |
| 8027 | + instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events"); | |
| 8028 | + instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events"); | |
| 8029 | + pointerEventsMutationOwnerByScopeElement.delete(scopeElement); | |
| 8030 | + } | |
| 8031 | + instance.performedPointerEventsMutation = false; | |
| 8032 | + instance.pointerEventsScopeElement = null; | |
| 8033 | + instance.pointerEventsReferenceElement = null; | |
| 8034 | + instance.pointerEventsFloatingElement = null; | |
| 1127 | 8035 | } |
| 8036 | +function applySafePolygonPointerEventsMutation(instance, options) { | |
| 8037 | + const { | |
| 8038 | + scopeElement, | |
| 8039 | + referenceElement, | |
| 8040 | + floatingElement | |
| 8041 | + } = options; | |
| 8042 | + const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement); | |
| 8043 | + if (existingOwner && existingOwner !== instance) { | |
| 8044 | + clearSafePolygonPointerEventsMutation(existingOwner); | |
| 8045 | + } | |
| 8046 | + clearSafePolygonPointerEventsMutation(instance); | |
| 8047 | + instance.performedPointerEventsMutation = true; | |
| 8048 | + instance.pointerEventsScopeElement = scopeElement; | |
| 8049 | + instance.pointerEventsReferenceElement = referenceElement; | |
| 8050 | + instance.pointerEventsFloatingElement = floatingElement; | |
| 8051 | + pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance); | |
| 8052 | + scopeElement.style.pointerEvents = "none"; | |
| 8053 | + referenceElement.style.pointerEvents = "auto"; | |
| 8054 | + floatingElement.style.pointerEvents = "auto"; | |
| 8055 | +} | |
| 8056 | +function useHoverInteractionSharedState(store) { | |
| 8057 | + const data = store.context.dataRef.current; | |
| 8058 | + const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current; | |
| 8059 | + if (!data.hoverInteractionState) { | |
| 8060 | + data.hoverInteractionState = instance; | |
| 8061 | + } | |
| 8062 | + useOnMount(data.hoverInteractionState.disposeEffect); | |
| 8063 | + return data.hoverInteractionState; | |
| 8064 | +} | |
| 1128 | 8065 | |
| 1129 | -// node_modules/use-callback-ref/dist/es2015/useRef.js | |
| 1130 | -var import_react = __toESM(require_react()); | |
| 1131 | -function useCallbackRef2(initialValue, callback) { | |
| 1132 | - var ref = (0, import_react.useState)(function() { | |
| 8066 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs | |
| 8067 | +function useHoverFloatingInteraction(context, parameters = {}) { | |
| 8068 | + const { | |
| 8069 | + enabled = true, | |
| 8070 | + closeDelay: closeDelayProp = 0, | |
| 8071 | + nodeId: nodeIdProp | |
| 8072 | + } = parameters; | |
| 8073 | + const store = "rootStore" in context ? context.rootStore : context; | |
| 8074 | + const open2 = store.useState("open"); | |
| 8075 | + const floatingElement = store.useState("floatingElement"); | |
| 8076 | + const domReferenceElement = store.useState("domReferenceElement"); | |
| 8077 | + const { | |
| 8078 | + dataRef | |
| 8079 | + } = store.context; | |
| 8080 | + const tree = useFloatingTree(); | |
| 8081 | + const parentId = useFloatingParentNodeId(); | |
| 8082 | + const instance = useHoverInteractionSharedState(store); | |
| 8083 | + const childClosedTimeout = useTimeout(); | |
| 8084 | + const isClickLikeOpenEvent2 = useStableCallback(() => { | |
| 8085 | + return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); | |
| 8086 | + }); | |
| 8087 | + const isHoverOpen = useStableCallback(() => { | |
| 8088 | + return isHoverOpenEvent(dataRef.current.openEvent?.type); | |
| 8089 | + }); | |
| 8090 | + const clearPointerEvents = useStableCallback(() => { | |
| 8091 | + clearSafePolygonPointerEventsMutation(instance); | |
| 8092 | + }); | |
| 8093 | + useIsoLayoutEffect(() => { | |
| 8094 | + if (!open2) { | |
| 8095 | + instance.pointerType = void 0; | |
| 8096 | + instance.restTimeoutPending = false; | |
| 8097 | + instance.interactedInside = false; | |
| 8098 | + clearPointerEvents(); | |
| 8099 | + } | |
| 8100 | + }, [open2, instance, clearPointerEvents]); | |
| 8101 | + React35.useEffect(() => { | |
| 8102 | + return clearPointerEvents; | |
| 8103 | + }, [clearPointerEvents]); | |
| 8104 | + useIsoLayoutEffect(() => { | |
| 8105 | + if (!enabled) { | |
| 8106 | + return void 0; | |
| 8107 | + } | |
| 8108 | + if (open2 && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) { | |
| 8109 | + const ref = domReferenceElement; | |
| 8110 | + const floatingEl = floatingElement; | |
| 8111 | + const doc = ownerDocument(floatingElement); | |
| 8112 | + const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating; | |
| 8113 | + if (parentFloating) { | |
| 8114 | + parentFloating.style.pointerEvents = ""; | |
| 8115 | + } | |
| 8116 | + const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null; | |
| 8117 | + const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null; | |
| 8118 | + const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest("[data-rootownerid]") ?? doc.body; | |
| 8119 | + applySafePolygonPointerEventsMutation(instance, { | |
| 8120 | + scopeElement, | |
| 8121 | + referenceElement: ref, | |
| 8122 | + floatingElement: floatingEl | |
| 8123 | + }); | |
| 8124 | + return () => { | |
| 8125 | + clearPointerEvents(); | |
| 8126 | + }; | |
| 8127 | + } | |
| 8128 | + return void 0; | |
| 8129 | + }, [enabled, open2, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]); | |
| 8130 | + React35.useEffect(() => { | |
| 8131 | + if (!enabled) { | |
| 8132 | + return void 0; | |
| 8133 | + } | |
| 8134 | + function hasParentChildren() { | |
| 8135 | + return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0); | |
| 8136 | + } | |
| 8137 | + function closeWithDelay(event) { | |
| 8138 | + const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType); | |
| 8139 | + const close = () => { | |
| 8140 | + store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); | |
| 8141 | + tree?.events.emit("floating.closed", event); | |
| 8142 | + }; | |
| 8143 | + if (closeDelay) { | |
| 8144 | + instance.openChangeTimeout.start(closeDelay, close); | |
| 8145 | + } else { | |
| 8146 | + instance.openChangeTimeout.clear(); | |
| 8147 | + close(); | |
| 8148 | + } | |
| 8149 | + } | |
| 8150 | + function handleInteractInside(event) { | |
| 8151 | + const target = getTarget(event); | |
| 8152 | + if (!isInteractiveElement(target)) { | |
| 8153 | + instance.interactedInside = false; | |
| 8154 | + return; | |
| 8155 | + } | |
| 8156 | + instance.interactedInside = target?.closest("[aria-haspopup]") != null; | |
| 8157 | + } | |
| 8158 | + function onFloatingMouseEnter() { | |
| 8159 | + instance.openChangeTimeout.clear(); | |
| 8160 | + childClosedTimeout.clear(); | |
| 8161 | + tree?.events.off("floating.closed", onNodeClosed); | |
| 8162 | + clearPointerEvents(); | |
| 8163 | + } | |
| 8164 | + function onFloatingMouseLeave(event) { | |
| 8165 | + if (hasParentChildren() && tree) { | |
| 8166 | + tree.events.on("floating.closed", onNodeClosed); | |
| 8167 | + return; | |
| 8168 | + } | |
| 8169 | + if (isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) { | |
| 8170 | + return; | |
| 8171 | + } | |
| 8172 | + const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp; | |
| 8173 | + const relatedTarget = event.relatedTarget; | |
| 8174 | + const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget)); | |
| 8175 | + if (isMovingIntoDescendantFloating) { | |
| 8176 | + return; | |
| 8177 | + } | |
| 8178 | + if (instance.handler) { | |
| 8179 | + instance.handler(event); | |
| 8180 | + return; | |
| 8181 | + } | |
| 8182 | + clearPointerEvents(); | |
| 8183 | + if (isHoverOpen() && !isClickLikeOpenEvent2()) { | |
| 8184 | + closeWithDelay(event); | |
| 8185 | + } | |
| 8186 | + } | |
| 8187 | + function onNodeClosed(event) { | |
| 8188 | + if (!tree || !parentId || hasParentChildren()) { | |
| 8189 | + return; | |
| 8190 | + } | |
| 8191 | + childClosedTimeout.start(0, () => { | |
| 8192 | + tree.events.off("floating.closed", onNodeClosed); | |
| 8193 | + store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); | |
| 8194 | + tree.events.emit("floating.closed", event); | |
| 8195 | + }); | |
| 8196 | + } | |
| 8197 | + const floating = floatingElement; | |
| 8198 | + return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => { | |
| 8199 | + tree?.events.off("floating.closed", onNodeClosed); | |
| 8200 | + }); | |
| 8201 | + }, [enabled, floatingElement, store, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]); | |
| 8202 | +} | |
| 8203 | + | |
| 8204 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs | |
| 8205 | +var React36 = __toESM(require_react(), 1); | |
| 8206 | +var ReactDOM5 = __toESM(require_react_dom(), 1); | |
| 8207 | +var EMPTY_REF = { | |
| 8208 | + current: null | |
| 8209 | +}; | |
| 8210 | +function useHoverReferenceInteraction(context, props = {}) { | |
| 8211 | + const { | |
| 8212 | + enabled = true, | |
| 8213 | + delay = 0, | |
| 8214 | + handleClose = null, | |
| 8215 | + mouseOnly = false, | |
| 8216 | + restMs = 0, | |
| 8217 | + move = true, | |
| 8218 | + triggerElementRef = EMPTY_REF, | |
| 8219 | + externalTree, | |
| 8220 | + isActiveTrigger = true, | |
| 8221 | + getHandleCloseContext, | |
| 8222 | + isClosing, | |
| 8223 | + shouldOpen: shouldOpenProp, | |
| 8224 | + guardStaleOpen = false | |
| 8225 | + } = props; | |
| 8226 | + const store = "rootStore" in context ? context.rootStore : context; | |
| 8227 | + const { | |
| 8228 | + dataRef, | |
| 8229 | + events | |
| 8230 | + } = store.context; | |
| 8231 | + const tree = useFloatingTree(externalTree); | |
| 8232 | + const instance = useHoverInteractionSharedState(store); | |
| 8233 | + const isHoverCloseActiveRef = React36.useRef(false); | |
| 8234 | + const handleCloseRef = useValueAsRef(handleClose); | |
| 8235 | + const delayRef = useValueAsRef(delay); | |
| 8236 | + const restMsRef = useValueAsRef(restMs); | |
| 8237 | + const enabledRef = useValueAsRef(enabled); | |
| 8238 | + const shouldOpenRef = useValueAsRef(shouldOpenProp); | |
| 8239 | + const isClosingRef = useValueAsRef(isClosing); | |
| 8240 | + const isClickLikeOpenEvent2 = useStableCallback(() => { | |
| 8241 | + return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); | |
| 8242 | + }); | |
| 8243 | + const checkShouldOpen = useStableCallback(() => { | |
| 8244 | + return shouldOpenRef.current?.() !== false; | |
| 8245 | + }); | |
| 8246 | + const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => { | |
| 8247 | + const allTriggers = store.context.triggerElements; | |
| 8248 | + if (allTriggers.hasElement(currentTarget)) { | |
| 8249 | + return !currentDomReference || !contains(currentDomReference, currentTarget); | |
| 8250 | + } | |
| 8251 | + if (!isElement(target)) { | |
| 8252 | + return false; | |
| 8253 | + } | |
| 8254 | + const targetElement = target; | |
| 8255 | + return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement)); | |
| 8256 | + }); | |
| 8257 | + const cleanupMouseMoveHandler = useStableCallback(() => { | |
| 8258 | + if (!instance.handler) { | |
| 8259 | + return; | |
| 8260 | + } | |
| 8261 | + const doc = ownerDocument(store.select("domReferenceElement")); | |
| 8262 | + doc.removeEventListener("mousemove", instance.handler); | |
| 8263 | + instance.handler = void 0; | |
| 8264 | + }); | |
| 8265 | + const clearPointerEvents = useStableCallback(() => { | |
| 8266 | + clearSafePolygonPointerEventsMutation(instance); | |
| 8267 | + }); | |
| 8268 | + if (isActiveTrigger) { | |
| 8269 | + instance.handleCloseOptions = handleClose?.__options; | |
| 8270 | + } | |
| 8271 | + React36.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]); | |
| 8272 | + React36.useEffect(() => { | |
| 8273 | + if (!enabled) { | |
| 8274 | + return void 0; | |
| 8275 | + } | |
| 8276 | + function onOpenChangeLocal(details) { | |
| 8277 | + if (!details.open) { | |
| 8278 | + isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover; | |
| 8279 | + cleanupMouseMoveHandler(); | |
| 8280 | + instance.openChangeTimeout.clear(); | |
| 8281 | + instance.restTimeout.clear(); | |
| 8282 | + instance.blockMouseMove = true; | |
| 8283 | + instance.restTimeoutPending = false; | |
| 8284 | + } else { | |
| 8285 | + isHoverCloseActiveRef.current = false; | |
| 8286 | + } | |
| 8287 | + } | |
| 8288 | + events.on("openchange", onOpenChangeLocal); | |
| 8289 | + return () => { | |
| 8290 | + events.off("openchange", onOpenChangeLocal); | |
| 8291 | + }; | |
| 8292 | + }, [enabled, events, instance, cleanupMouseMoveHandler]); | |
| 8293 | + React36.useEffect(() => { | |
| 8294 | + if (!enabled) { | |
| 8295 | + return void 0; | |
| 8296 | + } | |
| 8297 | + function closeWithDelay(event, runElseBranch = true) { | |
| 8298 | + const closeDelay = getDelay(delayRef.current, "close", instance.pointerType); | |
| 8299 | + if (closeDelay) { | |
| 8300 | + instance.openChangeTimeout.start(closeDelay, () => { | |
| 8301 | + store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); | |
| 8302 | + tree?.events.emit("floating.closed", event); | |
| 8303 | + }); | |
| 8304 | + } else if (runElseBranch) { | |
| 8305 | + instance.openChangeTimeout.clear(); | |
| 8306 | + store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); | |
| 8307 | + tree?.events.emit("floating.closed", event); | |
| 8308 | + } | |
| 8309 | + } | |
| 8310 | + const trigger = triggerElementRef.current ?? (isActiveTrigger ? store.select("domReferenceElement") : null); | |
| 8311 | + if (!isElement(trigger)) { | |
| 8312 | + return void 0; | |
| 8313 | + } | |
| 8314 | + function onMouseEnter(event) { | |
| 8315 | + instance.openChangeTimeout.clear(); | |
| 8316 | + instance.blockMouseMove = false; | |
| 8317 | + if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { | |
| 8318 | + return; | |
| 8319 | + } | |
| 8320 | + const restMsValue = getRestMs(restMsRef.current); | |
| 8321 | + const openDelay = getDelay(delayRef.current, "open", instance.pointerType); | |
| 8322 | + const eventTarget = getTarget(event); | |
| 8323 | + const currentTarget = event.currentTarget ?? null; | |
| 8324 | + const currentDomReference = store.select("domReferenceElement"); | |
| 8325 | + let triggerNode = currentTarget; | |
| 8326 | + if (isElement(eventTarget) && !store.context.triggerElements.hasElement(eventTarget)) { | |
| 8327 | + for (const triggerElement of store.context.triggerElements.elements()) { | |
| 8328 | + if (contains(triggerElement, eventTarget)) { | |
| 8329 | + triggerNode = triggerElement; | |
| 8330 | + break; | |
| 8331 | + } | |
| 8332 | + } | |
| 8333 | + } | |
| 8334 | + if (isElement(currentTarget) && isElement(currentDomReference) && !store.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) { | |
| 8335 | + triggerNode = currentDomReference; | |
| 8336 | + } | |
| 8337 | + const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget); | |
| 8338 | + const isOpen = store.select("open"); | |
| 8339 | + const isInClosingTransition = isClosingRef.current?.() ?? store.select("transitionStatus") === "ending"; | |
| 8340 | + const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current; | |
| 8341 | + const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition; | |
| 8342 | + const isRestOnlyDelay = restMsValue > 0 && !openDelay; | |
| 8343 | + const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition; | |
| 8344 | + const shouldOpen = !isOpen || isOverInactive; | |
| 8345 | + if (shouldOpenImmediately) { | |
| 8346 | + if (checkShouldOpen()) { | |
| 8347 | + store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); | |
| 8348 | + } | |
| 8349 | + return; | |
| 8350 | + } | |
| 8351 | + if (isRestOnlyDelay) { | |
| 8352 | + return; | |
| 8353 | + } | |
| 8354 | + if (openDelay) { | |
| 8355 | + instance.openChangeTimeout.start(openDelay, () => { | |
| 8356 | + if (shouldOpen && checkShouldOpen()) { | |
| 8357 | + store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); | |
| 8358 | + } | |
| 8359 | + }); | |
| 8360 | + } else if (shouldOpen) { | |
| 8361 | + if (checkShouldOpen()) { | |
| 8362 | + store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); | |
| 8363 | + } | |
| 8364 | + } | |
| 8365 | + } | |
| 8366 | + function onMouseLeave(event) { | |
| 8367 | + if (isClickLikeOpenEvent2()) { | |
| 8368 | + clearPointerEvents(); | |
| 8369 | + return; | |
| 8370 | + } | |
| 8371 | + cleanupMouseMoveHandler(); | |
| 8372 | + const domReferenceElement = store.select("domReferenceElement"); | |
| 8373 | + const doc = ownerDocument(domReferenceElement); | |
| 8374 | + instance.restTimeout.clear(); | |
| 8375 | + instance.restTimeoutPending = false; | |
| 8376 | + const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.(); | |
| 8377 | + if (isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) { | |
| 8378 | + return; | |
| 8379 | + } | |
| 8380 | + if (handleCloseRef.current && handleCloseContextBase) { | |
| 8381 | + if (!store.select("open")) { | |
| 8382 | + instance.openChangeTimeout.clear(); | |
| 8383 | + } | |
| 8384 | + const currentTrigger = triggerElementRef.current; | |
| 8385 | + instance.handler = handleCloseRef.current({ | |
| 8386 | + ...handleCloseContextBase, | |
| 8387 | + tree, | |
| 8388 | + x: event.clientX, | |
| 8389 | + y: event.clientY, | |
| 8390 | + onClose() { | |
| 8391 | + clearPointerEvents(); | |
| 8392 | + cleanupMouseMoveHandler(); | |
| 8393 | + if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store.select("domReferenceElement")) { | |
| 8394 | + closeWithDelay(event, true); | |
| 8395 | + } | |
| 8396 | + } | |
| 8397 | + }); | |
| 8398 | + doc.addEventListener("mousemove", instance.handler); | |
| 8399 | + instance.handler(event); | |
| 8400 | + return; | |
| 8401 | + } | |
| 8402 | + const shouldClose = instance.pointerType === "touch" ? !contains(store.select("floatingElement"), event.relatedTarget) : true; | |
| 8403 | + if (shouldClose) { | |
| 8404 | + closeWithDelay(event); | |
| 8405 | + } | |
| 8406 | + } | |
| 8407 | + function onMouseOut(event) { | |
| 8408 | + if (contains(trigger, event.relatedTarget)) { | |
| 8409 | + return; | |
| 8410 | + } | |
| 8411 | + instance.openChangeTimeout.clear(); | |
| 8412 | + instance.restTimeout.clear(); | |
| 8413 | + instance.restTimeoutPending = false; | |
| 8414 | + } | |
| 8415 | + const staleOpenGuard = guardStaleOpen ? addEventListener(trigger, "mouseout", onMouseOut) : void 0; | |
| 8416 | + if (move) { | |
| 8417 | + return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, { | |
| 8418 | + once: true | |
| 8419 | + }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard); | |
| 8420 | + } | |
| 8421 | + return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard); | |
| 8422 | + }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen, guardStaleOpen]); | |
| 8423 | + return React36.useMemo(() => { | |
| 8424 | + if (!enabled) { | |
| 8425 | + return void 0; | |
| 8426 | + } | |
| 8427 | + function setPointerRef(event) { | |
| 8428 | + instance.pointerType = event.pointerType; | |
| 8429 | + } | |
| 1133 | 8430 | return { |
| 1134 | - // value | |
| 1135 | - value: initialValue, | |
| 1136 | - // last callback | |
| 1137 | - callback, | |
| 1138 | - // "memoized" public interface | |
| 1139 | - facade: { | |
| 1140 | - get current() { | |
| 1141 | - return ref.value; | |
| 1142 | - }, | |
| 1143 | - set current(value) { | |
| 1144 | - var last = ref.value; | |
| 1145 | - if (last !== value) { | |
| 1146 | - ref.value = value; | |
| 1147 | - ref.callback(value, last); | |
| 8431 | + onPointerDown: setPointerRef, | |
| 8432 | + onPointerEnter: setPointerRef, | |
| 8433 | + onMouseMove(event) { | |
| 8434 | + const { | |
| 8435 | + nativeEvent | |
| 8436 | + } = event; | |
| 8437 | + const trigger = event.currentTarget; | |
| 8438 | + const currentDomReference = store.select("domReferenceElement"); | |
| 8439 | + const currentOpen = store.select("open"); | |
| 8440 | + const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target); | |
| 8441 | + if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { | |
| 8442 | + return; | |
| 8443 | + } | |
| 8444 | + if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) { | |
| 8445 | + const floatingElement = store.select("floatingElement"); | |
| 8446 | + if (floatingElement) { | |
| 8447 | + const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body; | |
| 8448 | + applySafePolygonPointerEventsMutation(instance, { | |
| 8449 | + scopeElement, | |
| 8450 | + referenceElement: trigger, | |
| 8451 | + floatingElement | |
| 8452 | + }); | |
| 1148 | 8453 | } |
| 1149 | 8454 | } |
| 8455 | + const restMsValue = getRestMs(restMsRef.current); | |
| 8456 | + if (currentOpen && !isOverInactive || restMsValue === 0) { | |
| 8457 | + return; | |
| 8458 | + } | |
| 8459 | + if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) { | |
| 8460 | + return; | |
| 8461 | + } | |
| 8462 | + instance.restTimeout.clear(); | |
| 8463 | + function handleMouseMove() { | |
| 8464 | + instance.restTimeoutPending = false; | |
| 8465 | + if (isClickLikeOpenEvent2()) { | |
| 8466 | + return; | |
| 8467 | + } | |
| 8468 | + const latestOpen = store.select("open"); | |
| 8469 | + if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) { | |
| 8470 | + store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger)); | |
| 8471 | + } | |
| 8472 | + } | |
| 8473 | + if (instance.pointerType === "touch") { | |
| 8474 | + ReactDOM5.flushSync(() => { | |
| 8475 | + handleMouseMove(); | |
| 8476 | + }); | |
| 8477 | + } else if (isOverInactive && currentOpen) { | |
| 8478 | + handleMouseMove(); | |
| 8479 | + } else { | |
| 8480 | + instance.restTimeoutPending = true; | |
| 8481 | + instance.restTimeout.start(restMsValue, handleMouseMove); | |
| 8482 | + } | |
| 1150 | 8483 | } |
| 1151 | 8484 | }; |
| 1152 | - })[0]; | |
| 1153 | - ref.callback = callback; | |
| 1154 | - return ref.facade; | |
| 8485 | + }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store, restMsRef, checkShouldOpen]); | |
| 1155 | 8486 | } |
| 1156 | 8487 | |
| 1157 | -// node_modules/use-callback-ref/dist/es2015/useMergeRef.js | |
| 1158 | -var React15 = __toESM(require_react()); | |
| 1159 | -var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React15.useLayoutEffect : React15.useEffect; | |
| 1160 | -var currentValues = /* @__PURE__ */ new WeakMap(); | |
| 1161 | -function useMergeRefs(refs, defaultValue) { | |
| 1162 | - var callbackRef = useCallbackRef2(defaultValue || null, function(newValue) { | |
| 1163 | - return refs.forEach(function(ref) { | |
| 1164 | - return assignRef(ref, newValue); | |
| 8488 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useListNavigation.mjs | |
| 8489 | +var React37 = __toESM(require_react(), 1); | |
| 8490 | +var ESCAPE = "Escape"; | |
| 8491 | +function isStationaryWebKitPointer(event) { | |
| 8492 | + return parts_exports.engine.webkit && event.movementX === 0 && event.movementY === 0; | |
| 8493 | +} | |
| 8494 | +function doSwitch(orientation, vertical, horizontal) { | |
| 8495 | + switch (orientation) { | |
| 8496 | + case "vertical": | |
| 8497 | + return vertical; | |
| 8498 | + case "horizontal": | |
| 8499 | + return horizontal; | |
| 8500 | + default: | |
| 8501 | + return vertical || horizontal; | |
| 8502 | + } | |
| 8503 | +} | |
| 8504 | +function isMainOrientationKey(key, orientation) { | |
| 8505 | + const vertical = key === ARROW_UP || key === ARROW_DOWN; | |
| 8506 | + const horizontal = key === ARROW_LEFT || key === ARROW_RIGHT; | |
| 8507 | + return doSwitch(orientation, vertical, horizontal); | |
| 8508 | +} | |
| 8509 | +function isMainOrientationToEndKey(key, orientation, rtl) { | |
| 8510 | + const vertical = key === ARROW_DOWN; | |
| 8511 | + const horizontal = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT; | |
| 8512 | + return doSwitch(orientation, vertical, horizontal) || key === "Enter" || key === " " || key === ""; | |
| 8513 | +} | |
| 8514 | +function isCrossOrientationOpenKey(key, orientation, rtl) { | |
| 8515 | + const vertical = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT; | |
| 8516 | + const horizontal = key === ARROW_DOWN; | |
| 8517 | + return doSwitch(orientation, vertical, horizontal); | |
| 8518 | +} | |
| 8519 | +function isCrossOrientationCloseKey(key, orientation, rtl, grid) { | |
| 8520 | + const vertical = rtl ? key === ARROW_RIGHT : key === ARROW_LEFT; | |
| 8521 | + const horizontal = key === ARROW_UP; | |
| 8522 | + if (orientation === "both" || orientation === "horizontal" && grid) { | |
| 8523 | + return key === ESCAPE; | |
| 8524 | + } | |
| 8525 | + return doSwitch(orientation, vertical, horizontal); | |
| 8526 | +} | |
| 8527 | +function useListNavigation(context, props) { | |
| 8528 | + const { | |
| 8529 | + listRef, | |
| 8530 | + activeIndex, | |
| 8531 | + onNavigate: onNavigateProp = () => { | |
| 8532 | + }, | |
| 8533 | + enabled = true, | |
| 8534 | + selectedIndex = null, | |
| 8535 | + allowEscape = false, | |
| 8536 | + loopFocus = false, | |
| 8537 | + nested = false, | |
| 8538 | + rtl = false, | |
| 8539 | + virtual = false, | |
| 8540 | + focusItemOnOpen = "auto", | |
| 8541 | + focusItemOnHover = true, | |
| 8542 | + openOnArrowKeyDown = true, | |
| 8543 | + disabledIndices = void 0, | |
| 8544 | + orientation = "vertical", | |
| 8545 | + parentOrientation, | |
| 8546 | + id, | |
| 8547 | + resetOnPointerLeave = true, | |
| 8548 | + externalTree, | |
| 8549 | + grid: navigateGrid | |
| 8550 | + } = props; | |
| 8551 | + const isGrid = navigateGrid != null; | |
| 8552 | + if (true) { | |
| 8553 | + if (allowEscape) { | |
| 8554 | + if (!loopFocus) { | |
| 8555 | + console.warn("`useListNavigation` looping must be enabled to allow escaping."); | |
| 8556 | + } | |
| 8557 | + if (!virtual) { | |
| 8558 | + console.warn("`useListNavigation` must be virtual to allow escaping."); | |
| 8559 | + } | |
| 8560 | + } | |
| 8561 | + if (orientation === "vertical" && isGrid) { | |
| 8562 | + console.warn("In grid list navigation mode, the `orientation` should", 'be either "horizontal" or "both".'); | |
| 8563 | + } | |
| 8564 | + } | |
| 8565 | + const store = "rootStore" in context ? context.rootStore : context; | |
| 8566 | + const open2 = store.useState("open"); | |
| 8567 | + const floatingElement = store.useState("floatingElement"); | |
| 8568 | + const domReferenceElement = store.useState("domReferenceElement"); | |
| 8569 | + const dataRef = store.context.dataRef; | |
| 8570 | + const floatingFocusElement = getFloatingFocusElement(floatingElement); | |
| 8571 | + const typeableComboboxReference = isTypeableCombobox(domReferenceElement); | |
| 8572 | + const floatingFocusElementRef = useValueAsRef(floatingFocusElement); | |
| 8573 | + const parentId = useFloatingParentNodeId(); | |
| 8574 | + const tree = useFloatingTree(externalTree); | |
| 8575 | + const focusItemOnOpenRef = React37.useRef(focusItemOnOpen); | |
| 8576 | + const indexRef = React37.useRef(selectedIndex ?? -1); | |
| 8577 | + const keyRef = React37.useRef(null); | |
| 8578 | + const isPointerModalityRef = React37.useRef(true); | |
| 8579 | + const onNavigate = useStableCallback((event) => { | |
| 8580 | + onNavigateProp(indexRef.current === -1 ? null : indexRef.current, event); | |
| 8581 | + }); | |
| 8582 | + const previousMountedRef = React37.useRef(!!floatingElement); | |
| 8583 | + const previousOpenRef = React37.useRef(open2); | |
| 8584 | + const forceSyncFocusRef = React37.useRef(false); | |
| 8585 | + const forceScrollIntoViewRef = React37.useRef(false); | |
| 8586 | + const cancelQueuedFocusRef = React37.useRef(null); | |
| 8587 | + const disabledIndicesRef = useValueAsRef(disabledIndices); | |
| 8588 | + const latestOpenRef = useValueAsRef(open2); | |
| 8589 | + const selectedIndexRef = useValueAsRef(selectedIndex); | |
| 8590 | + const resetOnPointerLeaveRef = useValueAsRef(resetOnPointerLeave); | |
| 8591 | + const focusFrame = useAnimationFrame(); | |
| 8592 | + const waitForListPopulatedFrame = useAnimationFrame(); | |
| 8593 | + const focusItem = useStableCallback(() => { | |
| 8594 | + function runFocus(item2) { | |
| 8595 | + if (virtual) { | |
| 8596 | + tree?.events.emit("virtualfocus", item2); | |
| 8597 | + } else { | |
| 8598 | + cancelQueuedFocusRef.current = enqueueFocus(item2, { | |
| 8599 | + sync: forceSyncFocusRef.current, | |
| 8600 | + preventScroll: true | |
| 8601 | + }); | |
| 8602 | + } | |
| 8603 | + } | |
| 8604 | + const initialItem = listRef.current[indexRef.current]; | |
| 8605 | + const forceScrollIntoView = forceScrollIntoViewRef.current; | |
| 8606 | + if (initialItem) { | |
| 8607 | + runFocus(initialItem); | |
| 8608 | + } | |
| 8609 | + const scheduler2 = forceSyncFocusRef.current ? (callback) => callback() : (callback) => focusFrame.request(callback); | |
| 8610 | + scheduler2(() => { | |
| 8611 | + const waitedItem = listRef.current[indexRef.current] || initialItem; | |
| 8612 | + if (!waitedItem) { | |
| 8613 | + return; | |
| 8614 | + } | |
| 8615 | + if (!initialItem) { | |
| 8616 | + runFocus(waitedItem); | |
| 8617 | + } | |
| 8618 | + const shouldScrollIntoView = ( | |
| 8619 | + // eslint-disable-next-line @typescript-eslint/no-use-before-define | |
| 8620 | + item && (forceScrollIntoView || !isPointerModalityRef.current) | |
| 8621 | + ); | |
| 8622 | + if (shouldScrollIntoView) { | |
| 8623 | + waitedItem.scrollIntoView?.({ | |
| 8624 | + block: "nearest", | |
| 8625 | + inline: "nearest" | |
| 8626 | + }); | |
| 8627 | + } | |
| 1165 | 8628 | }); |
| 1166 | 8629 | }); |
| 1167 | - useIsomorphicLayoutEffect(function() { | |
| 1168 | - var oldValue = currentValues.get(callbackRef); | |
| 1169 | - if (oldValue) { | |
| 1170 | - var prevRefs_1 = new Set(oldValue); | |
| 1171 | - var nextRefs_1 = new Set(refs); | |
| 1172 | - var current_1 = callbackRef.current; | |
| 1173 | - prevRefs_1.forEach(function(ref) { | |
| 1174 | - if (!nextRefs_1.has(ref)) { | |
| 1175 | - assignRef(ref, null); | |
| 8630 | + useIsoLayoutEffect(() => { | |
| 8631 | + dataRef.current.orientation = orientation; | |
| 8632 | + }, [dataRef, orientation]); | |
| 8633 | + useIsoLayoutEffect(() => { | |
| 8634 | + if (!enabled) { | |
| 8635 | + return; | |
| 8636 | + } | |
| 8637 | + if (open2 && floatingElement) { | |
| 8638 | + indexRef.current = selectedIndex ?? -1; | |
| 8639 | + if (focusItemOnOpenRef.current && selectedIndex != null) { | |
| 8640 | + forceScrollIntoViewRef.current = true; | |
| 8641 | + onNavigate(); | |
| 8642 | + } | |
| 8643 | + } else if (previousMountedRef.current) { | |
| 8644 | + indexRef.current = -1; | |
| 8645 | + onNavigate(); | |
| 8646 | + } | |
| 8647 | + }, [enabled, open2, floatingElement, selectedIndex, onNavigate]); | |
| 8648 | + useIsoLayoutEffect(() => { | |
| 8649 | + if (!enabled) { | |
| 8650 | + return; | |
| 8651 | + } | |
| 8652 | + if (!open2) { | |
| 8653 | + forceSyncFocusRef.current = false; | |
| 8654 | + return; | |
| 8655 | + } | |
| 8656 | + if (!floatingElement) { | |
| 8657 | + return; | |
| 8658 | + } | |
| 8659 | + if (activeIndex == null) { | |
| 8660 | + forceSyncFocusRef.current = false; | |
| 8661 | + if (selectedIndexRef.current != null) { | |
| 8662 | + return; | |
| 8663 | + } | |
| 8664 | + if (previousMountedRef.current) { | |
| 8665 | + indexRef.current = -1; | |
| 8666 | + focusItem(); | |
| 8667 | + } | |
| 8668 | + if ((!previousOpenRef.current || !previousMountedRef.current) && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) { | |
| 8669 | + let runs = 0; | |
| 8670 | + const waitForListPopulated = () => { | |
| 8671 | + if (listRef.current[0] == null) { | |
| 8672 | + if (runs < 2) { | |
| 8673 | + const scheduler2 = runs ? (callback) => waitForListPopulatedFrame.request(callback) : queueMicrotask; | |
| 8674 | + scheduler2(waitForListPopulated); | |
| 8675 | + } | |
| 8676 | + runs += 1; | |
| 8677 | + } else { | |
| 8678 | + indexRef.current = keyRef.current == null || isMainOrientationToEndKey(keyRef.current, orientation, rtl) || nested ? getMinListIndex(listRef) : getMaxListIndex(listRef); | |
| 8679 | + keyRef.current = null; | |
| 8680 | + onNavigate(); | |
| 8681 | + } | |
| 8682 | + }; | |
| 8683 | + waitForListPopulated(); | |
| 8684 | + } | |
| 8685 | + } else if (!isIndexOutOfListBounds(listRef.current, activeIndex)) { | |
| 8686 | + indexRef.current = activeIndex; | |
| 8687 | + focusItem(); | |
| 8688 | + forceScrollIntoViewRef.current = false; | |
| 8689 | + } | |
| 8690 | + }, [enabled, open2, floatingElement, activeIndex, selectedIndexRef, nested, listRef, orientation, rtl, onNavigate, focusItem, waitForListPopulatedFrame]); | |
| 8691 | + useIsoLayoutEffect(() => { | |
| 8692 | + if (!enabled || floatingElement || !tree || virtual || !previousMountedRef.current) { | |
| 8693 | + return; | |
| 8694 | + } | |
| 8695 | + const nodes = tree.nodesRef.current; | |
| 8696 | + const parent = nodes.find((node) => node.id === parentId)?.context?.elements.floating; | |
| 8697 | + const activeEl = activeElement(ownerDocument(domReferenceElement ?? parent ?? null)); | |
| 8698 | + const treeContainsActiveEl = nodes.some((node) => node.context && contains(node.context.elements.floating, activeEl)); | |
| 8699 | + if (parent && !treeContainsActiveEl && isPointerModalityRef.current) { | |
| 8700 | + parent.focus({ | |
| 8701 | + preventScroll: true | |
| 8702 | + }); | |
| 8703 | + } | |
| 8704 | + }, [enabled, floatingElement, domReferenceElement, tree, parentId, virtual]); | |
| 8705 | + useIsoLayoutEffect(() => { | |
| 8706 | + previousOpenRef.current = open2; | |
| 8707 | + previousMountedRef.current = !!floatingElement; | |
| 8708 | + }); | |
| 8709 | + useIsoLayoutEffect(() => { | |
| 8710 | + if (!open2) { | |
| 8711 | + keyRef.current = null; | |
| 8712 | + focusItemOnOpenRef.current = focusItemOnOpen; | |
| 8713 | + } | |
| 8714 | + }, [open2, focusItemOnOpen]); | |
| 8715 | + const hasActiveIndex = activeIndex != null; | |
| 8716 | + const syncCurrentTarget = useStableCallback((event) => { | |
| 8717 | + if (!latestOpenRef.current) { | |
| 8718 | + return; | |
| 8719 | + } | |
| 8720 | + const index2 = listRef.current.indexOf(event.currentTarget); | |
| 8721 | + if (index2 !== -1 && (indexRef.current !== index2 || activeIndex !== index2)) { | |
| 8722 | + indexRef.current = index2; | |
| 8723 | + onNavigate(event); | |
| 8724 | + } | |
| 8725 | + }); | |
| 8726 | + const getParentOrientation = useStableCallback(() => { | |
| 8727 | + return parentOrientation ?? tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.dataRef?.current.orientation; | |
| 8728 | + }); | |
| 8729 | + const getMinEnabledIndex = useStableCallback(() => { | |
| 8730 | + return getMinListIndex(listRef, disabledIndicesRef.current); | |
| 8731 | + }); | |
| 8732 | + const commonOnKeyDown = useStableCallback((event) => { | |
| 8733 | + isPointerModalityRef.current = false; | |
| 8734 | + forceSyncFocusRef.current = true; | |
| 8735 | + if (event.which === 229) { | |
| 8736 | + return; | |
| 8737 | + } | |
| 8738 | + if (!latestOpenRef.current && event.currentTarget === floatingFocusElementRef.current) { | |
| 8739 | + return; | |
| 8740 | + } | |
| 8741 | + if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl, isGrid)) { | |
| 8742 | + if (!isMainOrientationKey(event.key, getParentOrientation())) { | |
| 8743 | + stopEvent(event); | |
| 8744 | + } | |
| 8745 | + store.setOpen(false, createChangeEventDetails(reason_parts_exports.listNavigation, event.nativeEvent)); | |
| 8746 | + if (isHTMLElement(domReferenceElement)) { | |
| 8747 | + if (virtual) { | |
| 8748 | + tree?.events.emit("virtualfocus", domReferenceElement); | |
| 8749 | + } else { | |
| 8750 | + domReferenceElement.focus(); | |
| 1176 | 8751 | } |
| 1177 | - }); | |
| 1178 | - nextRefs_1.forEach(function(ref) { | |
| 1179 | - if (!prevRefs_1.has(ref)) { | |
| 1180 | - assignRef(ref, current_1); | |
| 8752 | + } | |
| 8753 | + return; | |
| 8754 | + } | |
| 8755 | + const currentIndex = indexRef.current; | |
| 8756 | + const minIndex = getMinListIndex(listRef, disabledIndices); | |
| 8757 | + const maxIndex = getMaxListIndex(listRef, disabledIndices); | |
| 8758 | + if (!typeableComboboxReference) { | |
| 8759 | + if (event.key === "Home") { | |
| 8760 | + stopEvent(event); | |
| 8761 | + indexRef.current = minIndex; | |
| 8762 | + onNavigate(event); | |
| 8763 | + } | |
| 8764 | + if (event.key === "End") { | |
| 8765 | + stopEvent(event); | |
| 8766 | + indexRef.current = maxIndex; | |
| 8767 | + onNavigate(event); | |
| 8768 | + } | |
| 8769 | + } | |
| 8770 | + if (navigateGrid != null) { | |
| 8771 | + const index2 = navigateGrid(event, indexRef.current, listRef, orientation, loopFocus, rtl, disabledIndices, minIndex, maxIndex); | |
| 8772 | + if (index2 != null) { | |
| 8773 | + indexRef.current = index2; | |
| 8774 | + onNavigate(event); | |
| 8775 | + } | |
| 8776 | + if (orientation === "both") { | |
| 8777 | + return; | |
| 8778 | + } | |
| 8779 | + } | |
| 8780 | + if (isMainOrientationKey(event.key, orientation)) { | |
| 8781 | + stopEvent(event); | |
| 8782 | + if (open2 && !virtual && activeElement(event.currentTarget.ownerDocument) === event.currentTarget) { | |
| 8783 | + indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex; | |
| 8784 | + onNavigate(event); | |
| 8785 | + return; | |
| 8786 | + } | |
| 8787 | + if (isMainOrientationToEndKey(event.key, orientation, rtl)) { | |
| 8788 | + if (loopFocus) { | |
| 8789 | + if (currentIndex >= maxIndex) { | |
| 8790 | + if (allowEscape && currentIndex !== listRef.current.length) { | |
| 8791 | + indexRef.current = -1; | |
| 8792 | + } else { | |
| 8793 | + forceSyncFocusRef.current = false; | |
| 8794 | + indexRef.current = minIndex; | |
| 8795 | + } | |
| 8796 | + } else { | |
| 8797 | + indexRef.current = findNonDisabledListIndex(listRef.current, { | |
| 8798 | + startingIndex: currentIndex, | |
| 8799 | + disabledIndices | |
| 8800 | + }); | |
| 8801 | + } | |
| 8802 | + } else { | |
| 8803 | + indexRef.current = Math.min(maxIndex, findNonDisabledListIndex(listRef.current, { | |
| 8804 | + startingIndex: currentIndex, | |
| 8805 | + disabledIndices | |
| 8806 | + })); | |
| 1181 | 8807 | } |
| 1182 | - }); | |
| 8808 | + } else if (loopFocus) { | |
| 8809 | + if (currentIndex <= minIndex) { | |
| 8810 | + if (allowEscape && currentIndex !== -1) { | |
| 8811 | + indexRef.current = listRef.current.length; | |
| 8812 | + } else { | |
| 8813 | + forceSyncFocusRef.current = false; | |
| 8814 | + indexRef.current = maxIndex; | |
| 8815 | + } | |
| 8816 | + } else { | |
| 8817 | + indexRef.current = findNonDisabledListIndex(listRef.current, { | |
| 8818 | + startingIndex: currentIndex, | |
| 8819 | + decrement: true, | |
| 8820 | + disabledIndices | |
| 8821 | + }); | |
| 8822 | + } | |
| 8823 | + } else { | |
| 8824 | + indexRef.current = Math.max(minIndex, findNonDisabledListIndex(listRef.current, { | |
| 8825 | + startingIndex: currentIndex, | |
| 8826 | + decrement: true, | |
| 8827 | + disabledIndices | |
| 8828 | + })); | |
| 8829 | + } | |
| 8830 | + if (isIndexOutOfListBounds(listRef.current, indexRef.current)) { | |
| 8831 | + indexRef.current = -1; | |
| 8832 | + } | |
| 8833 | + onNavigate(event); | |
| 1183 | 8834 | } |
| 1184 | - currentValues.set(callbackRef, refs); | |
| 1185 | - }, [refs]); | |
| 1186 | - return callbackRef; | |
| 8835 | + }); | |
| 8836 | + const item = React37.useMemo(() => { | |
| 8837 | + const itemProps = { | |
| 8838 | + onFocus(event) { | |
| 8839 | + forceSyncFocusRef.current = true; | |
| 8840 | + syncCurrentTarget(event); | |
| 8841 | + }, | |
| 8842 | + onClick: ({ | |
| 8843 | + currentTarget | |
| 8844 | + }) => currentTarget.focus({ | |
| 8845 | + preventScroll: true | |
| 8846 | + }), | |
| 8847 | + // Safari | |
| 8848 | + onMouseMove(event) { | |
| 8849 | + if (isStationaryWebKitPointer(event)) { | |
| 8850 | + return; | |
| 8851 | + } | |
| 8852 | + forceSyncFocusRef.current = true; | |
| 8853 | + forceScrollIntoViewRef.current = false; | |
| 8854 | + if (focusItemOnHover) { | |
| 8855 | + syncCurrentTarget(event); | |
| 8856 | + } | |
| 8857 | + }, | |
| 8858 | + onPointerLeave(event) { | |
| 8859 | + if (!latestOpenRef.current || !isPointerModalityRef.current || event.pointerType === "touch") { | |
| 8860 | + return; | |
| 8861 | + } | |
| 8862 | + forceSyncFocusRef.current = true; | |
| 8863 | + const relatedTarget = event.relatedTarget; | |
| 8864 | + if (!focusItemOnHover || listRef.current.includes(relatedTarget)) { | |
| 8865 | + return; | |
| 8866 | + } | |
| 8867 | + if (!resetOnPointerLeaveRef.current) { | |
| 8868 | + return; | |
| 8869 | + } | |
| 8870 | + cancelQueuedFocusRef.current?.(); | |
| 8871 | + cancelQueuedFocusRef.current = null; | |
| 8872 | + indexRef.current = -1; | |
| 8873 | + onNavigate(event); | |
| 8874 | + if (!virtual) { | |
| 8875 | + const floatingFocusEl = floatingFocusElementRef.current; | |
| 8876 | + const activeEl = activeElement(ownerDocument(floatingFocusEl)); | |
| 8877 | + if (floatingFocusEl && contains(floatingFocusEl, activeEl)) { | |
| 8878 | + floatingFocusEl.focus({ | |
| 8879 | + preventScroll: true | |
| 8880 | + }); | |
| 8881 | + } | |
| 8882 | + } | |
| 8883 | + } | |
| 8884 | + }; | |
| 8885 | + return itemProps; | |
| 8886 | + }, [syncCurrentTarget, latestOpenRef, floatingFocusElementRef, focusItemOnHover, listRef, onNavigate, resetOnPointerLeaveRef, virtual]); | |
| 8887 | + const ariaActiveDescendantProp = React37.useMemo(() => { | |
| 8888 | + return virtual && open2 && hasActiveIndex && { | |
| 8889 | + "aria-activedescendant": `${id}-${activeIndex}` | |
| 8890 | + }; | |
| 8891 | + }, [virtual, open2, hasActiveIndex, id, activeIndex]); | |
| 8892 | + const floating = React37.useMemo(() => { | |
| 8893 | + return { | |
| 8894 | + ...!typeableComboboxReference ? ariaActiveDescendantProp : {}, | |
| 8895 | + onKeyDown(event) { | |
| 8896 | + if (event.key === "Tab" && event.shiftKey && open2 && !virtual) { | |
| 8897 | + const target = getTarget(event.nativeEvent); | |
| 8898 | + if (target && !contains(floatingFocusElementRef.current, target)) { | |
| 8899 | + return; | |
| 8900 | + } | |
| 8901 | + stopEvent(event); | |
| 8902 | + store.setOpen(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent)); | |
| 8903 | + if (isHTMLElement(domReferenceElement)) { | |
| 8904 | + domReferenceElement.focus(); | |
| 8905 | + } | |
| 8906 | + return; | |
| 8907 | + } | |
| 8908 | + commonOnKeyDown(event); | |
| 8909 | + }, | |
| 8910 | + onPointerMove(event) { | |
| 8911 | + if (isStationaryWebKitPointer(event)) { | |
| 8912 | + return; | |
| 8913 | + } | |
| 8914 | + isPointerModalityRef.current = true; | |
| 8915 | + } | |
| 8916 | + }; | |
| 8917 | + }, [ariaActiveDescendantProp, commonOnKeyDown, floatingFocusElementRef, typeableComboboxReference, store, open2, virtual, domReferenceElement]); | |
| 8918 | + const trigger = React37.useMemo(() => { | |
| 8919 | + function openOnNavigationKeyDown(event) { | |
| 8920 | + store.setOpen(true, createChangeEventDetails(reason_parts_exports.listNavigation, event.nativeEvent, event.currentTarget)); | |
| 8921 | + } | |
| 8922 | + function checkVirtualMouse(event) { | |
| 8923 | + if (focusItemOnOpen === "auto" && isVirtualClick(event.nativeEvent)) { | |
| 8924 | + focusItemOnOpenRef.current = !virtual; | |
| 8925 | + } | |
| 8926 | + } | |
| 8927 | + function checkVirtualPointer(event) { | |
| 8928 | + focusItemOnOpenRef.current = focusItemOnOpen; | |
| 8929 | + if (focusItemOnOpen === "auto" && isVirtualPointerEvent(event.nativeEvent)) { | |
| 8930 | + focusItemOnOpenRef.current = true; | |
| 8931 | + } | |
| 8932 | + } | |
| 8933 | + return { | |
| 8934 | + onKeyDown(event) { | |
| 8935 | + const currentOpen = store.select("open"); | |
| 8936 | + isPointerModalityRef.current = false; | |
| 8937 | + const isArrowKey = event.key.startsWith("Arrow"); | |
| 8938 | + const isParentCrossOpenKey = isCrossOrientationOpenKey(event.key, getParentOrientation(), rtl); | |
| 8939 | + const isMainKey = isMainOrientationKey(event.key, orientation); | |
| 8940 | + const isNavigationKey = (nested ? isParentCrossOpenKey : isMainKey) || event.key === "Enter" || event.key.trim() === ""; | |
| 8941 | + if (virtual && currentOpen) { | |
| 8942 | + return commonOnKeyDown(event); | |
| 8943 | + } | |
| 8944 | + if (!currentOpen && !openOnArrowKeyDown && isArrowKey) { | |
| 8945 | + return void 0; | |
| 8946 | + } | |
| 8947 | + if (isNavigationKey) { | |
| 8948 | + const isParentMainKey = isMainOrientationKey(event.key, getParentOrientation()); | |
| 8949 | + keyRef.current = nested && isParentMainKey ? null : event.key; | |
| 8950 | + } | |
| 8951 | + if (nested) { | |
| 8952 | + if (isParentCrossOpenKey) { | |
| 8953 | + stopEvent(event); | |
| 8954 | + if (currentOpen) { | |
| 8955 | + indexRef.current = getMinEnabledIndex(); | |
| 8956 | + onNavigate(event); | |
| 8957 | + } else { | |
| 8958 | + openOnNavigationKeyDown(event); | |
| 8959 | + } | |
| 8960 | + } | |
| 8961 | + return void 0; | |
| 8962 | + } | |
| 8963 | + if (isMainKey) { | |
| 8964 | + if (selectedIndexRef.current != null) { | |
| 8965 | + indexRef.current = selectedIndexRef.current; | |
| 8966 | + } | |
| 8967 | + stopEvent(event); | |
| 8968 | + if (!currentOpen && openOnArrowKeyDown) { | |
| 8969 | + openOnNavigationKeyDown(event); | |
| 8970 | + } else { | |
| 8971 | + commonOnKeyDown(event); | |
| 8972 | + } | |
| 8973 | + if (currentOpen) { | |
| 8974 | + onNavigate(event); | |
| 8975 | + } | |
| 8976 | + } | |
| 8977 | + return void 0; | |
| 8978 | + }, | |
| 8979 | + onFocus(event) { | |
| 8980 | + if (store.select("open") && !virtual) { | |
| 8981 | + indexRef.current = -1; | |
| 8982 | + onNavigate(event); | |
| 8983 | + } | |
| 8984 | + }, | |
| 8985 | + onPointerDown: checkVirtualPointer, | |
| 8986 | + onPointerEnter: checkVirtualPointer, | |
| 8987 | + onMouseDown: checkVirtualMouse, | |
| 8988 | + onClick: checkVirtualMouse | |
| 8989 | + }; | |
| 8990 | + }, [commonOnKeyDown, focusItemOnOpen, getMinEnabledIndex, nested, onNavigate, store, openOnArrowKeyDown, orientation, getParentOrientation, rtl, selectedIndexRef, virtual]); | |
| 8991 | + const reference = React37.useMemo(() => { | |
| 8992 | + return { | |
| 8993 | + ...ariaActiveDescendantProp, | |
| 8994 | + ...trigger | |
| 8995 | + }; | |
| 8996 | + }, [ariaActiveDescendantProp, trigger]); | |
| 8997 | + return React37.useMemo(() => enabled ? { | |
| 8998 | + reference, | |
| 8999 | + floating, | |
| 9000 | + item, | |
| 9001 | + trigger | |
| 9002 | + } : {}, [enabled, reference, floating, trigger, item]); | |
| 1187 | 9003 | } |
| 1188 | 9004 | |
| 1189 | -// node_modules/use-sidecar/dist/es2015/medium.js | |
| 1190 | -function ItoI(a) { | |
| 1191 | - return a; | |
| 9005 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useTypeahead.mjs | |
| 9006 | +var React38 = __toESM(require_react(), 1); | |
| 9007 | +function useTypeahead(context, props) { | |
| 9008 | + const { | |
| 9009 | + listRef, | |
| 9010 | + elementsRef, | |
| 9011 | + activeIndex, | |
| 9012 | + onMatch: onMatchProp, | |
| 9013 | + disabledIndices, | |
| 9014 | + onTyping, | |
| 9015 | + enabled = true, | |
| 9016 | + resetMs = 750, | |
| 9017 | + selectedIndex = null | |
| 9018 | + } = props; | |
| 9019 | + const store = "rootStore" in context ? context.rootStore : context; | |
| 9020 | + const open2 = store.useState("open"); | |
| 9021 | + const timeout = useTimeout(); | |
| 9022 | + const stringRef = React38.useRef(""); | |
| 9023 | + const prevIndexRef = React38.useRef(selectedIndex ?? activeIndex ?? -1); | |
| 9024 | + const matchIndexRef = React38.useRef(null); | |
| 9025 | + const onKeyDown = useStableCallback((event) => { | |
| 9026 | + function getElement(index3) { | |
| 9027 | + return elementsRef?.current[index3]; | |
| 9028 | + } | |
| 9029 | + function isItemAvailable(index3) { | |
| 9030 | + const element = getElement(index3); | |
| 9031 | + if (element && !isElementVisible(element) || element?.matches(":disabled")) { | |
| 9032 | + return false; | |
| 9033 | + } | |
| 9034 | + return disabledIndices == null || !isListIndexDisabled(EMPTY_ARRAY, index3, disabledIndices); | |
| 9035 | + } | |
| 9036 | + function getMatchingIndex(list, string, startIndex2 = 0) { | |
| 9037 | + if (list.length === 0) { | |
| 9038 | + return -1; | |
| 9039 | + } | |
| 9040 | + const normalizedStartIndex = (startIndex2 % list.length + list.length) % list.length; | |
| 9041 | + const lowerString = string.toLowerCase(); | |
| 9042 | + for (let offset4 = 0; offset4 < list.length; offset4 += 1) { | |
| 9043 | + const index3 = (normalizedStartIndex + offset4) % list.length; | |
| 9044 | + const text = list[index3]; | |
| 9045 | + if (!text?.toLowerCase().startsWith(lowerString) || !isItemAvailable(index3)) { | |
| 9046 | + continue; | |
| 9047 | + } | |
| 9048 | + return index3; | |
| 9049 | + } | |
| 9050 | + return -1; | |
| 9051 | + } | |
| 9052 | + const listContent = listRef.current; | |
| 9053 | + if (stringRef.current.length > 0 && event.key === " ") { | |
| 9054 | + stopEvent(event); | |
| 9055 | + onTyping?.(true); | |
| 9056 | + } | |
| 9057 | + if (stringRef.current.length > 0 && stringRef.current[0] !== " ") { | |
| 9058 | + if (getMatchingIndex(listContent, stringRef.current) === -1 && event.key !== " ") { | |
| 9059 | + onTyping?.(false); | |
| 9060 | + } | |
| 9061 | + } | |
| 9062 | + if (listContent == null || // Character key. | |
| 9063 | + event.key.length !== 1 || // Modifier key. | |
| 9064 | + event.ctrlKey || event.metaKey || event.altKey) { | |
| 9065 | + return; | |
| 9066 | + } | |
| 9067 | + if (open2 && event.key !== " ") { | |
| 9068 | + stopEvent(event); | |
| 9069 | + onTyping?.(true); | |
| 9070 | + } | |
| 9071 | + const isNewSession = stringRef.current === ""; | |
| 9072 | + if (isNewSession) { | |
| 9073 | + prevIndexRef.current = selectedIndex ?? activeIndex ?? -1; | |
| 9074 | + } | |
| 9075 | + const allowRapidSuccessionOfFirstLetter = listContent.every((text, index3) => text && isItemAvailable(index3) ? text[0]?.toLowerCase() !== text[1]?.toLowerCase() : true); | |
| 9076 | + if (allowRapidSuccessionOfFirstLetter && stringRef.current === event.key) { | |
| 9077 | + stringRef.current = ""; | |
| 9078 | + prevIndexRef.current = matchIndexRef.current; | |
| 9079 | + } | |
| 9080 | + stringRef.current += event.key; | |
| 9081 | + timeout.start(resetMs, () => { | |
| 9082 | + stringRef.current = ""; | |
| 9083 | + prevIndexRef.current = matchIndexRef.current; | |
| 9084 | + onTyping?.(false); | |
| 9085 | + }); | |
| 9086 | + const prevIndex = isNewSession ? selectedIndex ?? activeIndex ?? -1 : prevIndexRef.current; | |
| 9087 | + const startIndex = (prevIndex ?? 0) + 1; | |
| 9088 | + const index2 = getMatchingIndex(listContent, stringRef.current, startIndex); | |
| 9089 | + if (index2 !== -1) { | |
| 9090 | + onMatchProp?.(index2); | |
| 9091 | + matchIndexRef.current = index2; | |
| 9092 | + } else if (event.key !== " ") { | |
| 9093 | + stringRef.current = ""; | |
| 9094 | + onTyping?.(false); | |
| 9095 | + } | |
| 9096 | + }); | |
| 9097 | + const onBlur = useStableCallback((event) => { | |
| 9098 | + const next = event.relatedTarget; | |
| 9099 | + const currentDomReferenceElement = store.select("domReferenceElement"); | |
| 9100 | + const currentFloatingElement = store.select("floatingElement"); | |
| 9101 | + const withinComposite = contains(currentDomReferenceElement, next) || contains(currentFloatingElement, next); | |
| 9102 | + if (withinComposite) { | |
| 9103 | + return; | |
| 9104 | + } | |
| 9105 | + timeout.clear(); | |
| 9106 | + stringRef.current = ""; | |
| 9107 | + prevIndexRef.current = matchIndexRef.current; | |
| 9108 | + onTyping?.(false); | |
| 9109 | + }); | |
| 9110 | + useIsoLayoutEffect(() => { | |
| 9111 | + if (!open2 && selectedIndex !== null) { | |
| 9112 | + return; | |
| 9113 | + } | |
| 9114 | + timeout.clear(); | |
| 9115 | + matchIndexRef.current = null; | |
| 9116 | + if (stringRef.current !== "") { | |
| 9117 | + stringRef.current = ""; | |
| 9118 | + } | |
| 9119 | + }, [open2, selectedIndex, timeout]); | |
| 9120 | + const sharedProps = React38.useMemo(() => ({ | |
| 9121 | + onKeyDown, | |
| 9122 | + onBlur | |
| 9123 | + }), [onKeyDown, onBlur]); | |
| 9124 | + return React38.useMemo(() => enabled ? { | |
| 9125 | + reference: sharedProps, | |
| 9126 | + floating: sharedProps | |
| 9127 | + } : {}, [enabled, sharedProps]); | |
| 1192 | 9128 | } |
| 1193 | -function innerCreateMedium(defaults, middleware) { | |
| 1194 | - if (middleware === void 0) { | |
| 1195 | - middleware = ItoI; | |
| 9129 | + | |
| 9130 | +// node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs | |
| 9131 | +var CURSOR_SPEED_THRESHOLD = 0.1; | |
| 9132 | +var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD; | |
| 9133 | +var POLYGON_BUFFER = 0.5; | |
| 9134 | +function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) { | |
| 9135 | + return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi; | |
| 9136 | +} | |
| 9137 | +function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) { | |
| 9138 | + let isInsideValue = false; | |
| 9139 | + if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) { | |
| 9140 | + isInsideValue = !isInsideValue; | |
| 1196 | 9141 | } |
| 1197 | - var buffer = []; | |
| 1198 | - var assigned = false; | |
| 1199 | - var medium = { | |
| 1200 | - read: function() { | |
| 1201 | - if (assigned) { | |
| 1202 | - throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`."); | |
| 9142 | + if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) { | |
| 9143 | + isInsideValue = !isInsideValue; | |
| 9144 | + } | |
| 9145 | + if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) { | |
| 9146 | + isInsideValue = !isInsideValue; | |
| 9147 | + } | |
| 9148 | + if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) { | |
| 9149 | + isInsideValue = !isInsideValue; | |
| 9150 | + } | |
| 9151 | + return isInsideValue; | |
| 9152 | +} | |
| 9153 | +function isInsideRect(pointX, pointY, rect) { | |
| 9154 | + return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height; | |
| 9155 | +} | |
| 9156 | +function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) { | |
| 9157 | + const minX = Math.min(x1, x2); | |
| 9158 | + const maxX = Math.max(x1, x2); | |
| 9159 | + const minY = Math.min(y1, y2); | |
| 9160 | + const maxY = Math.max(y1, y2); | |
| 9161 | + return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY; | |
| 9162 | +} | |
| 9163 | +function safePolygon(options = {}) { | |
| 9164 | + const { | |
| 9165 | + blockPointerEvents = false | |
| 9166 | + } = options; | |
| 9167 | + const timeout = new Timeout(); | |
| 9168 | + const fn = ({ | |
| 9169 | + x, | |
| 9170 | + y, | |
| 9171 | + placement, | |
| 9172 | + elements, | |
| 9173 | + onClose, | |
| 9174 | + nodeId, | |
| 9175 | + tree | |
| 9176 | + }) => { | |
| 9177 | + const side = placement?.split("-")[0]; | |
| 9178 | + let hasLanded = false; | |
| 9179 | + let lastX = null; | |
| 9180 | + let lastY = null; | |
| 9181 | + let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0; | |
| 9182 | + function isCursorMovingSlowly(nextX, nextY) { | |
| 9183 | + const currentTime = performance.now(); | |
| 9184 | + const elapsedTime = currentTime - lastCursorTime; | |
| 9185 | + if (lastX === null || lastY === null || elapsedTime === 0) { | |
| 9186 | + lastX = nextX; | |
| 9187 | + lastY = nextY; | |
| 9188 | + lastCursorTime = currentTime; | |
| 9189 | + return false; | |
| 1203 | 9190 | } |
| 1204 | - if (buffer.length) { | |
| 1205 | - return buffer[buffer.length - 1]; | |
| 9191 | + const deltaX = nextX - lastX; | |
| 9192 | + const deltaY = nextY - lastY; | |
| 9193 | + const distanceSquared = deltaX * deltaX + deltaY * deltaY; | |
| 9194 | + const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED; | |
| 9195 | + lastX = nextX; | |
| 9196 | + lastY = nextY; | |
| 9197 | + lastCursorTime = currentTime; | |
| 9198 | + return distanceSquared < thresholdSquared; | |
| 9199 | + } | |
| 9200 | + function close() { | |
| 9201 | + timeout.clear(); | |
| 9202 | + onClose(); | |
| 9203 | + } | |
| 9204 | + return function onMouseMove(event) { | |
| 9205 | + timeout.clear(); | |
| 9206 | + const domReference = elements.domReference; | |
| 9207 | + const floating = elements.floating; | |
| 9208 | + if (!domReference || !floating || side == null || x == null || y == null) { | |
| 9209 | + return void 0; | |
| 1206 | 9210 | } |
| 1207 | - return defaults; | |
| 1208 | - }, | |
| 1209 | - useMedium: function(data) { | |
| 1210 | - var item = middleware(data, assigned); | |
| 1211 | - buffer.push(item); | |
| 1212 | - return function() { | |
| 1213 | - buffer = buffer.filter(function(x) { | |
| 1214 | - return x !== item; | |
| 1215 | - }); | |
| 1216 | - }; | |
| 1217 | - }, | |
| 1218 | - assignSyncMedium: function(cb) { | |
| 1219 | - assigned = true; | |
| 1220 | - while (buffer.length) { | |
| 1221 | - var cbs = buffer; | |
| 1222 | - buffer = []; | |
| 1223 | - cbs.forEach(cb); | |
| 9211 | + const { | |
| 9212 | + clientX, | |
| 9213 | + clientY | |
| 9214 | + } = event; | |
| 9215 | + const target = getTarget(event); | |
| 9216 | + const isLeave = event.type === "mouseleave"; | |
| 9217 | + const isOverFloatingEl = contains(floating, target); | |
| 9218 | + const isOverReferenceEl = contains(domReference, target); | |
| 9219 | + if (isOverFloatingEl) { | |
| 9220 | + hasLanded = true; | |
| 9221 | + if (!isLeave) { | |
| 9222 | + return void 0; | |
| 9223 | + } | |
| 1224 | 9224 | } |
| 1225 | - buffer = { | |
| 1226 | - push: function(x) { | |
| 1227 | - return cb(x); | |
| 1228 | - }, | |
| 1229 | - filter: function() { | |
| 1230 | - return buffer; | |
| 9225 | + if (isOverReferenceEl) { | |
| 9226 | + hasLanded = false; | |
| 9227 | + if (!isLeave) { | |
| 9228 | + hasLanded = true; | |
| 9229 | + return void 0; | |
| 1231 | 9230 | } |
| 1232 | - }; | |
| 1233 | - }, | |
| 1234 | - assignMedium: function(cb) { | |
| 1235 | - assigned = true; | |
| 1236 | - var pendingQueue = []; | |
| 1237 | - if (buffer.length) { | |
| 1238 | - var cbs = buffer; | |
| 1239 | - buffer = []; | |
| 1240 | - cbs.forEach(cb); | |
| 1241 | - pendingQueue = buffer; | |
| 1242 | 9231 | } |
| 1243 | - var executeQueue = function() { | |
| 1244 | - var cbs2 = pendingQueue; | |
| 1245 | - pendingQueue = []; | |
| 1246 | - cbs2.forEach(cb); | |
| 1247 | - }; | |
| 1248 | - var cycle = function() { | |
| 1249 | - return Promise.resolve().then(executeQueue); | |
| 1250 | - }; | |
| 1251 | - cycle(); | |
| 1252 | - buffer = { | |
| 1253 | - push: function(x) { | |
| 1254 | - pendingQueue.push(x); | |
| 1255 | - cycle(); | |
| 1256 | - }, | |
| 1257 | - filter: function(filter) { | |
| 1258 | - pendingQueue = pendingQueue.filter(filter); | |
| 1259 | - return buffer; | |
| 9232 | + if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) { | |
| 9233 | + return void 0; | |
| 9234 | + } | |
| 9235 | + function hasOpenChildNode() { | |
| 9236 | + return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0); | |
| 9237 | + } | |
| 9238 | + function closeIfNoOpenChild() { | |
| 9239 | + if (!hasOpenChildNode()) { | |
| 9240 | + close(); | |
| 1260 | 9241 | } |
| 1261 | - }; | |
| 9242 | + } | |
| 9243 | + if (hasOpenChildNode()) { | |
| 9244 | + return void 0; | |
| 9245 | + } | |
| 9246 | + const refRect = domReference.getBoundingClientRect(); | |
| 9247 | + const rect = floating.getBoundingClientRect(); | |
| 9248 | + const cursorLeaveFromRight = x > rect.right - rect.width / 2; | |
| 9249 | + const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2; | |
| 9250 | + const isFloatingWider = rect.width > refRect.width; | |
| 9251 | + const isFloatingTaller = rect.height > refRect.height; | |
| 9252 | + const left = (isFloatingWider ? refRect : rect).left; | |
| 9253 | + const right = (isFloatingWider ? refRect : rect).right; | |
| 9254 | + const top = (isFloatingTaller ? refRect : rect).top; | |
| 9255 | + const bottom = (isFloatingTaller ? refRect : rect).bottom; | |
| 9256 | + if (side === "top" && y >= refRect.bottom - 1 || side === "bottom" && y <= refRect.top + 1 || side === "left" && x >= refRect.right - 1 || side === "right" && x <= refRect.left + 1) { | |
| 9257 | + closeIfNoOpenChild(); | |
| 9258 | + return void 0; | |
| 9259 | + } | |
| 9260 | + let isInsideTroughRect = false; | |
| 9261 | + switch (side) { | |
| 9262 | + case "top": | |
| 9263 | + isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1); | |
| 9264 | + break; | |
| 9265 | + case "bottom": | |
| 9266 | + isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1); | |
| 9267 | + break; | |
| 9268 | + case "left": | |
| 9269 | + isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top); | |
| 9270 | + break; | |
| 9271 | + case "right": | |
| 9272 | + isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top); | |
| 9273 | + break; | |
| 9274 | + default: | |
| 9275 | + } | |
| 9276 | + if (isInsideTroughRect) { | |
| 9277 | + return void 0; | |
| 9278 | + } | |
| 9279 | + if (hasLanded && !isInsideRect(clientX, clientY, refRect)) { | |
| 9280 | + closeIfNoOpenChild(); | |
| 9281 | + return void 0; | |
| 9282 | + } | |
| 9283 | + if (!isLeave && isCursorMovingSlowly(clientX, clientY)) { | |
| 9284 | + closeIfNoOpenChild(); | |
| 9285 | + return void 0; | |
| 9286 | + } | |
| 9287 | + let isInsidePolygon = false; | |
| 9288 | + switch (side) { | |
| 9289 | + case "top": { | |
| 9290 | + const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; | |
| 9291 | + const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; | |
| 9292 | + const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; | |
| 9293 | + const cursorPointY = y + POLYGON_BUFFER + 1; | |
| 9294 | + const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top; | |
| 9295 | + const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER; | |
| 9296 | + isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); | |
| 9297 | + break; | |
| 9298 | + } | |
| 9299 | + case "bottom": { | |
| 9300 | + const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; | |
| 9301 | + const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; | |
| 9302 | + const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; | |
| 9303 | + const cursorPointY = y - POLYGON_BUFFER; | |
| 9304 | + const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom; | |
| 9305 | + const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER; | |
| 9306 | + isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); | |
| 9307 | + break; | |
| 9308 | + } | |
| 9309 | + case "left": { | |
| 9310 | + const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; | |
| 9311 | + const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; | |
| 9312 | + const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; | |
| 9313 | + const cursorPointX = x + POLYGON_BUFFER + 1; | |
| 9314 | + const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left; | |
| 9315 | + const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER; | |
| 9316 | + isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY); | |
| 9317 | + break; | |
| 9318 | + } | |
| 9319 | + case "right": { | |
| 9320 | + const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; | |
| 9321 | + const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; | |
| 9322 | + const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; | |
| 9323 | + const cursorPointX = x - POLYGON_BUFFER; | |
| 9324 | + const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right; | |
| 9325 | + const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER; | |
| 9326 | + isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom); | |
| 9327 | + break; | |
| 9328 | + } | |
| 9329 | + default: | |
| 9330 | + } | |
| 9331 | + if (!isInsidePolygon) { | |
| 9332 | + closeIfNoOpenChild(); | |
| 9333 | + } else if (!hasLanded) { | |
| 9334 | + timeout.start(40, closeIfNoOpenChild); | |
| 9335 | + } | |
| 9336 | + return void 0; | |
| 9337 | + }; | |
| 9338 | + }; | |
| 9339 | + fn.__options = { | |
| 9340 | + ...options, | |
| 9341 | + blockPointerEvents | |
| 9342 | + }; | |
| 9343 | + return fn; | |
| 9344 | +} | |
| 9345 | + | |
| 9346 | +// node_modules/@base-ui/react/utils/NullStore.mjs | |
| 9347 | +var NullStore = class extends ReactStore { | |
| 9348 | + // `update`/`set`/`notifyAll` funnel through `setState` in the base `Store`, so overriding | |
| 9349 | + // `setState` alone would neutralize them today. They are overridden explicitly so the store stays | |
| 9350 | + // inert even if a future base-class change stops routing a mutator through `setState`. | |
| 9351 | + setState(_newState) { | |
| 9352 | + } | |
| 9353 | + update(_changes) { | |
| 9354 | + } | |
| 9355 | + set(_key, _value) { | |
| 9356 | + } | |
| 9357 | + notifyAll() { | |
| 9358 | + } | |
| 9359 | +}; | |
| 9360 | + | |
| 9361 | +// node_modules/@base-ui/utils/inertValue.mjs | |
| 9362 | +function inertValue(value) { | |
| 9363 | + if (isReactVersionAtLeast(19)) { | |
| 9364 | + return value; | |
| 9365 | + } | |
| 9366 | + return value ? "true" : void 0; | |
| 9367 | +} | |
| 9368 | + | |
| 9369 | +// node_modules/@base-ui/react/utils/InternalBackdrop.mjs | |
| 9370 | +var React39 = __toESM(require_react(), 1); | |
| 9371 | +var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); | |
| 9372 | +var InternalBackdrop = /* @__PURE__ */ React39.forwardRef(function InternalBackdrop2(props, ref) { | |
| 9373 | + const { | |
| 9374 | + cutout, | |
| 9375 | + ...otherProps | |
| 9376 | + } = props; | |
| 9377 | + let clipPath; | |
| 9378 | + if (cutout) { | |
| 9379 | + const rect = cutout.getBoundingClientRect(); | |
| 9380 | + clipPath = `polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${rect.left}px ${rect.top}px,${rect.left}px ${rect.bottom}px,${rect.right}px ${rect.bottom}px,${rect.right}px ${rect.top}px,${rect.left}px ${rect.top}px)`; | |
| 9381 | + } | |
| 9382 | + return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { | |
| 9383 | + ref, | |
| 9384 | + role: "presentation", | |
| 9385 | + "data-base-ui-inert": "", | |
| 9386 | + ...otherProps, | |
| 9387 | + style: { | |
| 9388 | + position: "fixed", | |
| 9389 | + inset: 0, | |
| 9390 | + userSelect: "none", | |
| 9391 | + WebkitUserSelect: "none", | |
| 9392 | + clipPath | |
| 1262 | 9393 | } |
| 9394 | + }); | |
| 9395 | +}); | |
| 9396 | +if (true) InternalBackdrop.displayName = "InternalBackdrop"; | |
| 9397 | + | |
| 9398 | +// node_modules/@base-ui/react/utils/useOpenInteractionType.mjs | |
| 9399 | +var React42 = __toESM(require_react(), 1); | |
| 9400 | + | |
| 9401 | +// node_modules/@base-ui/utils/useEnhancedClickHandler.mjs | |
| 9402 | +var React40 = __toESM(require_react(), 1); | |
| 9403 | +function useEnhancedClickHandler(handler) { | |
| 9404 | + const lastClickInteractionTypeRef = React40.useRef(""); | |
| 9405 | + const handlePointerDown = React40.useCallback((event) => { | |
| 9406 | + if (event.defaultPrevented) { | |
| 9407 | + return; | |
| 9408 | + } | |
| 9409 | + lastClickInteractionTypeRef.current = event.pointerType; | |
| 9410 | + handler(event, event.pointerType); | |
| 9411 | + }, [handler]); | |
| 9412 | + const handleClick = React40.useCallback((event) => { | |
| 9413 | + if (event.detail === 0) { | |
| 9414 | + handler(event, "keyboard"); | |
| 9415 | + return; | |
| 9416 | + } | |
| 9417 | + if ("pointerType" in event) { | |
| 9418 | + handler(event, event.pointerType); | |
| 9419 | + } else { | |
| 9420 | + handler(event, lastClickInteractionTypeRef.current); | |
| 9421 | + } | |
| 9422 | + lastClickInteractionTypeRef.current = ""; | |
| 9423 | + }, [handler]); | |
| 9424 | + return { | |
| 9425 | + onClick: handleClick, | |
| 9426 | + onPointerDown: handlePointerDown | |
| 1263 | 9427 | }; |
| 1264 | - return medium; | |
| 1265 | 9428 | } |
| 1266 | -function createSidecarMedium(options) { | |
| 1267 | - if (options === void 0) { | |
| 1268 | - options = {}; | |
| 9429 | + | |
| 9430 | +// node_modules/@base-ui/react/internals/useValueChanged.mjs | |
| 9431 | +var React41 = __toESM(require_react(), 1); | |
| 9432 | +function useValueChanged(value, onChange) { | |
| 9433 | + const valueRef = React41.useRef(value); | |
| 9434 | + const onChangeCallback = useStableCallback(onChange); | |
| 9435 | + useIsoLayoutEffect(() => { | |
| 9436 | + if (valueRef.current !== value) { | |
| 9437 | + onChangeCallback(valueRef.current); | |
| 9438 | + } | |
| 9439 | + valueRef.current = value; | |
| 9440 | + }, [value, onChangeCallback]); | |
| 9441 | +} | |
| 9442 | + | |
| 9443 | +// node_modules/@base-ui/react/utils/useOpenInteractionType.mjs | |
| 9444 | +function useOpenMethodTriggerProps(open2, setOpenMethod) { | |
| 9445 | + const handleTriggerClick = useStableCallback((_, interactionType) => { | |
| 9446 | + const isOpen = typeof open2 === "function" ? open2() : open2; | |
| 9447 | + if (!isOpen) { | |
| 9448 | + setOpenMethod(interactionType || // On iOS Safari, the hitslop around touch targets means tapping outside an element's | |
| 9449 | + // bounds does not fire `pointerdown` but does fire `mousedown`. The `interactionType` | |
| 9450 | + // will be "" in that case. | |
| 9451 | + (parts_exports.os.ios ? "touch" : "")); | |
| 9452 | + } | |
| 9453 | + }); | |
| 9454 | + const { | |
| 9455 | + onClick, | |
| 9456 | + onPointerDown | |
| 9457 | + } = useEnhancedClickHandler(handleTriggerClick); | |
| 9458 | + return React42.useMemo(() => ({ | |
| 9459 | + onClick, | |
| 9460 | + onPointerDown | |
| 9461 | + }), [onClick, onPointerDown]); | |
| 9462 | +} | |
| 9463 | +function useOpenInteractionType(open2) { | |
| 9464 | + const [openMethod, setOpenMethod] = React42.useState(null); | |
| 9465 | + const triggerProps = useOpenMethodTriggerProps(open2, setOpenMethod); | |
| 9466 | + useValueChanged(open2, (previousOpen) => { | |
| 9467 | + if (previousOpen && !open2) { | |
| 9468 | + setOpenMethod(null); | |
| 9469 | + } | |
| 9470 | + }); | |
| 9471 | + return React42.useMemo(() => ({ | |
| 9472 | + openMethod, | |
| 9473 | + triggerProps | |
| 9474 | + }), [openMethod, triggerProps]); | |
| 9475 | +} | |
| 9476 | + | |
| 9477 | +// node_modules/@base-ui/react/autocomplete/index.parts.mjs | |
| 9478 | +var index_parts_exports = {}; | |
| 9479 | +__export(index_parts_exports, { | |
| 9480 | + Arrow: () => ComboboxArrow, | |
| 9481 | + Backdrop: () => ComboboxBackdrop, | |
| 9482 | + Clear: () => ComboboxClear, | |
| 9483 | + Collection: () => ComboboxCollection, | |
| 9484 | + Empty: () => ComboboxEmpty, | |
| 9485 | + Group: () => ComboboxGroup, | |
| 9486 | + GroupLabel: () => ComboboxGroupLabel, | |
| 9487 | + Icon: () => ComboboxIcon, | |
| 9488 | + Input: () => ComboboxInput, | |
| 9489 | + InputGroup: () => AutocompleteInputGroup, | |
| 9490 | + Item: () => AutocompleteItem, | |
| 9491 | + List: () => ComboboxList, | |
| 9492 | + Popup: () => ComboboxPopup, | |
| 9493 | + Portal: () => ComboboxPortal, | |
| 9494 | + Positioner: () => ComboboxPositioner, | |
| 9495 | + Root: () => AutocompleteRoot, | |
| 9496 | + Row: () => ComboboxRow, | |
| 9497 | + Separator: () => AutocompleteSeparator, | |
| 9498 | + Status: () => ComboboxStatus, | |
| 9499 | + Trigger: () => AutocompleteTrigger, | |
| 9500 | + Value: () => AutocompleteValue, | |
| 9501 | + useFilter: () => useCoreFilter, | |
| 9502 | + useFilteredItems: () => useFilteredItems | |
| 9503 | +}); | |
| 9504 | + | |
| 9505 | +// node_modules/@base-ui/react/autocomplete/root/AutocompleteRoot.mjs | |
| 9506 | +var React53 = __toESM(require_react(), 1); | |
| 9507 | + | |
| 9508 | +// node_modules/@base-ui/react/combobox/root/AriaCombobox.mjs | |
| 9509 | +var React52 = __toESM(require_react(), 1); | |
| 9510 | + | |
| 9511 | +// node_modules/@base-ui/utils/useOnFirstRender.mjs | |
| 9512 | +var React43 = __toESM(require_react(), 1); | |
| 9513 | +function useOnFirstRender(fn) { | |
| 9514 | + const ref = React43.useRef(true); | |
| 9515 | + if (ref.current) { | |
| 9516 | + ref.current = false; | |
| 9517 | + fn(); | |
| 1269 | 9518 | } |
| 1270 | - var medium = innerCreateMedium(null); | |
| 1271 | - medium.options = __assign({ async: true, ssr: false }, options); | |
| 1272 | - return medium; | |
| 1273 | 9519 | } |
| 1274 | 9520 | |
| 1275 | -// node_modules/use-sidecar/dist/es2015/exports.js | |
| 1276 | -var React16 = __toESM(require_react()); | |
| 1277 | -var SideCar = function(_a) { | |
| 1278 | - var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]); | |
| 1279 | - if (!sideCar) { | |
| 1280 | - throw new Error("Sidecar: please provide `sideCar` property to import the right car"); | |
| 9521 | +// node_modules/@base-ui/react/floating-ui-react/hooks/gridNavigation.mjs | |
| 9522 | +function gridNavigation(event, prevIndex, listRef, orientation, loopFocus, rtl, disabledIndices, minIndex, maxIndex, cols = 2) { | |
| 9523 | + const nextIndex = getGridNavigatedIndex(listRef.current, { | |
| 9524 | + event, | |
| 9525 | + orientation, | |
| 9526 | + loopFocus, | |
| 9527 | + rtl, | |
| 9528 | + cols, | |
| 9529 | + disabledIndices, | |
| 9530 | + minIndex, | |
| 9531 | + maxIndex, | |
| 9532 | + // An out-of-range previous index falls back to the first enabled item. | |
| 9533 | + prevIndex: prevIndex > maxIndex ? minIndex : prevIndex, | |
| 9534 | + stopEvent: true | |
| 9535 | + }); | |
| 9536 | + return isIndexOutOfListBounds(listRef.current, nextIndex) ? void 0 : nextIndex; | |
| 9537 | +} | |
| 9538 | + | |
| 9539 | +// node_modules/@base-ui/react/combobox/root/ComboboxRootContext.mjs | |
| 9540 | +var React44 = __toESM(require_react(), 1); | |
| 9541 | +var ComboboxRootContext = /* @__PURE__ */ React44.createContext(void 0); | |
| 9542 | +if (true) ComboboxRootContext.displayName = "ComboboxRootContext"; | |
| 9543 | +var ComboboxFloatingContext = /* @__PURE__ */ React44.createContext(void 0); | |
| 9544 | +if (true) ComboboxFloatingContext.displayName = "ComboboxFloatingContext"; | |
| 9545 | +var ComboboxDerivedItemsContext = /* @__PURE__ */ React44.createContext(void 0); | |
| 9546 | +if (true) ComboboxDerivedItemsContext.displayName = "ComboboxDerivedItemsContext"; | |
| 9547 | +var ComboboxHasItemsContext = /* @__PURE__ */ React44.createContext(false); | |
| 9548 | +if (true) ComboboxHasItemsContext.displayName = "ComboboxHasItemsContext"; | |
| 9549 | +var ComboboxInputValueContext = /* @__PURE__ */ React44.createContext(""); | |
| 9550 | +if (true) ComboboxInputValueContext.displayName = "ComboboxInputValueContext"; | |
| 9551 | +function useComboboxRootContext() { | |
| 9552 | + const context = React44.useContext(ComboboxRootContext); | |
| 9553 | + if (!context) { | |
| 9554 | + throw new Error(true ? "Base UI: ComboboxRootContext is missing. Combobox parts must be placed within <Combobox.Root>." : formatErrorMessage_default(22)); | |
| 1281 | 9555 | } |
| 1282 | - var Target = sideCar.read(); | |
| 1283 | - if (!Target) { | |
| 1284 | - throw new Error("Sidecar medium not found"); | |
| 9556 | + return context; | |
| 9557 | +} | |
| 9558 | +function useComboboxFloatingContext() { | |
| 9559 | + const context = React44.useContext(ComboboxFloatingContext); | |
| 9560 | + if (!context) { | |
| 9561 | + throw new Error(true ? "Base UI: ComboboxFloatingContext is missing. Combobox parts must be placed within <Combobox.Root>." : formatErrorMessage_default(23)); | |
| 1285 | 9562 | } |
| 1286 | - return React16.createElement(Target, __assign({}, rest)); | |
| 9563 | + return context; | |
| 9564 | +} | |
| 9565 | +function useComboboxDerivedItemsContext() { | |
| 9566 | + const context = React44.useContext(ComboboxDerivedItemsContext); | |
| 9567 | + if (!context) { | |
| 9568 | + throw new Error(true ? "Base UI: ComboboxItemsContext is missing. Combobox parts must be placed within <Combobox.Root>." : formatErrorMessage_default(24)); | |
| 9569 | + } | |
| 9570 | + return context; | |
| 9571 | +} | |
| 9572 | +function useComboboxInputValueContext() { | |
| 9573 | + return React44.useContext(ComboboxInputValueContext); | |
| 9574 | +} | |
| 9575 | +function useComboboxHasItemsContext() { | |
| 9576 | + return React44.useContext(ComboboxHasItemsContext); | |
| 9577 | +} | |
| 9578 | + | |
| 9579 | +// node_modules/@base-ui/utils/areArraysEqual.mjs | |
| 9580 | +function areArraysEqual(array1, array2, itemComparer = Object.is) { | |
| 9581 | + const { | |
| 9582 | + length | |
| 9583 | + } = array1; | |
| 9584 | + if (length !== array2.length) { | |
| 9585 | + return false; | |
| 9586 | + } | |
| 9587 | + for (let i = 0; i < length; i += 1) { | |
| 9588 | + if (!itemComparer(array1[i], array2[i])) { | |
| 9589 | + return false; | |
| 9590 | + } | |
| 9591 | + } | |
| 9592 | + return true; | |
| 9593 | +} | |
| 9594 | + | |
| 9595 | +// node_modules/@base-ui/react/internals/itemEquality.mjs | |
| 9596 | +var defaultItemEquality = (itemValue, selectedValue) => Object.is(itemValue, selectedValue); | |
| 9597 | +function compareItemEquality(itemValue, selectedValue, comparer) { | |
| 9598 | + if (itemValue == null || selectedValue == null) { | |
| 9599 | + return Object.is(itemValue, selectedValue); | |
| 9600 | + } | |
| 9601 | + return comparer(itemValue, selectedValue); | |
| 9602 | +} | |
| 9603 | +function isSelectedValueDirty(currentValue, initialValue, comparer) { | |
| 9604 | + if (Array.isArray(currentValue) && Array.isArray(initialValue)) { | |
| 9605 | + return !areArraysEqual(currentValue, initialValue, (itemValue, initialItemValue) => compareItemEquality(itemValue, initialItemValue, comparer)); | |
| 9606 | + } | |
| 9607 | + return currentValue !== initialValue; | |
| 9608 | +} | |
| 9609 | +function selectedValueIncludes(selectedValues, itemValue, comparer) { | |
| 9610 | + if (!selectedValues) { | |
| 9611 | + return false; | |
| 9612 | + } | |
| 9613 | + return selectedValues.some((selectedValue) => { | |
| 9614 | + if (selectedValue === void 0) { | |
| 9615 | + return false; | |
| 9616 | + } | |
| 9617 | + return compareItemEquality(itemValue, selectedValue, comparer); | |
| 9618 | + }); | |
| 9619 | +} | |
| 9620 | +function findItemIndex(itemValues, selectedValue, comparer) { | |
| 9621 | + if (!itemValues) { | |
| 9622 | + return -1; | |
| 9623 | + } | |
| 9624 | + return itemValues.findIndex((itemValue) => { | |
| 9625 | + if (itemValue === void 0) { | |
| 9626 | + return false; | |
| 9627 | + } | |
| 9628 | + return compareItemEquality(itemValue, selectedValue, comparer); | |
| 9629 | + }); | |
| 9630 | +} | |
| 9631 | +function createSelectionMatcher(selectedValues, comparer) { | |
| 9632 | + if (comparer !== defaultItemEquality) { | |
| 9633 | + return (itemValue) => selectedValueIncludes(selectedValues, itemValue, comparer); | |
| 9634 | + } | |
| 9635 | + const index2 = new Set(selectedValues); | |
| 9636 | + index2.delete(void 0); | |
| 9637 | + return (itemValue) => index2.has(itemValue) && (itemValue !== 0 || selectedValues.some((v) => Object.is(itemValue, v))); | |
| 9638 | +} | |
| 9639 | +function findSelectionIndex(itemValues, selectedValue, comparer, multiple) { | |
| 9640 | + const index2 = multiple && Array.isArray(selectedValue) ? ( | |
| 9641 | + // Anchor to the first selected item in rendered order so the index does not depend | |
| 9642 | + // on the order in which the values were added to the array. | |
| 9643 | + itemValues.findIndex(createSelectionMatcher(selectedValue, comparer)) | |
| 9644 | + ) : findItemIndex(itemValues, selectedValue, comparer); | |
| 9645 | + return index2 === -1 ? null : index2; | |
| 9646 | +} | |
| 9647 | +function resolveSelectedIndex(index2, itemValue, registry, selectedValues, comparer, currentIndex) { | |
| 9648 | + if (selectedValueIncludes(selectedValues, itemValue, comparer)) { | |
| 9649 | + return currentIndex != null && index2 > currentIndex && selectedValueIncludes(selectedValues, registry[currentIndex], comparer) ? currentIndex : index2; | |
| 9650 | + } | |
| 9651 | + return index2 === currentIndex ? findSelectionIndex(registry, selectedValues, comparer, true) : currentIndex; | |
| 9652 | +} | |
| 9653 | +function removeItem(selectedValues, itemValue, comparer) { | |
| 9654 | + return selectedValues.filter((selectedValue) => !compareItemEquality(itemValue, selectedValue, comparer)); | |
| 9655 | +} | |
| 9656 | + | |
| 9657 | +// node_modules/@base-ui/react/internals/resolveValueLabel.mjs | |
| 9658 | +var React45 = __toESM(require_react(), 1); | |
| 9659 | + | |
| 9660 | +// node_modules/@base-ui/react/internals/serializeValue.mjs | |
| 9661 | +function serializeValue(value) { | |
| 9662 | + if (value == null) { | |
| 9663 | + return ""; | |
| 9664 | + } | |
| 9665 | + if (typeof value === "string") { | |
| 9666 | + return value; | |
| 9667 | + } | |
| 9668 | + try { | |
| 9669 | + return JSON.stringify(value); | |
| 9670 | + } catch { | |
| 9671 | + return String(value); | |
| 9672 | + } | |
| 9673 | +} | |
| 9674 | + | |
| 9675 | +// node_modules/@base-ui/react/internals/resolveValueLabel.mjs | |
| 9676 | +var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); | |
| 9677 | +function isGroup(item) { | |
| 9678 | + return typeof item === "object" && item != null && Array.isArray(item.items); | |
| 9679 | +} | |
| 9680 | +function isGroupedItems(items) { | |
| 9681 | + return isGroup(items?.[0]); | |
| 9682 | +} | |
| 9683 | +function flattenLeafItems(items) { | |
| 9684 | + return isGroupedItems(items) ? items.flatMap((group) => group.items) : items; | |
| 9685 | +} | |
| 9686 | +function hasNullItemLabel(items) { | |
| 9687 | + if (!Array.isArray(items)) { | |
| 9688 | + return items != null && "null" in items; | |
| 9689 | + } | |
| 9690 | + const arrayItems = items; | |
| 9691 | + if (isGroupedItems(arrayItems)) { | |
| 9692 | + for (const group of arrayItems) { | |
| 9693 | + for (const item of group.items) { | |
| 9694 | + if (item && item.value == null && item.label != null) { | |
| 9695 | + return true; | |
| 9696 | + } | |
| 9697 | + } | |
| 9698 | + } | |
| 9699 | + return false; | |
| 9700 | + } | |
| 9701 | + for (const item of arrayItems) { | |
| 9702 | + if (item && item.value == null && item.label != null) { | |
| 9703 | + return true; | |
| 9704 | + } | |
| 9705 | + } | |
| 9706 | + return false; | |
| 9707 | +} | |
| 9708 | +function stringifyAsLabel(item, itemToStringLabel) { | |
| 9709 | + if (itemToStringLabel && item != null) { | |
| 9710 | + return itemToStringLabel(item) ?? ""; | |
| 9711 | + } | |
| 9712 | + if (item && typeof item === "object") { | |
| 9713 | + if ("label" in item && item.label != null) { | |
| 9714 | + return String(item.label); | |
| 9715 | + } | |
| 9716 | + if ("value" in item) { | |
| 9717 | + return String(item.value); | |
| 9718 | + } | |
| 9719 | + } | |
| 9720 | + return serializeValue(item); | |
| 9721 | +} | |
| 9722 | +function stringifyAsValue(item, itemToStringValue) { | |
| 9723 | + if (itemToStringValue && item != null) { | |
| 9724 | + return itemToStringValue(item) ?? ""; | |
| 9725 | + } | |
| 9726 | + if (item && typeof item === "object" && "value" in item && "label" in item) { | |
| 9727 | + return serializeValue(item.value); | |
| 9728 | + } | |
| 9729 | + return serializeValue(item); | |
| 9730 | +} | |
| 9731 | + | |
| 9732 | +// node_modules/@base-ui/react/combobox/store.mjs | |
| 9733 | +var selectors2 = { | |
| 9734 | + id: (state) => state.id, | |
| 9735 | + labelId: (state) => state.labelId, | |
| 9736 | + items: (state) => state.items, | |
| 9737 | + selectedValue: (state) => state.selectedValue, | |
| 9738 | + hasSelectionChips: (state) => { | |
| 9739 | + const selectedValue = state.selectedValue; | |
| 9740 | + return Array.isArray(selectedValue) && selectedValue.length > 0; | |
| 9741 | + }, | |
| 9742 | + hasSelectedValue: (state) => { | |
| 9743 | + const { | |
| 9744 | + selectedValue, | |
| 9745 | + selectionMode | |
| 9746 | + } = state; | |
| 9747 | + if (selectedValue == null) { | |
| 9748 | + return false; | |
| 9749 | + } | |
| 9750 | + if (selectionMode === "multiple" && Array.isArray(selectedValue)) { | |
| 9751 | + return selectedValue.length > 0; | |
| 9752 | + } | |
| 9753 | + return true; | |
| 9754 | + }, | |
| 9755 | + hasNullItemLabel: (state, enabled) => { | |
| 9756 | + return enabled ? hasNullItemLabel(state.items) : false; | |
| 9757 | + }, | |
| 9758 | + open: (state) => state.open, | |
| 9759 | + mounted: (state) => state.mounted, | |
| 9760 | + forceMounted: (state) => state.forceMounted, | |
| 9761 | + inline: (state) => state.inline, | |
| 9762 | + activeIndex: (state) => state.activeIndex, | |
| 9763 | + selectedIndex: (state) => state.selectedIndex, | |
| 9764 | + isActive: (state, index2) => state.activeIndex === index2, | |
| 9765 | + isSelected: (state, itemValue) => { | |
| 9766 | + const comparer = state.isItemEqualToValue; | |
| 9767 | + const selectedValue = state.selectedValue; | |
| 9768 | + if (Array.isArray(selectedValue)) { | |
| 9769 | + return selectedValue.some((selectedItem) => compareItemEquality(itemValue, selectedItem, comparer)); | |
| 9770 | + } | |
| 9771 | + return compareItemEquality(itemValue, selectedValue, comparer); | |
| 9772 | + }, | |
| 9773 | + transitionStatus: (state) => state.transitionStatus, | |
| 9774 | + popupProps: (state) => state.popupProps, | |
| 9775 | + listProps: (state) => state.listProps, | |
| 9776 | + inputProps: (state) => state.inputProps, | |
| 9777 | + triggerProps: (state) => state.triggerProps, | |
| 9778 | + itemProps: (state) => state.itemProps, | |
| 9779 | + positionerElement: (state) => state.positionerElement, | |
| 9780 | + listElement: (state) => state.listElement, | |
| 9781 | + popupId: (state) => state.popupId, | |
| 9782 | + triggerElement: (state) => state.triggerElement, | |
| 9783 | + inputElement: (state) => state.inputElement, | |
| 9784 | + inputGroupElement: (state) => state.inputGroupElement, | |
| 9785 | + popupSide: (state) => state.popupSide, | |
| 9786 | + openMethod: (state) => state.openMethod, | |
| 9787 | + inputInsidePopup: (state) => state.inputInsidePopup, | |
| 9788 | + inputOwnsFormValue: (state) => state.inputOwnsFormValue, | |
| 9789 | + selectionMode: (state) => state.selectionMode, | |
| 9790 | + name: (state) => state.name, | |
| 9791 | + form: (state) => state.form, | |
| 9792 | + disabled: (state) => state.disabled, | |
| 9793 | + readOnly: (state) => state.readOnly, | |
| 9794 | + required: (state) => state.required, | |
| 9795 | + grid: (state) => state.grid, | |
| 9796 | + virtualized: (state) => state.virtualized, | |
| 9797 | + itemToStringLabel: (state) => state.itemToStringLabel, | |
| 9798 | + isItemEqualToValue: (state) => state.isItemEqualToValue, | |
| 9799 | + modal: (state) => state.modal, | |
| 9800 | + autoHighlight: (state) => state.autoHighlight | |
| 1287 | 9801 | }; |
| 1288 | -SideCar.isSideCarExport = true; | |
| 1289 | -function exportSidecar(medium, exported) { | |
| 1290 | - medium.useMedium(exported); | |
| 1291 | - return SideCar; | |
| 1292 | -} | |
| 1293 | 9802 | |
| 1294 | -// node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/medium.js | |
| 1295 | -var effectCar = createSidecarMedium(); | |
| 9803 | +// node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs | |
| 9804 | +var React46 = __toESM(require_react(), 1); | |
| 1296 | 9805 | |
| 1297 | -// node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/UI.js | |
| 1298 | -var nothing = function() { | |
| 1299 | - return; | |
| 9806 | +// node_modules/@base-ui/react/field/control/FieldControlDataAttributes.mjs | |
| 9807 | +var valid = "data-valid"; | |
| 9808 | +var invalid = "data-invalid"; | |
| 9809 | + | |
| 9810 | +// node_modules/@base-ui/react/internals/field-constants/constants.mjs | |
| 9811 | +var DEFAULT_VALIDITY_STATE = { | |
| 9812 | + badInput: false, | |
| 9813 | + customError: false, | |
| 9814 | + patternMismatch: false, | |
| 9815 | + rangeOverflow: false, | |
| 9816 | + rangeUnderflow: false, | |
| 9817 | + stepMismatch: false, | |
| 9818 | + tooLong: false, | |
| 9819 | + tooShort: false, | |
| 9820 | + typeMismatch: false, | |
| 9821 | + valid: null, | |
| 9822 | + valueMissing: false | |
| 1300 | 9823 | }; |
| 1301 | -var RemoveScroll = React17.forwardRef(function(props, parentRef) { | |
| 1302 | - var ref = React17.useRef(null); | |
| 1303 | - var _a = React17.useState({ | |
| 1304 | - onScrollCapture: nothing, | |
| 1305 | - onWheelCapture: nothing, | |
| 1306 | - onTouchMoveCapture: nothing | |
| 1307 | - }), callbacks = _a[0], setCallbacks = _a[1]; | |
| 1308 | - 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"]); | |
| 1309 | - var SideCar2 = sideCar; | |
| 1310 | - var containerRef = useMergeRefs([ref, parentRef]); | |
| 1311 | - var containerProps = __assign(__assign({}, rest), callbacks); | |
| 1312 | - return React17.createElement( | |
| 1313 | - React17.Fragment, | |
| 1314 | - null, | |
| 1315 | - enabled && React17.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noRelative, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }), | |
| 1316 | - forwardProps ? React17.cloneElement(React17.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React17.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children) | |
| 1317 | - ); | |
| 1318 | -}); | |
| 1319 | -RemoveScroll.defaultProps = { | |
| 1320 | - enabled: true, | |
| 1321 | - removeScrollBar: true, | |
| 1322 | - inert: false | |
| 9824 | +var DEFAULT_FIELD_STATE_ATTRIBUTES = { | |
| 9825 | + valid: null, | |
| 9826 | + touched: false, | |
| 9827 | + dirty: false, | |
| 9828 | + filled: false, | |
| 9829 | + focused: false | |
| 1323 | 9830 | }; |
| 1324 | -RemoveScroll.classNames = { | |
| 1325 | - fullWidth: fullWidthClassName, | |
| 1326 | - zeroRight: zeroRightClassName | |
| 9831 | +var DEFAULT_FIELD_ROOT_STATE = { | |
| 9832 | + disabled: false, | |
| 9833 | + ...DEFAULT_FIELD_STATE_ATTRIBUTES | |
| 1327 | 9834 | }; |
| 9835 | +var fieldValidityMapping = { | |
| 9836 | + valid(value) { | |
| 9837 | + if (value === null) { | |
| 9838 | + return null; | |
| 9839 | + } | |
| 9840 | + if (value) { | |
| 9841 | + return { | |
| 9842 | + [valid]: "" | |
| 9843 | + }; | |
| 9844 | + } | |
| 9845 | + return { | |
| 9846 | + [invalid]: "" | |
| 9847 | + }; | |
| 9848 | + } | |
| 9849 | +}; | |
| 1328 | 9850 | |
| 1329 | -// node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/SideEffect.js | |
| 1330 | -var React20 = __toESM(require_react()); | |
| 9851 | +// node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs | |
| 9852 | +var DEFAULT_FIELD_ROOT_CONTEXT = { | |
| 9853 | + invalid: void 0, | |
| 9854 | + name: void 0, | |
| 9855 | + validityData: { | |
| 9856 | + state: DEFAULT_VALIDITY_STATE, | |
| 9857 | + errors: [], | |
| 9858 | + error: "", | |
| 9859 | + value: "", | |
| 9860 | + initialValue: null | |
| 9861 | + }, | |
| 9862 | + setValidityData: NOOP, | |
| 9863 | + disabled: void 0, | |
| 9864 | + setTouched: NOOP, | |
| 9865 | + setDirty: NOOP, | |
| 9866 | + setFilled: NOOP, | |
| 9867 | + setFocused: NOOP, | |
| 9868 | + validationMode: "onSubmit", | |
| 9869 | + shouldValidateOnChange: () => false, | |
| 9870 | + state: DEFAULT_FIELD_ROOT_STATE, | |
| 9871 | + registerFieldControl: NOOP, | |
| 9872 | + validation: { | |
| 9873 | + getValidationProps: (_disabled, props = EMPTY_OBJECT) => props, | |
| 9874 | + inputRef: { | |
| 9875 | + current: null | |
| 9876 | + }, | |
| 9877 | + registeredInputs: /* @__PURE__ */ new Map(), | |
| 9878 | + registerInput: NOOP, | |
| 9879 | + getInputControl: () => null, | |
| 9880 | + commit: async () => { | |
| 9881 | + }, | |
| 9882 | + change: NOOP | |
| 9883 | + } | |
| 9884 | +}; | |
| 9885 | +var FieldRootContext = /* @__PURE__ */ React46.createContext(DEFAULT_FIELD_ROOT_CONTEXT); | |
| 9886 | +if (true) FieldRootContext.displayName = "FieldRootContext"; | |
| 9887 | +function useFieldRootContext(optional = true) { | |
| 9888 | + const context = React46.useContext(FieldRootContext); | |
| 9889 | + if (context.setValidityData === NOOP && !optional) { | |
| 9890 | + throw new Error(true ? "Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>." : formatErrorMessage_default(28)); | |
| 9891 | + } | |
| 9892 | + return context; | |
| 9893 | +} | |
| 1331 | 9894 | |
| 1332 | -// node_modules/react-remove-scroll-bar/dist/es2015/component.js | |
| 1333 | -var React19 = __toESM(require_react()); | |
| 9895 | +// node_modules/@base-ui/react/internals/field-register-control/useRegisterFieldControl.mjs | |
| 9896 | +function useRegisterFieldControl(controlRef, id, value, getFormValueOverride, enabled = true, name) { | |
| 9897 | + const { | |
| 9898 | + registerFieldControl | |
| 9899 | + } = useFieldRootContext(); | |
| 9900 | + const sourceRef = useRefWithInit(() => /* @__PURE__ */ Symbol()); | |
| 9901 | + useIsoLayoutEffect(() => { | |
| 9902 | + const source = sourceRef.current; | |
| 9903 | + if (!enabled) { | |
| 9904 | + registerFieldControl(source, void 0); | |
| 9905 | + return; | |
| 9906 | + } | |
| 9907 | + const registration = { | |
| 9908 | + controlRef, | |
| 9909 | + getValue: getFormValueOverride, | |
| 9910 | + id, | |
| 9911 | + name, | |
| 9912 | + value | |
| 9913 | + }; | |
| 9914 | + registerFieldControl(source, registration); | |
| 9915 | + }, [controlRef, enabled, getFormValueOverride, id, name, registerFieldControl, sourceRef, value]); | |
| 9916 | + useIsoLayoutEffect(() => { | |
| 9917 | + const source = sourceRef.current; | |
| 9918 | + return () => { | |
| 9919 | + registerFieldControl(source, void 0); | |
| 9920 | + }; | |
| 9921 | + }, [registerFieldControl, sourceRef]); | |
| 9922 | +} | |
| 1334 | 9923 | |
| 1335 | -// node_modules/react-style-singleton/dist/es2015/hook.js | |
| 1336 | -var React18 = __toESM(require_react()); | |
| 9924 | +// node_modules/@base-ui/react/internals/form-context/FormContext.mjs | |
| 9925 | +var React47 = __toESM(require_react(), 1); | |
| 9926 | +var FormContext = /* @__PURE__ */ React47.createContext({ | |
| 9927 | + elementRef: { | |
| 9928 | + current: null | |
| 9929 | + }, | |
| 9930 | + formRef: { | |
| 9931 | + current: { | |
| 9932 | + fields: /* @__PURE__ */ new Map() | |
| 9933 | + } | |
| 9934 | + }, | |
| 9935 | + errors: {}, | |
| 9936 | + clearErrors: NOOP, | |
| 9937 | + validationMode: "onSubmit", | |
| 9938 | + submitCountRef: { | |
| 9939 | + current: 0 | |
| 9940 | + } | |
| 9941 | +}); | |
| 9942 | +if (true) FormContext.displayName = "FormContext"; | |
| 9943 | +function useFormContext() { | |
| 9944 | + return React47.useContext(FormContext); | |
| 9945 | +} | |
| 1337 | 9946 | |
| 1338 | -// node_modules/get-nonce/dist/es2015/index.js | |
| 1339 | -var currentNonce; | |
| 1340 | -var getNonce = function() { | |
| 1341 | - if (currentNonce) { | |
| 1342 | - return currentNonce; | |
| 9947 | +// node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs | |
| 9948 | +var React49 = __toESM(require_react(), 1); | |
| 9949 | + | |
| 9950 | +// node_modules/@base-ui/react/internals/labelable-provider/LabelableContext.mjs | |
| 9951 | +var React48 = __toESM(require_react(), 1); | |
| 9952 | +var LabelableContext = /* @__PURE__ */ React48.createContext({ | |
| 9953 | + controlId: void 0, | |
| 9954 | + registerControlId: NOOP, | |
| 9955 | + resetControlId: NOOP, | |
| 9956 | + labelId: void 0, | |
| 9957 | + setLabelId: NOOP, | |
| 9958 | + messageIds: [], | |
| 9959 | + setMessageIds: NOOP, | |
| 9960 | + getDescriptionProps: (externalProps) => externalProps | |
| 9961 | +}); | |
| 9962 | +if (true) LabelableContext.displayName = "LabelableContext"; | |
| 9963 | +function useLabelableContext() { | |
| 9964 | + return React48.useContext(LabelableContext); | |
| 9965 | +} | |
| 9966 | + | |
| 9967 | +// node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs | |
| 9968 | +function useLabelableId(params = {}) { | |
| 9969 | + const { | |
| 9970 | + id, | |
| 9971 | + enabled = true | |
| 9972 | + } = params; | |
| 9973 | + const { | |
| 9974 | + controlId, | |
| 9975 | + registerControlId, | |
| 9976 | + resetControlId | |
| 9977 | + } = useLabelableContext(); | |
| 9978 | + const defaultId = useBaseUiId(); | |
| 9979 | + const controlSourceRef = useRefWithInit(() => /* @__PURE__ */ Symbol()); | |
| 9980 | + const hasRegisteredRef = React49.useRef(false); | |
| 9981 | + const hadExplicitIdRef = React49.useRef(false); | |
| 9982 | + const unregisterControlId = useStableCallback(() => { | |
| 9983 | + if (!hasRegisteredRef.current || registerControlId === NOOP) { | |
| 9984 | + return; | |
| 9985 | + } | |
| 9986 | + hasRegisteredRef.current = false; | |
| 9987 | + registerControlId(controlSourceRef.current, void 0); | |
| 9988 | + }); | |
| 9989 | + useIsoLayoutEffect(() => { | |
| 9990 | + if (!enabled || registerControlId === NOOP) { | |
| 9991 | + unregisterControlId(); | |
| 9992 | + return void 0; | |
| 9993 | + } | |
| 9994 | + let nextId; | |
| 9995 | + if (id !== void 0) { | |
| 9996 | + hadExplicitIdRef.current = true; | |
| 9997 | + nextId = id; | |
| 9998 | + } else if (hadExplicitIdRef.current) { | |
| 9999 | + nextId = defaultId; | |
| 10000 | + } else { | |
| 10001 | + resetControlId(); | |
| 10002 | + return void 0; | |
| 10003 | + } | |
| 10004 | + if (nextId === void 0) { | |
| 10005 | + unregisterControlId(); | |
| 10006 | + return void 0; | |
| 10007 | + } | |
| 10008 | + hasRegisteredRef.current = true; | |
| 10009 | + registerControlId(controlSourceRef.current, nextId); | |
| 10010 | + return void 0; | |
| 10011 | + }, [id, enabled, registerControlId, resetControlId, defaultId, controlSourceRef, unregisterControlId]); | |
| 10012 | + useIsoLayoutEffect(() => { | |
| 10013 | + return unregisterControlId; | |
| 10014 | + }, [unregisterControlId]); | |
| 10015 | + return (enabled ? controlId : void 0) ?? id ?? defaultId; | |
| 10016 | +} | |
| 10017 | + | |
| 10018 | +// node_modules/@base-ui/react/combobox/root/utils/index.mjs | |
| 10019 | +function getComboboxPopupId(rootId) { | |
| 10020 | + return rootId == null ? void 0 : `${rootId}-popup`; | |
| 10021 | +} | |
| 10022 | +function createCollatorItemFilter(collatorFilter, itemToStringLabel) { | |
| 10023 | + return (item, query) => { | |
| 10024 | + if (item == null) { | |
| 10025 | + return false; | |
| 10026 | + } | |
| 10027 | + return collatorFilter.contains(item, query, itemToStringLabel); | |
| 10028 | + }; | |
| 10029 | +} | |
| 10030 | + | |
| 10031 | +// node_modules/@base-ui/react/combobox/root/utils/useFilter.mjs | |
| 10032 | +var React50 = __toESM(require_react(), 1); | |
| 10033 | + | |
| 10034 | +// node_modules/@base-ui/utils/stringifyLocale.mjs | |
| 10035 | +function stringifyLocale(locale) { | |
| 10036 | + if (Array.isArray(locale)) { | |
| 10037 | + return locale.map((value) => stringifyLocale(value)).join(","); | |
| 1343 | 10038 | } |
| 1344 | - if (typeof __webpack_nonce__ !== "undefined") { | |
| 1345 | - return __webpack_nonce__; | |
| 10039 | + if (locale == null) { | |
| 10040 | + return ""; | |
| 1346 | 10041 | } |
| 10042 | + return String(locale); | |
| 10043 | +} | |
| 10044 | + | |
| 10045 | +// node_modules/@base-ui/react/internals/filter.mjs | |
| 10046 | +var filterCache = /* @__PURE__ */ new Map(); | |
| 10047 | +function getFilter(options = {}) { | |
| 10048 | + const mergedOptions = { | |
| 10049 | + usage: "search", | |
| 10050 | + sensitivity: "base", | |
| 10051 | + ignorePunctuation: true, | |
| 10052 | + ...options | |
| 10053 | + }; | |
| 10054 | + const cacheKey = `${stringifyLocale(options.locale)}|${JSON.stringify(mergedOptions)}`; | |
| 10055 | + const cachedFilter = filterCache.get(cacheKey); | |
| 10056 | + if (cachedFilter) { | |
| 10057 | + return cachedFilter; | |
| 10058 | + } | |
| 10059 | + const collator = new Intl.Collator(options.locale, mergedOptions); | |
| 10060 | + const filter = { | |
| 10061 | + contains(item, query, itemToString) { | |
| 10062 | + if (!query) { | |
| 10063 | + return true; | |
| 10064 | + } | |
| 10065 | + const itemString = stringifyAsLabel(item, itemToString); | |
| 10066 | + for (let i = 0; i <= itemString.length - query.length; i += 1) { | |
| 10067 | + if (collator.compare(itemString.slice(i, i + query.length), query) === 0) { | |
| 10068 | + return true; | |
| 10069 | + } | |
| 10070 | + } | |
| 10071 | + return false; | |
| 10072 | + }, | |
| 10073 | + startsWith(item, query, itemToString) { | |
| 10074 | + if (!query) { | |
| 10075 | + return true; | |
| 10076 | + } | |
| 10077 | + const itemString = stringifyAsLabel(item, itemToString); | |
| 10078 | + return collator.compare(itemString.slice(0, query.length), query) === 0; | |
| 10079 | + }, | |
| 10080 | + endsWith(item, query, itemToString) { | |
| 10081 | + if (!query) { | |
| 10082 | + return true; | |
| 10083 | + } | |
| 10084 | + const itemString = stringifyAsLabel(item, itemToString); | |
| 10085 | + const queryLength = query.length; | |
| 10086 | + return itemString.length >= queryLength && collator.compare(itemString.slice(itemString.length - queryLength), query) === 0; | |
| 10087 | + } | |
| 10088 | + }; | |
| 10089 | + filterCache.set(cacheKey, filter); | |
| 10090 | + return filter; | |
| 10091 | +} | |
| 10092 | + | |
| 10093 | +// node_modules/@base-ui/react/combobox/root/utils/useFilter.mjs | |
| 10094 | +var useCoreFilter = getFilter; | |
| 10095 | + | |
| 10096 | +// node_modules/@base-ui/react/utils/scrollable.mjs | |
| 10097 | +function isScrollableY(element, allowOverflowIntent = false) { | |
| 10098 | + const { | |
| 10099 | + overflowY | |
| 10100 | + } = getComputedStyle2(element); | |
| 10101 | + if (overflowY !== "auto" && overflowY !== "scroll") { | |
| 10102 | + return false; | |
| 10103 | + } | |
| 10104 | + return allowOverflowIntent ? element.clientHeight > 0 : element.scrollHeight > element.clientHeight; | |
| 10105 | +} | |
| 10106 | + | |
| 10107 | +// node_modules/@base-ui/react/combobox/root/utils/constants.mjs | |
| 10108 | +var NO_ACTIVE_VALUE = /* @__PURE__ */ Symbol("none"); | |
| 10109 | +var INITIAL_LAST_HIGHLIGHT = { | |
| 10110 | + value: NO_ACTIVE_VALUE, | |
| 10111 | + index: -1 | |
| 10112 | +}; | |
| 10113 | + | |
| 10114 | +// node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs | |
| 10115 | +var React51 = __toESM(require_react(), 1); | |
| 10116 | +var DirectionContext = /* @__PURE__ */ React51.createContext(void 0); | |
| 10117 | +if (true) DirectionContext.displayName = "DirectionContext"; | |
| 10118 | +function useDirection() { | |
| 10119 | + const context = React51.useContext(DirectionContext); | |
| 10120 | + return context?.direction ?? "ltr"; | |
| 10121 | +} | |
| 10122 | + | |
| 10123 | +// node_modules/@base-ui/react/combobox/items/itemCollection.mjs | |
| 10124 | +function findCollectionItem(valueToItem, itemValue, isEqual) { | |
| 10125 | + const exactItem = valueToItem.get(itemValue); | |
| 10126 | + if (exactItem !== void 0 || isEqual === defaultItemEquality) { | |
| 10127 | + return exactItem; | |
| 10128 | + } | |
| 10129 | + for (const [derivedValue, item] of valueToItem) { | |
| 10130 | + if (compareItemEquality(derivedValue, itemValue, isEqual)) { | |
| 10131 | + return item; | |
| 10132 | + } | |
| 10133 | + } | |
| 1347 | 10134 | return void 0; |
| 1348 | -}; | |
| 10135 | +} | |
| 1349 | 10136 | |
| 1350 | -// node_modules/react-style-singleton/dist/es2015/singleton.js | |
| 1351 | -function makeStyleTag() { | |
| 1352 | - if (!document) | |
| 1353 | - return null; | |
| 1354 | - var tag = document.createElement("style"); | |
| 1355 | - tag.type = "text/css"; | |
| 1356 | - var nonce = getNonce(); | |
| 1357 | - if (nonce) { | |
| 1358 | - tag.setAttribute("nonce", nonce); | |
| 10137 | +// node_modules/@base-ui/react/combobox/root/AriaCombobox.mjs | |
| 10138 | +var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); | |
| 10139 | +function AriaCombobox(props) { | |
| 10140 | + const { | |
| 10141 | + id: idProp, | |
| 10142 | + onOpenChangeComplete: onOpenChangeCompleteProp, | |
| 10143 | + defaultSelectedValue = null, | |
| 10144 | + selectedValue: selectedValueProp, | |
| 10145 | + onSelectedValueChange, | |
| 10146 | + defaultInputValue, | |
| 10147 | + inputValue: inputValueProp, | |
| 10148 | + open: openProp, | |
| 10149 | + defaultOpen = false, | |
| 10150 | + selectionMode, | |
| 10151 | + onItemHighlighted: onItemHighlightedProp, | |
| 10152 | + name: nameProp, | |
| 10153 | + form, | |
| 10154 | + disabled: disabledProp = false, | |
| 10155 | + readOnly = false, | |
| 10156 | + required = false, | |
| 10157 | + inputRef: inputRefProp, | |
| 10158 | + grid = false, | |
| 10159 | + items: itemsProp, | |
| 10160 | + filteredItems: filteredItemsProp, | |
| 10161 | + filter: filterProp, | |
| 10162 | + filterQuery: filterQueryProp, | |
| 10163 | + openOnInputClick = true, | |
| 10164 | + autoHighlight = false, | |
| 10165 | + keepHighlight = false, | |
| 10166 | + highlightItemOnHover = true, | |
| 10167 | + loopFocus = true, | |
| 10168 | + itemToStringLabel: itemToStringLabelProp, | |
| 10169 | + itemToStringValue, | |
| 10170 | + isItemEqualToValue = defaultItemEquality, | |
| 10171 | + virtualized = false, | |
| 10172 | + inline: inlineProp = false, | |
| 10173 | + fillInputOnItemPress = true, | |
| 10174 | + modal = false, | |
| 10175 | + limit = -1, | |
| 10176 | + autoComplete = "list", | |
| 10177 | + formAutoComplete, | |
| 10178 | + locale, | |
| 10179 | + submitOnItemClick = false | |
| 10180 | + } = props; | |
| 10181 | + const { | |
| 10182 | + clearErrors | |
| 10183 | + } = useFormContext(); | |
| 10184 | + const { | |
| 10185 | + setDirty, | |
| 10186 | + validityData, | |
| 10187 | + setFilled, | |
| 10188 | + name: fieldName, | |
| 10189 | + disabled: fieldDisabled, | |
| 10190 | + setTouched, | |
| 10191 | + setFocused, | |
| 10192 | + validationMode, | |
| 10193 | + validation | |
| 10194 | + } = useFieldRootContext(); | |
| 10195 | + const direction = useDirection(); | |
| 10196 | + const id = useLabelableId({ | |
| 10197 | + id: idProp | |
| 10198 | + }); | |
| 10199 | + const collatorFilter = useCoreFilter({ | |
| 10200 | + locale | |
| 10201 | + }); | |
| 10202 | + const collection = Array.isArray(itemsProp) ? null : itemsProp; | |
| 10203 | + if (collection && typeof collection.label !== "function") { | |
| 10204 | + throw new Error(true ? "Base UI: the `items` prop received an object that is not a collection, so its items cannot be read. Pass an array of items, an array of groups with items, or the result of `createItems()`. See https://base-ui.com/react/components/combobox#createitems" : formatErrorMessage_default(100)); | |
| 1359 | 10205 | } |
| 1360 | - return tag; | |
| 10206 | + const items = collection ? collection.data : itemsProp; | |
| 10207 | + const itemToValue = collection?.value; | |
| 10208 | + const storeItems = itemToValue ? void 0 : items; | |
| 10209 | + const externalWindow = React52.useMemo(() => { | |
| 10210 | + if (!filteredItemsProp || !itemToValue) { | |
| 10211 | + return void 0; | |
| 10212 | + } | |
| 10213 | + const flat = flattenLeafItems(filteredItemsProp); | |
| 10214 | + const values = flat.map(itemToValue); | |
| 10215 | + let valueToItem; | |
| 10216 | + return { | |
| 10217 | + values, | |
| 10218 | + findItem(itemValue, isEqual) { | |
| 10219 | + if (!valueToItem) { | |
| 10220 | + valueToItem = /* @__PURE__ */ new Map(); | |
| 10221 | + for (let i = 0; i < values.length; i += 1) { | |
| 10222 | + if (!valueToItem.has(values[i])) { | |
| 10223 | + valueToItem.set(values[i], flat[i]); | |
| 10224 | + } | |
| 10225 | + } | |
| 10226 | + } | |
| 10227 | + return findCollectionItem(valueToItem, itemValue, isEqual); | |
| 10228 | + } | |
| 10229 | + }; | |
| 10230 | + }, [filteredItemsProp, itemToValue]); | |
| 10231 | + const itemToStringLabel = React52.useMemo(() => { | |
| 10232 | + if (!collection) { | |
| 10233 | + return itemToStringLabelProp; | |
| 10234 | + } | |
| 10235 | + return (itemValue) => { | |
| 10236 | + return collection.label(itemValue, isItemEqualToValue, (unresolvedValue) => { | |
| 10237 | + const externalItem = externalWindow?.findItem(unresolvedValue, isItemEqualToValue); | |
| 10238 | + if (externalItem != null) { | |
| 10239 | + return collection.itemLabel(externalItem); | |
| 10240 | + } | |
| 10241 | + return stringifyAsLabel(unresolvedValue, itemToStringLabelProp); | |
| 10242 | + }); | |
| 10243 | + }; | |
| 10244 | + }, [collection, itemToStringLabelProp, externalWindow, isItemEqualToValue]); | |
| 10245 | + const filterItemToString = React52.useMemo(() => { | |
| 10246 | + if (!collection) { | |
| 10247 | + return itemToStringLabelProp; | |
| 10248 | + } | |
| 10249 | + return Object.assign((item) => collection.itemLabel(item), { | |
| 10250 | + selected: (value) => stringifyAsLabel(value, itemToStringLabel) | |
| 10251 | + }); | |
| 10252 | + }, [collection, itemToStringLabel, itemToStringLabelProp]); | |
| 10253 | + function stringifyValueLabel(item) { | |
| 10254 | + return stringifyAsLabel(item, itemToStringLabel); | |
| 10255 | + } | |
| 10256 | + const [queryChangedAfterOpen, setQueryChangedAfterOpen] = React52.useState(false); | |
| 10257 | + const [closeQuery, setCloseQuery] = React52.useState(null); | |
| 10258 | + const previousCloseQueryRef = React52.useRef(closeQuery); | |
| 10259 | + const listRef = React52.useRef([]); | |
| 10260 | + const labelsRef = React52.useRef([]); | |
| 10261 | + const popupRef = React52.useRef(null); | |
| 10262 | + const inputRef = React52.useRef(null); | |
| 10263 | + const startDismissRef = React52.useRef(null); | |
| 10264 | + const endDismissRef = React52.useRef(null); | |
| 10265 | + const emptyRef = React52.useRef(null); | |
| 10266 | + const keyboardActiveRef = React52.useRef(true); | |
| 10267 | + const hadInputClearRef = React52.useRef(false); | |
| 10268 | + const chipsContainerRef = React52.useRef(null); | |
| 10269 | + const clearRef = React52.useRef(null); | |
| 10270 | + const selectionEventRef = React52.useRef(null); | |
| 10271 | + const lastHighlightRef = React52.useRef(INITIAL_LAST_HIGHLIGHT); | |
| 10272 | + const pendingQueryHighlightRef = React52.useRef(null); | |
| 10273 | + const valuesRef = React52.useRef([]); | |
| 10274 | + const pointerDownItemRef = React52.useRef(null); | |
| 10275 | + const disabled2 = fieldDisabled || disabledProp; | |
| 10276 | + const name = fieldName ?? nameProp; | |
| 10277 | + const multiple = selectionMode === "multiple"; | |
| 10278 | + const single = selectionMode === "single"; | |
| 10279 | + const hasInputValue = inputValueProp !== void 0 || defaultInputValue !== void 0; | |
| 10280 | + const hasItems = items !== void 0; | |
| 10281 | + const hasFilteredItemsProp = filteredItemsProp !== void 0; | |
| 10282 | + let autoHighlightMode; | |
| 10283 | + if (autoHighlight === "always") { | |
| 10284 | + autoHighlightMode = "always"; | |
| 10285 | + } else { | |
| 10286 | + autoHighlightMode = autoHighlight ? "input-change" : false; | |
| 10287 | + } | |
| 10288 | + const [selectedValue, setSelectedValueUnwrapped] = useControlled({ | |
| 10289 | + controlled: selectedValueProp, | |
| 10290 | + default: multiple ? defaultSelectedValue ?? EMPTY_ARRAY : defaultSelectedValue, | |
| 10291 | + name: "Combobox", | |
| 10292 | + state: "selectedValue" | |
| 10293 | + }); | |
| 10294 | + const filter = React52.useMemo(() => { | |
| 10295 | + if (filterProp === null) { | |
| 10296 | + return () => true; | |
| 10297 | + } | |
| 10298 | + if (filterProp !== void 0) { | |
| 10299 | + return filterProp; | |
| 10300 | + } | |
| 10301 | + return createCollatorItemFilter(collatorFilter, filterItemToString); | |
| 10302 | + }, [filterProp, collatorFilter, filterItemToString]); | |
| 10303 | + const initialDefaultInputValue = useRefWithInit(() => { | |
| 10304 | + if (hasInputValue) { | |
| 10305 | + return defaultInputValue ?? ""; | |
| 10306 | + } | |
| 10307 | + if (single) { | |
| 10308 | + return stringifyValueLabel(selectedValue); | |
| 10309 | + } | |
| 10310 | + return ""; | |
| 10311 | + }).current; | |
| 10312 | + const [inputValue, setInputValueUnwrapped] = useControlled({ | |
| 10313 | + controlled: inputValueProp, | |
| 10314 | + default: initialDefaultInputValue, | |
| 10315 | + name: "Combobox", | |
| 10316 | + state: "inputValue" | |
| 10317 | + }); | |
| 10318 | + const [open2, setOpenUnwrapped] = useControlled({ | |
| 10319 | + controlled: openProp, | |
| 10320 | + default: defaultOpen, | |
| 10321 | + name: "Combobox", | |
| 10322 | + state: "open" | |
| 10323 | + }); | |
| 10324 | + const isGrouped = isGroupedItems(items); | |
| 10325 | + const query = !open2 && closeQuery !== null ? closeQuery : String(inputValue).trim(); | |
| 10326 | + const selectedLabelString = single ? stringifyValueLabel(selectedValue) : ""; | |
| 10327 | + const shouldBypassFiltering = single && !queryChangedAfterOpen && query !== "" && selectedLabelString.length === query.length && collatorFilter.contains(selectedLabelString, query); | |
| 10328 | + const filterQuery = shouldBypassFiltering ? "" : filterQueryProp ?? query; | |
| 10329 | + const shouldIgnoreExternalFiltering = hasItems && hasFilteredItemsProp && shouldBypassFiltering && (!collection || collection.hasValue(selectedValue, isItemEqualToValue)); | |
| 10330 | + const flatItems = React52.useMemo(() => items ? flattenLeafItems(items) : EMPTY_ARRAY, [items]); | |
| 10331 | + const filteredItems = React52.useMemo(() => { | |
| 10332 | + if (filteredItemsProp && !shouldIgnoreExternalFiltering) { | |
| 10333 | + return filteredItemsProp; | |
| 10334 | + } | |
| 10335 | + if (!items) { | |
| 10336 | + return EMPTY_ARRAY; | |
| 10337 | + } | |
| 10338 | + if (isGrouped) { | |
| 10339 | + const groupedItems = items; | |
| 10340 | + const resultingGroups = []; | |
| 10341 | + let currentCount = 0; | |
| 10342 | + for (const group of groupedItems) { | |
| 10343 | + if (limit > -1 && currentCount >= limit) { | |
| 10344 | + break; | |
| 10345 | + } | |
| 10346 | + const remainingLimit = limit > -1 ? limit - currentCount : Infinity; | |
| 10347 | + const itemsToTake = filterQuery === "" ? group.items.slice(0, remainingLimit) : []; | |
| 10348 | + if (filterQuery !== "") { | |
| 10349 | + for (const item of group.items) { | |
| 10350 | + if (itemsToTake.length >= remainingLimit) { | |
| 10351 | + break; | |
| 10352 | + } | |
| 10353 | + if (filter(item, filterQuery, filterItemToString)) { | |
| 10354 | + itemsToTake.push(item); | |
| 10355 | + } | |
| 10356 | + } | |
| 10357 | + } | |
| 10358 | + if (itemsToTake.length > 0) { | |
| 10359 | + const newGroup = { | |
| 10360 | + ...group, | |
| 10361 | + items: itemsToTake | |
| 10362 | + }; | |
| 10363 | + resultingGroups.push(newGroup); | |
| 10364 | + currentCount += itemsToTake.length; | |
| 10365 | + } | |
| 10366 | + } | |
| 10367 | + return resultingGroups; | |
| 10368 | + } | |
| 10369 | + if (filterQuery === "") { | |
| 10370 | + return limit > -1 ? flatItems.slice(0, limit) : ( | |
| 10371 | + // The cast here is done as `flatItems` is readonly. | |
| 10372 | + // valuesRef.current, a mutable ref, can be set to `flatFilteredValues`, which may | |
| 10373 | + // reference this exact readonly value, creating a mutation risk. | |
| 10374 | + // However, <Combobox.Item> can never mutate this value as the mutating effect | |
| 10375 | + // bails early when `items` is provided, and this is only ever returned | |
| 10376 | + // when `items` is provided due to the early return at the top of this hook. | |
| 10377 | + flatItems | |
| 10378 | + ); | |
| 10379 | + } | |
| 10380 | + const limitedItems = []; | |
| 10381 | + for (const item of flatItems) { | |
| 10382 | + if (limit > -1 && limitedItems.length >= limit) { | |
| 10383 | + break; | |
| 10384 | + } | |
| 10385 | + if (filter(item, filterQuery, filterItemToString)) { | |
| 10386 | + limitedItems.push(item); | |
| 10387 | + } | |
| 10388 | + } | |
| 10389 | + return limitedItems; | |
| 10390 | + }, [filteredItemsProp, shouldIgnoreExternalFiltering, items, isGrouped, filterQuery, limit, filter, filterItemToString, flatItems]); | |
| 10391 | + const flatFilteredValues = React52.useMemo(() => { | |
| 10392 | + if (externalWindow && filteredItems === filteredItemsProp) { | |
| 10393 | + return externalWindow.values; | |
| 10394 | + } | |
| 10395 | + const flat = flattenLeafItems(filteredItems); | |
| 10396 | + return itemToValue ? flat.map((item) => itemToValue(item)) : flat; | |
| 10397 | + }, [filteredItems, filteredItemsProp, externalWindow, itemToValue]); | |
| 10398 | + const store = useRefWithInit(() => { | |
| 10399 | + let initialSelectedIndex = null; | |
| 10400 | + if (inlineProp && open2 && hasItems && selectionMode !== "none") { | |
| 10401 | + initialSelectedIndex = findSelectionIndex(flatFilteredValues, selectedValue, isItemEqualToValue, multiple); | |
| 10402 | + } | |
| 10403 | + return new ReactStore({ | |
| 10404 | + id, | |
| 10405 | + labelId: void 0, | |
| 10406 | + selectedValue, | |
| 10407 | + open: open2, | |
| 10408 | + items: storeItems, | |
| 10409 | + selectionMode, | |
| 10410 | + name, | |
| 10411 | + form, | |
| 10412 | + disabled: disabled2, | |
| 10413 | + readOnly, | |
| 10414 | + required, | |
| 10415 | + grid, | |
| 10416 | + virtualized, | |
| 10417 | + openOnInputClick, | |
| 10418 | + itemToStringLabel, | |
| 10419 | + isItemEqualToValue, | |
| 10420 | + modal, | |
| 10421 | + autoHighlight: autoHighlightMode, | |
| 10422 | + submitOnItemClick, | |
| 10423 | + hasInputValue, | |
| 10424 | + mounted: false, | |
| 10425 | + forceMounted: false, | |
| 10426 | + transitionStatus: "idle", | |
| 10427 | + inline: inlineProp, | |
| 10428 | + activeIndex: null, | |
| 10429 | + selectedIndex: initialSelectedIndex, | |
| 10430 | + popupProps: {}, | |
| 10431 | + listProps: {}, | |
| 10432 | + inputProps: {}, | |
| 10433 | + triggerProps: {}, | |
| 10434 | + itemProps: EMPTY_OBJECT, | |
| 10435 | + positionerElement: null, | |
| 10436 | + listElement: null, | |
| 10437 | + popupId: void 0, | |
| 10438 | + triggerElement: null, | |
| 10439 | + inputElement: null, | |
| 10440 | + inputGroupElement: null, | |
| 10441 | + popupSide: null, | |
| 10442 | + openMethod: null, | |
| 10443 | + inputInsidePopup: true, | |
| 10444 | + // Avoid duplicate names in the server HTML. Popup inputs aren't rendered | |
| 10445 | + // until after hydration, so the hidden input takes over then if needed. | |
| 10446 | + inputOwnsFormValue: selectionMode === "none" | |
| 10447 | + }, { | |
| 10448 | + // Placeholder callbacks replaced on first render | |
| 10449 | + onOpenChangeComplete: NOOP, | |
| 10450 | + setOpen: NOOP, | |
| 10451 | + setInputValue: NOOP, | |
| 10452 | + setSelectedValue: NOOP, | |
| 10453 | + setIndices: NOOP, | |
| 10454 | + handleSelection: NOOP, | |
| 10455 | + forceMount: NOOP, | |
| 10456 | + requestSubmit: NOOP, | |
| 10457 | + listRef, | |
| 10458 | + labelsRef, | |
| 10459 | + popupRef, | |
| 10460 | + emptyRef, | |
| 10461 | + inputRef, | |
| 10462 | + startDismissRef, | |
| 10463 | + endDismissRef, | |
| 10464 | + keyboardActiveRef, | |
| 10465 | + chipsContainerRef, | |
| 10466 | + clearRef, | |
| 10467 | + valuesRef, | |
| 10468 | + pointerDownItemRef, | |
| 10469 | + selectionEventRef | |
| 10470 | + }, selectors2); | |
| 10471 | + }).current; | |
| 10472 | + const fieldRawValue = selectionMode === "none" ? inputValue : selectedValue; | |
| 10473 | + const fieldStringValue = React52.useMemo(() => { | |
| 10474 | + if (selectionMode === "none") { | |
| 10475 | + return fieldRawValue; | |
| 10476 | + } | |
| 10477 | + if (Array.isArray(selectedValue)) { | |
| 10478 | + return selectedValue.map((value) => stringifyAsValue(value, itemToStringValue)); | |
| 10479 | + } | |
| 10480 | + return stringifyAsValue(selectedValue, itemToStringValue); | |
| 10481 | + }, [fieldRawValue, itemToStringValue, selectionMode, selectedValue]); | |
| 10482 | + const onItemHighlighted = useStableCallback(onItemHighlightedProp); | |
| 10483 | + const onOpenChangeComplete = useStableCallback(onOpenChangeCompleteProp); | |
| 10484 | + const activeIndex = store.useState("activeIndex"); | |
| 10485 | + const selectedIndex = store.useState("selectedIndex"); | |
| 10486 | + const positionerElement = store.useState("positionerElement"); | |
| 10487 | + const listElement = store.useState("listElement"); | |
| 10488 | + const triggerElement = store.useState("triggerElement"); | |
| 10489 | + const inputElement = store.useState("inputElement"); | |
| 10490 | + const inputGroupElement = store.useState("inputGroupElement"); | |
| 10491 | + const inline4 = store.useState("inline"); | |
| 10492 | + const inputInsidePopup = store.useState("inputInsidePopup"); | |
| 10493 | + const inputOwnsFormValue = store.useState("inputOwnsFormValue"); | |
| 10494 | + const inputMatchesSelectedValue = single && !inputInsidePopup && inputValue === selectedLabelString; | |
| 10495 | + const triggerRef = useValueAsRef(triggerElement); | |
| 10496 | + const { | |
| 10497 | + mounted, | |
| 10498 | + setMounted, | |
| 10499 | + transitionStatus | |
| 10500 | + } = useTransitionStatus(open2); | |
| 10501 | + const { | |
| 10502 | + openMethod, | |
| 10503 | + triggerProps | |
| 10504 | + } = useOpenInteractionType(open2); | |
| 10505 | + const getStringifiedValueForForm = useStableCallback(() => fieldStringValue); | |
| 10506 | + useRegisterFieldControl(inputInsidePopup ? triggerRef : inputRef, id, fieldRawValue, getStringifiedValueForForm, !disabled2, nameProp); | |
| 10507 | + const forceMount = useStableCallback(() => { | |
| 10508 | + if (items) { | |
| 10509 | + labelsRef.current = flatFilteredValues.map(stringifyValueLabel); | |
| 10510 | + } else { | |
| 10511 | + store.set("forceMounted", true); | |
| 10512 | + } | |
| 10513 | + }); | |
| 10514 | + const emitHighlight = useStableCallback((value, index2, type) => { | |
| 10515 | + if (index2 === -1) { | |
| 10516 | + if (lastHighlightRef.current === INITIAL_LAST_HIGHLIGHT) { | |
| 10517 | + return; | |
| 10518 | + } | |
| 10519 | + lastHighlightRef.current = INITIAL_LAST_HIGHLIGHT; | |
| 10520 | + } else { | |
| 10521 | + lastHighlightRef.current = { | |
| 10522 | + value, | |
| 10523 | + index: index2 | |
| 10524 | + }; | |
| 10525 | + } | |
| 10526 | + onItemHighlighted(value, createGenericEventDetails(type, void 0, { | |
| 10527 | + index: index2 | |
| 10528 | + })); | |
| 10529 | + }); | |
| 10530 | + const setIndices = useStableCallback((options) => { | |
| 10531 | + const update2 = {}; | |
| 10532 | + if (options.activeIndex !== void 0) { | |
| 10533 | + update2.activeIndex = options.activeIndex; | |
| 10534 | + } | |
| 10535 | + if (options.selectedIndex !== void 0) { | |
| 10536 | + update2.selectedIndex = options.selectedIndex; | |
| 10537 | + } | |
| 10538 | + store.update(update2); | |
| 10539 | + const activeIndexOption = options.activeIndex; | |
| 10540 | + if (activeIndexOption === void 0) { | |
| 10541 | + return; | |
| 10542 | + } | |
| 10543 | + const type = options.type || reason_parts_exports.none; | |
| 10544 | + if (activeIndexOption === null) { | |
| 10545 | + emitHighlight(void 0, -1, type); | |
| 10546 | + } else { | |
| 10547 | + emitHighlight(valuesRef.current[activeIndexOption], activeIndexOption, type); | |
| 10548 | + } | |
| 10549 | + }); | |
| 10550 | + const setInputValue = useStableCallback((next, eventDetails) => { | |
| 10551 | + props.onInputValueChange?.(next, eventDetails); | |
| 10552 | + if (eventDetails.isCanceled) { | |
| 10553 | + return; | |
| 10554 | + } | |
| 10555 | + hadInputClearRef.current = eventDetails.reason === reason_parts_exports.inputClear; | |
| 10556 | + if (eventDetails.reason === reason_parts_exports.inputChange) { | |
| 10557 | + if (open2 && closeQuery !== null) { | |
| 10558 | + setCloseQuery(null); | |
| 10559 | + } | |
| 10560 | + const event = eventDetails.event; | |
| 10561 | + const inputType = event.inputType; | |
| 10562 | + const isTypedInput = event.type === "compositionend" || inputType != null && inputType !== "" && inputType !== "insertReplacementText"; | |
| 10563 | + if (isTypedInput) { | |
| 10564 | + const hasQuery = next.trim() !== ""; | |
| 10565 | + if (hasQuery) { | |
| 10566 | + setQueryChangedAfterOpen(true); | |
| 10567 | + } | |
| 10568 | + pendingQueryHighlightRef.current = { | |
| 10569 | + hasQuery | |
| 10570 | + }; | |
| 10571 | + const list = store.state.listElement; | |
| 10572 | + if (!store.state.virtualized && list) { | |
| 10573 | + const popup = popupRef.current; | |
| 10574 | + for (const ancestor of getOverflowAncestors(list.firstElementChild ?? list)) { | |
| 10575 | + if (!isHTMLElement(ancestor) || (popup ? !contains(popup, ancestor) : ancestor.getAttribute("role") === "dialog")) { | |
| 10576 | + break; | |
| 10577 | + } | |
| 10578 | + if (isScrollableY(ancestor)) { | |
| 10579 | + ancestor.scrollTop = 0; | |
| 10580 | + break; | |
| 10581 | + } | |
| 10582 | + } | |
| 10583 | + } | |
| 10584 | + if (hasQuery && autoHighlightMode && store.state.activeIndex == null && (open2 || inline4)) { | |
| 10585 | + store.set("activeIndex", 0); | |
| 10586 | + } | |
| 10587 | + } | |
| 10588 | + } else if (eventDetails.reason === reason_parts_exports.inputClear && next === "" && store.state.inputInsidePopup) { | |
| 10589 | + pendingQueryHighlightRef.current = { | |
| 10590 | + hasQuery: false, | |
| 10591 | + selection: true | |
| 10592 | + }; | |
| 10593 | + } | |
| 10594 | + setInputValueUnwrapped(next); | |
| 10595 | + }); | |
| 10596 | + const handleInterruptedReopen = useStableCallback((isInputChange) => { | |
| 10597 | + const clearsPendingInput = !isInputChange && inputInsidePopup && !inline4 && inputValue !== "" && (String(inputValue).trim() === closeQuery || inputValue === selectedLabelString); | |
| 10598 | + if (!isInputChange && (clearsPendingInput || inputValue === "" || inputMatchesSelectedValue)) { | |
| 10599 | + setQueryChangedAfterOpen(false); | |
| 10600 | + } | |
| 10601 | + setCloseQuery(null); | |
| 10602 | + if (clearsPendingInput) { | |
| 10603 | + setInputValue("", createChangeEventDetails(reason_parts_exports.inputClear)); | |
| 10604 | + } | |
| 10605 | + }); | |
| 10606 | + const setOpen = useStableCallback((nextOpen, eventDetails) => { | |
| 10607 | + if (open2 === nextOpen) { | |
| 10608 | + return; | |
| 10609 | + } | |
| 10610 | + if (eventDetails.reason === reason_parts_exports.escapeKey && hasItems && flatFilteredValues.length === 0 && !emptyRef.current) { | |
| 10611 | + eventDetails.allowPropagation(); | |
| 10612 | + } | |
| 10613 | + props.onOpenChange?.(nextOpen, eventDetails); | |
| 10614 | + if (eventDetails.isCanceled) { | |
| 10615 | + return; | |
| 10616 | + } | |
| 10617 | + if (nextOpen && closeQuery !== null) { | |
| 10618 | + handleInterruptedReopen(eventDetails.reason === reason_parts_exports.inputChange); | |
| 10619 | + } | |
| 10620 | + if (!nextOpen && queryChangedAfterOpen) { | |
| 10621 | + if (single) { | |
| 10622 | + if (!inline4) { | |
| 10623 | + setCloseQuery(query); | |
| 10624 | + } | |
| 10625 | + if (query === "") { | |
| 10626 | + setQueryChangedAfterOpen(false); | |
| 10627 | + } | |
| 10628 | + } else if (multiple) { | |
| 10629 | + if (!inline4) { | |
| 10630 | + setCloseQuery(query); | |
| 10631 | + } | |
| 10632 | + if (inputInsidePopup) { | |
| 10633 | + setIndices({ | |
| 10634 | + activeIndex: null | |
| 10635 | + }); | |
| 10636 | + } | |
| 10637 | + if (!inputInsidePopup || inline4) { | |
| 10638 | + setInputValue("", createChangeEventDetails(reason_parts_exports.inputClear, eventDetails.event, void 0, { | |
| 10639 | + isItemPress: eventDetails.reason === reason_parts_exports.itemPress | |
| 10640 | + })); | |
| 10641 | + } | |
| 10642 | + } | |
| 10643 | + } | |
| 10644 | + setOpenUnwrapped(nextOpen); | |
| 10645 | + if (!nextOpen && inputInsidePopup && (eventDetails.reason === reason_parts_exports.focusOut || eventDetails.reason === reason_parts_exports.outsidePress)) { | |
| 10646 | + setTouched(true); | |
| 10647 | + setFocused(false); | |
| 10648 | + if (validationMode === "onBlur") { | |
| 10649 | + const valueToValidate = selectionMode === "none" ? inputValue : selectedValue; | |
| 10650 | + validation.commit(valueToValidate); | |
| 10651 | + } | |
| 10652 | + } | |
| 10653 | + }); | |
| 10654 | + const setSelectedValue = useStableCallback((nextValue, eventDetails) => { | |
| 10655 | + onSelectedValueChange?.(nextValue, eventDetails); | |
| 10656 | + if (eventDetails.isCanceled) { | |
| 10657 | + return; | |
| 10658 | + } | |
| 10659 | + setSelectedValueUnwrapped(nextValue); | |
| 10660 | + const shouldFillInput = selectionMode === "none" && popupRef.current && fillInputOnItemPress || single && !store.state.inputInsidePopup; | |
| 10661 | + if (shouldFillInput) { | |
| 10662 | + setInputValue(stringifyValueLabel(nextValue), createChangeEventDetails(eventDetails.reason, eventDetails.event)); | |
| 10663 | + } | |
| 10664 | + }); | |
| 10665 | + const handleSelection = useStableCallback((event, itemValue) => { | |
| 10666 | + const targetEl = getTarget(event); | |
| 10667 | + const overrideEvent = selectionEventRef.current ?? event; | |
| 10668 | + selectionEventRef.current = null; | |
| 10669 | + const eventDetails = createChangeEventDetails(reason_parts_exports.itemPress, overrideEvent); | |
| 10670 | + const href = targetEl?.closest("a")?.getAttribute("href"); | |
| 10671 | + if (href) { | |
| 10672 | + if (href.startsWith("#")) { | |
| 10673 | + setOpen(false, eventDetails); | |
| 10674 | + } | |
| 10675 | + return; | |
| 10676 | + } | |
| 10677 | + if (multiple) { | |
| 10678 | + const currentSelectedValue = Array.isArray(selectedValue) ? selectedValue : []; | |
| 10679 | + const isCurrentlySelected = selectedValueIncludes(currentSelectedValue, itemValue, isItemEqualToValue); | |
| 10680 | + const nextValue = isCurrentlySelected ? removeItem(currentSelectedValue, itemValue, isItemEqualToValue) : [...currentSelectedValue, itemValue]; | |
| 10681 | + setSelectedValue(nextValue, eventDetails); | |
| 10682 | + if (eventDetails.isCanceled) { | |
| 10683 | + return; | |
| 10684 | + } | |
| 10685 | + const wasFiltering = inputRef.current ? inputRef.current.value.trim() !== "" : false; | |
| 10686 | + if (!wasFiltering) { | |
| 10687 | + return; | |
| 10688 | + } | |
| 10689 | + if (store.state.inputInsidePopup) { | |
| 10690 | + setInputValue("", createChangeEventDetails(reason_parts_exports.inputClear, eventDetails.event, void 0, { | |
| 10691 | + isItemPress: true | |
| 10692 | + })); | |
| 10693 | + const pendingHighlight = pendingQueryHighlightRef.current; | |
| 10694 | + if (pendingHighlight && !isCurrentlySelected) { | |
| 10695 | + pendingHighlight.toggledValue = itemValue; | |
| 10696 | + } | |
| 10697 | + } else { | |
| 10698 | + setOpen(false, eventDetails); | |
| 10699 | + } | |
| 10700 | + } else { | |
| 10701 | + setSelectedValue(itemValue, eventDetails); | |
| 10702 | + if (eventDetails.isCanceled) { | |
| 10703 | + return; | |
| 10704 | + } | |
| 10705 | + setOpen(false, eventDetails); | |
| 10706 | + } | |
| 10707 | + }); | |
| 10708 | + const requestSubmit = useStableCallback(() => { | |
| 10709 | + const formElement = validation.inputRef.current?.form ?? store.state.inputElement?.form; | |
| 10710 | + if (formElement && typeof formElement.requestSubmit === "function") { | |
| 10711 | + formElement.requestSubmit(); | |
| 10712 | + } | |
| 10713 | + }); | |
| 10714 | + const handleUnmount = useStableCallback(() => { | |
| 10715 | + setMounted(false); | |
| 10716 | + onOpenChangeComplete?.(false); | |
| 10717 | + setQueryChangedAfterOpen(false); | |
| 10718 | + setCloseQuery(null); | |
| 10719 | + if (selectionMode === "none") { | |
| 10720 | + setIndices({ | |
| 10721 | + activeIndex: null, | |
| 10722 | + selectedIndex: null | |
| 10723 | + }); | |
| 10724 | + } else { | |
| 10725 | + setIndices({ | |
| 10726 | + activeIndex: null | |
| 10727 | + }); | |
| 10728 | + } | |
| 10729 | + if (multiple && inputRef.current && inputRef.current.value !== "" && !hadInputClearRef.current) { | |
| 10730 | + setInputValue("", createChangeEventDetails(reason_parts_exports.inputClear)); | |
| 10731 | + } | |
| 10732 | + if (single) { | |
| 10733 | + if (store.state.inputInsidePopup) { | |
| 10734 | + if (inputRef.current && inputRef.current.value !== "") { | |
| 10735 | + setInputValue("", createChangeEventDetails(reason_parts_exports.inputClear)); | |
| 10736 | + } | |
| 10737 | + } else { | |
| 10738 | + const stringVal = stringifyValueLabel(selectedValue); | |
| 10739 | + if (inputRef.current && inputRef.current.value !== stringVal) { | |
| 10740 | + const reason = stringVal === "" ? reason_parts_exports.inputClear : reason_parts_exports.none; | |
| 10741 | + setInputValue(stringVal, createChangeEventDetails(reason)); | |
| 10742 | + } | |
| 10743 | + } | |
| 10744 | + } | |
| 10745 | + }); | |
| 10746 | + const resolvedPopupRef = React52.useMemo(() => { | |
| 10747 | + if (inline4 && positionerElement) { | |
| 10748 | + return { | |
| 10749 | + current: positionerElement.closest('[role="dialog"]') | |
| 10750 | + }; | |
| 10751 | + } | |
| 10752 | + return popupRef; | |
| 10753 | + }, [inline4, positionerElement]); | |
| 10754 | + useOpenChangeComplete({ | |
| 10755 | + enabled: !props.actionsRef, | |
| 10756 | + open: open2, | |
| 10757 | + ref: resolvedPopupRef, | |
| 10758 | + onComplete() { | |
| 10759 | + if (!open2) { | |
| 10760 | + handleUnmount(); | |
| 10761 | + } | |
| 10762 | + } | |
| 10763 | + }); | |
| 10764 | + React52.useImperativeHandle(props.actionsRef, () => ({ | |
| 10765 | + unmount: handleUnmount | |
| 10766 | + }), [handleUnmount]); | |
| 10767 | + useIsoLayoutEffect(function syncSelectedIndex() { | |
| 10768 | + const closeQueryReleased = previousCloseQueryRef.current !== null && closeQuery === null; | |
| 10769 | + previousCloseQueryRef.current = closeQuery; | |
| 10770 | + if (open2 && (!closeQueryReleased || !hasItems)) { | |
| 10771 | + return; | |
| 10772 | + } | |
| 10773 | + if (!open2) { | |
| 10774 | + pointerDownItemRef.current = null; | |
| 10775 | + } | |
| 10776 | + if (selectionMode === "none") { | |
| 10777 | + return; | |
| 10778 | + } | |
| 10779 | + const registry = hasItems ? flatFilteredValues : valuesRef.current; | |
| 10780 | + setIndices({ | |
| 10781 | + selectedIndex: findSelectionIndex(registry, selectedValue, isItemEqualToValue, multiple) | |
| 10782 | + }); | |
| 10783 | + }, [open2, closeQuery, selectedValue, selectionMode, multiple, hasItems, flatFilteredValues, isItemEqualToValue, setIndices]); | |
| 10784 | + useIsoLayoutEffect(() => { | |
| 10785 | + if (items) { | |
| 10786 | + valuesRef.current = flatFilteredValues; | |
| 10787 | + listRef.current.length = flatFilteredValues.length; | |
| 10788 | + } | |
| 10789 | + }, [items, flatFilteredValues]); | |
| 10790 | + useIsoLayoutEffect(() => { | |
| 10791 | + const pendingHighlight = pendingQueryHighlightRef.current; | |
| 10792 | + if (pendingHighlight) { | |
| 10793 | + const listIsNavigable = open2 || inline4 || store.state.positionerElement?.hidden === false; | |
| 10794 | + if (pendingHighlight.hasQuery) { | |
| 10795 | + if (autoHighlightMode && listIsNavigable) { | |
| 10796 | + store.set("activeIndex", 0); | |
| 10797 | + } | |
| 10798 | + pendingQueryHighlightRef.current = null; | |
| 10799 | + } else if (String(inputValue).trim() === "") { | |
| 10800 | + pendingQueryHighlightRef.current = null; | |
| 10801 | + if (listIsNavigable) { | |
| 10802 | + const clearedBySelection = pendingHighlight.selection; | |
| 10803 | + if (autoHighlightMode === "always" && !clearedBySelection && store.state.selectionMode === "none") { | |
| 10804 | + store.set("activeIndex", 0); | |
| 10805 | + } | |
| 10806 | + queueMicrotask(() => { | |
| 10807 | + if (!store.state.open && !store.state.inline || inputRef.current && inputRef.current.value.trim() !== "") { | |
| 10808 | + return; | |
| 10809 | + } | |
| 10810 | + const currentSelectedValue = store.state.selectedValue; | |
| 10811 | + const isMultiple = store.state.selectionMode === "multiple"; | |
| 10812 | + const hasSelection = isMultiple && Array.isArray(currentSelectedValue) ? currentSelectedValue.length > 0 : store.state.selectionMode !== "none" && currentSelectedValue != null; | |
| 10813 | + if (hasSelection) { | |
| 10814 | + const registry = hasItems || hasFilteredItemsProp ? flatFilteredValues : valuesRef.current; | |
| 10815 | + const toggledIndex = findItemIndex(registry, pendingHighlight.toggledValue, store.state.isItemEqualToValue); | |
| 10816 | + store.set("activeIndex", toggledIndex !== -1 ? toggledIndex : findSelectionIndex(registry, currentSelectedValue, store.state.isItemEqualToValue, isMultiple)); | |
| 10817 | + } else if (clearedBySelection) { | |
| 10818 | + store.set("activeIndex", null); | |
| 10819 | + } else if (autoHighlightMode === "always") { | |
| 10820 | + store.set("activeIndex", 0); | |
| 10821 | + } | |
| 10822 | + }); | |
| 10823 | + } | |
| 10824 | + } | |
| 10825 | + } | |
| 10826 | + if (!open2 && !inline4) { | |
| 10827 | + return; | |
| 10828 | + } | |
| 10829 | + const shouldUseFlatFilteredValues = hasItems || hasFilteredItemsProp; | |
| 10830 | + const candidateItems = shouldUseFlatFilteredValues ? flatFilteredValues : valuesRef.current; | |
| 10831 | + const storeActiveIndex = store.state.activeIndex; | |
| 10832 | + if (storeActiveIndex == null) { | |
| 10833 | + if (autoHighlightMode === "always" && candidateItems.length > 0) { | |
| 10834 | + store.set("activeIndex", 0); | |
| 10835 | + return; | |
| 10836 | + } | |
| 10837 | + emitHighlight(void 0, -1, reason_parts_exports.none); | |
| 10838 | + return; | |
| 10839 | + } | |
| 10840 | + if (storeActiveIndex >= candidateItems.length) { | |
| 10841 | + emitHighlight(void 0, -1, reason_parts_exports.none); | |
| 10842 | + store.set("activeIndex", null); | |
| 10843 | + return; | |
| 10844 | + } | |
| 10845 | + const itemValue = candidateItems[storeActiveIndex]; | |
| 10846 | + const previouslyHighlightedItemValue = lastHighlightRef.current.value; | |
| 10847 | + const isSameItem = previouslyHighlightedItemValue !== NO_ACTIVE_VALUE && compareItemEquality(itemValue, previouslyHighlightedItemValue, store.state.isItemEqualToValue); | |
| 10848 | + if (lastHighlightRef.current.index !== storeActiveIndex || !isSameItem) { | |
| 10849 | + emitHighlight(itemValue, storeActiveIndex, reason_parts_exports.none); | |
| 10850 | + } | |
| 10851 | + }, [ | |
| 10852 | + activeIndex, | |
| 10853 | + autoHighlightMode, | |
| 10854 | + emitHighlight, | |
| 10855 | + hasFilteredItemsProp, | |
| 10856 | + hasItems, | |
| 10857 | + flatFilteredValues, | |
| 10858 | + inline4, | |
| 10859 | + open2, | |
| 10860 | + store, | |
| 10861 | + // Reruns the effect when the query changes without affecting the deps above, such as | |
| 10862 | + // clearing the input when no items are filtered out (individually rendered items). | |
| 10863 | + inputValue | |
| 10864 | + ]); | |
| 10865 | + useIsoLayoutEffect(() => { | |
| 10866 | + if (selectionMode === "none") { | |
| 10867 | + setFilled(String(inputValue) !== ""); | |
| 10868 | + return; | |
| 10869 | + } | |
| 10870 | + setFilled(multiple ? Array.isArray(selectedValue) && selectedValue.length > 0 : selectedValue != null); | |
| 10871 | + }, [setFilled, selectionMode, inputValue, selectedValue, multiple]); | |
| 10872 | + React52.useEffect(() => { | |
| 10873 | + if (hasItems && autoHighlightMode && flatFilteredValues.length === 0) { | |
| 10874 | + setIndices({ | |
| 10875 | + activeIndex: null | |
| 10876 | + }); | |
| 10877 | + } | |
| 10878 | + }, [hasItems, autoHighlightMode, flatFilteredValues.length, setIndices]); | |
| 10879 | + function handleQueryChanged() { | |
| 10880 | + if (open2 && query !== "" && query !== String(initialDefaultInputValue) && !inputMatchesSelectedValue) { | |
| 10881 | + setQueryChangedAfterOpen(true); | |
| 10882 | + } | |
| 10883 | + } | |
| 10884 | + function handleOpenChanged() { | |
| 10885 | + if (open2 && closeQuery !== null) { | |
| 10886 | + handleInterruptedReopen(false); | |
| 10887 | + } | |
| 10888 | + } | |
| 10889 | + let syncedSelectedLabel = false; | |
| 10890 | + function syncInputToSelectedLabel() { | |
| 10891 | + if (!syncedSelectedLabel && inputValue !== selectedLabelString) { | |
| 10892 | + syncedSelectedLabel = true; | |
| 10893 | + setInputValue(selectedLabelString, createChangeEventDetails(reason_parts_exports.none)); | |
| 10894 | + } | |
| 10895 | + } | |
| 10896 | + function handleSelectedValueChanged() { | |
| 10897 | + if (selectionMode === "none") { | |
| 10898 | + return; | |
| 10899 | + } | |
| 10900 | + clearErrors(name); | |
| 10901 | + setDirty(isSelectedValueDirty(selectedValue, validityData.initialValue, isItemEqualToValue)); | |
| 10902 | + validation.change(selectedValue); | |
| 10903 | + if (single && !hasInputValue && !inputInsidePopup) { | |
| 10904 | + syncInputToSelectedLabel(); | |
| 10905 | + } | |
| 10906 | + } | |
| 10907 | + function syncInputAfterItemsOrLabelChange() { | |
| 10908 | + if (single && !hasInputValue && !inputInsidePopup && !queryChangedAfterOpen) { | |
| 10909 | + syncInputToSelectedLabel(); | |
| 10910 | + } | |
| 10911 | + } | |
| 10912 | + function handleInputValueChanged() { | |
| 10913 | + if (selectionMode !== "none") { | |
| 10914 | + return; | |
| 10915 | + } | |
| 10916 | + clearErrors(name); | |
| 10917 | + setDirty(inputValue !== validityData.initialValue); | |
| 10918 | + validation.change(inputValue); | |
| 10919 | + } | |
| 10920 | + useValueChanged(query, handleQueryChanged); | |
| 10921 | + useValueChanged(open2, handleOpenChanged); | |
| 10922 | + useValueChanged(selectedValue, handleSelectedValueChanged); | |
| 10923 | + useValueChanged(selectedLabelString, syncInputAfterItemsOrLabelChange); | |
| 10924 | + useValueChanged(items, syncInputAfterItemsOrLabelChange); | |
| 10925 | + useValueChanged(inputValue, handleInputValueChanged); | |
| 10926 | + const floatingRootContext = useFloatingRootContext({ | |
| 10927 | + open: inline4 ? true : open2, | |
| 10928 | + onOpenChange: setOpen, | |
| 10929 | + elements: { | |
| 10930 | + reference: inputInsidePopup ? triggerElement : inputElement, | |
| 10931 | + floating: positionerElement | |
| 10932 | + } | |
| 10933 | + }); | |
| 10934 | + const ariaHasPopup = grid ? "grid" : "listbox"; | |
| 10935 | + const expanded = open2 || inline4; | |
| 10936 | + const ariaExpanded = expanded ? "true" : "false"; | |
| 10937 | + const role = React52.useMemo(() => { | |
| 10938 | + const isPlainInput = inputElement?.tagName === "INPUT"; | |
| 10939 | + const shouldTreatAsInput = inputElement == null || isPlainInput; | |
| 10940 | + const shouldApplyAria = shouldTreatAsInput || expanded; | |
| 10941 | + const reference = shouldTreatAsInput ? { | |
| 10942 | + autoComplete: "off", | |
| 10943 | + spellCheck: "false", | |
| 10944 | + autoCorrect: "off", | |
| 10945 | + autoCapitalize: "none" | |
| 10946 | + } : {}; | |
| 10947 | + if (shouldApplyAria) { | |
| 10948 | + reference.role = "combobox"; | |
| 10949 | + reference["aria-expanded"] = ariaExpanded; | |
| 10950 | + reference["aria-haspopup"] = ariaHasPopup; | |
| 10951 | + reference["aria-controls"] = expanded ? listElement?.id : void 0; | |
| 10952 | + reference["aria-autocomplete"] = readOnly ? "none" : autoComplete; | |
| 10953 | + } | |
| 10954 | + return { | |
| 10955 | + reference, | |
| 10956 | + floating: { | |
| 10957 | + role: "presentation" | |
| 10958 | + } | |
| 10959 | + }; | |
| 10960 | + }, [inputElement, expanded, ariaExpanded, ariaHasPopup, listElement?.id, autoComplete, readOnly]); | |
| 10961 | + const click = useClick(floatingRootContext, { | |
| 10962 | + enabled: !disabled2 && openOnInputClick, | |
| 10963 | + event: "mousedown-only", | |
| 10964 | + toggle: false, | |
| 10965 | + // Apply a small delay for touch to let mobile viewport/keyboard positioning settle. | |
| 10966 | + // This avoids top-bottom flip flickers if the preferred position is "top" when first tapping. | |
| 10967 | + touchOpenDelay: inputInsidePopup ? 0 : 100, | |
| 10968 | + reason: reason_parts_exports.inputPress | |
| 10969 | + }); | |
| 10970 | + const dismiss = useDismiss(floatingRootContext, { | |
| 10971 | + enabled: !disabled2 && !inline4, | |
| 10972 | + outsidePressEvent: { | |
| 10973 | + mouse: "sloppy", | |
| 10974 | + // The visual viewport (affected by the mobile software keyboard) can be | |
| 10975 | + // somewhat small. The user may want to scroll the screen to see more of | |
| 10976 | + // the popup. | |
| 10977 | + touch: "intentional" | |
| 10978 | + }, | |
| 10979 | + // Without a popup, let the Escape key bubble the event up to other popups' handlers. | |
| 10980 | + bubbles: inline4 ? true : void 0, | |
| 10981 | + outsidePress(event) { | |
| 10982 | + const target = getTarget(event); | |
| 10983 | + return !contains(triggerElement, target) && !contains(clearRef.current, target) && !contains(chipsContainerRef.current, target) && !contains(inputGroupElement, target); | |
| 10984 | + } | |
| 10985 | + }); | |
| 10986 | + const listNavigation2 = useListNavigation(floatingRootContext, { | |
| 10987 | + enabled: !disabled2, | |
| 10988 | + id, | |
| 10989 | + listRef, | |
| 10990 | + activeIndex, | |
| 10991 | + selectedIndex, | |
| 10992 | + virtual: true, | |
| 10993 | + loopFocus, | |
| 10994 | + allowEscape: loopFocus && !autoHighlightMode, | |
| 10995 | + focusItemOnOpen: queryChangedAfterOpen || selectionMode === "none" && !autoHighlightMode ? false : "auto", | |
| 10996 | + focusItemOnHover: highlightItemOnHover, | |
| 10997 | + resetOnPointerLeave: !keepHighlight, | |
| 10998 | + orientation: grid ? "horizontal" : void 0, | |
| 10999 | + rtl: direction === "rtl", | |
| 11000 | + disabledIndices: EMPTY_ARRAY, | |
| 11001 | + grid: grid ? gridNavigation : void 0, | |
| 11002 | + onNavigate(nextActiveIndex, event) { | |
| 11003 | + if (!event && !open2 || transitionStatus === "ending") { | |
| 11004 | + return; | |
| 11005 | + } | |
| 11006 | + if (!event) { | |
| 11007 | + setIndices({ | |
| 11008 | + activeIndex: nextActiveIndex | |
| 11009 | + }); | |
| 11010 | + } else { | |
| 11011 | + setIndices({ | |
| 11012 | + activeIndex: nextActiveIndex, | |
| 11013 | + type: keyboardActiveRef.current ? reason_parts_exports.keyboard : reason_parts_exports.pointer | |
| 11014 | + }); | |
| 11015 | + } | |
| 11016 | + } | |
| 11017 | + }); | |
| 11018 | + const inputProps = React52.useMemo(() => mergeProps(listNavigation2.reference, { | |
| 11019 | + onKeyDown(event) { | |
| 11020 | + if (grid && store.state.activeIndex == null && (event.key === "ArrowLeft" || event.key === "ArrowRight")) { | |
| 11021 | + event.preventBaseUIHandler(); | |
| 11022 | + } | |
| 11023 | + } | |
| 11024 | + }, dismiss.reference, click.reference, role.reference), [listNavigation2.reference, dismiss.reference, click.reference, role.reference, grid, store]); | |
| 11025 | + const popupProps = React52.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, dismiss.floating), [dismiss.floating]); | |
| 11026 | + const listProps = React52.useMemo(() => mergeProps(listNavigation2.floating, role.floating), [listNavigation2.floating, role.floating]); | |
| 11027 | + const itemProps = React52.useMemo(() => { | |
| 11028 | + const listNavigationItemProps = listNavigation2.item; | |
| 11029 | + if (!listNavigationItemProps) { | |
| 11030 | + return EMPTY_OBJECT; | |
| 11031 | + } | |
| 11032 | + return { | |
| 11033 | + ...listNavigationItemProps, | |
| 11034 | + onFocus: void 0 | |
| 11035 | + }; | |
| 11036 | + }, [listNavigation2.item]); | |
| 11037 | + store.useContextCallback("setOpen", setOpen); | |
| 11038 | + store.useContextCallback("setInputValue", setInputValue); | |
| 11039 | + store.useContextCallback("setSelectedValue", setSelectedValue); | |
| 11040 | + store.useContextCallback("setIndices", setIndices); | |
| 11041 | + store.useContextCallback("handleSelection", handleSelection); | |
| 11042 | + store.useContextCallback("forceMount", forceMount); | |
| 11043 | + store.useContextCallback("requestSubmit", requestSubmit); | |
| 11044 | + store.useContextCallback("onOpenChangeComplete", onOpenChangeCompleteProp); | |
| 11045 | + useOnFirstRender(() => { | |
| 11046 | + store.update({ | |
| 11047 | + inline: inlineProp, | |
| 11048 | + popupProps, | |
| 11049 | + listProps, | |
| 11050 | + inputProps, | |
| 11051 | + triggerProps, | |
| 11052 | + itemProps | |
| 11053 | + }); | |
| 11054 | + }); | |
| 11055 | + const syncedValues = { | |
| 11056 | + id, | |
| 11057 | + selectedValue, | |
| 11058 | + open: open2, | |
| 11059 | + mounted, | |
| 11060 | + transitionStatus, | |
| 11061 | + items: storeItems, | |
| 11062 | + inline: inlineProp, | |
| 11063 | + popupProps, | |
| 11064 | + listProps, | |
| 11065 | + inputProps, | |
| 11066 | + triggerProps, | |
| 11067 | + itemProps, | |
| 11068 | + openMethod, | |
| 11069 | + selectionMode, | |
| 11070 | + name, | |
| 11071 | + form, | |
| 11072 | + disabled: disabled2, | |
| 11073 | + readOnly, | |
| 11074 | + required, | |
| 11075 | + grid, | |
| 11076 | + virtualized, | |
| 11077 | + openOnInputClick, | |
| 11078 | + itemToStringLabel, | |
| 11079 | + modal, | |
| 11080 | + autoHighlight: autoHighlightMode, | |
| 11081 | + isItemEqualToValue, | |
| 11082 | + submitOnItemClick, | |
| 11083 | + hasInputValue | |
| 11084 | + }; | |
| 11085 | + useIsoLayoutEffect(() => { | |
| 11086 | + store.update({ | |
| 11087 | + ...syncedValues, | |
| 11088 | + inputOwnsFormValue: selectionMode === "none" && (inlineProp || !store.state.inputInsidePopup) | |
| 11089 | + }); | |
| 11090 | + }, [store, ...Object.values(syncedValues)]); | |
| 11091 | + const hiddenInputRef = useMergedRefs(inputRefProp, validation.inputRef); | |
| 11092 | + const itemsContextValue = React52.useMemo(() => ({ | |
| 11093 | + query, | |
| 11094 | + hasItems, | |
| 11095 | + filteredItems, | |
| 11096 | + flatFilteredValues | |
| 11097 | + }), [query, hasItems, filteredItems, flatFilteredValues]); | |
| 11098 | + const serializedValue = React52.useMemo(() => { | |
| 11099 | + if (Array.isArray(fieldRawValue)) { | |
| 11100 | + return ""; | |
| 11101 | + } | |
| 11102 | + return stringifyAsValue(fieldRawValue, itemToStringValue); | |
| 11103 | + }, [fieldRawValue, itemToStringValue]); | |
| 11104 | + const hasMultipleSelection = multiple && Array.isArray(selectedValue) && selectedValue.length > 0; | |
| 11105 | + const hiddenInputName = multiple || selectionMode === "none" && inputOwnsFormValue ? void 0 : name; | |
| 11106 | + const hiddenInputs = React52.useMemo(() => { | |
| 11107 | + if (!multiple || !Array.isArray(selectedValue) || !name) { | |
| 11108 | + return null; | |
| 11109 | + } | |
| 11110 | + return selectedValue.map((value) => { | |
| 11111 | + const currentSerializedValue = stringifyAsValue(value, itemToStringValue); | |
| 11112 | + return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { | |
| 11113 | + type: "hidden", | |
| 11114 | + form, | |
| 11115 | + name, | |
| 11116 | + value: currentSerializedValue, | |
| 11117 | + disabled: disabled2 | |
| 11118 | + }, currentSerializedValue); | |
| 11119 | + }); | |
| 11120 | + }, [multiple, selectedValue, form, name, itemToStringValue, disabled2]); | |
| 11121 | + const children = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(React52.Fragment, { | |
| 11122 | + children: [props.children, /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { | |
| 11123 | + ...validation.getValidationProps(disabled2, { | |
| 11124 | + // Move focus when the hidden input is focused. | |
| 11125 | + onFocus() { | |
| 11126 | + if (inputInsidePopup) { | |
| 11127 | + triggerElement?.focus(); | |
| 11128 | + return; | |
| 11129 | + } | |
| 11130 | + (inputRef.current || triggerElement)?.focus(); | |
| 11131 | + }, | |
| 11132 | + // Handle browser autofill. | |
| 11133 | + onChange(event) { | |
| 11134 | + if (event.nativeEvent.defaultPrevented || disabled2 || readOnly) { | |
| 11135 | + return; | |
| 11136 | + } | |
| 11137 | + const nextValue = event.currentTarget.value; | |
| 11138 | + const nextValueLower = nextValue.toLowerCase(); | |
| 11139 | + const details = createChangeEventDetails(reason_parts_exports.none, event.nativeEvent); | |
| 11140 | + const findSerializedMatchIndex = () => valuesRef.current.findIndex((candidate) => stringifyAsValue(candidate, itemToStringValue).toLowerCase() === nextValueLower || stringifyValueLabel(candidate).toLowerCase() === nextValueLower); | |
| 11141 | + function handleChange() { | |
| 11142 | + if (multiple) { | |
| 11143 | + return; | |
| 11144 | + } | |
| 11145 | + if (selectionMode === "none") { | |
| 11146 | + setInputValue(nextValue, details); | |
| 11147 | + return; | |
| 11148 | + } | |
| 11149 | + let matchingIndex = findSerializedMatchIndex(); | |
| 11150 | + if (matchingIndex === -1) { | |
| 11151 | + matchingIndex = valuesRef.current.findIndex((_, index2) => { | |
| 11152 | + const renderedLabel = labelsRef.current[index2]; | |
| 11153 | + return renderedLabel != null && renderedLabel.toLowerCase() === nextValueLower; | |
| 11154 | + }); | |
| 11155 | + } | |
| 11156 | + const matchingValue = matchingIndex === -1 ? void 0 : valuesRef.current[matchingIndex]; | |
| 11157 | + if (matchingValue != null) { | |
| 11158 | + setSelectedValue?.(matchingValue, details); | |
| 11159 | + } | |
| 11160 | + } | |
| 11161 | + if (single) { | |
| 11162 | + forceMount(); | |
| 11163 | + if (items && findSerializedMatchIndex() === -1) { | |
| 11164 | + store.set("forceMounted", true); | |
| 11165 | + } | |
| 11166 | + } | |
| 11167 | + queueMicrotask(handleChange); | |
| 11168 | + } | |
| 11169 | + }), | |
| 11170 | + id: id && hiddenInputName == null ? `${id}-hidden-input` : void 0, | |
| 11171 | + form, | |
| 11172 | + name: hiddenInputName, | |
| 11173 | + autoComplete: formAutoComplete, | |
| 11174 | + disabled: disabled2, | |
| 11175 | + required: required && !hasMultipleSelection, | |
| 11176 | + readOnly, | |
| 11177 | + value: serializedValue, | |
| 11178 | + ref: hiddenInputRef, | |
| 11179 | + style: hiddenInputName ? visuallyHiddenInput : visuallyHidden, | |
| 11180 | + tabIndex: -1, | |
| 11181 | + "aria-hidden": true, | |
| 11182 | + suppressHydrationWarning: true | |
| 11183 | + }), hiddenInputs] | |
| 11184 | + }); | |
| 11185 | + return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ComboboxRootContext.Provider, { | |
| 11186 | + value: store, | |
| 11187 | + children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ComboboxFloatingContext.Provider, { | |
| 11188 | + value: floatingRootContext, | |
| 11189 | + children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ComboboxHasItemsContext.Provider, { | |
| 11190 | + value: hasItems, | |
| 11191 | + children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ComboboxDerivedItemsContext.Provider, { | |
| 11192 | + value: itemsContextValue, | |
| 11193 | + children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ComboboxInputValueContext.Provider, { | |
| 11194 | + value: inputValue, | |
| 11195 | + children | |
| 11196 | + }) | |
| 11197 | + }) | |
| 11198 | + }) | |
| 11199 | + }) | |
| 11200 | + }); | |
| 1361 | 11201 | } |
| 1362 | -function injectStyles(tag, css) { | |
| 1363 | - if (tag.styleSheet) { | |
| 1364 | - tag.styleSheet.cssText = css; | |
| 11202 | + | |
| 11203 | +// node_modules/@base-ui/react/autocomplete/root/AutocompleteRoot.mjs | |
| 11204 | +var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); | |
| 11205 | +function AutocompleteRoot(props) { | |
| 11206 | + const { | |
| 11207 | + openOnInputClick = false, | |
| 11208 | + value, | |
| 11209 | + defaultValue, | |
| 11210 | + onValueChange, | |
| 11211 | + mode = "list", | |
| 11212 | + itemToStringValue, | |
| 11213 | + ...other | |
| 11214 | + } = props; | |
| 11215 | + const enableInline = (mode === "inline" || mode === "both") && !props.readOnly; | |
| 11216 | + const staticItems = mode === "inline" || mode === "none"; | |
| 11217 | + const isControlled = value !== void 0; | |
| 11218 | + const [internalValue, setInternalValue] = React53.useState(defaultValue ?? ""); | |
| 11219 | + const [inlineInputValue, setInlineInputValue] = React53.useState(""); | |
| 11220 | + React53.useEffect(() => { | |
| 11221 | + if (isControlled || !enableInline) { | |
| 11222 | + setInlineInputValue(""); | |
| 11223 | + } | |
| 11224 | + }, [value, isControlled, enableInline]); | |
| 11225 | + let resolvedInputValue; | |
| 11226 | + if (enableInline && inlineInputValue !== "") { | |
| 11227 | + resolvedInputValue = inlineInputValue; | |
| 11228 | + } else if (isControlled) { | |
| 11229 | + resolvedInputValue = value ?? ""; | |
| 1365 | 11230 | } else { |
| 1366 | - tag.appendChild(document.createTextNode(css)); | |
| 11231 | + resolvedInputValue = internalValue; | |
| 1367 | 11232 | } |
| 11233 | + const collator = useCoreFilter({ | |
| 11234 | + locale: other.locale | |
| 11235 | + }); | |
| 11236 | + const resolvedQuery = String((isControlled ? value : internalValue) ?? "").trim(); | |
| 11237 | + const resolvedFilter = staticItems || other.filter === null ? null : other.filter ?? collator.contains; | |
| 11238 | + function handleValueChange(nextValue, eventDetails) { | |
| 11239 | + setInlineInputValue(""); | |
| 11240 | + if (!isControlled) { | |
| 11241 | + setInternalValue(nextValue); | |
| 11242 | + } | |
| 11243 | + onValueChange?.(nextValue, eventDetails); | |
| 11244 | + } | |
| 11245 | + function handleItemHighlighted(highlightedValue, eventDetails) { | |
| 11246 | + props.onItemHighlighted?.(highlightedValue, eventDetails); | |
| 11247 | + if (eventDetails.reason === reason_parts_exports.pointer) { | |
| 11248 | + return; | |
| 11249 | + } | |
| 11250 | + setInlineInputValue(enableInline && highlightedValue != null ? stringifyAsLabel(highlightedValue, itemToStringValue) : ""); | |
| 11251 | + } | |
| 11252 | + return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AriaCombobox, { | |
| 11253 | + ...other, | |
| 11254 | + itemToStringLabel: itemToStringValue, | |
| 11255 | + openOnInputClick, | |
| 11256 | + selectionMode: "none", | |
| 11257 | + fillInputOnItemPress: true, | |
| 11258 | + filter: resolvedFilter, | |
| 11259 | + filterQuery: ( | |
| 11260 | + // Inline completion temporarily changes the displayed input without changing this query. | |
| 11261 | + mode === "both" ? resolvedQuery : void 0 | |
| 11262 | + ), | |
| 11263 | + autoComplete: mode, | |
| 11264 | + inputValue: resolvedInputValue, | |
| 11265 | + defaultInputValue: defaultValue, | |
| 11266 | + onInputValueChange: handleValueChange, | |
| 11267 | + onItemHighlighted: handleItemHighlighted | |
| 11268 | + }); | |
| 1368 | 11269 | } |
| 1369 | -function insertStyleTag(tag) { | |
| 1370 | - var head = document.head || document.getElementsByTagName("head")[0]; | |
| 1371 | - head.appendChild(tag); | |
| 11270 | + | |
| 11271 | +// node_modules/@base-ui/react/autocomplete/value/AutocompleteValue.mjs | |
| 11272 | +var React54 = __toESM(require_react(), 1); | |
| 11273 | +var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); | |
| 11274 | +function AutocompleteValue(props) { | |
| 11275 | + const { | |
| 11276 | + children | |
| 11277 | + } = props; | |
| 11278 | + const inputValue = useComboboxInputValueContext(); | |
| 11279 | + let returnValue = null; | |
| 11280 | + if (typeof children === "function") { | |
| 11281 | + returnValue = children(String(inputValue)); | |
| 11282 | + } else if (children != null) { | |
| 11283 | + returnValue = children; | |
| 11284 | + } else { | |
| 11285 | + returnValue = inputValue; | |
| 11286 | + } | |
| 11287 | + return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(React54.Fragment, { | |
| 11288 | + children: returnValue | |
| 11289 | + }); | |
| 1372 | 11290 | } |
| 1373 | -var stylesheetSingleton = function() { | |
| 1374 | - var counter = 0; | |
| 1375 | - var stylesheet = null; | |
| 11291 | + | |
| 11292 | +// node_modules/@base-ui/react/combobox/trigger/ComboboxTrigger.mjs | |
| 11293 | +var React55 = __toESM(require_react(), 1); | |
| 11294 | + | |
| 11295 | +// node_modules/@base-ui/react/combobox/input/ComboboxInputDataAttributes.mjs | |
| 11296 | +var popupOpen3 = CommonTriggerDataAttributes_exports.popupOpen; | |
| 11297 | +var pressed2 = CommonTriggerDataAttributes_exports.pressed; | |
| 11298 | +var popupSide = "data-popup-side"; | |
| 11299 | +var listEmpty = "data-list-empty"; | |
| 11300 | + | |
| 11301 | +// node_modules/@base-ui/react/combobox/utils/stateAttributesMapping.mjs | |
| 11302 | +var triggerStateAttributesMapping = { | |
| 11303 | + ...pressableTriggerOpenStateMapping, | |
| 11304 | + ...fieldValidityMapping, | |
| 11305 | + popupSide: (side) => side ? { | |
| 11306 | + [popupSide]: side | |
| 11307 | + } : null, | |
| 11308 | + listEmpty: (empty) => empty ? { | |
| 11309 | + [listEmpty]: "" | |
| 11310 | + } : null | |
| 11311 | +}; | |
| 11312 | + | |
| 11313 | +// node_modules/@base-ui/react/utils/getPseudoElementBounds.mjs | |
| 11314 | +var BOUNDARY_OFFSET = 5; | |
| 11315 | +function isMouseWithinBounds(event, element) { | |
| 11316 | + const bounds = getPseudoElementBounds(element); | |
| 11317 | + return event.clientX >= bounds.left - BOUNDARY_OFFSET && event.clientX <= bounds.right + BOUNDARY_OFFSET && event.clientY >= bounds.top - BOUNDARY_OFFSET && event.clientY <= bounds.bottom + BOUNDARY_OFFSET; | |
| 11318 | +} | |
| 11319 | +function getPseudoElementBounds(element) { | |
| 11320 | + const elementRect = element.getBoundingClientRect(); | |
| 11321 | + const win = getWindow(element); | |
| 11322 | + if (parts_exports.env.jsdom) { | |
| 11323 | + return elementRect; | |
| 11324 | + } | |
| 11325 | + const beforeStyles = win.getComputedStyle(element, "::before"); | |
| 11326 | + const afterStyles = win.getComputedStyle(element, "::after"); | |
| 11327 | + const hasPseudoElements = beforeStyles.content !== "none" || afterStyles.content !== "none"; | |
| 11328 | + if (!hasPseudoElements) { | |
| 11329 | + return elementRect; | |
| 11330 | + } | |
| 11331 | + const beforeWidth = parseFloat(beforeStyles.width) || 0; | |
| 11332 | + const beforeHeight = parseFloat(beforeStyles.height) || 0; | |
| 11333 | + const afterWidth = parseFloat(afterStyles.width) || 0; | |
| 11334 | + const afterHeight = parseFloat(afterStyles.height) || 0; | |
| 11335 | + const totalWidth = Math.max(elementRect.width, beforeWidth, afterWidth); | |
| 11336 | + const totalHeight = Math.max(elementRect.height, beforeHeight, afterHeight); | |
| 11337 | + const widthDiff = totalWidth - elementRect.width; | |
| 11338 | + const heightDiff = totalHeight - elementRect.height; | |
| 1376 | 11339 | return { |
| 1377 | - add: function(style) { | |
| 1378 | - if (counter == 0) { | |
| 1379 | - if (stylesheet = makeStyleTag()) { | |
| 1380 | - injectStyles(stylesheet, style); | |
| 1381 | - insertStyleTag(stylesheet); | |
| 11340 | + left: elementRect.left - widthDiff / 2, | |
| 11341 | + right: elementRect.right + widthDiff / 2, | |
| 11342 | + top: elementRect.top - heightDiff / 2, | |
| 11343 | + bottom: elementRect.bottom + heightDiff / 2 | |
| 11344 | + }; | |
| 11345 | +} | |
| 11346 | + | |
| 11347 | +// node_modules/@base-ui/react/utils/resolveAriaLabelledBy.mjs | |
| 11348 | +function resolveAriaLabelledBy(fieldLabelId, localLabelId) { | |
| 11349 | + return fieldLabelId ?? localLabelId; | |
| 11350 | +} | |
| 11351 | + | |
| 11352 | +// node_modules/@base-ui/react/combobox/utils/parts.mjs | |
| 11353 | +function usePopupSide(store) { | |
| 11354 | + const mounted = store.useState("mounted"); | |
| 11355 | + const popupSide2 = store.useState("popupSide"); | |
| 11356 | + const positionerElement = store.useState("positionerElement"); | |
| 11357 | + return mounted && positionerElement ? popupSide2 : null; | |
| 11358 | +} | |
| 11359 | +function useListEmpty() { | |
| 11360 | + return useComboboxDerivedItemsContext().filteredItems.length === 0; | |
| 11361 | +} | |
| 11362 | +function getChipNavigationKeys(direction) { | |
| 11363 | + return direction === "rtl" ? ["ArrowRight", "ArrowLeft"] : ["ArrowLeft", "ArrowRight"]; | |
| 11364 | +} | |
| 11365 | +function getIndexAfterChipRemoval(index2, chipCount) { | |
| 11366 | + const nextIndex = index2 >= chipCount - 1 ? chipCount - 2 : index2; | |
| 11367 | + return nextIndex >= 0 ? nextIndex : void 0; | |
| 11368 | +} | |
| 11369 | +function clickHighlightedItem(store, activeIndex, nativeEvent) { | |
| 11370 | + const listItem = store.context.listRef.current[activeIndex]; | |
| 11371 | + if (listItem) { | |
| 11372 | + store.context.selectionEventRef.current = nativeEvent; | |
| 11373 | + listItem.click(); | |
| 11374 | + store.context.selectionEventRef.current = null; | |
| 11375 | + } | |
| 11376 | +} | |
| 11377 | + | |
| 11378 | +// node_modules/@base-ui/react/combobox/trigger/ComboboxTrigger.mjs | |
| 11379 | +var ComboboxTrigger = /* @__PURE__ */ React55.forwardRef(function ComboboxTrigger2(componentProps, forwardedRef) { | |
| 11380 | + const { | |
| 11381 | + render, | |
| 11382 | + className, | |
| 11383 | + nativeButton = true, | |
| 11384 | + disabled: disabledProp = false, | |
| 11385 | + id: idProp, | |
| 11386 | + style, | |
| 11387 | + ...elementProps | |
| 11388 | + } = componentProps; | |
| 11389 | + const { | |
| 11390 | + state: fieldState, | |
| 11391 | + disabled: fieldDisabled, | |
| 11392 | + setTouched, | |
| 11393 | + setFocused, | |
| 11394 | + validationMode, | |
| 11395 | + validation | |
| 11396 | + } = useFieldRootContext(); | |
| 11397 | + const { | |
| 11398 | + labelId: fieldLabelId | |
| 11399 | + } = useLabelableContext(); | |
| 11400 | + const store = useComboboxRootContext(); | |
| 11401 | + const selectionMode = store.useState("selectionMode"); | |
| 11402 | + const comboboxDisabled = store.useState("disabled"); | |
| 11403 | + const readOnly = store.useState("readOnly"); | |
| 11404 | + const required = store.useState("required"); | |
| 11405 | + const positionerElement = store.useState("positionerElement"); | |
| 11406 | + const listElement = store.useState("listElement"); | |
| 11407 | + const storedPopupId = store.useState("popupId"); | |
| 11408 | + const triggerProps = store.useState("triggerProps"); | |
| 11409 | + const inputInsidePopup = store.useState("inputInsidePopup"); | |
| 11410 | + const rootId = store.useState("id"); | |
| 11411 | + const comboboxLabelId = store.useState("labelId"); | |
| 11412 | + const open2 = store.useState("open"); | |
| 11413 | + const selectedValue = store.useState("selectedValue"); | |
| 11414 | + const activeIndex = store.useState("activeIndex"); | |
| 11415 | + const selectedIndex = store.useState("selectedIndex"); | |
| 11416 | + const hasSelectedValue = store.useState("hasSelectedValue"); | |
| 11417 | + const floatingRootContext = useComboboxFloatingContext(); | |
| 11418 | + const inputValue = useComboboxInputValueContext(); | |
| 11419 | + const focusTimeout = useTimeout(); | |
| 11420 | + const disabled2 = fieldDisabled || comboboxDisabled || disabledProp; | |
| 11421 | + const listEmpty2 = useListEmpty(); | |
| 11422 | + const popupSide2 = usePopupSide(store); | |
| 11423 | + useLabelableId({ | |
| 11424 | + id: inputInsidePopup ? idProp : void 0 | |
| 11425 | + }); | |
| 11426 | + const id = inputInsidePopup ? idProp ?? rootId : idProp; | |
| 11427 | + const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, comboboxLabelId); | |
| 11428 | + let ariaControls; | |
| 11429 | + if (open2 && inputInsidePopup) { | |
| 11430 | + ariaControls = storedPopupId ?? getComboboxPopupId(rootId); | |
| 11431 | + } else if (open2) { | |
| 11432 | + ariaControls = listElement?.id; | |
| 11433 | + } | |
| 11434 | + const currentPointerTypeRef = React55.useRef(""); | |
| 11435 | + function trackPointerType(event) { | |
| 11436 | + currentPointerTypeRef.current = event.pointerType; | |
| 11437 | + } | |
| 11438 | + const { | |
| 11439 | + reference: triggerTypeaheadProps | |
| 11440 | + } = useTypeahead(floatingRootContext, { | |
| 11441 | + // Typeahead on a closed trigger commits a value rather than moving a highlight, so it stays | |
| 11442 | + // gated on `readOnly`. | |
| 11443 | + enabled: !open2 && !readOnly && !comboboxDisabled && selectionMode === "single", | |
| 11444 | + listRef: store.context.labelsRef, | |
| 11445 | + activeIndex, | |
| 11446 | + selectedIndex, | |
| 11447 | + onMatch(index2) { | |
| 11448 | + const nextSelectedValue = store.context.valuesRef.current[index2]; | |
| 11449 | + if (nextSelectedValue !== void 0) { | |
| 11450 | + store.context.setSelectedValue(nextSelectedValue, createChangeEventDetails(reason_parts_exports.none)); | |
| 11451 | + } | |
| 11452 | + } | |
| 11453 | + }); | |
| 11454 | + const { | |
| 11455 | + reference: triggerClickProps | |
| 11456 | + } = useClick(floatingRootContext, { | |
| 11457 | + enabled: !comboboxDisabled, | |
| 11458 | + event: "mousedown" | |
| 11459 | + }); | |
| 11460 | + const { | |
| 11461 | + buttonRef, | |
| 11462 | + getButtonProps | |
| 11463 | + } = useButton({ | |
| 11464 | + native: nativeButton, | |
| 11465 | + disabled: disabled2 | |
| 11466 | + }); | |
| 11467 | + const state = { | |
| 11468 | + ...fieldState, | |
| 11469 | + readOnly, | |
| 11470 | + open: open2, | |
| 11471 | + disabled: disabled2, | |
| 11472 | + popupSide: popupSide2, | |
| 11473 | + listEmpty: listEmpty2, | |
| 11474 | + placeholder: selectionMode === "none" ? false : !hasSelectedValue | |
| 11475 | + }; | |
| 11476 | + const setTriggerElement = useStableCallback((element2) => { | |
| 11477 | + store.set("triggerElement", element2); | |
| 11478 | + }); | |
| 11479 | + const element = useRenderElement("button", componentProps, { | |
| 11480 | + ref: [forwardedRef, buttonRef, setTriggerElement], | |
| 11481 | + state, | |
| 11482 | + props: [triggerProps, triggerClickProps, triggerTypeaheadProps, { | |
| 11483 | + id, | |
| 11484 | + tabIndex: inputInsidePopup ? 0 : -1, | |
| 11485 | + role: inputInsidePopup ? "combobox" : void 0, | |
| 11486 | + "aria-expanded": open2, | |
| 11487 | + "aria-haspopup": inputInsidePopup ? "dialog" : "listbox", | |
| 11488 | + "aria-controls": ariaControls, | |
| 11489 | + "aria-required": inputInsidePopup ? required || void 0 : void 0, | |
| 11490 | + // Only valid alongside the `combobox` role; without it the trigger is a plain button, and | |
| 11491 | + // the `Combobox.Input` outside the popup already carries `aria-readonly`. | |
| 11492 | + "aria-readonly": inputInsidePopup ? readOnly || void 0 : void 0, | |
| 11493 | + "aria-labelledby": ariaLabelledBy, | |
| 11494 | + onPointerDown: trackPointerType, | |
| 11495 | + onPointerEnter: trackPointerType, | |
| 11496 | + onFocus() { | |
| 11497 | + setFocused(true); | |
| 11498 | + if (disabled2) { | |
| 11499 | + return; | |
| 1382 | 11500 | } |
| 11501 | + focusTimeout.start(0, store.context.forceMount); | |
| 11502 | + }, | |
| 11503 | + onBlur(event) { | |
| 11504 | + if (contains(positionerElement, event.relatedTarget)) { | |
| 11505 | + return; | |
| 11506 | + } | |
| 11507 | + setTouched(true); | |
| 11508 | + setFocused(false); | |
| 11509 | + if (validationMode === "onBlur") { | |
| 11510 | + const valueToValidate = selectionMode === "none" ? inputValue : selectedValue; | |
| 11511 | + validation.commit(valueToValidate); | |
| 11512 | + } | |
| 11513 | + }, | |
| 11514 | + onMouseDown(event) { | |
| 11515 | + if (disabled2) { | |
| 11516 | + return; | |
| 11517 | + } | |
| 11518 | + if (!inputInsidePopup) { | |
| 11519 | + floatingRootContext.set("domReferenceElement", event.currentTarget); | |
| 11520 | + } | |
| 11521 | + store.context.forceMount(); | |
| 11522 | + if (currentPointerTypeRef.current !== "touch") { | |
| 11523 | + store.context.inputRef.current?.focus(); | |
| 11524 | + if (!inputInsidePopup) { | |
| 11525 | + event.preventDefault(); | |
| 11526 | + } | |
| 11527 | + } | |
| 11528 | + if (open2) { | |
| 11529 | + return; | |
| 11530 | + } | |
| 11531 | + const doc = ownerDocument(event.currentTarget); | |
| 11532 | + function handleMouseUp(mouseEvent) { | |
| 11533 | + const currentTriggerElement = store.state.triggerElement; | |
| 11534 | + if (!currentTriggerElement) { | |
| 11535 | + return; | |
| 11536 | + } | |
| 11537 | + const mouseUpTarget = getTarget(mouseEvent); | |
| 11538 | + const positioner = store.state.positionerElement; | |
| 11539 | + const list = store.state.listElement; | |
| 11540 | + if (contains(currentTriggerElement, mouseUpTarget) || contains(positioner, mouseUpTarget) || contains(list, mouseUpTarget)) { | |
| 11541 | + return; | |
| 11542 | + } | |
| 11543 | + if (isMouseWithinBounds(mouseEvent, currentTriggerElement)) { | |
| 11544 | + return; | |
| 11545 | + } | |
| 11546 | + store.context.setOpen(false, createChangeEventDetails(reason_parts_exports.cancelOpen, mouseEvent)); | |
| 11547 | + } | |
| 11548 | + if (inputInsidePopup) { | |
| 11549 | + doc.addEventListener("mouseup", handleMouseUp, { | |
| 11550 | + once: true | |
| 11551 | + }); | |
| 11552 | + } | |
| 11553 | + }, | |
| 11554 | + onKeyDown(event) { | |
| 11555 | + if (event.key === "ArrowDown" || event.key === "ArrowUp") { | |
| 11556 | + stopEvent(event); | |
| 11557 | + store.context.setOpen(true, createChangeEventDetails(reason_parts_exports.listNavigation, event.nativeEvent)); | |
| 11558 | + store.context.inputRef.current?.focus(); | |
| 11559 | + } | |
| 1383 | 11560 | } |
| 1384 | - counter++; | |
| 1385 | - }, | |
| 1386 | - remove: function() { | |
| 1387 | - counter--; | |
| 1388 | - if (!counter && stylesheet) { | |
| 1389 | - stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet); | |
| 1390 | - stylesheet = null; | |
| 11561 | + }, validation.getValidationProps(disabled2, elementProps), getButtonProps], | |
| 11562 | + stateAttributesMapping: triggerStateAttributesMapping | |
| 11563 | + }); | |
| 11564 | + return element; | |
| 11565 | +}); | |
| 11566 | +if (true) ComboboxTrigger.displayName = "ComboboxTrigger"; | |
| 11567 | + | |
| 11568 | +// node_modules/@base-ui/react/autocomplete/trigger/AutocompleteTrigger.mjs | |
| 11569 | +var AutocompleteTrigger = ComboboxTrigger; | |
| 11570 | + | |
| 11571 | +// node_modules/@base-ui/react/combobox/input/ComboboxInput.mjs | |
| 11572 | +var React59 = __toESM(require_react(), 1); | |
| 11573 | + | |
| 11574 | +// node_modules/@base-ui/react/combobox/chips/ComboboxChipsContext.mjs | |
| 11575 | +var React56 = __toESM(require_react(), 1); | |
| 11576 | +var ComboboxChipsContext = /* @__PURE__ */ React56.createContext(void 0); | |
| 11577 | +if (true) ComboboxChipsContext.displayName = "ComboboxChipsContext"; | |
| 11578 | +function useComboboxChipsContext() { | |
| 11579 | + return React56.useContext(ComboboxChipsContext); | |
| 11580 | +} | |
| 11581 | + | |
| 11582 | +// node_modules/@base-ui/react/combobox/positioner/ComboboxPositionerContext.mjs | |
| 11583 | +var React57 = __toESM(require_react(), 1); | |
| 11584 | +var ComboboxPositionerContext = /* @__PURE__ */ React57.createContext(void 0); | |
| 11585 | +if (true) ComboboxPositionerContext.displayName = "ComboboxPositionerContext"; | |
| 11586 | +function useComboboxPositionerContext(optional) { | |
| 11587 | + const context = React57.useContext(ComboboxPositionerContext); | |
| 11588 | + if (context === void 0 && !optional) { | |
| 11589 | + throw new Error(true ? "Base UI: <Combobox.Popup> and <Combobox.Arrow> must be used within the <Combobox.Positioner> component" : formatErrorMessage_default(21)); | |
| 11590 | + } | |
| 11591 | + return context; | |
| 11592 | +} | |
| 11593 | + | |
| 11594 | +// node_modules/@base-ui/react/combobox/utils/ComboboxInternalDismissButton.mjs | |
| 11595 | +var React58 = __toESM(require_react(), 1); | |
| 11596 | +var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); | |
| 11597 | +var ComboboxInternalDismissButton = /* @__PURE__ */ React58.forwardRef(function ComboboxInternalDismissButton2(_, forwardedRef) { | |
| 11598 | + const store = useComboboxRootContext(); | |
| 11599 | + const { | |
| 11600 | + buttonRef, | |
| 11601 | + getButtonProps | |
| 11602 | + } = useButton({ | |
| 11603 | + native: false | |
| 11604 | + }); | |
| 11605 | + const mergedRef = useMergedRefs(forwardedRef, buttonRef); | |
| 11606 | + function handleDismiss(event) { | |
| 11607 | + store.context.setOpen(false, createChangeEventDetails(reason_parts_exports.closePress, event.nativeEvent, event.currentTarget)); | |
| 11608 | + } | |
| 11609 | + const dismissProps = getButtonProps({ | |
| 11610 | + onClick: handleDismiss | |
| 11611 | + }); | |
| 11612 | + return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { | |
| 11613 | + ref: mergedRef, | |
| 11614 | + ...dismissProps, | |
| 11615 | + "aria-label": "Dismiss", | |
| 11616 | + tabIndex: void 0, | |
| 11617 | + style: visuallyHiddenInput | |
| 11618 | + }); | |
| 11619 | +}); | |
| 11620 | +if (true) ComboboxInternalDismissButton.displayName = "ComboboxInternalDismissButton"; | |
| 11621 | + | |
| 11622 | +// node_modules/@base-ui/react/combobox/input/ComboboxInput.mjs | |
| 11623 | +var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); | |
| 11624 | +var ComboboxInput = /* @__PURE__ */ React59.forwardRef(function ComboboxInput2(componentProps, forwardedRef) { | |
| 11625 | + const { | |
| 11626 | + render, | |
| 11627 | + className, | |
| 11628 | + disabled: disabledProp = false, | |
| 11629 | + id: idProp, | |
| 11630 | + style, | |
| 11631 | + ...elementProps | |
| 11632 | + } = componentProps; | |
| 11633 | + const { | |
| 11634 | + state: fieldState, | |
| 11635 | + disabled: fieldDisabled, | |
| 11636 | + setTouched, | |
| 11637 | + setFocused, | |
| 11638 | + validationMode, | |
| 11639 | + validation | |
| 11640 | + } = useFieldRootContext(); | |
| 11641 | + const { | |
| 11642 | + labelId: fieldLabelId | |
| 11643 | + } = useLabelableContext(); | |
| 11644 | + const comboboxChipsContext = useComboboxChipsContext(); | |
| 11645 | + const positioning = useComboboxPositionerContext(true); | |
| 11646 | + const hasPositionerParent = Boolean(positioning); | |
| 11647 | + const store = useComboboxRootContext(); | |
| 11648 | + const inputValue = useComboboxInputValueContext(); | |
| 11649 | + const direction = useDirection(); | |
| 11650 | + const required = store.useState("required"); | |
| 11651 | + const comboboxDisabled = store.useState("disabled"); | |
| 11652 | + const readOnly = store.useState("readOnly"); | |
| 11653 | + const name = store.useState("name"); | |
| 11654 | + const form = store.useState("form"); | |
| 11655 | + const selectionMode = store.useState("selectionMode"); | |
| 11656 | + const autoHighlightMode = store.useState("autoHighlight"); | |
| 11657 | + const inputProps = store.useState("inputProps"); | |
| 11658 | + const triggerProps = store.useState("triggerProps"); | |
| 11659 | + const open2 = store.useState("open"); | |
| 11660 | + const mounted = store.useState("mounted"); | |
| 11661 | + const selectedValue = store.useState("selectedValue"); | |
| 11662 | + const rootId = store.useState("id"); | |
| 11663 | + const inline4 = store.useState("inline"); | |
| 11664 | + const modal = store.useState("modal"); | |
| 11665 | + const autoHighlightEnabled = Boolean(autoHighlightMode); | |
| 11666 | + const popupSide2 = usePopupSide(store); | |
| 11667 | + const disabled2 = fieldDisabled || comboboxDisabled || disabledProp; | |
| 11668 | + const listEmpty2 = useListEmpty(); | |
| 11669 | + const isInsidePopup = hasPositionerParent || inline4; | |
| 11670 | + const focusManagerModal = !isInsidePopup || modal; | |
| 11671 | + const id = useBaseUiId(idProp ?? (!isInsidePopup ? rootId : void 0)); | |
| 11672 | + const fieldStateForInput = hasPositionerParent ? DEFAULT_FIELD_STATE_ATTRIBUTES : fieldState; | |
| 11673 | + const [composingValue, setComposingValue] = React59.useState(null); | |
| 11674 | + const isComposingRef = React59.useRef(false); | |
| 11675 | + const lastActiveIndexRef = React59.useRef(null); | |
| 11676 | + const shouldRestoreActiveIndexRef = React59.useRef(false); | |
| 11677 | + const inputOwnsFormValue = selectionMode === "none" && !hasPositionerParent; | |
| 11678 | + const setInputElement = useStableCallback((element2) => { | |
| 11679 | + const nextIsInsidePopup = hasPositionerParent || store.state.inline; | |
| 11680 | + if (nextIsInsidePopup && !store.state.hasInputValue) { | |
| 11681 | + store.context.setInputValue("", createChangeEventDetails(reason_parts_exports.none)); | |
| 11682 | + } | |
| 11683 | + store.update({ | |
| 11684 | + inputElement: element2, | |
| 11685 | + inputInsidePopup: nextIsInsidePopup, | |
| 11686 | + inputOwnsFormValue | |
| 11687 | + }); | |
| 11688 | + }); | |
| 11689 | + const validationProps = hasPositionerParent ? elementProps : validation.getValidationProps(disabled2, elementProps); | |
| 11690 | + function clearHighlight() { | |
| 11691 | + store.context.setIndices({ | |
| 11692 | + activeIndex: null, | |
| 11693 | + selectedIndex: null, | |
| 11694 | + type: store.context.keyboardActiveRef.current ? reason_parts_exports.keyboard : reason_parts_exports.pointer | |
| 11695 | + }); | |
| 11696 | + } | |
| 11697 | + function markPointerActive() { | |
| 11698 | + store.context.keyboardActiveRef.current = false; | |
| 11699 | + } | |
| 11700 | + const state = { | |
| 11701 | + ...fieldStateForInput, | |
| 11702 | + open: open2, | |
| 11703 | + disabled: disabled2, | |
| 11704 | + readOnly, | |
| 11705 | + popupSide: popupSide2, | |
| 11706 | + listEmpty: listEmpty2 | |
| 11707 | + }; | |
| 11708 | + function handleKeyDown(event) { | |
| 11709 | + if (!comboboxChipsContext) { | |
| 11710 | + return void 0; | |
| 11711 | + } | |
| 11712 | + let nextIndex; | |
| 11713 | + const { | |
| 11714 | + highlightedChipIndex | |
| 11715 | + } = comboboxChipsContext; | |
| 11716 | + const renderedChipsCount = comboboxChipsContext.chipsRef.current.length; | |
| 11717 | + const [previousChipKey, nextChipKey] = getChipNavigationKeys(direction); | |
| 11718 | + if (highlightedChipIndex !== void 0) { | |
| 11719 | + if (event.key === previousChipKey) { | |
| 11720 | + event.preventDefault(); | |
| 11721 | + if (highlightedChipIndex > 0) { | |
| 11722 | + nextIndex = highlightedChipIndex - 1; | |
| 11723 | + } else { | |
| 11724 | + nextIndex = void 0; | |
| 11725 | + } | |
| 11726 | + } else if (event.key === nextChipKey) { | |
| 11727 | + event.preventDefault(); | |
| 11728 | + if (highlightedChipIndex < renderedChipsCount - 1) { | |
| 11729 | + nextIndex = highlightedChipIndex + 1; | |
| 11730 | + } else { | |
| 11731 | + nextIndex = void 0; | |
| 11732 | + } | |
| 11733 | + } else if (event.key === "Backspace" || event.key === "Delete") { | |
| 11734 | + event.preventDefault(); | |
| 11735 | + nextIndex = getIndexAfterChipRemoval(highlightedChipIndex, selectedValue.length); | |
| 11736 | + clearHighlight(); | |
| 1391 | 11737 | } |
| 11738 | + return nextIndex; | |
| 1392 | 11739 | } |
| 11740 | + if (event.key === previousChipKey && (event.currentTarget.selectionStart ?? 0) === 0 && selectedValue.length > 0) { | |
| 11741 | + event.preventDefault(); | |
| 11742 | + nextIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : void 0; | |
| 11743 | + } | |
| 11744 | + return nextIndex; | |
| 11745 | + } | |
| 11746 | + const element = useRenderElement("input", componentProps, { | |
| 11747 | + state, | |
| 11748 | + ref: [forwardedRef, store.context.inputRef, setInputElement], | |
| 11749 | + props: [inputProps, triggerProps, { | |
| 11750 | + value: composingValue ?? inputValue, | |
| 11751 | + "aria-readonly": readOnly || void 0, | |
| 11752 | + "aria-required": required || void 0, | |
| 11753 | + "aria-labelledby": fieldLabelId, | |
| 11754 | + disabled: disabled2, | |
| 11755 | + readOnly, | |
| 11756 | + required: selectionMode === "none" ? required : void 0, | |
| 11757 | + form, | |
| 11758 | + ...inputOwnsFormValue && name && { | |
| 11759 | + name | |
| 11760 | + }, | |
| 11761 | + id, | |
| 11762 | + onFocus() { | |
| 11763 | + setFocused(true); | |
| 11764 | + if (!inline4 || !shouldRestoreActiveIndexRef.current) { | |
| 11765 | + return; | |
| 11766 | + } | |
| 11767 | + shouldRestoreActiveIndexRef.current = false; | |
| 11768 | + const nextActiveIndex = lastActiveIndexRef.current; | |
| 11769 | + if (nextActiveIndex == null || // `valuesRef` can be sparse, so guard against restoring a removed slot. | |
| 11770 | + !Object.hasOwn(store.context.valuesRef.current, nextActiveIndex)) { | |
| 11771 | + return; | |
| 11772 | + } | |
| 11773 | + store.context.setIndices({ | |
| 11774 | + activeIndex: nextActiveIndex | |
| 11775 | + }); | |
| 11776 | + }, | |
| 11777 | + onBlur() { | |
| 11778 | + setTouched(true); | |
| 11779 | + setFocused(false); | |
| 11780 | + const activeIndex = store.state.activeIndex; | |
| 11781 | + if (inline4 && activeIndex !== null && autoHighlightMode !== "always") { | |
| 11782 | + lastActiveIndexRef.current = activeIndex; | |
| 11783 | + shouldRestoreActiveIndexRef.current = true; | |
| 11784 | + store.context.setIndices({ | |
| 11785 | + activeIndex: null | |
| 11786 | + }); | |
| 11787 | + } | |
| 11788 | + if (validationMode === "onBlur") { | |
| 11789 | + const valueToValidate = selectionMode === "none" ? inputValue : selectedValue; | |
| 11790 | + validation.commit(valueToValidate); | |
| 11791 | + } | |
| 11792 | + }, | |
| 11793 | + onCompositionStart(event) { | |
| 11794 | + if (parts_exports.os.android) { | |
| 11795 | + return; | |
| 11796 | + } | |
| 11797 | + isComposingRef.current = true; | |
| 11798 | + setComposingValue(event.currentTarget.value); | |
| 11799 | + }, | |
| 11800 | + onCompositionEnd(event) { | |
| 11801 | + isComposingRef.current = false; | |
| 11802 | + const next = event.currentTarget.value; | |
| 11803 | + setComposingValue(null); | |
| 11804 | + store.context.setInputValue(next, createChangeEventDetails(reason_parts_exports.inputChange, event.nativeEvent)); | |
| 11805 | + }, | |
| 11806 | + onChange(event) { | |
| 11807 | + const nativeEvent = event.nativeEvent; | |
| 11808 | + const inputType = nativeEvent.inputType; | |
| 11809 | + const autofillLikeInput = !inputType || inputType === "insertReplacementText"; | |
| 11810 | + const shouldOpenOnInput = isComposingRef.current || !autofillLikeInput; | |
| 11811 | + function maybeOpenOnInput(trimmed) { | |
| 11812 | + if (readOnly || disabled2 || !trimmed || !shouldOpenOnInput) { | |
| 11813 | + return; | |
| 11814 | + } | |
| 11815 | + store.context.setOpen(true, createChangeEventDetails(reason_parts_exports.inputChange, nativeEvent)); | |
| 11816 | + if (!autoHighlightEnabled) { | |
| 11817 | + clearHighlight(); | |
| 11818 | + } | |
| 11819 | + } | |
| 11820 | + if (isComposingRef.current) { | |
| 11821 | + const nextVal = event.currentTarget.value; | |
| 11822 | + setComposingValue(nextVal); | |
| 11823 | + if (nextVal === "" && !store.state.openOnInputClick && !store.state.inputInsidePopup) { | |
| 11824 | + store.context.setOpen(false, createChangeEventDetails(reason_parts_exports.inputClear, nativeEvent)); | |
| 11825 | + } | |
| 11826 | + const trimmed = nextVal.trim(); | |
| 11827 | + const shouldMaintainHighlight = autoHighlightEnabled && trimmed !== ""; | |
| 11828 | + maybeOpenOnInput(trimmed); | |
| 11829 | + if (open2 && store.state.activeIndex !== null && !shouldMaintainHighlight) { | |
| 11830 | + clearHighlight(); | |
| 11831 | + } | |
| 11832 | + return; | |
| 11833 | + } | |
| 11834 | + const inputChangeDetails = createChangeEventDetails(reason_parts_exports.inputChange, nativeEvent); | |
| 11835 | + store.context.setInputValue(event.currentTarget.value, inputChangeDetails); | |
| 11836 | + if (inputChangeDetails.isCanceled) { | |
| 11837 | + return; | |
| 11838 | + } | |
| 11839 | + const empty = event.currentTarget.value === ""; | |
| 11840 | + const clearDetails = createChangeEventDetails(reason_parts_exports.inputClear, nativeEvent); | |
| 11841 | + if (empty && !store.state.inputInsidePopup) { | |
| 11842 | + if (selectionMode === "single") { | |
| 11843 | + store.context.setSelectedValue(null, clearDetails); | |
| 11844 | + } | |
| 11845 | + if (!store.state.openOnInputClick) { | |
| 11846 | + store.context.setOpen(false, clearDetails); | |
| 11847 | + } | |
| 11848 | + } | |
| 11849 | + maybeOpenOnInput(event.currentTarget.value.trim()); | |
| 11850 | + if (open2 && store.state.activeIndex !== null && !autoHighlightEnabled) { | |
| 11851 | + clearHighlight(); | |
| 11852 | + } | |
| 11853 | + }, | |
| 11854 | + onKeyDown(event) { | |
| 11855 | + if (event.ctrlKey || event.shiftKey || event.altKey || event.metaKey) { | |
| 11856 | + return; | |
| 11857 | + } | |
| 11858 | + store.context.keyboardActiveRef.current = true; | |
| 11859 | + if (disabled2 || readOnly) { | |
| 11860 | + if (readOnly && event.key === "Enter" && open2 && store.state.activeIndex !== null) { | |
| 11861 | + stopEvent(event); | |
| 11862 | + } | |
| 11863 | + return; | |
| 11864 | + } | |
| 11865 | + const input = event.currentTarget; | |
| 11866 | + const scrollAmount = input.scrollWidth - input.clientWidth; | |
| 11867 | + const isRTL4 = direction === "rtl"; | |
| 11868 | + if (event.key === "Home") { | |
| 11869 | + stopEvent(event); | |
| 11870 | + const cursor = parts_exports.engine.gecko && isRTL4 ? input.value.length : 0; | |
| 11871 | + input.setSelectionRange(cursor, cursor); | |
| 11872 | + input.scrollLeft = 0; | |
| 11873 | + return; | |
| 11874 | + } | |
| 11875 | + if (event.key === "End") { | |
| 11876 | + stopEvent(event); | |
| 11877 | + const cursor = parts_exports.engine.gecko && isRTL4 ? 0 : input.value.length; | |
| 11878 | + input.setSelectionRange(cursor, cursor); | |
| 11879 | + input.scrollLeft = isRTL4 ? -scrollAmount : scrollAmount; | |
| 11880 | + return; | |
| 11881 | + } | |
| 11882 | + if (!mounted && event.key === "Escape") { | |
| 11883 | + const isClear = selectionMode === "multiple" && Array.isArray(selectedValue) ? selectedValue.length === 0 : selectedValue === null; | |
| 11884 | + const details = createChangeEventDetails(reason_parts_exports.escapeKey, event.nativeEvent); | |
| 11885 | + const value = selectionMode === "multiple" ? [] : null; | |
| 11886 | + store.context.setInputValue("", details); | |
| 11887 | + store.context.setSelectedValue(value, details); | |
| 11888 | + if (!isClear && !store.state.inline && !details.isPropagationAllowed) { | |
| 11889 | + event.stopPropagation(); | |
| 11890 | + } | |
| 11891 | + return; | |
| 11892 | + } | |
| 11893 | + if (comboboxChipsContext && event.key === "Backspace" && input.value === "" && comboboxChipsContext.highlightedChipIndex === void 0 && Array.isArray(selectedValue) && selectedValue.length > 0) { | |
| 11894 | + const renderedChipsCount = comboboxChipsContext.chipsRef.current.length; | |
| 11895 | + const removalIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : selectedValue.length - 1; | |
| 11896 | + const newValue = selectedValue.filter((_, index2) => index2 !== removalIndex); | |
| 11897 | + clearHighlight(); | |
| 11898 | + store.context.setSelectedValue(newValue, createChangeEventDetails(reason_parts_exports.none, event.nativeEvent)); | |
| 11899 | + return; | |
| 11900 | + } | |
| 11901 | + const hadHighlightedChip = comboboxChipsContext?.highlightedChipIndex !== void 0; | |
| 11902 | + const nextIndex = handleKeyDown(event); | |
| 11903 | + comboboxChipsContext?.setHighlightedChipIndex(nextIndex); | |
| 11904 | + if (nextIndex !== void 0) { | |
| 11905 | + comboboxChipsContext?.chipsRef.current[nextIndex]?.focus(); | |
| 11906 | + } else if (hadHighlightedChip) { | |
| 11907 | + store.context.inputRef.current?.focus(); | |
| 11908 | + } | |
| 11909 | + if (event.which === 229) { | |
| 11910 | + return; | |
| 11911 | + } | |
| 11912 | + if (event.key === "Enter" && open2) { | |
| 11913 | + const activeIndex = store.state.activeIndex; | |
| 11914 | + const nativeEvent = event.nativeEvent; | |
| 11915 | + if (activeIndex === null) { | |
| 11916 | + if (inline4) { | |
| 11917 | + return; | |
| 11918 | + } | |
| 11919 | + store.context.setOpen(false, createChangeEventDetails(reason_parts_exports.none, nativeEvent)); | |
| 11920 | + return; | |
| 11921 | + } | |
| 11922 | + stopEvent(event); | |
| 11923 | + clickHighlightedItem(store, activeIndex, nativeEvent); | |
| 11924 | + } | |
| 11925 | + }, | |
| 11926 | + onPointerMove: markPointerActive, | |
| 11927 | + onPointerDown: markPointerActive | |
| 11928 | + }, validationProps], | |
| 11929 | + stateAttributesMapping: triggerStateAttributesMapping | |
| 11930 | + }); | |
| 11931 | + const renderedInput = hasPositionerParent ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FieldRootContext.Provider, { | |
| 11932 | + value: DEFAULT_FIELD_ROOT_CONTEXT, | |
| 11933 | + children: element | |
| 11934 | + }) : element; | |
| 11935 | + return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(React59.Fragment, { | |
| 11936 | + children: [open2 && focusManagerModal && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ComboboxInternalDismissButton, { | |
| 11937 | + ref: store.context.startDismissRef | |
| 11938 | + }), renderedInput] | |
| 11939 | + }); | |
| 11940 | +}); | |
| 11941 | +if (true) ComboboxInput.displayName = "ComboboxInput"; | |
| 11942 | + | |
| 11943 | +// node_modules/@base-ui/react/combobox/input-group/ComboboxInputGroup.mjs | |
| 11944 | +var React60 = __toESM(require_react(), 1); | |
| 11945 | + | |
| 11946 | +// node_modules/@base-ui/react/combobox/utils/handleInputPress.mjs | |
| 11947 | +function handleInputPress(event, store, disabled2, shouldIgnoreTarget) { | |
| 11948 | + if (event.baseUIHandlerPrevented) { | |
| 11949 | + return; | |
| 11950 | + } | |
| 11951 | + const target = getTarget(event.nativeEvent); | |
| 11952 | + const targetElement = isElement(target) ? target : null; | |
| 11953 | + if (targetElement !== event.currentTarget && (shouldIgnoreTarget?.(targetElement) || isInteractiveElement(targetElement))) { | |
| 11954 | + return; | |
| 11955 | + } | |
| 11956 | + event.preventDefault(); | |
| 11957 | + if (disabled2) { | |
| 11958 | + return; | |
| 11959 | + } | |
| 11960 | + store.context.inputRef.current?.focus(); | |
| 11961 | + if (store.state.openOnInputClick) { | |
| 11962 | + store.context.setOpen(true, createChangeEventDetails(reason_parts_exports.inputPress, event.nativeEvent)); | |
| 11963 | + } | |
| 11964 | +} | |
| 11965 | + | |
| 11966 | +// node_modules/@base-ui/react/combobox/input-group/ComboboxInputGroup.mjs | |
| 11967 | +var ComboboxInputGroup = /* @__PURE__ */ React60.forwardRef(function ComboboxInputGroup2(componentProps, forwardedRef) { | |
| 11968 | + const { | |
| 11969 | + render, | |
| 11970 | + className, | |
| 11971 | + style, | |
| 11972 | + ...elementProps | |
| 11973 | + } = componentProps; | |
| 11974 | + const { | |
| 11975 | + state: fieldState | |
| 11976 | + } = useFieldRootContext(); | |
| 11977 | + const store = useComboboxRootContext(); | |
| 11978 | + const open2 = store.useState("open"); | |
| 11979 | + const comboboxDisabled = store.useState("disabled"); | |
| 11980 | + const readOnly = store.useState("readOnly"); | |
| 11981 | + const hasSelectedValue = store.useState("hasSelectedValue"); | |
| 11982 | + const selectionMode = store.useState("selectionMode"); | |
| 11983 | + const popupSide2 = usePopupSide(store); | |
| 11984 | + const disabled2 = comboboxDisabled; | |
| 11985 | + const listEmpty2 = useListEmpty(); | |
| 11986 | + const placeholder = selectionMode === "none" ? false : !hasSelectedValue; | |
| 11987 | + const state = { | |
| 11988 | + ...fieldState, | |
| 11989 | + open: open2, | |
| 11990 | + disabled: disabled2, | |
| 11991 | + readOnly, | |
| 11992 | + popupSide: popupSide2, | |
| 11993 | + listEmpty: listEmpty2, | |
| 11994 | + placeholder | |
| 1393 | 11995 | }; |
| 11996 | + const setInputGroupElement = useStableCallback((element) => { | |
| 11997 | + store.set("inputGroupElement", element); | |
| 11998 | + }); | |
| 11999 | + return useRenderElement("div", componentProps, { | |
| 12000 | + ref: [forwardedRef, setInputGroupElement], | |
| 12001 | + props: [{ | |
| 12002 | + role: "group", | |
| 12003 | + onMouseDown(event) { | |
| 12004 | + handleInputPress(event, store, disabled2, (target) => { | |
| 12005 | + return contains(store.context.chipsContainerRef.current, target); | |
| 12006 | + }); | |
| 12007 | + } | |
| 12008 | + }, elementProps], | |
| 12009 | + state, | |
| 12010 | + stateAttributesMapping: triggerStateAttributesMapping | |
| 12011 | + }); | |
| 12012 | +}); | |
| 12013 | +if (true) ComboboxInputGroup.displayName = "ComboboxInputGroup"; | |
| 12014 | + | |
| 12015 | +// node_modules/@base-ui/react/autocomplete/input-group/AutocompleteInputGroup.mjs | |
| 12016 | +var AutocompleteInputGroup = ComboboxInputGroup; | |
| 12017 | + | |
| 12018 | +// node_modules/@base-ui/react/combobox/icon/ComboboxIcon.mjs | |
| 12019 | +var React61 = __toESM(require_react(), 1); | |
| 12020 | +var ComboboxIcon = /* @__PURE__ */ React61.forwardRef(function ComboboxIcon2(componentProps, forwardedRef) { | |
| 12021 | + const { | |
| 12022 | + render, | |
| 12023 | + className, | |
| 12024 | + style, | |
| 12025 | + ...elementProps | |
| 12026 | + } = componentProps; | |
| 12027 | + const element = useRenderElement("span", componentProps, { | |
| 12028 | + ref: forwardedRef, | |
| 12029 | + props: [{ | |
| 12030 | + "aria-hidden": true, | |
| 12031 | + children: "▼" | |
| 12032 | + }, elementProps] | |
| 12033 | + }); | |
| 12034 | + return element; | |
| 12035 | +}); | |
| 12036 | +if (true) ComboboxIcon.displayName = "ComboboxIcon"; | |
| 12037 | + | |
| 12038 | +// node_modules/@base-ui/react/combobox/clear/ComboboxClear.mjs | |
| 12039 | +var React62 = __toESM(require_react(), 1); | |
| 12040 | +var stateAttributesMapping = { | |
| 12041 | + ...transitionStatusMapping, | |
| 12042 | + ...triggerOpenStateMapping | |
| 1394 | 12043 | }; |
| 12044 | +var ComboboxClear = /* @__PURE__ */ React62.forwardRef(function ComboboxClear2(componentProps, forwardedRef) { | |
| 12045 | + const { | |
| 12046 | + render, | |
| 12047 | + className, | |
| 12048 | + disabled: disabledProp = false, | |
| 12049 | + nativeButton = true, | |
| 12050 | + keepMounted = false, | |
| 12051 | + style, | |
| 12052 | + ...elementProps | |
| 12053 | + } = componentProps; | |
| 12054 | + const { | |
| 12055 | + disabled: fieldDisabled | |
| 12056 | + } = useFieldRootContext(); | |
| 12057 | + const store = useComboboxRootContext(); | |
| 12058 | + const selectionMode = store.useState("selectionMode"); | |
| 12059 | + const comboboxDisabled = store.useState("disabled"); | |
| 12060 | + const readOnly = store.useState("readOnly"); | |
| 12061 | + const open2 = store.useState("open"); | |
| 12062 | + const selectedValue = store.useState("selectedValue"); | |
| 12063 | + const hasSelectionChips = store.useState("hasSelectionChips"); | |
| 12064 | + const inputValue = useComboboxInputValueContext(); | |
| 12065 | + let visible = false; | |
| 12066 | + if (selectionMode === "none") { | |
| 12067 | + visible = inputValue !== ""; | |
| 12068 | + } else if (selectionMode === "single") { | |
| 12069 | + visible = selectedValue != null; | |
| 12070 | + } else { | |
| 12071 | + visible = hasSelectionChips; | |
| 12072 | + } | |
| 12073 | + const disabled2 = fieldDisabled || comboboxDisabled || disabledProp; | |
| 12074 | + const { | |
| 12075 | + buttonRef, | |
| 12076 | + getButtonProps | |
| 12077 | + } = useButton({ | |
| 12078 | + native: nativeButton, | |
| 12079 | + disabled: disabled2 | |
| 12080 | + }); | |
| 12081 | + const { | |
| 12082 | + mounted, | |
| 12083 | + transitionStatus, | |
| 12084 | + setMounted | |
| 12085 | + } = useTransitionStatus(visible); | |
| 12086 | + const state = { | |
| 12087 | + disabled: disabled2, | |
| 12088 | + visible, | |
| 12089 | + open: open2, | |
| 12090 | + transitionStatus | |
| 12091 | + }; | |
| 12092 | + useOpenChangeComplete({ | |
| 12093 | + open: visible, | |
| 12094 | + ref: store.context.clearRef, | |
| 12095 | + onComplete() { | |
| 12096 | + if (!visible) { | |
| 12097 | + setMounted(false); | |
| 12098 | + } | |
| 12099 | + } | |
| 12100 | + }); | |
| 12101 | + const element = useRenderElement("button", componentProps, { | |
| 12102 | + state, | |
| 12103 | + ref: [forwardedRef, buttonRef, store.context.clearRef], | |
| 12104 | + props: [{ | |
| 12105 | + tabIndex: -1, | |
| 12106 | + children: "x", | |
| 12107 | + // Avoid stealing focus from the input. | |
| 12108 | + onMouseDown(event) { | |
| 12109 | + event.preventDefault(); | |
| 12110 | + }, | |
| 12111 | + onClick(event) { | |
| 12112 | + if (disabled2 || readOnly) { | |
| 12113 | + return; | |
| 12114 | + } | |
| 12115 | + const type = store.context.keyboardActiveRef.current ? reason_parts_exports.keyboard : reason_parts_exports.pointer; | |
| 12116 | + store.context.setInputValue("", createChangeEventDetails(reason_parts_exports.clearPress, event.nativeEvent)); | |
| 12117 | + if (selectionMode !== "none") { | |
| 12118 | + store.context.setSelectedValue(Array.isArray(selectedValue) ? [] : null, createChangeEventDetails(reason_parts_exports.clearPress, event.nativeEvent)); | |
| 12119 | + store.context.setIndices({ | |
| 12120 | + activeIndex: null, | |
| 12121 | + selectedIndex: null, | |
| 12122 | + type | |
| 12123 | + }); | |
| 12124 | + } else { | |
| 12125 | + store.context.setIndices({ | |
| 12126 | + activeIndex: null, | |
| 12127 | + type | |
| 12128 | + }); | |
| 12129 | + } | |
| 12130 | + store.context.inputRef.current?.focus(); | |
| 12131 | + } | |
| 12132 | + }, elementProps, getButtonProps], | |
| 12133 | + stateAttributesMapping | |
| 12134 | + }); | |
| 12135 | + const shouldRender = keepMounted || mounted; | |
| 12136 | + if (!shouldRender) { | |
| 12137 | + return null; | |
| 12138 | + } | |
| 12139 | + return element; | |
| 12140 | +}); | |
| 12141 | +if (true) ComboboxClear.displayName = "ComboboxClear"; | |
| 1395 | 12142 | |
| 1396 | -// node_modules/react-style-singleton/dist/es2015/hook.js | |
| 1397 | -var styleHookSingleton = function() { | |
| 1398 | - var sheet = stylesheetSingleton(); | |
| 1399 | - return function(styles, isDynamic) { | |
| 1400 | - React18.useEffect(function() { | |
| 1401 | - sheet.add(styles); | |
| 1402 | - return function() { | |
| 1403 | - sheet.remove(); | |
| 1404 | - }; | |
| 1405 | - }, [styles && isDynamic]); | |
| 12143 | +// node_modules/@base-ui/react/combobox/list/ComboboxList.mjs | |
| 12144 | +var React65 = __toESM(require_react(), 1); | |
| 12145 | + | |
| 12146 | +// node_modules/@base-ui/react/combobox/collection/ComboboxCollection.mjs | |
| 12147 | +var React64 = __toESM(require_react(), 1); | |
| 12148 | + | |
| 12149 | +// node_modules/@base-ui/react/combobox/collection/GroupCollectionContext.mjs | |
| 12150 | +var React63 = __toESM(require_react(), 1); | |
| 12151 | +var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); | |
| 12152 | +var GroupCollectionContext = /* @__PURE__ */ React63.createContext(null); | |
| 12153 | +if (true) GroupCollectionContext.displayName = "GroupCollectionContext"; | |
| 12154 | +function useGroupCollectionContext() { | |
| 12155 | + return React63.useContext(GroupCollectionContext); | |
| 12156 | +} | |
| 12157 | +function GroupCollectionProvider(props) { | |
| 12158 | + const { | |
| 12159 | + children, | |
| 12160 | + items | |
| 12161 | + } = props; | |
| 12162 | + const contextValue = React63.useMemo(() => ({ | |
| 12163 | + items | |
| 12164 | + }), [items]); | |
| 12165 | + return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(GroupCollectionContext.Provider, { | |
| 12166 | + value: contextValue, | |
| 12167 | + children | |
| 12168 | + }); | |
| 12169 | +} | |
| 12170 | + | |
| 12171 | +// node_modules/@base-ui/react/combobox/collection/ComboboxCollection.mjs | |
| 12172 | +var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); | |
| 12173 | +function ComboboxCollection(props) { | |
| 12174 | + const { | |
| 12175 | + children | |
| 12176 | + } = props; | |
| 12177 | + const { | |
| 12178 | + filteredItems | |
| 12179 | + } = useComboboxDerivedItemsContext(); | |
| 12180 | + const groupContext = useGroupCollectionContext(); | |
| 12181 | + const itemsToRender = groupContext ? groupContext.items : filteredItems; | |
| 12182 | + return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(React64.Fragment, { | |
| 12183 | + children: itemsToRender.map(children) | |
| 12184 | + }); | |
| 12185 | +} | |
| 12186 | + | |
| 12187 | +// node_modules/@base-ui/react/combobox/list/ComboboxList.mjs | |
| 12188 | +var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); | |
| 12189 | +var ComboboxList = /* @__PURE__ */ React65.forwardRef(function ComboboxList2(componentProps, forwardedRef) { | |
| 12190 | + var _ComboboxCollection; | |
| 12191 | + const { | |
| 12192 | + render, | |
| 12193 | + className, | |
| 12194 | + style, | |
| 12195 | + children, | |
| 12196 | + ...elementProps | |
| 12197 | + } = componentProps; | |
| 12198 | + const store = useComboboxRootContext(); | |
| 12199 | + const floatingRootContext = useComboboxFloatingContext(); | |
| 12200 | + const hasPositionerContext = Boolean(useComboboxPositionerContext(true)); | |
| 12201 | + const { | |
| 12202 | + filteredItems, | |
| 12203 | + hasItems | |
| 12204 | + } = useComboboxDerivedItemsContext(); | |
| 12205 | + const selectionMode = store.useState("selectionMode"); | |
| 12206 | + const grid = store.useState("grid"); | |
| 12207 | + const readOnly = store.useState("readOnly"); | |
| 12208 | + const listProps = store.useState("listProps"); | |
| 12209 | + const virtualized = store.useState("virtualized"); | |
| 12210 | + const forceMounted = store.useState("forceMounted"); | |
| 12211 | + const multiple = selectionMode === "multiple"; | |
| 12212 | + const empty = filteredItems.length === 0; | |
| 12213 | + const setPositionerElement = useStableCallback((element2) => { | |
| 12214 | + store.set("positionerElement", element2); | |
| 12215 | + }); | |
| 12216 | + const setListElement = useStableCallback((element2) => { | |
| 12217 | + store.set("listElement", element2); | |
| 12218 | + }); | |
| 12219 | + const resolvedChildren = React65.useMemo(() => { | |
| 12220 | + if (typeof children === "function") { | |
| 12221 | + return _ComboboxCollection || (_ComboboxCollection = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ComboboxCollection, { | |
| 12222 | + children | |
| 12223 | + })); | |
| 12224 | + } | |
| 12225 | + return children; | |
| 12226 | + }, [children]); | |
| 12227 | + const state = { | |
| 12228 | + empty | |
| 1406 | 12229 | }; |
| 12230 | + const floatingId = floatingRootContext.useState("floatingId"); | |
| 12231 | + const element = useRenderElement("div", componentProps, { | |
| 12232 | + state, | |
| 12233 | + ref: [forwardedRef, setListElement, hasPositionerContext ? null : setPositionerElement], | |
| 12234 | + props: [listProps, { | |
| 12235 | + children: resolvedChildren, | |
| 12236 | + tabIndex: -1, | |
| 12237 | + id: floatingId, | |
| 12238 | + role: grid ? "grid" : "listbox", | |
| 12239 | + "aria-multiselectable": multiple ? "true" : void 0, | |
| 12240 | + // On a grid the attribute describes cell editability, not selection, so it's left to the | |
| 12241 | + // combobox element in that mode. | |
| 12242 | + "aria-readonly": !grid && readOnly ? true : void 0, | |
| 12243 | + onKeyDown(event) { | |
| 12244 | + if (store.state.disabled || store.state.readOnly) { | |
| 12245 | + return; | |
| 12246 | + } | |
| 12247 | + if (event.key === "Enter") { | |
| 12248 | + const activeIndex = store.state.activeIndex; | |
| 12249 | + if (activeIndex == null) { | |
| 12250 | + return; | |
| 12251 | + } | |
| 12252 | + stopEvent(event); | |
| 12253 | + clickHighlightedItem(store, activeIndex, event.nativeEvent); | |
| 12254 | + } | |
| 12255 | + }, | |
| 12256 | + onKeyDownCapture() { | |
| 12257 | + store.context.keyboardActiveRef.current = true; | |
| 12258 | + }, | |
| 12259 | + onPointerMoveCapture() { | |
| 12260 | + store.context.keyboardActiveRef.current = false; | |
| 12261 | + } | |
| 12262 | + }, elementProps] | |
| 12263 | + }); | |
| 12264 | + if (virtualized) { | |
| 12265 | + return element; | |
| 12266 | + } | |
| 12267 | + const labelsRef = hasItems && !forceMounted ? void 0 : store.context.labelsRef; | |
| 12268 | + return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CompositeList, { | |
| 12269 | + elementsRef: store.context.listRef, | |
| 12270 | + labelsRef, | |
| 12271 | + children: element | |
| 12272 | + }); | |
| 12273 | +}); | |
| 12274 | +if (true) ComboboxList.displayName = "ComboboxList"; | |
| 12275 | + | |
| 12276 | +// node_modules/@base-ui/react/combobox/status/ComboboxStatus.mjs | |
| 12277 | +var React67 = __toESM(require_react(), 1); | |
| 12278 | + | |
| 12279 | +// node_modules/@base-ui/react/combobox/utils/useInitialLiveRegionTextMutation.mjs | |
| 12280 | +var React66 = __toESM(require_react(), 1); | |
| 12281 | +var LIVE_REGION_MARKER = ""; | |
| 12282 | +var INITIAL_LIVE_REGION_TEXT_MUTATION_RESET_DELAY = 200; | |
| 12283 | +function findLastTextNode(root2) { | |
| 12284 | + const walker = root2.ownerDocument.createTreeWalker(root2, NodeFilter.SHOW_TEXT); | |
| 12285 | + let lastTextNode = null; | |
| 12286 | + while (walker.nextNode()) { | |
| 12287 | + const textNode = walker.currentNode; | |
| 12288 | + if (textNode.nodeValue !== "") { | |
| 12289 | + lastTextNode = textNode; | |
| 12290 | + } | |
| 12291 | + } | |
| 12292 | + return lastTextNode; | |
| 12293 | +} | |
| 12294 | +function useInitialLiveRegionTextMutation() { | |
| 12295 | + const timeout = useTimeout(); | |
| 12296 | + const rootRef = React66.useRef(null); | |
| 12297 | + React66.useEffect(() => { | |
| 12298 | + if (parts_exports.os.ios) { | |
| 12299 | + return void 0; | |
| 12300 | + } | |
| 12301 | + const root2 = rootRef.current; | |
| 12302 | + if (root2 == null) { | |
| 12303 | + return void 0; | |
| 12304 | + } | |
| 12305 | + const textNode = findLastTextNode(root2); | |
| 12306 | + if (textNode == null) { | |
| 12307 | + return void 0; | |
| 12308 | + } | |
| 12309 | + const originalValue = textNode.data; | |
| 12310 | + const markedValue = `${originalValue}${LIVE_REGION_MARKER}`; | |
| 12311 | + textNode.nodeValue = markedValue; | |
| 12312 | + timeout.start(INITIAL_LIVE_REGION_TEXT_MUTATION_RESET_DELAY, () => { | |
| 12313 | + if (textNode.nodeValue === markedValue) { | |
| 12314 | + textNode.nodeValue = originalValue; | |
| 12315 | + } | |
| 12316 | + }); | |
| 12317 | + return () => { | |
| 12318 | + timeout.clear(); | |
| 12319 | + if (textNode.nodeValue === markedValue) { | |
| 12320 | + textNode.nodeValue = originalValue; | |
| 12321 | + } | |
| 12322 | + }; | |
| 12323 | + }, [rootRef, timeout]); | |
| 12324 | + return rootRef; | |
| 12325 | +} | |
| 12326 | + | |
| 12327 | +// node_modules/@base-ui/react/combobox/status/ComboboxStatus.mjs | |
| 12328 | +var ComboboxStatus = /* @__PURE__ */ React67.forwardRef(function ComboboxStatus2(componentProps, forwardedRef) { | |
| 12329 | + const { | |
| 12330 | + render, | |
| 12331 | + className, | |
| 12332 | + style, | |
| 12333 | + children: childrenProp, | |
| 12334 | + ...elementProps | |
| 12335 | + } = componentProps; | |
| 12336 | + const statusRef = useInitialLiveRegionTextMutation(); | |
| 12337 | + return useRenderElement("div", componentProps, { | |
| 12338 | + ref: [forwardedRef, statusRef], | |
| 12339 | + props: [{ | |
| 12340 | + children: childrenProp, | |
| 12341 | + role: "status", | |
| 12342 | + "aria-live": "polite", | |
| 12343 | + "aria-atomic": true | |
| 12344 | + }, elementProps] | |
| 12345 | + }); | |
| 12346 | +}); | |
| 12347 | +if (true) ComboboxStatus.displayName = "ComboboxStatus"; | |
| 12348 | + | |
| 12349 | +// node_modules/@base-ui/react/combobox/portal/ComboboxPortal.mjs | |
| 12350 | +var React69 = __toESM(require_react(), 1); | |
| 12351 | + | |
| 12352 | +// node_modules/@base-ui/react/combobox/portal/ComboboxPortalContext.mjs | |
| 12353 | +var React68 = __toESM(require_react(), 1); | |
| 12354 | +var ComboboxPortalContext = /* @__PURE__ */ React68.createContext(void 0); | |
| 12355 | +if (true) ComboboxPortalContext.displayName = "ComboboxPortalContext"; | |
| 12356 | +function useComboboxPortalContext() { | |
| 12357 | + const context = React68.useContext(ComboboxPortalContext); | |
| 12358 | + if (context === void 0) { | |
| 12359 | + throw new Error(true ? "Base UI: <Combobox.Portal> is missing." : formatErrorMessage_default(20)); | |
| 12360 | + } | |
| 12361 | + return context; | |
| 12362 | +} | |
| 12363 | + | |
| 12364 | +// node_modules/@base-ui/react/combobox/portal/ComboboxPortal.mjs | |
| 12365 | +var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); | |
| 12366 | +var ComboboxPortal = /* @__PURE__ */ React69.forwardRef(function ComboboxPortal2(props, forwardedRef) { | |
| 12367 | + const { | |
| 12368 | + keepMounted = false, | |
| 12369 | + ...portalProps | |
| 12370 | + } = props; | |
| 12371 | + const store = useComboboxRootContext(); | |
| 12372 | + const mounted = store.useState("mounted"); | |
| 12373 | + const forceMounted = store.useState("forceMounted"); | |
| 12374 | + const shouldRender = mounted || keepMounted || forceMounted; | |
| 12375 | + if (!shouldRender) { | |
| 12376 | + return null; | |
| 12377 | + } | |
| 12378 | + return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ComboboxPortalContext.Provider, { | |
| 12379 | + value: keepMounted, | |
| 12380 | + children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FloatingPortal, { | |
| 12381 | + ref: forwardedRef, | |
| 12382 | + ...portalProps | |
| 12383 | + }) | |
| 12384 | + }); | |
| 12385 | +}); | |
| 12386 | +if (true) ComboboxPortal.displayName = "ComboboxPortal"; | |
| 12387 | + | |
| 12388 | +// node_modules/@base-ui/react/combobox/backdrop/ComboboxBackdrop.mjs | |
| 12389 | +var React70 = __toESM(require_react(), 1); | |
| 12390 | +var stateAttributesMapping2 = { | |
| 12391 | + ...popupStateMapping, | |
| 12392 | + ...transitionStatusMapping | |
| 1407 | 12393 | }; |
| 12394 | +var ComboboxBackdrop = /* @__PURE__ */ React70.forwardRef(function ComboboxBackdrop2(componentProps, forwardedRef) { | |
| 12395 | + const { | |
| 12396 | + render, | |
| 12397 | + className, | |
| 12398 | + style, | |
| 12399 | + ...elementProps | |
| 12400 | + } = componentProps; | |
| 12401 | + const store = useComboboxRootContext(); | |
| 12402 | + const open2 = store.useState("open"); | |
| 12403 | + const mounted = store.useState("mounted"); | |
| 12404 | + const transitionStatus = store.useState("transitionStatus"); | |
| 12405 | + const state = { | |
| 12406 | + open: open2, | |
| 12407 | + transitionStatus | |
| 12408 | + }; | |
| 12409 | + return useRenderElement("div", componentProps, { | |
| 12410 | + state, | |
| 12411 | + ref: forwardedRef, | |
| 12412 | + stateAttributesMapping: stateAttributesMapping2, | |
| 12413 | + props: [{ | |
| 12414 | + role: "presentation", | |
| 12415 | + hidden: !mounted, | |
| 12416 | + style: { | |
| 12417 | + userSelect: "none", | |
| 12418 | + WebkitUserSelect: "none" | |
| 12419 | + } | |
| 12420 | + }, elementProps] | |
| 12421 | + }); | |
| 12422 | +}); | |
| 12423 | +if (true) ComboboxBackdrop.displayName = "ComboboxBackdrop"; | |
| 1408 | 12424 | |
| 1409 | -// node_modules/react-style-singleton/dist/es2015/component.js | |
| 1410 | -var styleSingleton = function() { | |
| 1411 | - var useStyle = styleHookSingleton(); | |
| 1412 | - var Sheet = function(_a) { | |
| 1413 | - var styles = _a.styles, dynamic = _a.dynamic; | |
| 1414 | - useStyle(styles, dynamic); | |
| 1415 | - return null; | |
| 12425 | +// node_modules/@base-ui/react/combobox/positioner/ComboboxPositioner.mjs | |
| 12426 | +var React73 = __toESM(require_react(), 1); | |
| 12427 | + | |
| 12428 | +// node_modules/@base-ui/react/internals/useAnchorPositioning.mjs | |
| 12429 | +var React71 = __toESM(require_react(), 1); | |
| 12430 | + | |
| 12431 | +// node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs | |
| 12432 | +var baseArrow = (options) => ({ | |
| 12433 | + name: "arrow", | |
| 12434 | + options, | |
| 12435 | + async fn(state) { | |
| 12436 | + const { | |
| 12437 | + x, | |
| 12438 | + y, | |
| 12439 | + placement, | |
| 12440 | + rects, | |
| 12441 | + platform: platform3, | |
| 12442 | + elements, | |
| 12443 | + middlewareData | |
| 12444 | + } = state; | |
| 12445 | + const { | |
| 12446 | + element, | |
| 12447 | + padding = 0, | |
| 12448 | + offsetParent = "real" | |
| 12449 | + } = evaluate(options, state) || {}; | |
| 12450 | + if (element == null) { | |
| 12451 | + return {}; | |
| 12452 | + } | |
| 12453 | + const paddingObject = getPaddingObject(padding); | |
| 12454 | + const coords = { | |
| 12455 | + x, | |
| 12456 | + y | |
| 12457 | + }; | |
| 12458 | + const axis = getAlignmentAxis(placement); | |
| 12459 | + const length = getAxisLength(axis); | |
| 12460 | + const arrowDimensions = await platform3.getDimensions(element); | |
| 12461 | + const isYAxis = axis === "y"; | |
| 12462 | + const minProp = isYAxis ? "top" : "left"; | |
| 12463 | + const maxProp = isYAxis ? "bottom" : "right"; | |
| 12464 | + const clientProp = isYAxis ? "clientHeight" : "clientWidth"; | |
| 12465 | + const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; | |
| 12466 | + const startDiff = coords[axis] - rects.reference[axis]; | |
| 12467 | + const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating; | |
| 12468 | + let clientSize = elements.floating[clientProp] || rects.floating[length]; | |
| 12469 | + if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) { | |
| 12470 | + clientSize = elements.floating[clientProp] || rects.floating[length]; | |
| 12471 | + } | |
| 12472 | + const centerToReference = endDiff / 2 - startDiff / 2; | |
| 12473 | + const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; | |
| 12474 | + const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding); | |
| 12475 | + const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding); | |
| 12476 | + const min2 = minPadding; | |
| 12477 | + const max2 = clientSize - arrowDimensions[length] - maxPadding; | |
| 12478 | + const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; | |
| 12479 | + const offset4 = clamp(min2, center, max2); | |
| 12480 | + const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; | |
| 12481 | + const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0; | |
| 12482 | + return { | |
| 12483 | + [axis]: coords[axis] + alignmentOffset, | |
| 12484 | + data: { | |
| 12485 | + [axis]: offset4, | |
| 12486 | + centerOffset: center - offset4 - alignmentOffset, | |
| 12487 | + ...shouldAddOffset && { | |
| 12488 | + alignmentOffset | |
| 12489 | + } | |
| 12490 | + }, | |
| 12491 | + reset: shouldAddOffset | |
| 12492 | + }; | |
| 12493 | + } | |
| 12494 | +}); | |
| 12495 | +var arrow4 = (options, deps) => { | |
| 12496 | + const { | |
| 12497 | + name, | |
| 12498 | + fn | |
| 12499 | + } = baseArrow(options); | |
| 12500 | + return { | |
| 12501 | + name, | |
| 12502 | + fn, | |
| 12503 | + options: [options, deps] | |
| 1416 | 12504 | }; |
| 1417 | - return Sheet; | |
| 1418 | 12505 | }; |
| 1419 | 12506 | |
| 1420 | -// node_modules/react-remove-scroll-bar/dist/es2015/utils.js | |
| 1421 | -var zeroGap = { | |
| 1422 | - left: 0, | |
| 1423 | - top: 0, | |
| 1424 | - right: 0, | |
| 1425 | - gap: 0 | |
| 12507 | +// node_modules/@base-ui/react/utils/hideMiddleware.mjs | |
| 12508 | +var hide4 = { | |
| 12509 | + name: "hide", | |
| 12510 | + async fn(state) { | |
| 12511 | + const { | |
| 12512 | + width, | |
| 12513 | + height, | |
| 12514 | + x, | |
| 12515 | + y | |
| 12516 | + } = state.rects.reference; | |
| 12517 | + const anchorHidden2 = width === 0 && height === 0 && x === 0 && y === 0; | |
| 12518 | + const overflow = await state.platform.detectOverflow(state, { | |
| 12519 | + elementContext: "reference" | |
| 12520 | + }); | |
| 12521 | + const referenceHidden = overflow.top - height >= 0 || overflow.right - width >= 0 || overflow.bottom - height >= 0 || overflow.left - width >= 0; | |
| 12522 | + return { | |
| 12523 | + data: { | |
| 12524 | + referenceHidden: referenceHidden || anchorHidden2 | |
| 12525 | + } | |
| 12526 | + }; | |
| 12527 | + } | |
| 1426 | 12528 | }; |
| 1427 | -var parse = function(x) { | |
| 1428 | - return parseInt(x || "", 10) || 0; | |
| 12529 | + | |
| 12530 | +// node_modules/@base-ui/react/utils/adaptiveOriginConstants.mjs | |
| 12531 | +var DEFAULT_SIDES = { | |
| 12532 | + sideX: "left", | |
| 12533 | + sideY: "top" | |
| 1429 | 12534 | }; |
| 1430 | -var getOffset = function(gapMode) { | |
| 1431 | - var cs = window.getComputedStyle(document.body); | |
| 1432 | - var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"]; | |
| 1433 | - var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"]; | |
| 1434 | - var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"]; | |
| 1435 | - return [parse(left), parse(top), parse(right)]; | |
| 1436 | -}; | |
| 1437 | -var getGapWidth = function(gapMode) { | |
| 1438 | - if (gapMode === void 0) { | |
| 1439 | - gapMode = "margin"; | |
| 12535 | + | |
| 12536 | +// node_modules/@base-ui/react/utils/CommonPositionerCssVars.mjs | |
| 12537 | +var availableWidth = "--available-width"; | |
| 12538 | +var availableHeight = "--available-height"; | |
| 12539 | +var anchorWidth = "--anchor-width"; | |
| 12540 | +var anchorHeight = "--anchor-height"; | |
| 12541 | +var transformOrigin = "--transform-origin"; | |
| 12542 | +var positionerWidth = "--positioner-width"; | |
| 12543 | +var positionerHeight = "--positioner-height"; | |
| 12544 | + | |
| 12545 | +// node_modules/@base-ui/react/internals/useAnchorPositioning.mjs | |
| 12546 | +var AVAILABLE_WIDTH_VAR = availableWidth; | |
| 12547 | +var AVAILABLE_HEIGHT_VAR = availableHeight; | |
| 12548 | +function getLogicalSide(sideParam, renderedSide, isRtl) { | |
| 12549 | + const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end"; | |
| 12550 | + const logicalRight = isRtl ? "inline-start" : "inline-end"; | |
| 12551 | + const logicalLeft = isRtl ? "inline-end" : "inline-start"; | |
| 12552 | + return { | |
| 12553 | + top: "top", | |
| 12554 | + right: isLogicalSideParam ? logicalRight : "right", | |
| 12555 | + bottom: "bottom", | |
| 12556 | + left: isLogicalSideParam ? logicalLeft : "left" | |
| 12557 | + }[renderedSide]; | |
| 12558 | +} | |
| 12559 | +function getOffsetData(state, sideParam, isRtl) { | |
| 12560 | + const { | |
| 12561 | + rects, | |
| 12562 | + placement | |
| 12563 | + } = state; | |
| 12564 | + const data = { | |
| 12565 | + side: getLogicalSide(sideParam, getSide(placement), isRtl), | |
| 12566 | + align: getAlignment(placement) || "center", | |
| 12567 | + anchor: { | |
| 12568 | + width: rects.reference.width, | |
| 12569 | + height: rects.reference.height | |
| 12570 | + }, | |
| 12571 | + positioner: { | |
| 12572 | + width: rects.floating.width, | |
| 12573 | + height: rects.floating.height | |
| 12574 | + } | |
| 12575 | + }; | |
| 12576 | + return data; | |
| 12577 | +} | |
| 12578 | +function useAnchorPositioning(params) { | |
| 12579 | + return useAnchorPositioningWithHook(params, useBaseUIFloating); | |
| 12580 | +} | |
| 12581 | +function useAnchorPositioningWithHook(params, useFloatingHook) { | |
| 12582 | + const { | |
| 12583 | + // Public parameters | |
| 12584 | + anchor, | |
| 12585 | + positionMethod = "absolute", | |
| 12586 | + side: sideParam = "bottom", | |
| 12587 | + sideOffset = 0, | |
| 12588 | + align = "center", | |
| 12589 | + alignOffset = 0, | |
| 12590 | + collisionBoundary, | |
| 12591 | + collisionPadding: collisionPaddingParam = 5, | |
| 12592 | + sticky = false, | |
| 12593 | + arrowPadding = 5, | |
| 12594 | + disableAnchorTracking = false, | |
| 12595 | + inline: inlineMiddleware, | |
| 12596 | + // Private parameters | |
| 12597 | + keepMounted = false, | |
| 12598 | + floatingRootContext, | |
| 12599 | + mounted, | |
| 12600 | + collisionAvoidance, | |
| 12601 | + shift: shift4, | |
| 12602 | + nodeId, | |
| 12603 | + adaptiveOrigin: adaptiveOrigin2, | |
| 12604 | + lazyFlip = false, | |
| 12605 | + externalTree | |
| 12606 | + } = params; | |
| 12607 | + const [mountSide, setMountSide] = React71.useState(null); | |
| 12608 | + if (!mounted && mountSide !== null) { | |
| 12609 | + setMountSide(null); | |
| 1440 | 12610 | } |
| 1441 | - if (typeof window === "undefined") { | |
| 1442 | - return zeroGap; | |
| 12611 | + const collisionAvoidanceSide = collisionAvoidance.side || "flip"; | |
| 12612 | + const collisionAvoidanceAlign = collisionAvoidance.align || "flip"; | |
| 12613 | + const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end"; | |
| 12614 | + const shiftCrossAxis = shift4?.crossAxis ?? false; | |
| 12615 | + const shiftRootBoundary = shift4?.rootBoundary; | |
| 12616 | + const anchorFn = typeof anchor === "function" ? anchor : void 0; | |
| 12617 | + const anchorFnCallback = useStableCallback(anchorFn); | |
| 12618 | + const anchorDep = anchorFn ? anchorFnCallback : anchor; | |
| 12619 | + const anchorValueRef = useValueAsRef(anchor); | |
| 12620 | + const mountedRef = useValueAsRef(mounted); | |
| 12621 | + const direction = useDirection(); | |
| 12622 | + const isRtl = direction === "rtl"; | |
| 12623 | + const side = mountSide || { | |
| 12624 | + top: "top", | |
| 12625 | + right: "right", | |
| 12626 | + bottom: "bottom", | |
| 12627 | + left: "left", | |
| 12628 | + "inline-end": isRtl ? "left" : "right", | |
| 12629 | + "inline-start": isRtl ? "right" : "left" | |
| 12630 | + }[sideParam]; | |
| 12631 | + const placement = align === "center" ? side : `${side}-${align}`; | |
| 12632 | + let collisionPadding = collisionPaddingParam; | |
| 12633 | + if (typeof collisionPadding === "number") { | |
| 12634 | + collisionPadding = { | |
| 12635 | + top: collisionPadding, | |
| 12636 | + right: collisionPadding, | |
| 12637 | + bottom: collisionPadding, | |
| 12638 | + left: collisionPadding | |
| 12639 | + }; | |
| 12640 | + } else if (collisionPadding) { | |
| 12641 | + collisionPadding = { | |
| 12642 | + top: collisionPadding.top || 0, | |
| 12643 | + right: collisionPadding.right || 0, | |
| 12644 | + bottom: collisionPadding.bottom || 0, | |
| 12645 | + left: collisionPadding.left || 0 | |
| 12646 | + }; | |
| 1443 | 12647 | } |
| 1444 | - var offsets = getOffset(gapMode); | |
| 1445 | - var documentWidth = document.documentElement.clientWidth; | |
| 1446 | - var windowWidth = window.innerWidth; | |
| 1447 | - return { | |
| 1448 | - left: offsets[0], | |
| 1449 | - top: offsets[1], | |
| 1450 | - right: offsets[2], | |
| 1451 | - gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0]) | |
| 12648 | + const bias = 1; | |
| 12649 | + const biasTop = sideParam === "bottom" ? bias : 0; | |
| 12650 | + const biasBottom = sideParam === "top" ? bias : 0; | |
| 12651 | + const biasLeft = sideParam === "right" ? bias : 0; | |
| 12652 | + const biasRight = sideParam === "left" ? bias : 0; | |
| 12653 | + const commonCollisionProps = { | |
| 12654 | + boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary, | |
| 12655 | + padding: collisionPadding | |
| 1452 | 12656 | }; |
| 1453 | -}; | |
| 12657 | + const arrowRef = React71.useRef(null); | |
| 12658 | + const sideOffsetRef = useValueAsRef(sideOffset); | |
| 12659 | + const alignOffsetRef = useValueAsRef(alignOffset); | |
| 12660 | + const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0; | |
| 12661 | + const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0; | |
| 12662 | + const middleware = []; | |
| 12663 | + if (inlineMiddleware) { | |
| 12664 | + middleware.push(inlineMiddleware); | |
| 12665 | + } | |
| 12666 | + middleware.push(offset3((state) => { | |
| 12667 | + const data = getOffsetData(state, sideParam, isRtl); | |
| 12668 | + const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current; | |
| 12669 | + const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current; | |
| 12670 | + return { | |
| 12671 | + mainAxis: sideAxis, | |
| 12672 | + crossAxis: alignAxis, | |
| 12673 | + alignmentAxis: alignAxis | |
| 12674 | + }; | |
| 12675 | + }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam])); | |
| 12676 | + const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift"; | |
| 12677 | + const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift"); | |
| 12678 | + const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({ | |
| 12679 | + ...commonCollisionProps, | |
| 12680 | + // Ensure the popup flips if it's been limited by its --available-height and it resizes. | |
| 12681 | + // Since the size() padding is smaller than the flip() padding, flip() will take precedence. | |
| 12682 | + padding: { | |
| 12683 | + top: collisionPadding.top + bias + biasTop, | |
| 12684 | + right: collisionPadding.right + bias + biasRight, | |
| 12685 | + bottom: collisionPadding.bottom + bias + biasBottom, | |
| 12686 | + left: collisionPadding.left + bias + biasLeft | |
| 12687 | + }, | |
| 12688 | + mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip", | |
| 12689 | + crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false, | |
| 12690 | + fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide | |
| 12691 | + }); | |
| 12692 | + const shiftMiddleware = shiftDisabled ? null : shift3({ | |
| 12693 | + ...commonCollisionProps, | |
| 12694 | + // Use the Layout Viewport to avoid shifting around when pinch-zooming. | |
| 12695 | + rootBoundary: shiftRootBoundary, | |
| 12696 | + mainAxis: collisionAvoidanceAlign !== "none", | |
| 12697 | + crossAxis: crossAxisShiftEnabled, | |
| 12698 | + limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => { | |
| 12699 | + if (!arrowRef.current) { | |
| 12700 | + return {}; | |
| 12701 | + } | |
| 12702 | + const { | |
| 12703 | + width, | |
| 12704 | + height | |
| 12705 | + } = arrowRef.current.getBoundingClientRect(); | |
| 12706 | + const sideAxis = getSideAxis(getSide(limitData.placement)); | |
| 12707 | + const arrowSize = sideAxis === "y" ? width : height; | |
| 12708 | + const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom; | |
| 12709 | + return { | |
| 12710 | + offset: arrowSize / 2 + offsetAmount / 2 | |
| 12711 | + }; | |
| 12712 | + }) | |
| 12713 | + }, [commonCollisionProps, sticky, shiftCrossAxis, shiftRootBoundary, collisionPadding, collisionAvoidanceAlign]); | |
| 12714 | + if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") { | |
| 12715 | + middleware.push(shiftMiddleware, flipMiddleware); | |
| 12716 | + } else { | |
| 12717 | + middleware.push(flipMiddleware, shiftMiddleware); | |
| 12718 | + } | |
| 12719 | + middleware.push(size3({ | |
| 12720 | + ...commonCollisionProps, | |
| 12721 | + apply({ | |
| 12722 | + elements: { | |
| 12723 | + floating | |
| 12724 | + }, | |
| 12725 | + availableWidth: availableWidth2, | |
| 12726 | + availableHeight: availableHeight2, | |
| 12727 | + rects | |
| 12728 | + }) { | |
| 12729 | + if (!mountedRef.current) { | |
| 12730 | + return; | |
| 12731 | + } | |
| 12732 | + const floatingStyle = floating.style; | |
| 12733 | + floatingStyle.setProperty(AVAILABLE_WIDTH_VAR, `${availableWidth2}px`); | |
| 12734 | + floatingStyle.setProperty(AVAILABLE_HEIGHT_VAR, `${availableHeight2}px`); | |
| 12735 | + const dpr = getWindow(floating).devicePixelRatio || 1; | |
| 12736 | + const { | |
| 12737 | + x: x2, | |
| 12738 | + y: y2, | |
| 12739 | + width, | |
| 12740 | + height | |
| 12741 | + } = rects.reference; | |
| 12742 | + const anchorWidth2 = (Math.round((x2 + width) * dpr) - Math.round(x2 * dpr)) / dpr; | |
| 12743 | + const anchorHeight2 = (Math.round((y2 + height) * dpr) - Math.round(y2 * dpr)) / dpr; | |
| 12744 | + floatingStyle.setProperty(anchorWidth, `${anchorWidth2}px`); | |
| 12745 | + floatingStyle.setProperty(anchorHeight, `${anchorHeight2}px`); | |
| 12746 | + } | |
| 12747 | + }), arrow4((state) => ({ | |
| 12748 | + // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set, | |
| 12749 | + // we'll create a fake element. | |
| 12750 | + element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"), | |
| 12751 | + // No padding for the fake arrow: it would displace aligned popups on narrow anchors. | |
| 12752 | + padding: arrowRef.current ? arrowPadding : 0, | |
| 12753 | + offsetParent: "floating" | |
| 12754 | + }), [arrowPadding]), { | |
| 12755 | + name: "transformOrigin", | |
| 12756 | + fn(state) { | |
| 12757 | + const { | |
| 12758 | + elements: { | |
| 12759 | + floating | |
| 12760 | + }, | |
| 12761 | + middlewareData: middlewareData2, | |
| 12762 | + placement: renderedPlacement2, | |
| 12763 | + platform: platform3, | |
| 12764 | + rects, | |
| 12765 | + y: y2 | |
| 12766 | + } = state; | |
| 12767 | + const renderedSide2 = getSide(renderedPlacement2); | |
| 12768 | + const renderedAlign2 = getAlignment(renderedPlacement2); | |
| 12769 | + const isVertical = getSideAxis(renderedSide2) === "y"; | |
| 12770 | + const arrowEl = arrowRef.current; | |
| 12771 | + const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset; | |
| 12772 | + let crossOrigin; | |
| 12773 | + if (!arrowEl && renderedAlign2 && Math.abs(isVertical ? middlewareData2.shift?.x || 0 : middlewareData2.shift?.y || 0) <= 1) { | |
| 12774 | + crossOrigin = renderedAlign2 === "start" === (isVertical && platform3.isRTL?.(floating) === true) ? "100%" : "0%"; | |
| 12775 | + } else { | |
| 12776 | + const arrowOffset = isVertical ? middlewareData2.arrow?.x || 0 : middlewareData2.arrow?.y || 0; | |
| 12777 | + const arrowSize = isVertical ? arrowEl?.clientWidth || 0 : arrowEl?.clientHeight || 0; | |
| 12778 | + crossOrigin = `${arrowOffset + arrowSize / 2}px`; | |
| 12779 | + } | |
| 12780 | + let sideOrigin = renderedSide2 === "top" || renderedSide2 === "left" ? `calc(100% + ${sideOffsetValue}px)` : `${-sideOffsetValue}px`; | |
| 12781 | + if (crossAxisShiftEnabled && isVertical && Math.abs(middlewareData2.shift?.y || 0) > sideOffsetValue) { | |
| 12782 | + sideOrigin = `${rects.reference.y + rects.reference.height / 2 - y2}px`; | |
| 12783 | + } | |
| 12784 | + floating.style.setProperty(transformOrigin, isVertical ? `${crossOrigin} ${sideOrigin}` : `${sideOrigin} ${crossOrigin}`); | |
| 12785 | + return {}; | |
| 12786 | + } | |
| 12787 | + }, hide4, adaptiveOrigin2); | |
| 12788 | + useIsoLayoutEffect(() => { | |
| 12789 | + if (!mounted && floatingRootContext) { | |
| 12790 | + floatingRootContext.update({ | |
| 12791 | + referenceElement: null, | |
| 12792 | + floatingElement: null, | |
| 12793 | + domReferenceElement: null, | |
| 12794 | + positionReference: null | |
| 12795 | + }); | |
| 12796 | + } | |
| 12797 | + }, [mounted, floatingRootContext]); | |
| 12798 | + const autoUpdateOptions = React71.useMemo(() => ({ | |
| 12799 | + ancestorScroll: !disableAnchorTracking, | |
| 12800 | + elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined", | |
| 12801 | + layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined" | |
| 12802 | + }), [disableAnchorTracking]); | |
| 12803 | + const { | |
| 12804 | + refs, | |
| 12805 | + elements, | |
| 12806 | + x, | |
| 12807 | + y, | |
| 12808 | + middlewareData, | |
| 12809 | + update: update2, | |
| 12810 | + placement: renderedPlacement, | |
| 12811 | + context, | |
| 12812 | + isPositioned, | |
| 12813 | + floatingStyles: originalFloatingStyles | |
| 12814 | + } = useFloatingHook({ | |
| 12815 | + rootContext: floatingRootContext, | |
| 12816 | + open: keepMounted ? mounted : void 0, | |
| 12817 | + placement, | |
| 12818 | + middleware, | |
| 12819 | + strategy: positionMethod, | |
| 12820 | + whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions), | |
| 12821 | + nodeId, | |
| 12822 | + externalTree | |
| 12823 | + }); | |
| 12824 | + const { | |
| 12825 | + sideX, | |
| 12826 | + sideY | |
| 12827 | + } = middlewareData.adaptiveOrigin || DEFAULT_SIDES; | |
| 12828 | + const resolvedPosition = isPositioned ? positionMethod : "fixed"; | |
| 12829 | + const floatingStyles = React71.useMemo(() => { | |
| 12830 | + let base; | |
| 12831 | + if (!isPositioned) { | |
| 12832 | + base = { | |
| 12833 | + position: resolvedPosition, | |
| 12834 | + top: 0, | |
| 12835 | + left: 0 | |
| 12836 | + }; | |
| 12837 | + } else if (adaptiveOrigin2) { | |
| 12838 | + base = { | |
| 12839 | + position: resolvedPosition, | |
| 12840 | + [sideX]: x, | |
| 12841 | + [sideY]: y | |
| 12842 | + }; | |
| 12843 | + } else { | |
| 12844 | + base = { | |
| 12845 | + ...originalFloatingStyles, | |
| 12846 | + position: resolvedPosition | |
| 12847 | + }; | |
| 12848 | + } | |
| 12849 | + base[AVAILABLE_WIDTH_VAR] = "100vw"; | |
| 12850 | + base[AVAILABLE_HEIGHT_VAR] = "100vh"; | |
| 12851 | + if (!isPositioned) { | |
| 12852 | + base.opacity = 0; | |
| 12853 | + } | |
| 12854 | + return base; | |
| 12855 | + }, [adaptiveOrigin2, resolvedPosition, sideX, x, sideY, y, originalFloatingStyles, isPositioned]); | |
| 12856 | + const registeredPositionReferenceRef = React71.useRef(null); | |
| 12857 | + useIsoLayoutEffect(() => { | |
| 12858 | + if (!mounted) { | |
| 12859 | + return; | |
| 12860 | + } | |
| 12861 | + const anchorValue = anchorValueRef.current; | |
| 12862 | + const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue; | |
| 12863 | + const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null; | |
| 12864 | + const finalAnchor = unwrappedElement || null; | |
| 12865 | + if (finalAnchor !== registeredPositionReferenceRef.current) { | |
| 12866 | + refs.setPositionReference(finalAnchor); | |
| 12867 | + registeredPositionReferenceRef.current = finalAnchor; | |
| 12868 | + } | |
| 12869 | + }, [mounted, refs, anchorDep, anchorValueRef]); | |
| 12870 | + React71.useEffect(() => { | |
| 12871 | + if (!mounted) { | |
| 12872 | + return; | |
| 12873 | + } | |
| 12874 | + const anchorValue = anchorValueRef.current; | |
| 12875 | + if (typeof anchorValue === "function") { | |
| 12876 | + return; | |
| 12877 | + } | |
| 12878 | + if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) { | |
| 12879 | + refs.setPositionReference(anchorValue.current); | |
| 12880 | + registeredPositionReferenceRef.current = anchorValue.current; | |
| 12881 | + } | |
| 12882 | + }, [mounted, refs, anchorDep, anchorValueRef]); | |
| 12883 | + React71.useEffect(() => { | |
| 12884 | + if (keepMounted && mounted && elements.reference && elements.floating) { | |
| 12885 | + return autoUpdate(elements.reference, elements.floating, update2, autoUpdateOptions); | |
| 12886 | + } | |
| 12887 | + return void 0; | |
| 12888 | + }, [keepMounted, mounted, elements, update2, autoUpdateOptions]); | |
| 12889 | + const renderedSide = getSide(renderedPlacement); | |
| 12890 | + const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl); | |
| 12891 | + const renderedAlign = getAlignment(renderedPlacement) || "center"; | |
| 12892 | + const anchorHidden2 = Boolean(middlewareData.hide?.referenceHidden); | |
| 12893 | + useIsoLayoutEffect(() => { | |
| 12894 | + if (lazyFlip && mounted && isPositioned && renderedSide !== side) { | |
| 12895 | + setMountSide(renderedSide); | |
| 12896 | + } | |
| 12897 | + }, [lazyFlip, mounted, isPositioned, renderedSide, side]); | |
| 12898 | + const arrowStyles = React71.useMemo(() => ({ | |
| 12899 | + position: "absolute", | |
| 12900 | + top: middlewareData.arrow?.y, | |
| 12901 | + left: middlewareData.arrow?.x | |
| 12902 | + }), [middlewareData.arrow]); | |
| 12903 | + const arrowUncentered = middlewareData.arrow?.centerOffset !== 0; | |
| 12904 | + return React71.useMemo(() => ({ | |
| 12905 | + positionerStyles: floatingStyles, | |
| 12906 | + arrowStyles, | |
| 12907 | + arrowRef, | |
| 12908 | + arrowUncentered, | |
| 12909 | + side: logicalRenderedSide, | |
| 12910 | + align: renderedAlign, | |
| 12911 | + physicalSide: renderedSide, | |
| 12912 | + anchorHidden: anchorHidden2, | |
| 12913 | + refs, | |
| 12914 | + context, | |
| 12915 | + isPositioned, | |
| 12916 | + update: update2 | |
| 12917 | + }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden2, refs, context, isPositioned, update2]); | |
| 12918 | +} | |
| 12919 | +function isRef(param) { | |
| 12920 | + return param != null && "current" in param; | |
| 12921 | +} | |
| 1454 | 12922 | |
| 1455 | -// node_modules/react-remove-scroll-bar/dist/es2015/component.js | |
| 1456 | -var Style = styleSingleton(); | |
| 1457 | -var lockAttribute = "data-scroll-locked"; | |
| 1458 | -var getStyles = function(_a, allowRelative, gapMode, important) { | |
| 1459 | - var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap; | |
| 1460 | - if (gapMode === void 0) { | |
| 1461 | - gapMode = "margin"; | |
| 12923 | +// node_modules/@base-ui/react/internals/getDisabledMountTransitionStyles.mjs | |
| 12924 | +function getDisabledMountTransitionStyles(transitionStatus) { | |
| 12925 | + return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT; | |
| 12926 | +} | |
| 12927 | + | |
| 12928 | +// node_modules/@base-ui/react/utils/usePositioner.mjs | |
| 12929 | +function usePositioner(componentProps, state, { | |
| 12930 | + styles, | |
| 12931 | + transitionStatus, | |
| 12932 | + props, | |
| 12933 | + refs, | |
| 12934 | + hidden, | |
| 12935 | + inert = false | |
| 12936 | +}) { | |
| 12937 | + const style = { | |
| 12938 | + ...styles | |
| 12939 | + }; | |
| 12940 | + if (inert) { | |
| 12941 | + style.pointerEvents = "none"; | |
| 1462 | 12942 | } |
| 1463 | - 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([ | |
| 1464 | - allowRelative && "position: relative ".concat(important, ";"), | |
| 1465 | - 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 "), | |
| 1466 | - gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";") | |
| 1467 | - ].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"); | |
| 12943 | + return useRenderElement("div", componentProps, { | |
| 12944 | + state, | |
| 12945 | + ref: refs, | |
| 12946 | + props: [{ | |
| 12947 | + role: "presentation", | |
| 12948 | + hidden, | |
| 12949 | + style | |
| 12950 | + }, getDisabledMountTransitionStyles(transitionStatus), props], | |
| 12951 | + stateAttributesMapping: popupStateMapping | |
| 12952 | + }); | |
| 12953 | +} | |
| 12954 | + | |
| 12955 | +// node_modules/@base-ui/react/utils/useAnchoredPopupScrollLock.mjs | |
| 12956 | +var React72 = __toESM(require_react(), 1); | |
| 12957 | +var VIEWPORT_WIDTH_TOLERANCE_PX = 20; | |
| 12958 | +function useAnchoredPopupScrollLock(enabled, touchOpen, positionerElement, referenceElement) { | |
| 12959 | + const [touchOpenShouldLockScroll, setTouchOpenShouldLockScroll] = React72.useState(false); | |
| 12960 | + useIsoLayoutEffect(() => { | |
| 12961 | + if (!enabled || !touchOpen || positionerElement == null) { | |
| 12962 | + setTouchOpenShouldLockScroll(false); | |
| 12963 | + return; | |
| 12964 | + } | |
| 12965 | + const viewportWidth = ownerDocument(positionerElement).documentElement.clientWidth; | |
| 12966 | + const popupWidth2 = positionerElement.offsetWidth; | |
| 12967 | + setTouchOpenShouldLockScroll(viewportWidth > 0 && popupWidth2 > 0 && popupWidth2 >= viewportWidth - VIEWPORT_WIDTH_TOLERANCE_PX); | |
| 12968 | + }, [enabled, touchOpen, positionerElement]); | |
| 12969 | + useScrollLock(enabled && (!touchOpen || touchOpenShouldLockScroll), referenceElement); | |
| 12970 | +} | |
| 12971 | + | |
| 12972 | +// node_modules/@base-ui/react/combobox/positioner/ComboboxPositioner.mjs | |
| 12973 | +var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); | |
| 12974 | +var ComboboxPositioner = /* @__PURE__ */ React73.forwardRef(function ComboboxPositioner2(componentProps, forwardedRef) { | |
| 12975 | + const { | |
| 12976 | + render, | |
| 12977 | + className, | |
| 12978 | + anchor, | |
| 12979 | + // `useAnchorPositioning` applies the same defaults to the undefined values; the names | |
| 12980 | + // remain destructured to exclude the props from `elementProps`. | |
| 12981 | + positionMethod, | |
| 12982 | + side, | |
| 12983 | + align, | |
| 12984 | + sideOffset, | |
| 12985 | + alignOffset, | |
| 12986 | + collisionBoundary = "clipping-ancestors", | |
| 12987 | + collisionPadding, | |
| 12988 | + arrowPadding, | |
| 12989 | + sticky, | |
| 12990 | + disableAnchorTracking = false, | |
| 12991 | + collisionAvoidance = DROPDOWN_COLLISION_AVOIDANCE, | |
| 12992 | + style: styleProp, | |
| 12993 | + ...elementProps | |
| 12994 | + } = componentProps; | |
| 12995 | + const store = useComboboxRootContext(); | |
| 12996 | + const floatingRootContext = useComboboxFloatingContext(); | |
| 12997 | + const keepMounted = useComboboxPortalContext(); | |
| 12998 | + const modal = store.useState("modal"); | |
| 12999 | + const open2 = store.useState("open"); | |
| 13000 | + const mounted = store.useState("mounted"); | |
| 13001 | + const openMethod = store.useState("openMethod"); | |
| 13002 | + const positionerElement = store.useState("positionerElement"); | |
| 13003 | + const triggerElement = store.useState("triggerElement"); | |
| 13004 | + const inputElement = store.useState("inputElement"); | |
| 13005 | + const inputGroupElement = store.useState("inputGroupElement"); | |
| 13006 | + const inputInsidePopup = store.useState("inputInsidePopup"); | |
| 13007 | + const transitionStatus = store.useState("transitionStatus"); | |
| 13008 | + const empty = useListEmpty(); | |
| 13009 | + const resolvedAnchor = anchor ?? (inputInsidePopup ? triggerElement : inputGroupElement ?? inputElement); | |
| 13010 | + const positioning = useAnchorPositioning({ | |
| 13011 | + anchor: resolvedAnchor, | |
| 13012 | + floatingRootContext, | |
| 13013 | + positionMethod, | |
| 13014 | + mounted, | |
| 13015 | + side, | |
| 13016 | + sideOffset, | |
| 13017 | + align, | |
| 13018 | + alignOffset, | |
| 13019 | + arrowPadding, | |
| 13020 | + collisionBoundary, | |
| 13021 | + collisionPadding, | |
| 13022 | + sticky, | |
| 13023 | + disableAnchorTracking, | |
| 13024 | + keepMounted, | |
| 13025 | + collisionAvoidance, | |
| 13026 | + lazyFlip: true | |
| 13027 | + }); | |
| 13028 | + useAnchoredPopupScrollLock(open2 && modal, openMethod === "touch", positionerElement, triggerElement); | |
| 13029 | + const state = { | |
| 13030 | + open: open2, | |
| 13031 | + side: positioning.side, | |
| 13032 | + align: positioning.align, | |
| 13033 | + anchorHidden: positioning.anchorHidden, | |
| 13034 | + empty | |
| 13035 | + }; | |
| 13036 | + useIsoLayoutEffect(() => { | |
| 13037 | + store.set("popupSide", positioning.side); | |
| 13038 | + }, [store, positioning.side]); | |
| 13039 | + const setPositionerElement = useStableCallback((element2) => { | |
| 13040 | + store.set("positionerElement", element2); | |
| 13041 | + }); | |
| 13042 | + const element = usePositioner(componentProps, state, { | |
| 13043 | + styles: positioning.positionerStyles, | |
| 13044 | + transitionStatus, | |
| 13045 | + props: elementProps, | |
| 13046 | + refs: [forwardedRef, setPositionerElement], | |
| 13047 | + hidden: !mounted, | |
| 13048 | + inert: !open2 | |
| 13049 | + }); | |
| 13050 | + return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ComboboxPositionerContext.Provider, { | |
| 13051 | + value: positioning, | |
| 13052 | + children: [mounted && modal && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(InternalBackdrop, { | |
| 13053 | + inert: inertValue(!open2), | |
| 13054 | + cutout: inputGroupElement ?? inputElement ?? triggerElement | |
| 13055 | + }), element] | |
| 13056 | + }); | |
| 13057 | +}); | |
| 13058 | +if (true) ComboboxPositioner.displayName = "ComboboxPositioner"; | |
| 13059 | + | |
| 13060 | +// node_modules/@base-ui/react/combobox/popup/ComboboxPopup.mjs | |
| 13061 | +var React74 = __toESM(require_react(), 1); | |
| 13062 | +var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); | |
| 13063 | +var stateAttributesMapping3 = { | |
| 13064 | + ...popupStateMapping, | |
| 13065 | + ...transitionStatusMapping | |
| 1468 | 13066 | }; |
| 1469 | -var getCurrentUseCounter = function() { | |
| 1470 | - var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10); | |
| 1471 | - return isFinite(counter) ? counter : 0; | |
| 1472 | -}; | |
| 1473 | -var useLockAttribute = function() { | |
| 1474 | - React19.useEffect(function() { | |
| 1475 | - document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString()); | |
| 1476 | - return function() { | |
| 1477 | - var newCounter = getCurrentUseCounter() - 1; | |
| 1478 | - if (newCounter <= 0) { | |
| 1479 | - document.body.removeAttribute(lockAttribute); | |
| 1480 | - } else { | |
| 1481 | - document.body.setAttribute(lockAttribute, newCounter.toString()); | |
| 13067 | +var ComboboxPopup = /* @__PURE__ */ React74.forwardRef(function ComboboxPopup2(componentProps, forwardedRef) { | |
| 13068 | + const { | |
| 13069 | + render, | |
| 13070 | + className, | |
| 13071 | + style, | |
| 13072 | + initialFocus, | |
| 13073 | + finalFocus, | |
| 13074 | + ...elementProps | |
| 13075 | + } = componentProps; | |
| 13076 | + const store = useComboboxRootContext(); | |
| 13077 | + const positioning = useComboboxPositionerContext(); | |
| 13078 | + const floatingRootContext = useComboboxFloatingContext(); | |
| 13079 | + const mounted = store.useState("mounted"); | |
| 13080 | + const open2 = store.useState("open"); | |
| 13081 | + const openMethod = store.useState("openMethod"); | |
| 13082 | + const popupProps = store.useState("popupProps"); | |
| 13083 | + const transitionStatus = store.useState("transitionStatus"); | |
| 13084 | + const inputInsidePopup = store.useState("inputInsidePopup"); | |
| 13085 | + const inputElement = store.useState("inputElement"); | |
| 13086 | + const modal = store.useState("modal"); | |
| 13087 | + const rootId = store.useState("id"); | |
| 13088 | + const empty = useListEmpty(); | |
| 13089 | + const popupId = elementProps.id ?? (inputInsidePopup ? getComboboxPopupId(rootId) : void 0); | |
| 13090 | + useIsoLayoutEffect(() => { | |
| 13091 | + store.set("popupId", store.context.popupRef.current?.id || popupId); | |
| 13092 | + return () => { | |
| 13093 | + store.set("popupId", void 0); | |
| 13094 | + }; | |
| 13095 | + }, [store, popupId]); | |
| 13096 | + useOpenChangeComplete({ | |
| 13097 | + open: open2, | |
| 13098 | + ref: store.context.popupRef, | |
| 13099 | + onComplete() { | |
| 13100 | + if (open2) { | |
| 13101 | + store.context.onOpenChangeComplete(true); | |
| 1482 | 13102 | } |
| 13103 | + } | |
| 13104 | + }); | |
| 13105 | + const state = { | |
| 13106 | + open: open2, | |
| 13107 | + side: positioning.side, | |
| 13108 | + align: positioning.align, | |
| 13109 | + anchorHidden: positioning.anchorHidden, | |
| 13110 | + transitionStatus, | |
| 13111 | + empty | |
| 13112 | + }; | |
| 13113 | + const element = useRenderElement("div", componentProps, { | |
| 13114 | + state, | |
| 13115 | + ref: [forwardedRef, store.context.popupRef], | |
| 13116 | + props: [popupProps, { | |
| 13117 | + id: popupId, | |
| 13118 | + role: inputInsidePopup ? "dialog" : "presentation", | |
| 13119 | + onFocus(event) { | |
| 13120 | + const target = getTarget(event.nativeEvent); | |
| 13121 | + if (openMethod !== "touch" && (contains(store.state.listElement, target) || target === event.currentTarget)) { | |
| 13122 | + store.context.inputRef.current?.focus(); | |
| 13123 | + } | |
| 13124 | + } | |
| 13125 | + }, getDisabledMountTransitionStyles(transitionStatus), elementProps], | |
| 13126 | + stateAttributesMapping: stateAttributesMapping3 | |
| 13127 | + }); | |
| 13128 | + const computedDefaultInitialFocus = inputInsidePopup ? (interactionType) => interactionType === "touch" ? store.context.popupRef.current : inputElement : false; | |
| 13129 | + const resolvedInitialFocus = initialFocus === void 0 ? computedDefaultInitialFocus : initialFocus; | |
| 13130 | + let resolvedFinalFocus; | |
| 13131 | + if (finalFocus != null) { | |
| 13132 | + resolvedFinalFocus = finalFocus; | |
| 13133 | + } else { | |
| 13134 | + resolvedFinalFocus = inputInsidePopup ? void 0 : false; | |
| 13135 | + } | |
| 13136 | + const focusManagerModal = !inputInsidePopup || modal; | |
| 13137 | + return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(FloatingFocusManager, { | |
| 13138 | + context: floatingRootContext, | |
| 13139 | + disabled: !mounted, | |
| 13140 | + modal: focusManagerModal, | |
| 13141 | + openInteractionType: openMethod, | |
| 13142 | + initialFocus: resolvedInitialFocus, | |
| 13143 | + returnFocus: resolvedFinalFocus, | |
| 13144 | + getInsideElements: () => [store.context.startDismissRef.current, store.context.endDismissRef.current], | |
| 13145 | + children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(React74.Fragment, { | |
| 13146 | + children: [element, focusManagerModal && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ComboboxInternalDismissButton, { | |
| 13147 | + ref: store.context.endDismissRef | |
| 13148 | + })] | |
| 13149 | + }) | |
| 13150 | + }); | |
| 13151 | +}); | |
| 13152 | +if (true) ComboboxPopup.displayName = "ComboboxPopup"; | |
| 13153 | + | |
| 13154 | +// node_modules/@base-ui/react/combobox/arrow/ComboboxArrow.mjs | |
| 13155 | +var React75 = __toESM(require_react(), 1); | |
| 13156 | +var ComboboxArrow = /* @__PURE__ */ React75.forwardRef(function ComboboxArrow2(componentProps, forwardedRef) { | |
| 13157 | + const { | |
| 13158 | + render, | |
| 13159 | + className, | |
| 13160 | + style, | |
| 13161 | + ...elementProps | |
| 13162 | + } = componentProps; | |
| 13163 | + const store = useComboboxRootContext(); | |
| 13164 | + const { | |
| 13165 | + arrowRef, | |
| 13166 | + side, | |
| 13167 | + align, | |
| 13168 | + arrowUncentered, | |
| 13169 | + arrowStyles | |
| 13170 | + } = useComboboxPositionerContext(); | |
| 13171 | + const open2 = store.useState("open"); | |
| 13172 | + const state = { | |
| 13173 | + open: open2, | |
| 13174 | + side, | |
| 13175 | + align, | |
| 13176 | + uncentered: arrowUncentered | |
| 13177 | + }; | |
| 13178 | + return useRenderElement("div", componentProps, { | |
| 13179 | + ref: [arrowRef, forwardedRef], | |
| 13180 | + stateAttributesMapping: popupStateMapping, | |
| 13181 | + state, | |
| 13182 | + props: { | |
| 13183 | + style: arrowStyles, | |
| 13184 | + "aria-hidden": true, | |
| 13185 | + ...elementProps | |
| 13186 | + } | |
| 13187 | + }); | |
| 13188 | +}); | |
| 13189 | +if (true) ComboboxArrow.displayName = "ComboboxArrow"; | |
| 13190 | + | |
| 13191 | +// node_modules/@base-ui/react/combobox/group/ComboboxGroup.mjs | |
| 13192 | +var React77 = __toESM(require_react(), 1); | |
| 13193 | + | |
| 13194 | +// node_modules/@base-ui/react/combobox/group/ComboboxGroupContext.mjs | |
| 13195 | +var React76 = __toESM(require_react(), 1); | |
| 13196 | +var ComboboxGroupContext = /* @__PURE__ */ React76.createContext(void 0); | |
| 13197 | +if (true) ComboboxGroupContext.displayName = "ComboboxGroupContext"; | |
| 13198 | +function useComboboxGroupContext() { | |
| 13199 | + const context = React76.useContext(ComboboxGroupContext); | |
| 13200 | + if (context === void 0) { | |
| 13201 | + throw new Error(true ? "Base UI: ComboboxGroupContext is missing. ComboboxGroup parts must be placed within <Combobox.Group>." : formatErrorMessage_default(18)); | |
| 13202 | + } | |
| 13203 | + return context; | |
| 13204 | +} | |
| 13205 | + | |
| 13206 | +// node_modules/@base-ui/react/combobox/group/ComboboxGroup.mjs | |
| 13207 | +var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); | |
| 13208 | +var ComboboxGroup = /* @__PURE__ */ React77.forwardRef(function ComboboxGroup2(componentProps, forwardedRef) { | |
| 13209 | + const { | |
| 13210 | + render, | |
| 13211 | + className, | |
| 13212 | + style, | |
| 13213 | + items, | |
| 13214 | + ...elementProps | |
| 13215 | + } = componentProps; | |
| 13216 | + const store = useComboboxRootContext(); | |
| 13217 | + const grid = store.useState("grid"); | |
| 13218 | + const [labelId, setLabelId] = React77.useState(); | |
| 13219 | + const contextValue = React77.useMemo(() => ({ | |
| 13220 | + labelId, | |
| 13221 | + setLabelId, | |
| 13222 | + items | |
| 13223 | + }), [labelId, setLabelId, items]); | |
| 13224 | + const element = useRenderElement("div", componentProps, { | |
| 13225 | + ref: forwardedRef, | |
| 13226 | + props: [{ | |
| 13227 | + // `group` is not a valid owned element of `grid`, and `row` must be owned | |
| 13228 | + // by `grid`, `rowgroup`, or `treegrid`. | |
| 13229 | + role: grid ? "rowgroup" : "group", | |
| 13230 | + "aria-labelledby": labelId | |
| 13231 | + }, elementProps] | |
| 13232 | + }); | |
| 13233 | + const wrappedElement = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ComboboxGroupContext.Provider, { | |
| 13234 | + value: contextValue, | |
| 13235 | + children: element | |
| 13236 | + }); | |
| 13237 | + if (items) { | |
| 13238 | + return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(GroupCollectionProvider, { | |
| 13239 | + items, | |
| 13240 | + children: wrappedElement | |
| 13241 | + }); | |
| 13242 | + } | |
| 13243 | + return wrappedElement; | |
| 13244 | +}); | |
| 13245 | +if (true) ComboboxGroup.displayName = "ComboboxGroup"; | |
| 13246 | + | |
| 13247 | +// node_modules/@base-ui/react/combobox/group-label/ComboboxGroupLabel.mjs | |
| 13248 | +var React78 = __toESM(require_react(), 1); | |
| 13249 | +var ComboboxGroupLabel = /* @__PURE__ */ React78.forwardRef(function ComboboxGroupLabel2(componentProps, forwardedRef) { | |
| 13250 | + const { | |
| 13251 | + render, | |
| 13252 | + className, | |
| 13253 | + style, | |
| 13254 | + id: idProp, | |
| 13255 | + ...elementProps | |
| 13256 | + } = componentProps; | |
| 13257 | + const { | |
| 13258 | + setLabelId | |
| 13259 | + } = useComboboxGroupContext(); | |
| 13260 | + const id = useBaseUiId(idProp); | |
| 13261 | + useIsoLayoutEffect(() => { | |
| 13262 | + setLabelId(id); | |
| 13263 | + return () => { | |
| 13264 | + setLabelId((currentId) => currentId === id ? void 0 : currentId); | |
| 1483 | 13265 | }; |
| 1484 | - }, []); | |
| 1485 | -}; | |
| 1486 | -var RemoveScrollBar = function(_a) { | |
| 1487 | - var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b; | |
| 1488 | - useLockAttribute(); | |
| 1489 | - var gap = React19.useMemo(function() { | |
| 1490 | - return getGapWidth(gapMode); | |
| 1491 | - }, [gapMode]); | |
| 1492 | - return React19.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") }); | |
| 1493 | -}; | |
| 13266 | + }, [id, setLabelId]); | |
| 13267 | + const element = useRenderElement("div", componentProps, { | |
| 13268 | + ref: forwardedRef, | |
| 13269 | + props: [{ | |
| 13270 | + id, | |
| 13271 | + "aria-hidden": true | |
| 13272 | + }, elementProps] | |
| 13273 | + }); | |
| 13274 | + return element; | |
| 13275 | +}); | |
| 13276 | +if (true) ComboboxGroupLabel.displayName = "ComboboxGroupLabel"; | |
| 1494 | 13277 | |
| 1495 | -// node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js | |
| 1496 | -var passiveSupported = false; | |
| 1497 | -if (typeof window !== "undefined") { | |
| 1498 | - try { | |
| 1499 | - options = Object.defineProperty({}, "passive", { | |
| 1500 | - get: function() { | |
| 1501 | - passiveSupported = true; | |
| 1502 | - return true; | |
| 13278 | +// node_modules/@base-ui/react/combobox/item/ComboboxItem.mjs | |
| 13279 | +var React81 = __toESM(require_react(), 1); | |
| 13280 | +var ReactDOM6 = __toESM(require_react_dom(), 1); | |
| 13281 | + | |
| 13282 | +// node_modules/@base-ui/react/combobox/item/ComboboxItemContext.mjs | |
| 13283 | +var React79 = __toESM(require_react(), 1); | |
| 13284 | +var ComboboxItemContext = /* @__PURE__ */ React79.createContext(void 0); | |
| 13285 | +if (true) ComboboxItemContext.displayName = "ComboboxItemContext"; | |
| 13286 | + | |
| 13287 | +// node_modules/@base-ui/react/combobox/row/ComboboxRowContext.mjs | |
| 13288 | +var React80 = __toESM(require_react(), 1); | |
| 13289 | +var ComboboxRowContext = /* @__PURE__ */ React80.createContext(false); | |
| 13290 | +if (true) ComboboxRowContext.displayName = "ComboboxRowContext"; | |
| 13291 | +function useComboboxRowContext() { | |
| 13292 | + return React80.useContext(ComboboxRowContext); | |
| 13293 | +} | |
| 13294 | + | |
| 13295 | +// node_modules/@base-ui/react/combobox/item/ComboboxItem.mjs | |
| 13296 | +var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); | |
| 13297 | +function ComboboxItemInner(props) { | |
| 13298 | + const { | |
| 13299 | + componentProps, | |
| 13300 | + forwardedRef, | |
| 13301 | + virtualized, | |
| 13302 | + indexFromFilter | |
| 13303 | + } = props; | |
| 13304 | + const { | |
| 13305 | + render, | |
| 13306 | + className, | |
| 13307 | + style, | |
| 13308 | + value: itemValue = null, | |
| 13309 | + index: indexProp, | |
| 13310 | + disabled: disabledProp = false, | |
| 13311 | + nativeButton = false, | |
| 13312 | + ...elementProps | |
| 13313 | + } = componentProps; | |
| 13314 | + const textRef = React81.useRef(null); | |
| 13315 | + const listItem = useCompositeListItem({ | |
| 13316 | + guess: true, | |
| 13317 | + index: indexProp, | |
| 13318 | + textRef | |
| 13319 | + }); | |
| 13320 | + const store = useComboboxRootContext(); | |
| 13321 | + const isRow = useComboboxRowContext(); | |
| 13322 | + const hasItems = useComboboxHasItemsContext(); | |
| 13323 | + const selectionMode = store.useState("selectionMode"); | |
| 13324 | + const rootDisabled = store.useState("disabled"); | |
| 13325 | + const readOnly = store.useState("readOnly"); | |
| 13326 | + const isItemEqualToValue = store.useState("isItemEqualToValue"); | |
| 13327 | + const disabled2 = rootDisabled || disabledProp; | |
| 13328 | + const selectable = selectionMode !== "none"; | |
| 13329 | + const index2 = indexProp ?? indexFromFilter ?? listItem.index; | |
| 13330 | + const hasRegistered = index2 !== -1; | |
| 13331 | + const rootId = store.useState("id"); | |
| 13332 | + const highlighted = store.useState("isActive", index2); | |
| 13333 | + const matchesSelectedValue = store.useState("isSelected", itemValue); | |
| 13334 | + const itemProps = store.useState("itemProps"); | |
| 13335 | + const itemRef = React81.useRef(null); | |
| 13336 | + const id = rootId != null && hasRegistered ? `${rootId}-${index2}` : void 0; | |
| 13337 | + const selected = matchesSelectedValue && selectable; | |
| 13338 | + useIsoLayoutEffect(() => { | |
| 13339 | + const shouldRun = hasRegistered && (virtualized || indexProp != null); | |
| 13340 | + if (!shouldRun) { | |
| 13341 | + return void 0; | |
| 13342 | + } | |
| 13343 | + const list = store.context.listRef.current; | |
| 13344 | + list[index2] = itemRef.current; | |
| 13345 | + return () => { | |
| 13346 | + delete list[index2]; | |
| 13347 | + }; | |
| 13348 | + }, [hasRegistered, virtualized, index2, indexProp, store]); | |
| 13349 | + useIsoLayoutEffect(() => { | |
| 13350 | + if (!hasRegistered || hasItems) { | |
| 13351 | + return void 0; | |
| 13352 | + } | |
| 13353 | + const visibleValues = store.context.valuesRef.current; | |
| 13354 | + visibleValues[index2] = itemValue; | |
| 13355 | + return () => { | |
| 13356 | + delete visibleValues[index2]; | |
| 13357 | + }; | |
| 13358 | + }, [hasRegistered, hasItems, index2, itemValue, store]); | |
| 13359 | + useIsoLayoutEffect(() => { | |
| 13360 | + if (!hasRegistered || hasItems) { | |
| 13361 | + return; | |
| 13362 | + } | |
| 13363 | + const selectedValue = store.state.selectedValue; | |
| 13364 | + let nextIndex = store.state.selectedIndex; | |
| 13365 | + if (store.state.selectionMode === "multiple" && Array.isArray(selectedValue)) { | |
| 13366 | + nextIndex = resolveSelectedIndex(index2, itemValue, store.context.valuesRef.current, selectedValue, isItemEqualToValue, nextIndex); | |
| 13367 | + } else if (compareItemEquality(itemValue, selectedValue, isItemEqualToValue)) { | |
| 13368 | + nextIndex = index2; | |
| 13369 | + } | |
| 13370 | + store.set("selectedIndex", nextIndex); | |
| 13371 | + }, [hasRegistered, hasItems, store, index2, itemValue, isItemEqualToValue]); | |
| 13372 | + const { | |
| 13373 | + getButtonProps, | |
| 13374 | + buttonRef | |
| 13375 | + } = useButton({ | |
| 13376 | + disabled: disabled2, | |
| 13377 | + focusableWhenDisabled: true, | |
| 13378 | + native: nativeButton, | |
| 13379 | + composite: true | |
| 13380 | + }); | |
| 13381 | + const state = { | |
| 13382 | + disabled: disabled2, | |
| 13383 | + selected, | |
| 13384 | + highlighted | |
| 13385 | + }; | |
| 13386 | + function commitSelection(nativeEvent) { | |
| 13387 | + function selectItem() { | |
| 13388 | + store.context.handleSelection(nativeEvent, itemValue); | |
| 13389 | + } | |
| 13390 | + if (store.state.submitOnItemClick) { | |
| 13391 | + ReactDOM6.flushSync(selectItem); | |
| 13392 | + store.context.requestSubmit(); | |
| 13393 | + } else { | |
| 13394 | + selectItem(); | |
| 13395 | + } | |
| 13396 | + } | |
| 13397 | + const defaultProps = { | |
| 13398 | + id, | |
| 13399 | + role: isRow ? "gridcell" : "option", | |
| 13400 | + "aria-selected": selectable ? selected : void 0, | |
| 13401 | + // Focusable items steal focus from the input upon mouseup. | |
| 13402 | + // Warn if the user renders a natively focusable element like `<button>`, | |
| 13403 | + // as it should be a `<div>` instead. | |
| 13404 | + tabIndex: void 0, | |
| 13405 | + onPointerDownCapture(event) { | |
| 13406 | + if (event.isPrimary) { | |
| 13407 | + store.context.pointerDownItemRef.current = event.currentTarget; | |
| 1503 | 13408 | } |
| 13409 | + event.preventDefault(); | |
| 13410 | + }, | |
| 13411 | + onMouseDown(event) { | |
| 13412 | + event.preventDefault(); | |
| 13413 | + }, | |
| 13414 | + onClick(event) { | |
| 13415 | + if (disabled2 || readOnly) { | |
| 13416 | + return; | |
| 13417 | + } | |
| 13418 | + commitSelection(event.nativeEvent); | |
| 13419 | + }, | |
| 13420 | + onMouseUp(event) { | |
| 13421 | + const pointerStartedOnItem = store.context.pointerDownItemRef.current === event.currentTarget; | |
| 13422 | + store.context.pointerDownItemRef.current = null; | |
| 13423 | + if (disabled2 || readOnly || event.button !== 0 || pointerStartedOnItem || !highlighted) { | |
| 13424 | + return; | |
| 13425 | + } | |
| 13426 | + commitSelection(event.nativeEvent); | |
| 13427 | + } | |
| 13428 | + }; | |
| 13429 | + const element = useRenderElement("div", componentProps, { | |
| 13430 | + ref: [buttonRef, forwardedRef, listItem.ref, itemRef], | |
| 13431 | + state, | |
| 13432 | + props: [itemProps, defaultProps, elementProps, getButtonProps] | |
| 13433 | + }); | |
| 13434 | + const contextValue = React81.useMemo(() => ({ | |
| 13435 | + selected, | |
| 13436 | + textRef | |
| 13437 | + }), [selected, textRef]); | |
| 13438 | + return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ComboboxItemContext.Provider, { | |
| 13439 | + value: contextValue, | |
| 13440 | + children: element | |
| 13441 | + }); | |
| 13442 | +} | |
| 13443 | +function ComboboxItemVirtualizedIndex(props) { | |
| 13444 | + const { | |
| 13445 | + componentProps, | |
| 13446 | + forwardedRef | |
| 13447 | + } = props; | |
| 13448 | + const store = useComboboxRootContext(); | |
| 13449 | + const isItemEqualToValue = store.useState("isItemEqualToValue"); | |
| 13450 | + const { | |
| 13451 | + flatFilteredValues | |
| 13452 | + } = useComboboxDerivedItemsContext(); | |
| 13453 | + const lookupValue = componentProps.value ?? null; | |
| 13454 | + const indexFromFilter = findItemIndex(flatFilteredValues, lookupValue, isItemEqualToValue); | |
| 13455 | + return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ComboboxItemInner, { | |
| 13456 | + componentProps, | |
| 13457 | + forwardedRef, | |
| 13458 | + virtualized: true, | |
| 13459 | + indexFromFilter | |
| 13460 | + }); | |
| 13461 | +} | |
| 13462 | +var ComboboxItem = /* @__PURE__ */ React81.memo(/* @__PURE__ */ React81.forwardRef(function ComboboxItem2(componentProps, forwardedRef) { | |
| 13463 | + const store = useComboboxRootContext(); | |
| 13464 | + const virtualized = store.useState("virtualized"); | |
| 13465 | + if (virtualized && componentProps.index == null) { | |
| 13466 | + return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ComboboxItemVirtualizedIndex, { | |
| 13467 | + componentProps, | |
| 13468 | + forwardedRef | |
| 1504 | 13469 | }); |
| 1505 | - window.addEventListener("test", options, options); | |
| 1506 | - window.removeEventListener("test", options, options); | |
| 1507 | - } catch (err) { | |
| 1508 | - passiveSupported = false; | |
| 1509 | 13470 | } |
| 13471 | + return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ComboboxItemInner, { | |
| 13472 | + componentProps, | |
| 13473 | + forwardedRef, | |
| 13474 | + virtualized, | |
| 13475 | + indexFromFilter: void 0 | |
| 13476 | + }); | |
| 13477 | +})); | |
| 13478 | +if (true) ComboboxItem.displayName = "ComboboxItem"; | |
| 13479 | + | |
| 13480 | +// node_modules/@base-ui/react/autocomplete/item/AutocompleteItem.mjs | |
| 13481 | +var AutocompleteItem = ComboboxItem; | |
| 13482 | + | |
| 13483 | +// node_modules/@base-ui/react/combobox/row/ComboboxRow.mjs | |
| 13484 | +var React82 = __toESM(require_react(), 1); | |
| 13485 | +var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); | |
| 13486 | +var ComboboxRow = /* @__PURE__ */ React82.forwardRef(function ComboboxRow2(componentProps, forwardedRef) { | |
| 13487 | + const { | |
| 13488 | + render, | |
| 13489 | + className, | |
| 13490 | + style, | |
| 13491 | + ...elementProps | |
| 13492 | + } = componentProps; | |
| 13493 | + const element = useRenderElement("div", componentProps, { | |
| 13494 | + ref: forwardedRef, | |
| 13495 | + props: [{ | |
| 13496 | + role: "row" | |
| 13497 | + }, elementProps] | |
| 13498 | + }); | |
| 13499 | + return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ComboboxRowContext.Provider, { | |
| 13500 | + value: true, | |
| 13501 | + children: element | |
| 13502 | + }); | |
| 13503 | +}); | |
| 13504 | +if (true) ComboboxRow.displayName = "ComboboxRow"; | |
| 13505 | + | |
| 13506 | +// node_modules/@base-ui/react/combobox/empty/ComboboxEmpty.mjs | |
| 13507 | +var React83 = __toESM(require_react(), 1); | |
| 13508 | +var ComboboxEmpty = /* @__PURE__ */ React83.forwardRef(function ComboboxEmpty2(componentProps, forwardedRef) { | |
| 13509 | + const { | |
| 13510 | + render, | |
| 13511 | + className, | |
| 13512 | + style, | |
| 13513 | + children: childrenProp, | |
| 13514 | + ...elementProps | |
| 13515 | + } = componentProps; | |
| 13516 | + const { | |
| 13517 | + filteredItems | |
| 13518 | + } = useComboboxDerivedItemsContext(); | |
| 13519 | + const store = useComboboxRootContext(); | |
| 13520 | + const emptyRef = useInitialLiveRegionTextMutation(); | |
| 13521 | + const children = filteredItems.length === 0 ? childrenProp : null; | |
| 13522 | + return useRenderElement("div", componentProps, { | |
| 13523 | + ref: [forwardedRef, store.context.emptyRef, emptyRef], | |
| 13524 | + props: [{ | |
| 13525 | + children, | |
| 13526 | + role: "status", | |
| 13527 | + "aria-live": "polite", | |
| 13528 | + "aria-atomic": true | |
| 13529 | + }, elementProps] | |
| 13530 | + }); | |
| 13531 | +}); | |
| 13532 | +if (true) ComboboxEmpty.displayName = "ComboboxEmpty"; | |
| 13533 | + | |
| 13534 | +// node_modules/@base-ui/react/utils/listbox-separator/ListboxSeparator.mjs | |
| 13535 | +var React84 = __toESM(require_react(), 1); | |
| 13536 | +var ListboxSeparator = /* @__PURE__ */ React84.forwardRef(function ListboxSeparator2(componentProps, forwardedRef) { | |
| 13537 | + const { | |
| 13538 | + className, | |
| 13539 | + render, | |
| 13540 | + orientation = "horizontal", | |
| 13541 | + style, | |
| 13542 | + ...elementProps | |
| 13543 | + } = componentProps; | |
| 13544 | + const state = { | |
| 13545 | + orientation | |
| 13546 | + }; | |
| 13547 | + return useRenderElement("div", componentProps, { | |
| 13548 | + state, | |
| 13549 | + ref: forwardedRef, | |
| 13550 | + props: [{ | |
| 13551 | + role: "presentation" | |
| 13552 | + }, elementProps] | |
| 13553 | + }); | |
| 13554 | +}); | |
| 13555 | +if (true) ListboxSeparator.displayName = "ListboxSeparator"; | |
| 13556 | + | |
| 13557 | +// node_modules/@base-ui/react/autocomplete/separator/AutocompleteSeparator.mjs | |
| 13558 | +var AutocompleteSeparator = ListboxSeparator; | |
| 13559 | + | |
| 13560 | +// node_modules/@base-ui/react/combobox/root/utils/useFilteredItems.mjs | |
| 13561 | +function useFilteredItems() { | |
| 13562 | + const items = useComboboxDerivedItemsContext(); | |
| 13563 | + return items.filteredItems; | |
| 1510 | 13564 | } |
| 1511 | -var options; | |
| 1512 | -var nonPassive = passiveSupported ? { passive: false } : false; | |
| 1513 | 13565 | |
| 1514 | -// node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/handleScroll.js | |
| 1515 | -var alwaysContainsScroll = function(node) { | |
| 1516 | - return node.tagName === "TEXTAREA"; | |
| 1517 | -}; | |
| 1518 | -var elementCanBeScrolled = function(node, overflow) { | |
| 1519 | - if (!(node instanceof Element)) { | |
| 13566 | +// node_modules/@base-ui/react/button/Button.mjs | |
| 13567 | +var React85 = __toESM(require_react(), 1); | |
| 13568 | +var Button = /* @__PURE__ */ React85.forwardRef(function Button2(componentProps, forwardedRef) { | |
| 13569 | + const { | |
| 13570 | + render, | |
| 13571 | + className, | |
| 13572 | + disabled: disabled2 = false, | |
| 13573 | + focusableWhenDisabled = false, | |
| 13574 | + nativeButton = true, | |
| 13575 | + style, | |
| 13576 | + ...elementProps | |
| 13577 | + } = componentProps; | |
| 13578 | + const { | |
| 13579 | + getButtonProps, | |
| 13580 | + buttonRef | |
| 13581 | + } = useButton({ | |
| 13582 | + disabled: disabled2, | |
| 13583 | + focusableWhenDisabled, | |
| 13584 | + native: nativeButton | |
| 13585 | + }); | |
| 13586 | + const state = { | |
| 13587 | + disabled: disabled2 | |
| 13588 | + }; | |
| 13589 | + return useRenderElement("button", componentProps, { | |
| 13590 | + state, | |
| 13591 | + ref: [forwardedRef, buttonRef], | |
| 13592 | + props: [elementProps, getButtonProps] | |
| 13593 | + }); | |
| 13594 | +}); | |
| 13595 | +if (true) Button.displayName = "Button"; | |
| 13596 | + | |
| 13597 | +// node_modules/@base-ui/react/field/item/FieldItemContext.mjs | |
| 13598 | +var React86 = __toESM(require_react(), 1); | |
| 13599 | +var FieldItemContext = /* @__PURE__ */ React86.createContext({ | |
| 13600 | + disabled: false | |
| 13601 | +}); | |
| 13602 | +if (true) FieldItemContext.displayName = "FieldItemContext"; | |
| 13603 | +function useFieldItemContext() { | |
| 13604 | + const context = React86.useContext(FieldItemContext); | |
| 13605 | + return context; | |
| 13606 | +} | |
| 13607 | + | |
| 13608 | +// node_modules/@base-ui/react/field/root/useFieldValidation.mjs | |
| 13609 | +var React87 = __toESM(require_react(), 1); | |
| 13610 | + | |
| 13611 | +// node_modules/@base-ui/react/field/utils/getCombinedFieldValidityData.mjs | |
| 13612 | +function getCombinedFieldValidityData(validityData, invalid2) { | |
| 13613 | + return { | |
| 13614 | + ...validityData, | |
| 13615 | + state: { | |
| 13616 | + ...validityData.state, | |
| 13617 | + valid: !invalid2 && validityData.state.valid | |
| 13618 | + } | |
| 13619 | + }; | |
| 13620 | +} | |
| 13621 | + | |
| 13622 | +// node_modules/@base-ui/react/field/root/useFieldValidation.mjs | |
| 13623 | +var validityKeys = Object.keys(DEFAULT_VALIDITY_STATE); | |
| 13624 | +function isEligibleInput(input, formElement) { | |
| 13625 | + if (input.matches(":disabled")) { | |
| 1520 | 13626 | return false; |
| 1521 | 13627 | } |
| 1522 | - var styles = window.getComputedStyle(node); | |
| 1523 | - return ( | |
| 1524 | - // not-not-scrollable | |
| 1525 | - styles[overflow] !== "hidden" && // contains scroll inside self | |
| 1526 | - !(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible") | |
| 1527 | - ); | |
| 1528 | -}; | |
| 1529 | -var elementCouldBeVScrolled = function(node) { | |
| 1530 | - return elementCanBeScrolled(node, "overflowY"); | |
| 1531 | -}; | |
| 1532 | -var elementCouldBeHScrolled = function(node) { | |
| 1533 | - return elementCanBeScrolled(node, "overflowX"); | |
| 1534 | -}; | |
| 1535 | -var locationCouldBeScrolled = function(axis, node) { | |
| 1536 | - var ownerDocument = node.ownerDocument; | |
| 1537 | - var current = node; | |
| 1538 | - do { | |
| 1539 | - if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) { | |
| 1540 | - current = current.host; | |
| 13628 | + if (!formElement || input.form === formElement) { | |
| 13629 | + return true; | |
| 13630 | + } | |
| 13631 | + return input.form === null && !input.hasAttribute("form"); | |
| 13632 | +} | |
| 13633 | +function findRepresentativeInput(inputs, formElement) { | |
| 13634 | + let fallback = null; | |
| 13635 | + for (const input of inputs.keys()) { | |
| 13636 | + if (!isEligibleInput(input, formElement)) { | |
| 13637 | + continue; | |
| 1541 | 13638 | } |
| 1542 | - var isScrollable = elementCouldBeScrolled(axis, current); | |
| 1543 | - if (isScrollable) { | |
| 1544 | - var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2]; | |
| 1545 | - if (scrollHeight > clientHeight) { | |
| 1546 | - return true; | |
| 13639 | + if (!input.validity.valid) { | |
| 13640 | + return input; | |
| 13641 | + } | |
| 13642 | + fallback ??= input; | |
| 13643 | + } | |
| 13644 | + return fallback; | |
| 13645 | +} | |
| 13646 | +function makeState(customError) { | |
| 13647 | + return { | |
| 13648 | + ...DEFAULT_VALIDITY_STATE, | |
| 13649 | + valid: !customError, | |
| 13650 | + customError | |
| 13651 | + }; | |
| 13652 | +} | |
| 13653 | +function getNativeErrors(element) { | |
| 13654 | + return element && element.validationMessage ? [element.validationMessage] : []; | |
| 13655 | +} | |
| 13656 | +function useFieldValidation(params) { | |
| 13657 | + const { | |
| 13658 | + elementRef, | |
| 13659 | + formRef | |
| 13660 | + } = useFormContext(); | |
| 13661 | + const { | |
| 13662 | + setValidityData, | |
| 13663 | + validate, | |
| 13664 | + validityData, | |
| 13665 | + validationDebounceTime, | |
| 13666 | + invalid: invalid2, | |
| 13667 | + markedDirtyRef, | |
| 13668 | + state, | |
| 13669 | + shouldValidateOnChange, | |
| 13670 | + validationMode, | |
| 13671 | + registeredFieldIdRef | |
| 13672 | + } = params; | |
| 13673 | + const { | |
| 13674 | + controlId, | |
| 13675 | + getDescriptionProps | |
| 13676 | + } = useLabelableContext(); | |
| 13677 | + const timeout = useTimeout(); | |
| 13678 | + const inputRef = React87.useRef(null); | |
| 13679 | + const registeredInputs = useRefWithInit(() => /* @__PURE__ */ new Map()).current; | |
| 13680 | + const validationCommitIdRef = React87.useRef(0); | |
| 13681 | + const customValidityRef = React87.useRef(null); | |
| 13682 | + const registerInput = React87.useCallback((element, registration) => { | |
| 13683 | + registeredInputs.set(element, registration); | |
| 13684 | + return () => { | |
| 13685 | + registeredInputs.delete(element); | |
| 13686 | + }; | |
| 13687 | + }, [registeredInputs]); | |
| 13688 | + const getInputControl = useStableCallback(() => { | |
| 13689 | + const element = findRepresentativeInput(registeredInputs, elementRef.current); | |
| 13690 | + return element && registeredInputs.get(element)?.controlRef.current || null; | |
| 13691 | + }); | |
| 13692 | + const commit = useStableCallback(async (value, revalidate = false) => { | |
| 13693 | + validationCommitIdRef.current += 1; | |
| 13694 | + const validationCommitId = validationCommitIdRef.current; | |
| 13695 | + function updateRegisteredFieldValidity(nextValidityData, externalInvalid = invalid2) { | |
| 13696 | + const fieldId = registeredFieldIdRef.current ?? controlId; | |
| 13697 | + if (fieldId == null) { | |
| 13698 | + return; | |
| 1547 | 13699 | } |
| 13700 | + const currentFieldData = formRef.current.fields.get(fieldId); | |
| 13701 | + if (!currentFieldData) { | |
| 13702 | + return; | |
| 13703 | + } | |
| 13704 | + const validityDataWithFormErrors = getCombinedFieldValidityData(nextValidityData, externalInvalid); | |
| 13705 | + formRef.current.fields.set(fieldId, { | |
| 13706 | + ...currentFieldData, | |
| 13707 | + validityData: validityDataWithFormErrors | |
| 13708 | + }); | |
| 1548 | 13709 | } |
| 1549 | - current = current.parentNode; | |
| 1550 | - } while (current && current !== ownerDocument.body); | |
| 1551 | - return false; | |
| 1552 | -}; | |
| 1553 | -var getVScrollVariables = function(_a) { | |
| 1554 | - var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight; | |
| 1555 | - return [ | |
| 1556 | - scrollTop, | |
| 1557 | - scrollHeight, | |
| 1558 | - clientHeight | |
| 1559 | - ]; | |
| 1560 | -}; | |
| 1561 | -var getHScrollVariables = function(_a) { | |
| 1562 | - var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth; | |
| 1563 | - return [ | |
| 1564 | - scrollLeft, | |
| 1565 | - scrollWidth, | |
| 1566 | - clientWidth | |
| 1567 | - ]; | |
| 1568 | -}; | |
| 1569 | -var elementCouldBeScrolled = function(axis, node) { | |
| 1570 | - return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node); | |
| 1571 | -}; | |
| 1572 | -var getScrollVariables = function(axis, node) { | |
| 1573 | - return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node); | |
| 1574 | -}; | |
| 1575 | -var getDirectionFactor = function(axis, direction) { | |
| 1576 | - return axis === "h" && direction === "rtl" ? -1 : 1; | |
| 1577 | -}; | |
| 1578 | -var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) { | |
| 1579 | - var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction); | |
| 1580 | - var delta = directionFactor * sourceDelta; | |
| 1581 | - var target = event.target; | |
| 1582 | - var targetInLock = endTarget.contains(target); | |
| 1583 | - var shouldCancelScroll = false; | |
| 1584 | - var isDeltaPositive = delta > 0; | |
| 1585 | - var availableScroll = 0; | |
| 1586 | - var availableScrollTop = 0; | |
| 1587 | - do { | |
| 1588 | - if (!target) { | |
| 1589 | - break; | |
| 13710 | + function makeValidityData(validityState, errorMessages) { | |
| 13711 | + const errors = validityState.valid === false ? errorMessages : []; | |
| 13712 | + return { | |
| 13713 | + value, | |
| 13714 | + state: validityState, | |
| 13715 | + error: errors[0] ?? "", | |
| 13716 | + errors, | |
| 13717 | + initialValue: validityData.initialValue | |
| 13718 | + }; | |
| 1590 | 13719 | } |
| 1591 | - var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2]; | |
| 1592 | - var elementScroll = scroll_1 - capacity - directionFactor * position; | |
| 1593 | - if (position || elementScroll) { | |
| 1594 | - if (elementCouldBeScrolled(axis, target)) { | |
| 1595 | - availableScroll += elementScroll; | |
| 1596 | - availableScrollTop += position; | |
| 13720 | + function setCustomValidity(element2, message) { | |
| 13721 | + const displaced = element2.validity.customError ? element2.validationMessage : ""; | |
| 13722 | + const ownedMessage = message.replace(/\r\n?/g, "\n"); | |
| 13723 | + element2.setCustomValidity(ownedMessage); | |
| 13724 | + customValidityRef.current = [element2, ownedMessage, displaced]; | |
| 13725 | + } | |
| 13726 | + function clearCustomValidity() { | |
| 13727 | + const record = customValidityRef.current; | |
| 13728 | + customValidityRef.current = null; | |
| 13729 | + if (record && (!record[0].willValidate || record[0].validationMessage === record[1])) { | |
| 13730 | + record[0].setCustomValidity(record[2]); | |
| 1597 | 13731 | } |
| 1598 | 13732 | } |
| 1599 | - var parent_1 = target.parentNode; | |
| 1600 | - target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1; | |
| 1601 | - } while ( | |
| 1602 | - // portaled content | |
| 1603 | - !targetInLock && target !== document.body || // self content | |
| 1604 | - targetInLock && (endTarget.contains(target) || endTarget === target) | |
| 1605 | - ); | |
| 1606 | - if (isDeltaPositive && (noOverscroll && Math.abs(availableScroll) < 1 || !noOverscroll && delta > availableScroll)) { | |
| 1607 | - shouldCancelScroll = true; | |
| 1608 | - } else if (!isDeltaPositive && (noOverscroll && Math.abs(availableScrollTop) < 1 || !noOverscroll && -delta > availableScrollTop)) { | |
| 1609 | - shouldCancelScroll = true; | |
| 13733 | + function publish(validityState, errorMessages, externalInvalid) { | |
| 13734 | + const nextValidityData = makeValidityData(validityState, errorMessages); | |
| 13735 | + updateRegisteredFieldValidity(nextValidityData, externalInvalid); | |
| 13736 | + setValidityData(nextValidityData); | |
| 13737 | + } | |
| 13738 | + function getState(el) { | |
| 13739 | + const computedState = validityKeys.reduce((acc, key) => { | |
| 13740 | + acc[key] = el.validity[key]; | |
| 13741 | + return acc; | |
| 13742 | + }, {}); | |
| 13743 | + let hasOnlyValueMissingError = false; | |
| 13744 | + for (const key of validityKeys) { | |
| 13745 | + if (key === "valid") { | |
| 13746 | + continue; | |
| 13747 | + } | |
| 13748 | + if (key === "valueMissing" && computedState[key]) { | |
| 13749 | + hasOnlyValueMissingError = true; | |
| 13750 | + } else if (computedState[key]) { | |
| 13751 | + return computedState; | |
| 13752 | + } | |
| 13753 | + } | |
| 13754 | + if (hasOnlyValueMissingError && !markedDirtyRef.current) { | |
| 13755 | + computedState.valid = true; | |
| 13756 | + computedState.valueMissing = false; | |
| 13757 | + } | |
| 13758 | + return computedState; | |
| 13759 | + } | |
| 13760 | + function resolveRepresentativeInput() { | |
| 13761 | + return registeredInputs.size > 0 ? findRepresentativeInput(registeredInputs, elementRef.current) : inputRef.current; | |
| 13762 | + } | |
| 13763 | + let element = resolveRepresentativeInput(); | |
| 13764 | + function refreshState() { | |
| 13765 | + element = resolveRepresentativeInput(); | |
| 13766 | + return element?.willValidate ? getState(element) : makeState(false); | |
| 13767 | + } | |
| 13768 | + if (revalidate) { | |
| 13769 | + if (state.valid !== false || !element) { | |
| 13770 | + return; | |
| 13771 | + } | |
| 13772 | + if (!element.validity.valueMissing) { | |
| 13773 | + clearCustomValidity(); | |
| 13774 | + const currentElement = resolveRepresentativeInput(); | |
| 13775 | + const foreign = currentElement?.validity.customError ? getNativeErrors(currentElement) : []; | |
| 13776 | + publish(makeState(foreign.length > 0), foreign, false); | |
| 13777 | + return; | |
| 13778 | + } | |
| 13779 | + for (const key of validityKeys) { | |
| 13780 | + if (key !== "valid" && key !== "valueMissing" && key !== "customError" && element.validity[key]) { | |
| 13781 | + return; | |
| 13782 | + } | |
| 13783 | + } | |
| 13784 | + } | |
| 13785 | + timeout.clear(); | |
| 13786 | + clearCustomValidity(); | |
| 13787 | + let nextState = refreshState(); | |
| 13788 | + let validationErrors = getNativeErrors(element); | |
| 13789 | + const isValidatingOnChange = shouldValidateOnChange(); | |
| 13790 | + if (validationErrors.length === 0 || isValidatingOnChange) { | |
| 13791 | + const formValues = Array.from(formRef.current.fields.values()).reduce((acc, field) => { | |
| 13792 | + if (field.name) { | |
| 13793 | + acc[field.name] = field.getValue(); | |
| 13794 | + } | |
| 13795 | + return acc; | |
| 13796 | + }, {}); | |
| 13797 | + const resultOrPromise = validate(value, formValues); | |
| 13798 | + let result; | |
| 13799 | + if (typeof resultOrPromise === "object" && resultOrPromise !== null && "then" in resultOrPromise) { | |
| 13800 | + if (nextState.valid === false) { | |
| 13801 | + publish(nextState, validationErrors); | |
| 13802 | + } else if (validationMode === "onSubmit" || !validityData.state.customError) { | |
| 13803 | + nextState.valid = null; | |
| 13804 | + publish(nextState, validationErrors); | |
| 13805 | + } | |
| 13806 | + result = await resultOrPromise; | |
| 13807 | + if (validationCommitId !== validationCommitIdRef.current) { | |
| 13808 | + return; | |
| 13809 | + } | |
| 13810 | + nextState = refreshState(); | |
| 13811 | + } else { | |
| 13812 | + result = resultOrPromise; | |
| 13813 | + } | |
| 13814 | + validationErrors = result ? [].concat(result).filter(Boolean) : []; | |
| 13815 | + if (validationErrors.length > 0) { | |
| 13816 | + nextState.valid = false; | |
| 13817 | + nextState.customError = true; | |
| 13818 | + if (element?.willValidate) { | |
| 13819 | + setCustomValidity(element, validationErrors.join("\n")); | |
| 13820 | + } | |
| 13821 | + } else { | |
| 13822 | + validationErrors = getNativeErrors(element); | |
| 13823 | + } | |
| 13824 | + } | |
| 13825 | + publish(nextState, validationErrors); | |
| 13826 | + }); | |
| 13827 | + const change = useStableCallback((value, cancelPending = false) => { | |
| 13828 | + timeout.clear(); | |
| 13829 | + validationCommitIdRef.current += 1; | |
| 13830 | + if (cancelPending) { | |
| 13831 | + return; | |
| 13832 | + } | |
| 13833 | + const validateOnChange = shouldValidateOnChange(); | |
| 13834 | + if (validateOnChange && value !== "" && validationDebounceTime) { | |
| 13835 | + timeout.start(validationDebounceTime, () => { | |
| 13836 | + commit(value); | |
| 13837 | + }); | |
| 13838 | + } else { | |
| 13839 | + commit(value, !validateOnChange); | |
| 13840 | + } | |
| 13841 | + }); | |
| 13842 | + const getValidationProps = React87.useCallback((disabled2, externalProps = {}) => mergeProps(getDescriptionProps(externalProps), state.valid === false && !state.disabled && !disabled2 ? { | |
| 13843 | + "aria-invalid": true | |
| 13844 | + } : EMPTY_OBJECT), [getDescriptionProps, state.disabled, state.valid]); | |
| 13845 | + return React87.useMemo(() => ({ | |
| 13846 | + getValidationProps, | |
| 13847 | + inputRef, | |
| 13848 | + registeredInputs, | |
| 13849 | + registerInput, | |
| 13850 | + getInputControl, | |
| 13851 | + commit, | |
| 13852 | + change | |
| 13853 | + }), [getValidationProps, registeredInputs, registerInput, getInputControl, commit, change]); | |
| 13854 | +} | |
| 13855 | + | |
| 13856 | +// node_modules/@base-ui/react/utils/useRegisteredLabelId.mjs | |
| 13857 | +function useRegisteredLabelId(idProp, setLabelId) { | |
| 13858 | + const id = useBaseUiId(idProp); | |
| 13859 | + useIsoLayoutEffect(() => { | |
| 13860 | + setLabelId(id); | |
| 13861 | + return () => { | |
| 13862 | + setLabelId((currentId) => currentId === id ? void 0 : currentId); | |
| 13863 | + }; | |
| 13864 | + }, [id, setLabelId]); | |
| 13865 | + return id; | |
| 13866 | +} | |
| 13867 | + | |
| 13868 | +// node_modules/@base-ui/react/internals/labelable-provider/useLabel.mjs | |
| 13869 | +function useLabel(params = {}) { | |
| 13870 | + const { | |
| 13871 | + id: idProp, | |
| 13872 | + fallbackControlId, | |
| 13873 | + native = false, | |
| 13874 | + setLabelId: setLabelIdProp, | |
| 13875 | + focusControl: focusControlProp | |
| 13876 | + } = params; | |
| 13877 | + const { | |
| 13878 | + controlId: contextControlId, | |
| 13879 | + setLabelId: setContextLabelId | |
| 13880 | + } = useLabelableContext(); | |
| 13881 | + const syncLabelId = useStableCallback((nextLabelId) => { | |
| 13882 | + setContextLabelId(nextLabelId); | |
| 13883 | + setLabelIdProp?.(nextLabelId); | |
| 13884 | + }); | |
| 13885 | + const id = useRegisteredLabelId(idProp, syncLabelId); | |
| 13886 | + const resolvedControlId = contextControlId ?? fallbackControlId; | |
| 13887 | + function focusControl(event) { | |
| 13888 | + if (focusControlProp) { | |
| 13889 | + focusControlProp(event, resolvedControlId); | |
| 13890 | + return; | |
| 13891 | + } | |
| 13892 | + if (!resolvedControlId) { | |
| 13893 | + return; | |
| 13894 | + } | |
| 13895 | + const controlElement = ownerDocument(event.currentTarget).getElementById(resolvedControlId); | |
| 13896 | + if (isHTMLElement(controlElement)) { | |
| 13897 | + focusElementWithVisible(controlElement); | |
| 13898 | + } | |
| 1610 | 13899 | } |
| 1611 | - return shouldCancelScroll; | |
| 13900 | + function handleInteraction(event) { | |
| 13901 | + const target = getTarget(event.nativeEvent); | |
| 13902 | + if (target?.closest("button,input,select,textarea")) { | |
| 13903 | + return; | |
| 13904 | + } | |
| 13905 | + if (!event.defaultPrevented && event.detail > 1) { | |
| 13906 | + event.preventDefault(); | |
| 13907 | + } | |
| 13908 | + if (native) { | |
| 13909 | + return; | |
| 13910 | + } | |
| 13911 | + focusControl(event); | |
| 13912 | + } | |
| 13913 | + return native ? { | |
| 13914 | + id, | |
| 13915 | + htmlFor: resolvedControlId, | |
| 13916 | + onMouseDown: handleInteraction | |
| 13917 | + } : { | |
| 13918 | + id, | |
| 13919 | + onClick: handleInteraction, | |
| 13920 | + onPointerDown(event) { | |
| 13921 | + event.preventDefault(); | |
| 13922 | + } | |
| 13923 | + }; | |
| 13924 | +} | |
| 13925 | +function focusElementWithVisible(element) { | |
| 13926 | + element.focus({ | |
| 13927 | + // Available from Chrome 144+ (January 2026). | |
| 13928 | + // Safari and Firefox already support it. | |
| 13929 | + focusVisible: true | |
| 13930 | + }); | |
| 13931 | +} | |
| 13932 | + | |
| 13933 | +// node_modules/@base-ui/react/utils/usePopupViewport.mjs | |
| 13934 | +var React91 = __toESM(require_react(), 1); | |
| 13935 | +var ReactDOM7 = __toESM(require_react_dom(), 1); | |
| 13936 | + | |
| 13937 | +// node_modules/@base-ui/utils/usePreviousValue.mjs | |
| 13938 | +var React88 = __toESM(require_react(), 1); | |
| 13939 | +function usePreviousValue(value) { | |
| 13940 | + const [state, setState] = React88.useState({ | |
| 13941 | + current: value, | |
| 13942 | + previous: null | |
| 13943 | + }); | |
| 13944 | + if (!Object.is(value, state.current)) { | |
| 13945 | + setState({ | |
| 13946 | + current: value, | |
| 13947 | + previous: state.current | |
| 13948 | + }); | |
| 13949 | + } | |
| 13950 | + return state.previous; | |
| 13951 | +} | |
| 13952 | + | |
| 13953 | +// node_modules/@base-ui/react/utils/usePopupAutoResize.mjs | |
| 13954 | +var React89 = __toESM(require_react(), 1); | |
| 13955 | + | |
| 13956 | +// node_modules/@base-ui/react/utils/getCssDimensions.mjs | |
| 13957 | +function getCssDimensions2(element) { | |
| 13958 | + const css = getComputedStyle2(element); | |
| 13959 | + let width = parseFloat(css.width) || 0; | |
| 13960 | + let height = parseFloat(css.height) || 0; | |
| 13961 | + const hasOffset = isHTMLElement(element); | |
| 13962 | + const offsetWidth = hasOffset ? element.offsetWidth : width; | |
| 13963 | + const offsetHeight = hasOffset ? element.offsetHeight : height; | |
| 13964 | + const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; | |
| 13965 | + if (shouldFallback) { | |
| 13966 | + width = offsetWidth; | |
| 13967 | + height = offsetHeight; | |
| 13968 | + } | |
| 13969 | + return { | |
| 13970 | + width, | |
| 13971 | + height | |
| 13972 | + }; | |
| 13973 | +} | |
| 13974 | + | |
| 13975 | +// node_modules/@base-ui/react/utils/CommonPopupCssVars.mjs | |
| 13976 | +var popupWidth = "--popup-width"; | |
| 13977 | +var popupHeight = "--popup-height"; | |
| 13978 | + | |
| 13979 | +// node_modules/@base-ui/react/utils/usePopupAutoResize.mjs | |
| 13980 | +function usePopupAutoResize(parameters) { | |
| 13981 | + const { | |
| 13982 | + popupElement, | |
| 13983 | + positionerElement, | |
| 13984 | + content, | |
| 13985 | + mounted, | |
| 13986 | + onMeasureLayout: onMeasureLayoutParam, | |
| 13987 | + onMeasureLayoutComplete: onMeasureLayoutCompleteParam, | |
| 13988 | + side, | |
| 13989 | + direction | |
| 13990 | + } = parameters; | |
| 13991 | + const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true); | |
| 13992 | + const animationFrame = useAnimationFrame(); | |
| 13993 | + const committedDimensionsRef = React89.useRef(null); | |
| 13994 | + const isInitialRenderRef = React89.useRef(true); | |
| 13995 | + const restoreAnchoringStylesRef = React89.useRef(NOOP); | |
| 13996 | + const onMeasureLayout = useStableCallback(onMeasureLayoutParam); | |
| 13997 | + const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam); | |
| 13998 | + const anchoringStyles = React89.useMemo(() => getPopupAnchoringStyles(side, direction), [side, direction]); | |
| 13999 | + useIsoLayoutEffect(() => { | |
| 14000 | + if (!mounted) { | |
| 14001 | + restoreAnchoringStylesRef.current = NOOP; | |
| 14002 | + isInitialRenderRef.current = true; | |
| 14003 | + committedDimensionsRef.current = null; | |
| 14004 | + return void 0; | |
| 14005 | + } | |
| 14006 | + if (!popupElement || !positionerElement) { | |
| 14007 | + return void 0; | |
| 14008 | + } | |
| 14009 | + restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles); | |
| 14010 | + setPopupCssSize(popupElement, "auto"); | |
| 14011 | + const restorePopupPosition = overrideElementStyle(popupElement, "position", "static"); | |
| 14012 | + const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none"); | |
| 14013 | + const restorePopupScale = overrideElementStyle(popupElement, "scale", "1"); | |
| 14014 | + const restorePositionerAvailableSize = applyElementStyles(positionerElement, { | |
| 14015 | + [availableWidth]: "max-content", | |
| 14016 | + [availableHeight]: "max-content" | |
| 14017 | + }); | |
| 14018 | + function restoreMeasurementOverrides() { | |
| 14019 | + restorePopupPosition(); | |
| 14020 | + restorePopupTransform(); | |
| 14021 | + restorePositionerAvailableSize(); | |
| 14022 | + } | |
| 14023 | + function restoreMeasurementOverridesIncludingScale() { | |
| 14024 | + restoreMeasurementOverrides(); | |
| 14025 | + restorePopupScale(); | |
| 14026 | + } | |
| 14027 | + onMeasureLayout?.(); | |
| 14028 | + if (isInitialRenderRef.current || committedDimensionsRef.current === null) { | |
| 14029 | + setPositionerCssSize(positionerElement, "max-content"); | |
| 14030 | + const dimensions = getCssDimensions2(popupElement); | |
| 14031 | + committedDimensionsRef.current = dimensions; | |
| 14032 | + setPositionerCssSize(positionerElement, dimensions); | |
| 14033 | + restoreMeasurementOverridesIncludingScale(); | |
| 14034 | + onMeasureLayoutComplete?.(null, dimensions); | |
| 14035 | + isInitialRenderRef.current = false; | |
| 14036 | + return () => { | |
| 14037 | + restoreAnchoringStylesRef.current(); | |
| 14038 | + restoreAnchoringStylesRef.current = NOOP; | |
| 14039 | + }; | |
| 14040 | + } | |
| 14041 | + setPositionerCssSize(positionerElement, "max-content"); | |
| 14042 | + const previousDimensions = committedDimensionsRef.current; | |
| 14043 | + const newDimensions = getCssDimensions2(popupElement); | |
| 14044 | + committedDimensionsRef.current = newDimensions; | |
| 14045 | + setPopupCssSize(popupElement, previousDimensions); | |
| 14046 | + restoreMeasurementOverridesIncludingScale(); | |
| 14047 | + onMeasureLayoutComplete?.(previousDimensions, newDimensions); | |
| 14048 | + setPositionerCssSize(positionerElement, newDimensions); | |
| 14049 | + const abortController = new AbortController(); | |
| 14050 | + animationFrame.request(() => { | |
| 14051 | + setPopupCssSize(popupElement, newDimensions); | |
| 14052 | + runOnceAnimationsFinish(() => { | |
| 14053 | + popupElement.style.setProperty(popupWidth, "auto"); | |
| 14054 | + popupElement.style.setProperty(popupHeight, "auto"); | |
| 14055 | + }, abortController.signal); | |
| 14056 | + }); | |
| 14057 | + return () => { | |
| 14058 | + abortController.abort(); | |
| 14059 | + animationFrame.cancel(); | |
| 14060 | + restoreAnchoringStylesRef.current(); | |
| 14061 | + restoreAnchoringStylesRef.current = NOOP; | |
| 14062 | + }; | |
| 14063 | + }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]); | |
| 14064 | +} | |
| 14065 | +function getPopupAnchoringStyles(side, direction) { | |
| 14066 | + const isPhysicalTop = side === "top"; | |
| 14067 | + const isPhysicalLeft = side === "left" || side === (direction === "rtl" ? "inline-end" : "inline-start"); | |
| 14068 | + if (!isPhysicalTop && !isPhysicalLeft) { | |
| 14069 | + return EMPTY_OBJECT; | |
| 14070 | + } | |
| 14071 | + return { | |
| 14072 | + position: "absolute", | |
| 14073 | + [isPhysicalTop ? "bottom" : "top"]: "0", | |
| 14074 | + [isPhysicalLeft ? "right" : "left"]: "0" | |
| 14075 | + }; | |
| 14076 | +} | |
| 14077 | +function overrideElementStyle(element, property, value) { | |
| 14078 | + const originalValue = element.style.getPropertyValue(property); | |
| 14079 | + element.style.setProperty(property, value); | |
| 14080 | + return () => { | |
| 14081 | + element.style.setProperty(property, originalValue); | |
| 14082 | + }; | |
| 14083 | +} | |
| 14084 | +function applyElementStyles(element, styles) { | |
| 14085 | + const restorers = []; | |
| 14086 | + for (const [key, value] of Object.entries(styles)) { | |
| 14087 | + restorers.push(overrideElementStyle(element, key, value)); | |
| 14088 | + } | |
| 14089 | + return restorers.length ? () => { | |
| 14090 | + restorers.forEach((restore) => restore()); | |
| 14091 | + } : NOOP; | |
| 14092 | +} | |
| 14093 | +function setPopupCssSize(popupElement, size4) { | |
| 14094 | + const width = size4 === "auto" ? "auto" : `${size4.width}px`; | |
| 14095 | + const height = size4 === "auto" ? "auto" : `${size4.height}px`; | |
| 14096 | + popupElement.style.setProperty(popupWidth, width); | |
| 14097 | + popupElement.style.setProperty(popupHeight, height); | |
| 14098 | +} | |
| 14099 | +function setPositionerCssSize(positionerElement, size4) { | |
| 14100 | + const width = size4 === "max-content" ? "max-content" : `${size4.width}px`; | |
| 14101 | + const height = size4 === "max-content" ? "max-content" : `${size4.height}px`; | |
| 14102 | + positionerElement.style.setProperty(positionerWidth, width); | |
| 14103 | + positionerElement.style.setProperty(positionerHeight, height); | |
| 14104 | +} | |
| 14105 | + | |
| 14106 | +// node_modules/@base-ui/react/direction-provider/DirectionProvider.mjs | |
| 14107 | +var React90 = __toESM(require_react(), 1); | |
| 14108 | +var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); | |
| 14109 | +var DirectionProvider = function DirectionProvider2(props) { | |
| 14110 | + const { | |
| 14111 | + direction = "ltr" | |
| 14112 | + } = props; | |
| 14113 | + const contextValue = React90.useMemo(() => ({ | |
| 14114 | + direction | |
| 14115 | + }), [direction]); | |
| 14116 | + return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DirectionContext.Provider, { | |
| 14117 | + value: contextValue, | |
| 14118 | + children: props.children | |
| 14119 | + }); | |
| 1612 | 14120 | }; |
| 14121 | +if (true) DirectionProvider.displayName = "DirectionProvider"; | |
| 1613 | 14122 | |
| 1614 | -// node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/SideEffect.js | |
| 1615 | -var getTouchXY = function(event) { | |
| 1616 | - return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0]; | |
| 14123 | +// node_modules/@base-ui/react/utils/adaptiveOriginMiddleware.mjs | |
| 14124 | +var adaptiveOrigin = { | |
| 14125 | + name: "adaptiveOrigin", | |
| 14126 | + async fn(state) { | |
| 14127 | + const { | |
| 14128 | + x: rawX, | |
| 14129 | + y: rawY, | |
| 14130 | + rects: { | |
| 14131 | + floating: floatRect | |
| 14132 | + }, | |
| 14133 | + elements: { | |
| 14134 | + floating | |
| 14135 | + }, | |
| 14136 | + platform: platform3, | |
| 14137 | + strategy, | |
| 14138 | + placement | |
| 14139 | + } = state; | |
| 14140 | + const win = getWindow(floating); | |
| 14141 | + const styles = win.getComputedStyle(floating); | |
| 14142 | + const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== ""; | |
| 14143 | + if (!hasTransition) { | |
| 14144 | + return { | |
| 14145 | + x: rawX, | |
| 14146 | + y: rawY, | |
| 14147 | + data: DEFAULT_SIDES | |
| 14148 | + }; | |
| 14149 | + } | |
| 14150 | + const offsetParent = await platform3.getOffsetParent?.(floating); | |
| 14151 | + let offsetDimensions = { | |
| 14152 | + width: 0, | |
| 14153 | + height: 0 | |
| 14154 | + }; | |
| 14155 | + if (strategy === "fixed" && win?.visualViewport) { | |
| 14156 | + offsetDimensions = { | |
| 14157 | + width: win.visualViewport.width, | |
| 14158 | + height: win.visualViewport.height | |
| 14159 | + }; | |
| 14160 | + } else if (offsetParent === win) { | |
| 14161 | + const doc = ownerDocument(floating); | |
| 14162 | + offsetDimensions = { | |
| 14163 | + width: doc.documentElement.clientWidth, | |
| 14164 | + height: doc.documentElement.clientHeight | |
| 14165 | + }; | |
| 14166 | + } else if (await platform3.isElement?.(offsetParent)) { | |
| 14167 | + offsetDimensions = await platform3.getDimensions(offsetParent); | |
| 14168 | + } | |
| 14169 | + const currentSide = getSide(placement); | |
| 14170 | + let x = rawX; | |
| 14171 | + let y = rawY; | |
| 14172 | + if (currentSide === "left") { | |
| 14173 | + x = offsetDimensions.width - (rawX + floatRect.width); | |
| 14174 | + } | |
| 14175 | + if (currentSide === "top") { | |
| 14176 | + y = offsetDimensions.height - (rawY + floatRect.height); | |
| 14177 | + } | |
| 14178 | + const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX; | |
| 14179 | + const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY; | |
| 14180 | + return { | |
| 14181 | + x, | |
| 14182 | + y, | |
| 14183 | + data: { | |
| 14184 | + sideX, | |
| 14185 | + sideY | |
| 14186 | + } | |
| 14187 | + }; | |
| 14188 | + } | |
| 1617 | 14189 | }; |
| 1618 | -var getDeltaXY = function(event) { | |
| 1619 | - return [event.deltaX, event.deltaY]; | |
| 14190 | + | |
| 14191 | +// node_modules/@base-ui/react/utils/CommonViewportDataAttributes.mjs | |
| 14192 | +var activationDirection = "data-activation-direction"; | |
| 14193 | + | |
| 14194 | +// node_modules/@base-ui/react/utils/usePopupViewport.mjs | |
| 14195 | +var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); | |
| 14196 | +var popupViewportStateMapping = { | |
| 14197 | + activationDirection: (value) => value ? { | |
| 14198 | + [activationDirection]: value | |
| 14199 | + } : null | |
| 1620 | 14200 | }; |
| 1621 | -var extractRef = function(ref) { | |
| 1622 | - return ref && "current" in ref ? ref.current : ref; | |
| 1623 | -}; | |
| 1624 | -var deltaCompare = function(x, y) { | |
| 1625 | - return x[0] === y[0] && x[1] === y[1]; | |
| 1626 | -}; | |
| 1627 | -var generateStyle = function(id) { | |
| 1628 | - return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n"); | |
| 1629 | -}; | |
| 1630 | -var idCounter = 0; | |
| 1631 | -var lockStack = []; | |
| 1632 | -function RemoveScrollSideCar(props) { | |
| 1633 | - var shouldPreventQueue = React20.useRef([]); | |
| 1634 | - var touchStartRef = React20.useRef([0, 0]); | |
| 1635 | - var activeAxis = React20.useRef(); | |
| 1636 | - var id = React20.useState(idCounter++)[0]; | |
| 1637 | - var Style2 = React20.useState(styleSingleton)[0]; | |
| 1638 | - var lastProps = React20.useRef(props); | |
| 1639 | - React20.useEffect(function() { | |
| 1640 | - lastProps.current = props; | |
| 1641 | - }, [props]); | |
| 1642 | - React20.useEffect(function() { | |
| 1643 | - if (props.inert) { | |
| 1644 | - document.body.classList.add("block-interactivity-".concat(id)); | |
| 1645 | - var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean); | |
| 1646 | - allow_1.forEach(function(el) { | |
| 1647 | - return el.classList.add("allow-interactivity-".concat(id)); | |
| 14201 | +function usePopupViewport(parameters) { | |
| 14202 | + const { | |
| 14203 | + store, | |
| 14204 | + side, | |
| 14205 | + children | |
| 14206 | + } = parameters; | |
| 14207 | + const direction = useDirection(); | |
| 14208 | + const activeTrigger = store.useState("activeTriggerElement"); | |
| 14209 | + const activeTriggerId = store.useState("activeTriggerId"); | |
| 14210 | + const open2 = store.useState("open"); | |
| 14211 | + const payload = store.useState("payload"); | |
| 14212 | + const mounted = store.useState("mounted"); | |
| 14213 | + const popupElement = store.useState("popupElement"); | |
| 14214 | + const positionerElement = store.useState("positionerElement"); | |
| 14215 | + const previousActiveTrigger = usePreviousValue(open2 ? activeTrigger : null); | |
| 14216 | + const currentContentKey = usePopupContentKey(activeTriggerId, payload); | |
| 14217 | + const capturedNodeRef = React91.useRef(null); | |
| 14218 | + const [previousContentNode, setPreviousContentNode] = React91.useState(null); | |
| 14219 | + const [newTriggerOffset, setNewTriggerOffset] = React91.useState(null); | |
| 14220 | + const currentContainerRef = React91.useRef(null); | |
| 14221 | + const previousContainerRef = React91.useRef(null); | |
| 14222 | + const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true); | |
| 14223 | + const cleanupFrame = useAnimationFrame(); | |
| 14224 | + const cleanupControllerRef = React91.useRef(null); | |
| 14225 | + const [previousContentDimensions, setPreviousContentDimensions] = React91.useState(null); | |
| 14226 | + const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React91.useState(false); | |
| 14227 | + useIsoLayoutEffect(() => { | |
| 14228 | + store.set("adaptiveOrigin", adaptiveOrigin); | |
| 14229 | + return () => { | |
| 14230 | + store.set("adaptiveOrigin", void 0); | |
| 14231 | + }; | |
| 14232 | + }, [store]); | |
| 14233 | + const handleMeasureLayout = useStableCallback(() => { | |
| 14234 | + currentContainerRef.current?.style.setProperty("animation", "none"); | |
| 14235 | + currentContainerRef.current?.style.setProperty("transition", "none"); | |
| 14236 | + previousContainerRef.current?.style.setProperty("display", "none"); | |
| 14237 | + }); | |
| 14238 | + const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => { | |
| 14239 | + currentContainerRef.current?.style.removeProperty("animation"); | |
| 14240 | + currentContainerRef.current?.style.removeProperty("transition"); | |
| 14241 | + previousContainerRef.current?.style.removeProperty("display"); | |
| 14242 | + if (previousDimensions) { | |
| 14243 | + setPreviousContentDimensions(previousDimensions); | |
| 14244 | + } | |
| 14245 | + }); | |
| 14246 | + const armViewportCleanup = useStableCallback(() => { | |
| 14247 | + cleanupControllerRef.current?.abort(); | |
| 14248 | + const controller = new AbortController(); | |
| 14249 | + cleanupControllerRef.current = controller; | |
| 14250 | + onAnimationsFinished(() => { | |
| 14251 | + setPreviousContentNode(null); | |
| 14252 | + setPreviousContentDimensions(null); | |
| 14253 | + capturedNodeRef.current = null; | |
| 14254 | + }, controller.signal); | |
| 14255 | + }); | |
| 14256 | + const lastHandledTriggerRef = React91.useRef(null); | |
| 14257 | + useIsoLayoutEffect(() => { | |
| 14258 | + if (!open2 || !mounted) { | |
| 14259 | + lastHandledTriggerRef.current = null; | |
| 14260 | + } | |
| 14261 | + }, [open2, mounted]); | |
| 14262 | + useIsoLayoutEffect(() => { | |
| 14263 | + if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) { | |
| 14264 | + setPreviousContentNode(capturedNodeRef.current); | |
| 14265 | + setShowStartingStyleAttribute(true); | |
| 14266 | + const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger); | |
| 14267 | + setNewTriggerOffset(offset4); | |
| 14268 | + lastHandledTriggerRef.current = activeTrigger; | |
| 14269 | + } | |
| 14270 | + }, [activeTrigger, previousActiveTrigger]); | |
| 14271 | + useIsoLayoutEffect(() => { | |
| 14272 | + if (previousContentNode == null) { | |
| 14273 | + return; | |
| 14274 | + } | |
| 14275 | + cleanupControllerRef.current?.abort(); | |
| 14276 | + setShowStartingStyleAttribute(true); | |
| 14277 | + cleanupFrame.request(() => { | |
| 14278 | + ReactDOM7.flushSync(() => { | |
| 14279 | + setShowStartingStyleAttribute(false); | |
| 1648 | 14280 | }); |
| 1649 | - return function() { | |
| 1650 | - document.body.classList.remove("block-interactivity-".concat(id)); | |
| 1651 | - allow_1.forEach(function(el) { | |
| 1652 | - return el.classList.remove("allow-interactivity-".concat(id)); | |
| 1653 | - }); | |
| 1654 | - }; | |
| 14281 | + armViewportCleanup(); | |
| 14282 | + }); | |
| 14283 | + }, [currentContentKey, previousContentNode, armViewportCleanup, cleanupFrame]); | |
| 14284 | + useIsoLayoutEffect(() => { | |
| 14285 | + const source = currentContainerRef.current; | |
| 14286 | + if (!source) { | |
| 14287 | + return; | |
| 1655 | 14288 | } |
| 1656 | - return; | |
| 1657 | - }, [props.inert, props.lockRef.current, props.shards]); | |
| 1658 | - var shouldCancelEvent = React20.useCallback(function(event, parent) { | |
| 1659 | - if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) { | |
| 1660 | - return !lastProps.current.allowPinchZoom; | |
| 14289 | + const wrapper = ownerDocument(source).createElement("div"); | |
| 14290 | + for (const child of Array.from(source.childNodes)) { | |
| 14291 | + wrapper.appendChild(child.cloneNode(true)); | |
| 1661 | 14292 | } |
| 1662 | - var touch = getTouchXY(event); | |
| 1663 | - var touchStart = touchStartRef.current; | |
| 1664 | - var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0]; | |
| 1665 | - var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1]; | |
| 1666 | - var currentAxis; | |
| 1667 | - var target = event.target; | |
| 1668 | - var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v"; | |
| 1669 | - if ("touches" in event && moveDirection === "h" && target.type === "range") { | |
| 1670 | - return false; | |
| 14293 | + capturedNodeRef.current = wrapper; | |
| 14294 | + }); | |
| 14295 | + const isTransitioning = previousContentNode != null; | |
| 14296 | + let childrenToRender; | |
| 14297 | + if (!isTransitioning) { | |
| 14298 | + childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { | |
| 14299 | + "data-current": true, | |
| 14300 | + ref: currentContainerRef, | |
| 14301 | + children | |
| 14302 | + }, currentContentKey); | |
| 14303 | + } else { | |
| 14304 | + childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(React91.Fragment, { | |
| 14305 | + children: [/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { | |
| 14306 | + "data-previous": true, | |
| 14307 | + inert: inertValue(true), | |
| 14308 | + ref: previousContainerRef, | |
| 14309 | + style: { | |
| 14310 | + ...previousContentDimensions ? { | |
| 14311 | + [popupWidth]: `${previousContentDimensions.width}px`, | |
| 14312 | + [popupHeight]: `${previousContentDimensions.height}px` | |
| 14313 | + } : null, | |
| 14314 | + position: "absolute" | |
| 14315 | + }, | |
| 14316 | + "data-ending-style": showStartingStyleAttribute ? void 0 : "" | |
| 14317 | + }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { | |
| 14318 | + "data-current": true, | |
| 14319 | + ref: currentContainerRef, | |
| 14320 | + "data-starting-style": showStartingStyleAttribute ? "" : void 0, | |
| 14321 | + children | |
| 14322 | + }, currentContentKey)] | |
| 14323 | + }); | |
| 14324 | + } | |
| 14325 | + useIsoLayoutEffect(() => { | |
| 14326 | + const container = previousContainerRef.current; | |
| 14327 | + if (!container || !previousContentNode) { | |
| 14328 | + return; | |
| 1671 | 14329 | } |
| 1672 | - var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target); | |
| 1673 | - if (!canBeScrolledInMainDirection) { | |
| 1674 | - return true; | |
| 14330 | + container.replaceChildren(...Array.from(previousContentNode.childNodes)); | |
| 14331 | + }, [previousContentNode]); | |
| 14332 | + usePopupAutoResize({ | |
| 14333 | + popupElement, | |
| 14334 | + positionerElement, | |
| 14335 | + mounted, | |
| 14336 | + content: payload, | |
| 14337 | + onMeasureLayout: handleMeasureLayout, | |
| 14338 | + onMeasureLayoutComplete: handleMeasureLayoutComplete, | |
| 14339 | + side, | |
| 14340 | + direction | |
| 14341 | + }); | |
| 14342 | + const state = { | |
| 14343 | + activationDirection: getActivationDirection(newTriggerOffset), | |
| 14344 | + transitioning: isTransitioning | |
| 14345 | + }; | |
| 14346 | + return { | |
| 14347 | + children: childrenToRender, | |
| 14348 | + state | |
| 14349 | + }; | |
| 14350 | +} | |
| 14351 | +function getActivationDirection(offset4) { | |
| 14352 | + if (!offset4) { | |
| 14353 | + return void 0; | |
| 14354 | + } | |
| 14355 | + return `${getValueWithTolerance(offset4.horizontal, 5, "right", "left")} ${getValueWithTolerance(offset4.vertical, 5, "down", "up")}`; | |
| 14356 | +} | |
| 14357 | +function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) { | |
| 14358 | + if (value > tolerance) { | |
| 14359 | + return positiveLabel; | |
| 14360 | + } | |
| 14361 | + if (value < -tolerance) { | |
| 14362 | + return negativeLabel; | |
| 14363 | + } | |
| 14364 | + return ""; | |
| 14365 | +} | |
| 14366 | +function calculateRelativePosition(from, to) { | |
| 14367 | + const fromRect = from.getBoundingClientRect(); | |
| 14368 | + const toRect = to.getBoundingClientRect(); | |
| 14369 | + const fromCenter = { | |
| 14370 | + x: fromRect.left + fromRect.width / 2, | |
| 14371 | + y: fromRect.top + fromRect.height / 2 | |
| 14372 | + }; | |
| 14373 | + const toCenter = { | |
| 14374 | + x: toRect.left + toRect.width / 2, | |
| 14375 | + y: toRect.top + toRect.height / 2 | |
| 14376 | + }; | |
| 14377 | + return { | |
| 14378 | + horizontal: toCenter.x - fromCenter.x, | |
| 14379 | + vertical: toCenter.y - fromCenter.y | |
| 14380 | + }; | |
| 14381 | +} | |
| 14382 | +function usePopupContentKey(activeTriggerId, payload) { | |
| 14383 | + const [contentKey, setContentKey] = React91.useState(0); | |
| 14384 | + const previousActiveTriggerIdRef = React91.useRef(activeTriggerId); | |
| 14385 | + const previousPayloadRef = React91.useRef(payload); | |
| 14386 | + const pendingPayloadUpdateRef = React91.useRef(false); | |
| 14387 | + useIsoLayoutEffect(() => { | |
| 14388 | + const previousActiveTriggerId = previousActiveTriggerIdRef.current; | |
| 14389 | + const previousPayload = previousPayloadRef.current; | |
| 14390 | + const triggerIdChanged = activeTriggerId !== previousActiveTriggerId; | |
| 14391 | + const payloadChanged = payload !== previousPayload; | |
| 14392 | + if (triggerIdChanged) { | |
| 14393 | + setContentKey((value) => value + 1); | |
| 14394 | + pendingPayloadUpdateRef.current = !payloadChanged; | |
| 14395 | + } else if (pendingPayloadUpdateRef.current && payloadChanged) { | |
| 14396 | + setContentKey((value) => value + 1); | |
| 14397 | + pendingPayloadUpdateRef.current = false; | |
| 1675 | 14398 | } |
| 1676 | - if (canBeScrolledInMainDirection) { | |
| 1677 | - currentAxis = moveDirection; | |
| 14399 | + previousActiveTriggerIdRef.current = activeTriggerId; | |
| 14400 | + previousPayloadRef.current = payload; | |
| 14401 | + }, [activeTriggerId, payload]); | |
| 14402 | + return `${activeTriggerId ?? "current"}-${contentKey}`; | |
| 14403 | +} | |
| 14404 | + | |
| 14405 | +// node_modules/@base-ui/react/field/index.parts.mjs | |
| 14406 | +var index_parts_exports2 = {}; | |
| 14407 | +__export(index_parts_exports2, { | |
| 14408 | + Control: () => FieldControl, | |
| 14409 | + Description: () => FieldDescription, | |
| 14410 | + Error: () => FieldError, | |
| 14411 | + Item: () => FieldItem, | |
| 14412 | + Label: () => FieldLabel, | |
| 14413 | + Root: () => FieldRoot, | |
| 14414 | + Validity: () => FieldValidity | |
| 14415 | +}); | |
| 14416 | + | |
| 14417 | +// node_modules/@base-ui/react/field/root/FieldRoot.mjs | |
| 14418 | +var React95 = __toESM(require_react(), 1); | |
| 14419 | + | |
| 14420 | +// node_modules/@base-ui/react/fieldset/root/FieldsetRootContext.mjs | |
| 14421 | +var React92 = __toESM(require_react(), 1); | |
| 14422 | +var FieldsetRootContext = /* @__PURE__ */ React92.createContext(void 0); | |
| 14423 | +if (true) FieldsetRootContext.displayName = "FieldsetRootContext"; | |
| 14424 | +function useFieldsetRootContext(optional = false) { | |
| 14425 | + const context = React92.useContext(FieldsetRootContext); | |
| 14426 | + if (!context && !optional) { | |
| 14427 | + throw new Error(true ? "Base UI: FieldsetRootContext is missing. Fieldset parts must be placed within <Fieldset.Root>." : formatErrorMessage_default(86)); | |
| 14428 | + } | |
| 14429 | + return context; | |
| 14430 | +} | |
| 14431 | + | |
| 14432 | +// node_modules/@base-ui/react/internals/labelable-provider/LabelableProvider.mjs | |
| 14433 | +var React93 = __toESM(require_react(), 1); | |
| 14434 | +var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); | |
| 14435 | +var LabelableProvider = function LabelableProvider2(props) { | |
| 14436 | + const defaultId = useBaseUiId(); | |
| 14437 | + const [controlIdState, setControlIdState] = React93.useState(defaultId); | |
| 14438 | + const [labelId, setLabelId] = React93.useState(); | |
| 14439 | + const [messageIds, setMessageIds] = React93.useState([]); | |
| 14440 | + const controlId = controlIdState === void 0 ? defaultId : controlIdState; | |
| 14441 | + const registrationsRef = useRefWithInit(() => /* @__PURE__ */ new Map()); | |
| 14442 | + const { | |
| 14443 | + messageIds: parentMessageIds | |
| 14444 | + } = useLabelableContext(); | |
| 14445 | + const registerControlId = useStableCallback((source, nextId) => { | |
| 14446 | + const registrations = registrationsRef.current; | |
| 14447 | + if (nextId === void 0) { | |
| 14448 | + registrations.delete(source); | |
| 1678 | 14449 | } else { |
| 1679 | - currentAxis = moveDirection === "v" ? "h" : "v"; | |
| 1680 | - canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target); | |
| 14450 | + registrations.set(source, nextId); | |
| 1681 | 14451 | } |
| 1682 | - if (!canBeScrolledInMainDirection) { | |
| 1683 | - return false; | |
| 14452 | + setControlIdState((prev) => { | |
| 14453 | + if (registrations.size === 0) { | |
| 14454 | + return prev; | |
| 14455 | + } | |
| 14456 | + let nextControlId; | |
| 14457 | + for (const id of registrations.values()) { | |
| 14458 | + if (id === prev) { | |
| 14459 | + return prev; | |
| 14460 | + } | |
| 14461 | + if (nextControlId === void 0) { | |
| 14462 | + nextControlId = id; | |
| 14463 | + } | |
| 14464 | + } | |
| 14465 | + return nextControlId; | |
| 14466 | + }); | |
| 14467 | + }); | |
| 14468 | + const resetControlId = useStableCallback(() => { | |
| 14469 | + if (registrationsRef.current.size === 0) { | |
| 14470 | + setControlIdState(defaultId); | |
| 1684 | 14471 | } |
| 1685 | - if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) { | |
| 1686 | - activeAxis.current = currentAxis; | |
| 14472 | + }); | |
| 14473 | + const getDescriptionProps = React93.useCallback((externalProps) => { | |
| 14474 | + const ids = externalProps["aria-describedby"] ? externalProps["aria-describedby"].split(" ") : []; | |
| 14475 | + ids.push(...parentMessageIds, ...messageIds); | |
| 14476 | + return { | |
| 14477 | + ...externalProps, | |
| 14478 | + "aria-describedby": Array.from(new Set(ids)).join(" ") || void 0 | |
| 14479 | + }; | |
| 14480 | + }, [parentMessageIds, messageIds]); | |
| 14481 | + const contextValue = React93.useMemo(() => ({ | |
| 14482 | + controlId, | |
| 14483 | + registerControlId, | |
| 14484 | + resetControlId, | |
| 14485 | + labelId, | |
| 14486 | + setLabelId, | |
| 14487 | + messageIds, | |
| 14488 | + setMessageIds, | |
| 14489 | + getDescriptionProps | |
| 14490 | + }), [controlId, registerControlId, resetControlId, labelId, setLabelId, messageIds, setMessageIds, getDescriptionProps]); | |
| 14491 | + return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(LabelableContext.Provider, { | |
| 14492 | + value: contextValue, | |
| 14493 | + children: props.children | |
| 14494 | + }); | |
| 14495 | +}; | |
| 14496 | +if (true) LabelableProvider.displayName = "LabelableProvider"; | |
| 14497 | + | |
| 14498 | +// node_modules/@base-ui/react/internals/field-register-control/useFieldControlRegistration.mjs | |
| 14499 | +var React94 = __toESM(require_react(), 1); | |
| 14500 | +function useFieldControlRegistration(params) { | |
| 14501 | + const { | |
| 14502 | + change, | |
| 14503 | + commit, | |
| 14504 | + invalid: invalid2, | |
| 14505 | + markedDirtyRef, | |
| 14506 | + name, | |
| 14507 | + setRegisteredFieldName, | |
| 14508 | + registeredFieldIdRef, | |
| 14509 | + setValidityData, | |
| 14510 | + validityData | |
| 14511 | + } = params; | |
| 14512 | + const { | |
| 14513 | + formRef | |
| 14514 | + } = useFormContext(); | |
| 14515 | + const activeFieldControlSourceRef = React94.useRef(null); | |
| 14516 | + const registrationRef = React94.useRef(null); | |
| 14517 | + const initialValueCapturedRef = React94.useRef(false); | |
| 14518 | + const getValueForForm = useStableCallback(() => { | |
| 14519 | + const registration = registrationRef.current; | |
| 14520 | + if (!registration) { | |
| 14521 | + return void 0; | |
| 1687 | 14522 | } |
| 1688 | - if (!currentAxis) { | |
| 1689 | - return true; | |
| 14523 | + if (registration.getValue) { | |
| 14524 | + return registration.getValue(); | |
| 1690 | 14525 | } |
| 1691 | - var cancelingAxis = activeAxis.current || currentAxis; | |
| 1692 | - return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY, true); | |
| 1693 | - }, []); | |
| 1694 | - var shouldPrevent = React20.useCallback(function(_event) { | |
| 1695 | - var event = _event; | |
| 1696 | - if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) { | |
| 14526 | + return registration.value; | |
| 14527 | + }); | |
| 14528 | + function getRegistrationValue(registration) { | |
| 14529 | + return registration.value === void 0 ? getValueForForm() : registration.value; | |
| 14530 | + } | |
| 14531 | + const validate = useStableCallback(() => { | |
| 14532 | + const registration = registrationRef.current; | |
| 14533 | + markedDirtyRef.current = true; | |
| 14534 | + if (!registration) { | |
| 14535 | + commit(validityData.value); | |
| 1697 | 14536 | return; |
| 1698 | 14537 | } |
| 1699 | - var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event); | |
| 1700 | - var sourceEvent = shouldPreventQueue.current.filter(function(e) { | |
| 1701 | - return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta); | |
| 1702 | - })[0]; | |
| 1703 | - if (sourceEvent && sourceEvent.should) { | |
| 1704 | - if (event.cancelable) { | |
| 1705 | - event.preventDefault(); | |
| 14538 | + commit(getRegistrationValue(registration)); | |
| 14539 | + }); | |
| 14540 | + function refreshRegistration() { | |
| 14541 | + const registration = registrationRef.current; | |
| 14542 | + if (!registration || !registration.id) { | |
| 14543 | + return; | |
| 14544 | + } | |
| 14545 | + formRef.current.fields.set(registration.id, { | |
| 14546 | + getValue: getValueForForm, | |
| 14547 | + name: name ?? registration.name, | |
| 14548 | + controlRef: registration.controlRef, | |
| 14549 | + validityData: getCombinedFieldValidityData(validityData, invalid2), | |
| 14550 | + validate | |
| 14551 | + }); | |
| 14552 | + } | |
| 14553 | + function deleteRegistration(id = registrationRef.current?.id) { | |
| 14554 | + if (id) { | |
| 14555 | + formRef.current.fields.delete(id); | |
| 14556 | + } | |
| 14557 | + } | |
| 14558 | + function captureInitialValue(registration) { | |
| 14559 | + if (initialValueCapturedRef.current) { | |
| 14560 | + return; | |
| 14561 | + } | |
| 14562 | + initialValueCapturedRef.current = true; | |
| 14563 | + const initialValue = getRegistrationValue(registration); | |
| 14564 | + setValidityData((prev) => prev.initialValue === initialValue ? prev : { | |
| 14565 | + ...prev, | |
| 14566 | + initialValue | |
| 14567 | + }); | |
| 14568 | + } | |
| 14569 | + useIsoLayoutEffect(() => { | |
| 14570 | + const registration = registrationRef.current; | |
| 14571 | + if (!registration || !registration.id) { | |
| 14572 | + return; | |
| 14573 | + } | |
| 14574 | + setRegisteredFieldName(name ? void 0 : registration.name); | |
| 14575 | + formRef.current.fields.set(registration.id, { | |
| 14576 | + getValue: getValueForForm, | |
| 14577 | + name: name ?? registration.name, | |
| 14578 | + controlRef: registration.controlRef, | |
| 14579 | + validityData: getCombinedFieldValidityData(validityData, invalid2), | |
| 14580 | + validate | |
| 14581 | + }); | |
| 14582 | + }, [formRef, getValueForForm, invalid2, name, setRegisteredFieldName, validate, validityData]); | |
| 14583 | + useIsoLayoutEffect(() => { | |
| 14584 | + const fields = formRef.current.fields; | |
| 14585 | + return () => { | |
| 14586 | + const id = registrationRef.current?.id; | |
| 14587 | + if (id) { | |
| 14588 | + fields.delete(id); | |
| 1706 | 14589 | } |
| 14590 | + }; | |
| 14591 | + }, [formRef]); | |
| 14592 | + const register2 = useStableCallback((source, registration) => { | |
| 14593 | + if (!registration) { | |
| 14594 | + if (activeFieldControlSourceRef.current === source) { | |
| 14595 | + activeFieldControlSourceRef.current = null; | |
| 14596 | + change(void 0, true); | |
| 14597 | + deleteRegistration(); | |
| 14598 | + registrationRef.current = null; | |
| 14599 | + setRegisteredFieldName(void 0); | |
| 14600 | + registeredFieldIdRef.current = void 0; | |
| 14601 | + } | |
| 1707 | 14602 | return; |
| 1708 | 14603 | } |
| 1709 | - if (!sourceEvent) { | |
| 1710 | - var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node) { | |
| 1711 | - return node.contains(event.target); | |
| 1712 | - }); | |
| 1713 | - var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation; | |
| 1714 | - if (shouldStop) { | |
| 1715 | - if (event.cancelable) { | |
| 1716 | - event.preventDefault(); | |
| 14604 | + const previousId = registrationRef.current?.id; | |
| 14605 | + const previousSource = activeFieldControlSourceRef.current; | |
| 14606 | + if (previousSource && previousSource !== source) { | |
| 14607 | + change(void 0, true); | |
| 14608 | + } | |
| 14609 | + activeFieldControlSourceRef.current = source; | |
| 14610 | + registrationRef.current = registration; | |
| 14611 | + if (!name) { | |
| 14612 | + setRegisteredFieldName(registration.name); | |
| 14613 | + } | |
| 14614 | + registeredFieldIdRef.current = registration.id; | |
| 14615 | + if (previousId && previousId !== registration.id) { | |
| 14616 | + deleteRegistration(previousId); | |
| 14617 | + } | |
| 14618 | + captureInitialValue(registration); | |
| 14619 | + refreshRegistration(); | |
| 14620 | + }); | |
| 14621 | + return [validate, register2]; | |
| 14622 | +} | |
| 14623 | + | |
| 14624 | +// node_modules/@base-ui/react/field/root/FieldRoot.mjs | |
| 14625 | +var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); | |
| 14626 | +var FieldRootInner = /* @__PURE__ */ React95.forwardRef(function FieldRootInner2(componentProps, forwardedRef) { | |
| 14627 | + const { | |
| 14628 | + errors, | |
| 14629 | + validationMode: formValidationMode, | |
| 14630 | + submitCountRef | |
| 14631 | + } = useFormContext(); | |
| 14632 | + const { | |
| 14633 | + render, | |
| 14634 | + className, | |
| 14635 | + validate: validateProp, | |
| 14636 | + validationDebounceTime = 0, | |
| 14637 | + validationMode = formValidationMode, | |
| 14638 | + name, | |
| 14639 | + disabled: disabledProp = false, | |
| 14640 | + invalid: invalidProp, | |
| 14641 | + dirty: dirtyProp, | |
| 14642 | + touched: touchedProp, | |
| 14643 | + actionsRef, | |
| 14644 | + style, | |
| 14645 | + ...elementProps | |
| 14646 | + } = componentProps; | |
| 14647 | + const disabledFieldset = useFieldsetRootContext(true)?.disabled; | |
| 14648 | + const validate = useStableCallback(validateProp || (() => null)); | |
| 14649 | + const disabled2 = disabledFieldset || disabledProp; | |
| 14650 | + const [touchedState, setTouchedUnwrapped] = React95.useState(false); | |
| 14651 | + const [dirtyState, setDirtyUnwrapped] = React95.useState(false); | |
| 14652 | + const [filled, setFilled] = React95.useState(false); | |
| 14653 | + const [focused, setFocused] = React95.useState(false); | |
| 14654 | + const dirty = dirtyProp ?? dirtyState; | |
| 14655 | + const touched = touchedProp ?? touchedState; | |
| 14656 | + const markedDirtyRef = React95.useRef(dirty); | |
| 14657 | + const registeredFieldIdRef = React95.useRef(void 0); | |
| 14658 | + const [registeredFieldName, setRegisteredFieldName] = React95.useState(); | |
| 14659 | + const effectiveName = name ?? registeredFieldName; | |
| 14660 | + useIsoLayoutEffect(() => { | |
| 14661 | + if (dirtyProp !== void 0) { | |
| 14662 | + markedDirtyRef.current = dirtyProp; | |
| 14663 | + } | |
| 14664 | + }, [dirtyProp]); | |
| 14665 | + const setDirty = useStableCallback((value) => { | |
| 14666 | + if (dirtyProp !== void 0) { | |
| 14667 | + return; | |
| 14668 | + } | |
| 14669 | + if (value) { | |
| 14670 | + markedDirtyRef.current = true; | |
| 14671 | + } | |
| 14672 | + setDirtyUnwrapped(value); | |
| 14673 | + }); | |
| 14674 | + const setTouched = useStableCallback((value) => { | |
| 14675 | + if (touchedProp !== void 0) { | |
| 14676 | + return; | |
| 14677 | + } | |
| 14678 | + setTouchedUnwrapped(value); | |
| 14679 | + }); | |
| 14680 | + const shouldValidateOnChange = useStableCallback(() => validationMode === "onChange" || validationMode === "onSubmit" && submitCountRef.current > 0); | |
| 14681 | + const formError = effectiveName && Object.hasOwn(errors, effectiveName) ? errors[effectiveName] : null; | |
| 14682 | + const hasFormError = !!(Array.isArray(formError) ? formError.length : formError); | |
| 14683 | + const invalid2 = invalidProp === true || hasFormError; | |
| 14684 | + const [validityData, setValidityData] = React95.useState({ | |
| 14685 | + state: DEFAULT_VALIDITY_STATE, | |
| 14686 | + error: "", | |
| 14687 | + errors: [], | |
| 14688 | + value: null, | |
| 14689 | + initialValue: null | |
| 14690 | + }); | |
| 14691 | + const valid2 = !invalid2 && (disabled2 ? null : validityData.state.valid); | |
| 14692 | + const state = React95.useMemo(() => ({ | |
| 14693 | + disabled: disabled2, | |
| 14694 | + touched, | |
| 14695 | + dirty, | |
| 14696 | + valid: valid2, | |
| 14697 | + filled, | |
| 14698 | + focused | |
| 14699 | + }), [disabled2, touched, dirty, valid2, filled, focused]); | |
| 14700 | + const validation = useFieldValidation({ | |
| 14701 | + setValidityData, | |
| 14702 | + validate, | |
| 14703 | + validityData, | |
| 14704 | + validationDebounceTime, | |
| 14705 | + invalid: invalid2, | |
| 14706 | + markedDirtyRef, | |
| 14707 | + state, | |
| 14708 | + shouldValidateOnChange, | |
| 14709 | + validationMode, | |
| 14710 | + registeredFieldIdRef | |
| 14711 | + }); | |
| 14712 | + const [validateFieldControl, registerFieldControl] = useFieldControlRegistration({ | |
| 14713 | + change: validation.change, | |
| 14714 | + commit: validation.commit, | |
| 14715 | + invalid: invalid2, | |
| 14716 | + markedDirtyRef, | |
| 14717 | + name, | |
| 14718 | + setRegisteredFieldName, | |
| 14719 | + registeredFieldIdRef, | |
| 14720 | + setValidityData, | |
| 14721 | + validityData | |
| 14722 | + }); | |
| 14723 | + React95.useImperativeHandle(actionsRef, () => ({ | |
| 14724 | + validate: validateFieldControl | |
| 14725 | + }), [validateFieldControl]); | |
| 14726 | + const contextValue = React95.useMemo(() => ({ | |
| 14727 | + invalid: invalid2, | |
| 14728 | + name: effectiveName, | |
| 14729 | + validityData, | |
| 14730 | + setValidityData, | |
| 14731 | + disabled: disabled2, | |
| 14732 | + setTouched, | |
| 14733 | + setDirty, | |
| 14734 | + setFilled, | |
| 14735 | + setFocused, | |
| 14736 | + validationMode, | |
| 14737 | + shouldValidateOnChange, | |
| 14738 | + state, | |
| 14739 | + registerFieldControl, | |
| 14740 | + validation | |
| 14741 | + }), [invalid2, effectiveName, validityData, disabled2, setTouched, setDirty, setFilled, setFocused, validationMode, shouldValidateOnChange, state, registerFieldControl, validation]); | |
| 14742 | + const element = useRenderElement("div", componentProps, { | |
| 14743 | + ref: forwardedRef, | |
| 14744 | + state, | |
| 14745 | + props: elementProps, | |
| 14746 | + stateAttributesMapping: fieldValidityMapping | |
| 14747 | + }); | |
| 14748 | + return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FieldRootContext.Provider, { | |
| 14749 | + value: contextValue, | |
| 14750 | + children: element | |
| 14751 | + }); | |
| 14752 | +}); | |
| 14753 | +if (true) FieldRootInner.displayName = "FieldRootInner"; | |
| 14754 | +var FieldRoot = /* @__PURE__ */ React95.forwardRef(function FieldRoot2(componentProps, forwardedRef) { | |
| 14755 | + return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(LabelableProvider, { | |
| 14756 | + children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FieldRootInner, { | |
| 14757 | + ...componentProps, | |
| 14758 | + ref: forwardedRef | |
| 14759 | + }) | |
| 14760 | + }); | |
| 14761 | +}); | |
| 14762 | +if (true) FieldRoot.displayName = "FieldRoot"; | |
| 14763 | + | |
| 14764 | +// node_modules/@base-ui/react/field/label/FieldLabel.mjs | |
| 14765 | +var React96 = __toESM(require_react(), 1); | |
| 14766 | +var FieldLabel = /* @__PURE__ */ React96.forwardRef(function FieldLabel2(componentProps, forwardedRef) { | |
| 14767 | + const { | |
| 14768 | + render, | |
| 14769 | + className, | |
| 14770 | + style, | |
| 14771 | + id: idProp, | |
| 14772 | + nativeLabel = true, | |
| 14773 | + ...elementProps | |
| 14774 | + } = componentProps; | |
| 14775 | + const fieldRootContext = useFieldRootContext(false); | |
| 14776 | + const fieldItemContext = useFieldItemContext(); | |
| 14777 | + const { | |
| 14778 | + labelId | |
| 14779 | + } = useLabelableContext(); | |
| 14780 | + const state = { | |
| 14781 | + ...fieldRootContext.state, | |
| 14782 | + disabled: fieldRootContext.disabled || fieldItemContext.disabled | |
| 14783 | + }; | |
| 14784 | + const labelRef = React96.useRef(null); | |
| 14785 | + const labelProps = useLabel({ | |
| 14786 | + id: labelId ?? idProp, | |
| 14787 | + native: nativeLabel | |
| 14788 | + }); | |
| 14789 | + if (true) { | |
| 14790 | + React96.useEffect(() => { | |
| 14791 | + if (!labelRef.current) { | |
| 14792 | + return; | |
| 14793 | + } | |
| 14794 | + const isLabelTag = labelRef.current.tagName === "LABEL"; | |
| 14795 | + if (nativeLabel) { | |
| 14796 | + if (!isLabelTag) { | |
| 14797 | + const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; | |
| 14798 | + const message = "<Field.Label> expected a <label> element because the `nativeLabel` prop is true. Rendering a non-<label> disables native label association, so `htmlFor` will not work. Use a real <label> in the `render` prop, or set `nativeLabel` to `false`."; | |
| 14799 | + error(`${message}${ownerStackMessage}`); | |
| 1717 | 14800 | } |
| 14801 | + } else if (isLabelTag) { | |
| 14802 | + const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; | |
| 14803 | + const message = "<Field.Label> expected a non-<label> element because the `nativeLabel` prop is false. Rendering a <label> assumes native label behavior while Base UI treats it as non-native, which can cause unexpected pointer behavior. Use a non-<label> in the `render` prop, or set `nativeLabel` to `true`."; | |
| 14804 | + error(`${message}${ownerStackMessage}`); | |
| 1718 | 14805 | } |
| 14806 | + }, [nativeLabel]); | |
| 14807 | + } | |
| 14808 | + const element = useRenderElement("label", componentProps, { | |
| 14809 | + ref: [forwardedRef, labelRef], | |
| 14810 | + state, | |
| 14811 | + props: [labelProps, elementProps], | |
| 14812 | + stateAttributesMapping: fieldValidityMapping | |
| 14813 | + }); | |
| 14814 | + return element; | |
| 14815 | +}); | |
| 14816 | +if (true) FieldLabel.displayName = "FieldLabel"; | |
| 14817 | + | |
| 14818 | +// node_modules/@base-ui/react/field/error/FieldError.mjs | |
| 14819 | +var React97 = __toESM(require_react(), 1); | |
| 14820 | +var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); | |
| 14821 | +var stateAttributesMapping4 = { | |
| 14822 | + ...fieldValidityMapping, | |
| 14823 | + ...transitionStatusMapping | |
| 14824 | +}; | |
| 14825 | +var FieldError = /* @__PURE__ */ React97.forwardRef(function FieldError2(componentProps, forwardedRef) { | |
| 14826 | + const { | |
| 14827 | + render, | |
| 14828 | + id: idProp, | |
| 14829 | + className, | |
| 14830 | + match, | |
| 14831 | + style, | |
| 14832 | + ...elementProps | |
| 14833 | + } = componentProps; | |
| 14834 | + const id = useBaseUiId(idProp); | |
| 14835 | + const { | |
| 14836 | + validityData, | |
| 14837 | + state: fieldState, | |
| 14838 | + name | |
| 14839 | + } = useFieldRootContext(false); | |
| 14840 | + const { | |
| 14841 | + setMessageIds | |
| 14842 | + } = useLabelableContext(); | |
| 14843 | + const { | |
| 14844 | + errors | |
| 14845 | + } = useFormContext(); | |
| 14846 | + const formError = name && Object.hasOwn(errors, name) ? errors[name] : null; | |
| 14847 | + const hasFormError = !!(Array.isArray(formError) ? formError.length : formError); | |
| 14848 | + const hasSpecificMatch = typeof match === "string"; | |
| 14849 | + let rendered = false; | |
| 14850 | + if (match === true) { | |
| 14851 | + rendered = true; | |
| 14852 | + } else if (fieldState.disabled) { | |
| 14853 | + rendered = false; | |
| 14854 | + } else if (hasSpecificMatch) { | |
| 14855 | + rendered = Boolean(validityData.state[match]); | |
| 14856 | + } else { | |
| 14857 | + rendered = hasFormError || validityData.state.valid === false; | |
| 14858 | + } | |
| 14859 | + const { | |
| 14860 | + mounted, | |
| 14861 | + transitionStatus, | |
| 14862 | + setMounted | |
| 14863 | + } = useTransitionStatus(rendered); | |
| 14864 | + useIsoLayoutEffect(() => { | |
| 14865 | + if (!rendered || !id) { | |
| 14866 | + return void 0; | |
| 1719 | 14867 | } |
| 1720 | - }, []); | |
| 1721 | - var shouldCancel = React20.useCallback(function(name, delta, target, should) { | |
| 1722 | - var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) }; | |
| 1723 | - shouldPreventQueue.current.push(event); | |
| 1724 | - setTimeout(function() { | |
| 1725 | - shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) { | |
| 1726 | - return e !== event; | |
| 1727 | - }); | |
| 1728 | - }, 1); | |
| 1729 | - }, []); | |
| 1730 | - var scrollTouchStart = React20.useCallback(function(event) { | |
| 1731 | - touchStartRef.current = getTouchXY(event); | |
| 1732 | - activeAxis.current = void 0; | |
| 1733 | - }, []); | |
| 1734 | - var scrollWheel = React20.useCallback(function(event) { | |
| 1735 | - shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current)); | |
| 1736 | - }, []); | |
| 1737 | - var scrollTouchMove = React20.useCallback(function(event) { | |
| 1738 | - shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current)); | |
| 1739 | - }, []); | |
| 1740 | - React20.useEffect(function() { | |
| 1741 | - lockStack.push(Style2); | |
| 1742 | - props.setCallbacks({ | |
| 1743 | - onScrollCapture: scrollWheel, | |
| 1744 | - onWheelCapture: scrollWheel, | |
| 1745 | - onTouchMoveCapture: scrollTouchMove | |
| 1746 | - }); | |
| 1747 | - document.addEventListener("wheel", shouldPrevent, nonPassive); | |
| 1748 | - document.addEventListener("touchmove", shouldPrevent, nonPassive); | |
| 1749 | - document.addEventListener("touchstart", scrollTouchStart, nonPassive); | |
| 1750 | - return function() { | |
| 1751 | - lockStack = lockStack.filter(function(inst) { | |
| 1752 | - return inst !== Style2; | |
| 1753 | - }); | |
| 1754 | - document.removeEventListener("wheel", shouldPrevent, nonPassive); | |
| 1755 | - document.removeEventListener("touchmove", shouldPrevent, nonPassive); | |
| 1756 | - document.removeEventListener("touchstart", scrollTouchStart, nonPassive); | |
| 14868 | + setMessageIds((v) => v.concat(id)); | |
| 14869 | + return () => { | |
| 14870 | + setMessageIds((v) => v.filter((item) => item !== id)); | |
| 1757 | 14871 | }; |
| 1758 | - }, []); | |
| 1759 | - var removeScrollBar = props.removeScrollBar, inert = props.inert; | |
| 1760 | - return React20.createElement( | |
| 1761 | - React20.Fragment, | |
| 1762 | - null, | |
| 1763 | - inert ? React20.createElement(Style2, { styles: generateStyle(id) }) : null, | |
| 1764 | - removeScrollBar ? React20.createElement(RemoveScrollBar, { noRelative: props.noRelative, gapMode: props.gapMode }) : null | |
| 1765 | - ); | |
| 1766 | -} | |
| 1767 | -function getOutermostShadowParent(node) { | |
| 1768 | - var shadowParent = null; | |
| 1769 | - while (node !== null) { | |
| 1770 | - if (node instanceof ShadowRoot) { | |
| 1771 | - shadowParent = node.host; | |
| 1772 | - node = node.host; | |
| 14872 | + }, [rendered, id, setMessageIds]); | |
| 14873 | + const errorRef = React97.useRef(null); | |
| 14874 | + const [lastRenderedMessage, setLastRenderedMessage] = React97.useState(null); | |
| 14875 | + const [lastRenderedMessageKey, setLastRenderedMessageKey] = React97.useState(null); | |
| 14876 | + let error2 = validityData.error; | |
| 14877 | + if (!hasSpecificMatch && hasFormError) { | |
| 14878 | + error2 = formError; | |
| 14879 | + } else if (validityData.errors.length > 1) { | |
| 14880 | + error2 = validityData.errors; | |
| 14881 | + } | |
| 14882 | + let errorMessage = error2; | |
| 14883 | + if (Array.isArray(error2)) { | |
| 14884 | + errorMessage = error2.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("ul", { | |
| 14885 | + children: error2.map((message) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("li", { | |
| 14886 | + children: message | |
| 14887 | + }, message)) | |
| 14888 | + }) : error2[0]; | |
| 14889 | + } | |
| 14890 | + const errorKey = Array.isArray(error2) ? JSON.stringify(error2) : error2; | |
| 14891 | + if (rendered && errorKey !== lastRenderedMessageKey) { | |
| 14892 | + setLastRenderedMessageKey(errorKey); | |
| 14893 | + setLastRenderedMessage(errorMessage); | |
| 14894 | + } | |
| 14895 | + useOpenChangeComplete({ | |
| 14896 | + open: rendered, | |
| 14897 | + ref: errorRef, | |
| 14898 | + onComplete() { | |
| 14899 | + if (!rendered) { | |
| 14900 | + setMounted(false); | |
| 14901 | + } | |
| 1773 | 14902 | } |
| 1774 | - node = node.parentNode; | |
| 14903 | + }); | |
| 14904 | + const state = { | |
| 14905 | + ...fieldState, | |
| 14906 | + transitionStatus | |
| 14907 | + }; | |
| 14908 | + const element = useRenderElement("div", componentProps, { | |
| 14909 | + ref: [forwardedRef, errorRef], | |
| 14910 | + state, | |
| 14911 | + props: [{ | |
| 14912 | + id, | |
| 14913 | + children: rendered ? errorMessage : lastRenderedMessage | |
| 14914 | + }, elementProps], | |
| 14915 | + stateAttributesMapping: stateAttributesMapping4, | |
| 14916 | + enabled: mounted | |
| 14917 | + }); | |
| 14918 | + if (!mounted) { | |
| 14919 | + return null; | |
| 1775 | 14920 | } |
| 1776 | - return shadowParent; | |
| 1777 | -} | |
| 14921 | + return element; | |
| 14922 | +}); | |
| 14923 | +if (true) FieldError.displayName = "FieldError"; | |
| 1778 | 14924 | |
| 1779 | -// node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/sidecar.js | |
| 1780 | -var sidecar_default = exportSidecar(effectCar, RemoveScrollSideCar); | |
| 14925 | +// node_modules/@base-ui/react/field/description/FieldDescription.mjs | |
| 14926 | +var React98 = __toESM(require_react(), 1); | |
| 14927 | +var FieldDescription = /* @__PURE__ */ React98.forwardRef(function FieldDescription2(componentProps, forwardedRef) { | |
| 14928 | + const { | |
| 14929 | + render, | |
| 14930 | + id: idProp, | |
| 14931 | + className, | |
| 14932 | + style, | |
| 14933 | + ...elementProps | |
| 14934 | + } = componentProps; | |
| 14935 | + const id = useBaseUiId(idProp); | |
| 14936 | + const fieldRootContext = useFieldRootContext(false); | |
| 14937 | + const fieldItemContext = useFieldItemContext(); | |
| 14938 | + const { | |
| 14939 | + setMessageIds | |
| 14940 | + } = useLabelableContext(); | |
| 14941 | + const state = { | |
| 14942 | + ...fieldRootContext.state, | |
| 14943 | + disabled: fieldRootContext.disabled || fieldItemContext.disabled | |
| 14944 | + }; | |
| 14945 | + useIsoLayoutEffect(() => { | |
| 14946 | + if (!id) { | |
| 14947 | + return void 0; | |
| 14948 | + } | |
| 14949 | + setMessageIds((v) => v.concat(id)); | |
| 14950 | + return () => { | |
| 14951 | + setMessageIds((v) => v.filter((item) => item !== id)); | |
| 14952 | + }; | |
| 14953 | + }, [id, setMessageIds]); | |
| 14954 | + const element = useRenderElement("p", componentProps, { | |
| 14955 | + ref: forwardedRef, | |
| 14956 | + state, | |
| 14957 | + props: [{ | |
| 14958 | + id | |
| 14959 | + }, elementProps], | |
| 14960 | + stateAttributesMapping: fieldValidityMapping | |
| 14961 | + }); | |
| 14962 | + return element; | |
| 14963 | +}); | |
| 14964 | +if (true) FieldDescription.displayName = "FieldDescription"; | |
| 1781 | 14965 | |
| 1782 | -// node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/Combination.js | |
| 1783 | -var ReactRemoveScroll = React21.forwardRef(function(props, ref) { | |
| 1784 | - return React21.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: sidecar_default })); | |
| 14966 | +// node_modules/@base-ui/react/field/control/FieldControl.mjs | |
| 14967 | +var React99 = __toESM(require_react(), 1); | |
| 14968 | +var FieldControl = /* @__PURE__ */ React99.forwardRef(function FieldControl2(componentProps, forwardedRef) { | |
| 14969 | + const { | |
| 14970 | + render, | |
| 14971 | + className, | |
| 14972 | + id: idProp, | |
| 14973 | + name: nameProp, | |
| 14974 | + value: valueProp, | |
| 14975 | + disabled: disabledProp = false, | |
| 14976 | + onValueChange, | |
| 14977 | + defaultValue, | |
| 14978 | + autoFocus = false, | |
| 14979 | + style, | |
| 14980 | + ...elementProps | |
| 14981 | + } = componentProps; | |
| 14982 | + const { | |
| 14983 | + state: fieldState, | |
| 14984 | + name: fieldName, | |
| 14985 | + disabled: fieldDisabled, | |
| 14986 | + setTouched, | |
| 14987 | + setDirty, | |
| 14988 | + validityData, | |
| 14989 | + setFocused, | |
| 14990 | + setFilled, | |
| 14991 | + validationMode, | |
| 14992 | + validation | |
| 14993 | + } = useFieldRootContext(); | |
| 14994 | + const { | |
| 14995 | + clearErrors, | |
| 14996 | + elementRef: formElementRef, | |
| 14997 | + submitCountRef | |
| 14998 | + } = useFormContext(); | |
| 14999 | + const disabled2 = fieldDisabled || disabledProp; | |
| 15000 | + const name = fieldName ?? nameProp; | |
| 15001 | + const state = { | |
| 15002 | + ...fieldState, | |
| 15003 | + disabled: disabled2 | |
| 15004 | + }; | |
| 15005 | + const { | |
| 15006 | + labelId | |
| 15007 | + } = useLabelableContext(); | |
| 15008 | + const id = useLabelableId({ | |
| 15009 | + id: idProp | |
| 15010 | + }); | |
| 15011 | + const [valueUnwrapped] = useControlled({ | |
| 15012 | + controlled: valueProp, | |
| 15013 | + default: defaultValue, | |
| 15014 | + name: "FieldControl", | |
| 15015 | + state: "value" | |
| 15016 | + }); | |
| 15017 | + const isControlled = valueProp !== void 0; | |
| 15018 | + const value = isControlled ? valueUnwrapped : void 0; | |
| 15019 | + const serializedValue = value == null ? void 0 : String(value); | |
| 15020 | + const getValueFromInput = useStableCallback(() => validation.inputRef.current?.value); | |
| 15021 | + useRegisterFieldControl(validation.inputRef, id, serializedValue, getValueFromInput, !disabled2, nameProp); | |
| 15022 | + useIsoLayoutEffect(() => { | |
| 15023 | + const currentValue = serializedValue ?? validation.inputRef.current?.value; | |
| 15024 | + if (currentValue !== void 0) { | |
| 15025 | + setFilled(currentValue !== ""); | |
| 15026 | + } | |
| 15027 | + }, [serializedValue, validation.inputRef, setFilled]); | |
| 15028 | + useValueChanged(serializedValue, () => { | |
| 15029 | + if (serializedValue === void 0) { | |
| 15030 | + return; | |
| 15031 | + } | |
| 15032 | + clearErrors(name); | |
| 15033 | + setDirty(serializedValue !== (validityData.initialValue ?? "")); | |
| 15034 | + validation.change(serializedValue); | |
| 15035 | + }); | |
| 15036 | + const inputRef = React99.useRef(null); | |
| 15037 | + const enterValidationTimeout = useTimeout(); | |
| 15038 | + useIsoLayoutEffect(() => { | |
| 15039 | + if (autoFocus && inputRef.current === activeElement(ownerDocument(inputRef.current))) { | |
| 15040 | + setFocused(true); | |
| 15041 | + } | |
| 15042 | + }, [autoFocus, setFocused]); | |
| 15043 | + const element = useRenderElement("input", componentProps, { | |
| 15044 | + ref: [forwardedRef, inputRef], | |
| 15045 | + state, | |
| 15046 | + props: [{ | |
| 15047 | + id, | |
| 15048 | + disabled: disabled2, | |
| 15049 | + name, | |
| 15050 | + ref: validation.inputRef, | |
| 15051 | + "aria-labelledby": labelId, | |
| 15052 | + autoFocus, | |
| 15053 | + ...isControlled ? { | |
| 15054 | + value | |
| 15055 | + } : { | |
| 15056 | + defaultValue | |
| 15057 | + }, | |
| 15058 | + onChange(event) { | |
| 15059 | + const inputValue = event.currentTarget.value; | |
| 15060 | + const details = createChangeEventDetails(reason_parts_exports.none, event.nativeEvent); | |
| 15061 | + onValueChange?.(inputValue, details); | |
| 15062 | + if (isControlled) { | |
| 15063 | + return; | |
| 15064 | + } | |
| 15065 | + setDirty(inputValue !== (validityData.initialValue ?? "")); | |
| 15066 | + setFilled(inputValue !== ""); | |
| 15067 | + if (!event.nativeEvent.defaultPrevented && !details.isCanceled) { | |
| 15068 | + clearErrors(name); | |
| 15069 | + validation.change(inputValue); | |
| 15070 | + } | |
| 15071 | + }, | |
| 15072 | + onFocus() { | |
| 15073 | + setFocused(true); | |
| 15074 | + }, | |
| 15075 | + onBlur(event) { | |
| 15076 | + setTouched(true); | |
| 15077 | + setFocused(false); | |
| 15078 | + if (validationMode === "onBlur") { | |
| 15079 | + const inputValue = event.currentTarget.value; | |
| 15080 | + validation.commit(inputValue); | |
| 15081 | + if (isControlled) { | |
| 15082 | + queueMicrotask(() => { | |
| 15083 | + const nextValue = validation.inputRef.current?.value; | |
| 15084 | + if (nextValue !== void 0 && nextValue !== inputValue && nextValue !== (validityData.initialValue ?? "")) { | |
| 15085 | + validation.commit(nextValue); | |
| 15086 | + } | |
| 15087 | + }); | |
| 15088 | + } | |
| 15089 | + } | |
| 15090 | + }, | |
| 15091 | + onKeyDown(event) { | |
| 15092 | + if (event.currentTarget.tagName === "INPUT" && event.key === "Enter") { | |
| 15093 | + setTouched(true); | |
| 15094 | + const value2 = event.currentTarget.value; | |
| 15095 | + const form = event.currentTarget.form; | |
| 15096 | + if (form && form === formElementRef.current && !event.defaultPrevented) { | |
| 15097 | + const input = event.currentTarget; | |
| 15098 | + const submitCount = submitCountRef.current; | |
| 15099 | + enterValidationTimeout.start(0, () => { | |
| 15100 | + if (submitCountRef.current === submitCount) { | |
| 15101 | + validation.commit(input.value); | |
| 15102 | + } | |
| 15103 | + }); | |
| 15104 | + } else { | |
| 15105 | + validation.commit(value2); | |
| 15106 | + } | |
| 15107 | + } | |
| 15108 | + } | |
| 15109 | + }, elementProps, (props) => validation.getValidationProps(disabled2, props)], | |
| 15110 | + stateAttributesMapping: fieldValidityMapping | |
| 15111 | + }); | |
| 15112 | + return element; | |
| 1785 | 15113 | }); |
| 1786 | -ReactRemoveScroll.classNames = RemoveScroll.classNames; | |
| 1787 | -var Combination_default = ReactRemoveScroll; | |
| 15114 | +if (true) FieldControl.displayName = "FieldControl"; | |
| 1788 | 15115 | |
| 1789 | -// node_modules/aria-hidden/dist/es2015/index.js | |
| 1790 | -var getDefaultParent = function(originalTarget) { | |
| 1791 | - if (typeof document === "undefined") { | |
| 15116 | +// node_modules/@base-ui/react/field/validity/FieldValidity.mjs | |
| 15117 | +var React100 = __toESM(require_react(), 1); | |
| 15118 | +var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); | |
| 15119 | +var FieldValidity = function FieldValidity2(props) { | |
| 15120 | + const { | |
| 15121 | + children | |
| 15122 | + } = props; | |
| 15123 | + const { | |
| 15124 | + validityData, | |
| 15125 | + invalid: invalid2 | |
| 15126 | + } = useFieldRootContext(false); | |
| 15127 | + const combinedFieldValidityData = React100.useMemo(() => getCombinedFieldValidityData(validityData, invalid2), [validityData, invalid2]); | |
| 15128 | + const isInvalid = combinedFieldValidityData.state.valid === false; | |
| 15129 | + const { | |
| 15130 | + transitionStatus | |
| 15131 | + } = useTransitionStatus(isInvalid); | |
| 15132 | + const fieldValidityState = React100.useMemo(() => { | |
| 15133 | + return { | |
| 15134 | + ...combinedFieldValidityData, | |
| 15135 | + validity: combinedFieldValidityData.state, | |
| 15136 | + transitionStatus | |
| 15137 | + }; | |
| 15138 | + }, [combinedFieldValidityData, transitionStatus]); | |
| 15139 | + return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(React100.Fragment, { | |
| 15140 | + children: children(fieldValidityState) | |
| 15141 | + }); | |
| 15142 | +}; | |
| 15143 | +if (true) FieldValidity.displayName = "FieldValidity"; | |
| 15144 | + | |
| 15145 | +// node_modules/@base-ui/react/field/item/FieldItem.mjs | |
| 15146 | +var React101 = __toESM(require_react(), 1); | |
| 15147 | +var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); | |
| 15148 | +var FieldItem = /* @__PURE__ */ React101.forwardRef(function FieldItem2(componentProps, forwardedRef) { | |
| 15149 | + const { | |
| 15150 | + render, | |
| 15151 | + className, | |
| 15152 | + style, | |
| 15153 | + disabled: disabledProp = false, | |
| 15154 | + ...elementProps | |
| 15155 | + } = componentProps; | |
| 15156 | + const { | |
| 15157 | + state: fieldState, | |
| 15158 | + disabled: rootDisabled | |
| 15159 | + } = useFieldRootContext(false); | |
| 15160 | + const disabled2 = rootDisabled || disabledProp; | |
| 15161 | + const state = { | |
| 15162 | + ...fieldState, | |
| 15163 | + disabled: disabled2 | |
| 15164 | + }; | |
| 15165 | + const fieldItemContext = React101.useMemo(() => ({ | |
| 15166 | + disabled: disabled2 | |
| 15167 | + }), [disabled2]); | |
| 15168 | + const element = useRenderElement("div", componentProps, { | |
| 15169 | + ref: forwardedRef, | |
| 15170 | + state, | |
| 15171 | + props: elementProps, | |
| 15172 | + stateAttributesMapping: fieldValidityMapping | |
| 15173 | + }); | |
| 15174 | + return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(LabelableProvider, { | |
| 15175 | + children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(FieldItemContext.Provider, { | |
| 15176 | + value: fieldItemContext, | |
| 15177 | + children: element | |
| 15178 | + }) | |
| 15179 | + }); | |
| 15180 | +}); | |
| 15181 | +if (true) FieldItem.displayName = "FieldItem"; | |
| 15182 | + | |
| 15183 | +// node_modules/@base-ui/react/input/Input.mjs | |
| 15184 | +var React102 = __toESM(require_react(), 1); | |
| 15185 | +var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); | |
| 15186 | +var Input = /* @__PURE__ */ React102.forwardRef(function Input2(props, forwardedRef) { | |
| 15187 | + return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(index_parts_exports2.Control, { | |
| 15188 | + ref: forwardedRef, | |
| 15189 | + ...props | |
| 15190 | + }); | |
| 15191 | +}); | |
| 15192 | +if (true) Input.displayName = "Input"; | |
| 15193 | + | |
| 15194 | +// node_modules/@base-ui/react/utils/FloatingPortalLite.mjs | |
| 15195 | +var React103 = __toESM(require_react(), 1); | |
| 15196 | +var ReactDOM8 = __toESM(require_react_dom(), 1); | |
| 15197 | +var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); | |
| 15198 | +var FloatingPortalLite = /* @__PURE__ */ React103.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) { | |
| 15199 | + const { | |
| 15200 | + children, | |
| 15201 | + container, | |
| 15202 | + className, | |
| 15203 | + render, | |
| 15204 | + style, | |
| 15205 | + ...elementProps | |
| 15206 | + } = componentProps; | |
| 15207 | + const { | |
| 15208 | + node: portalNode, | |
| 15209 | + subtree: portalSubtree | |
| 15210 | + } = useFloatingPortalNode({ | |
| 15211 | + container, | |
| 15212 | + ref: forwardedRef, | |
| 15213 | + componentProps, | |
| 15214 | + elementProps | |
| 15215 | + }); | |
| 15216 | + if (!portalSubtree && !portalNode) { | |
| 1792 | 15217 | return null; |
| 1793 | 15218 | } |
| 1794 | - var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget; | |
| 1795 | - return sampleTarget.ownerDocument.body; | |
| 15219 | + return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(React103.Fragment, { | |
| 15220 | + children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM8.createPortal(children, portalNode)] | |
| 15221 | + }); | |
| 15222 | +}); | |
| 15223 | +if (true) FloatingPortalLite.displayName = "FloatingPortalLite"; | |
| 15224 | + | |
| 15225 | +// node_modules/@base-ui/react/tooltip/index.parts.mjs | |
| 15226 | +var index_parts_exports3 = {}; | |
| 15227 | +__export(index_parts_exports3, { | |
| 15228 | + Arrow: () => TooltipArrow, | |
| 15229 | + Handle: () => TooltipHandle, | |
| 15230 | + Popup: () => TooltipPopup, | |
| 15231 | + Portal: () => TooltipPortal, | |
| 15232 | + Positioner: () => TooltipPositioner, | |
| 15233 | + Provider: () => TooltipProvider, | |
| 15234 | + Root: () => TooltipRoot, | |
| 15235 | + Trigger: () => TooltipTrigger, | |
| 15236 | + Viewport: () => TooltipViewport, | |
| 15237 | + createHandle: () => createTooltipHandle | |
| 15238 | +}); | |
| 15239 | + | |
| 15240 | +// node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs | |
| 15241 | +var React106 = __toESM(require_react(), 1); | |
| 15242 | + | |
| 15243 | +// node_modules/@base-ui/react/tooltip/root/TooltipRootContext.mjs | |
| 15244 | +var React104 = __toESM(require_react(), 1); | |
| 15245 | +var TooltipRootContext = /* @__PURE__ */ React104.createContext(void 0); | |
| 15246 | +if (true) TooltipRootContext.displayName = "TooltipRootContext"; | |
| 15247 | +function useTooltipRootContext(optional) { | |
| 15248 | + const context = React104.useContext(TooltipRootContext); | |
| 15249 | + if (context === void 0 && !optional) { | |
| 15250 | + throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72)); | |
| 15251 | + } | |
| 15252 | + return context; | |
| 15253 | +} | |
| 15254 | + | |
| 15255 | +// node_modules/@base-ui/react/tooltip/store/TooltipStore.mjs | |
| 15256 | +var React105 = __toESM(require_react(), 1); | |
| 15257 | +var selectors3 = { | |
| 15258 | + ...popupStoreSelectors, | |
| 15259 | + disabled: (state) => state.disabled, | |
| 15260 | + instantType: (state) => state.instantType, | |
| 15261 | + isInstantPhase: (state) => state.isInstantPhase, | |
| 15262 | + trackCursorAxis: (state) => state.trackCursorAxis, | |
| 15263 | + disableHoverablePopup: (state) => state.disableHoverablePopup, | |
| 15264 | + lastOpenChangeReason: (state) => state.openChangeReason, | |
| 15265 | + closeOnClick: (state) => state.closeOnClick, | |
| 15266 | + closeDelay: (state) => state.closeDelay, | |
| 15267 | + adaptiveOrigin: (state) => state.adaptiveOrigin | |
| 1796 | 15268 | }; |
| 1797 | -var counterMap = /* @__PURE__ */ new WeakMap(); | |
| 1798 | -var uncontrolledNodes = /* @__PURE__ */ new WeakMap(); | |
| 1799 | -var markerMap = {}; | |
| 1800 | -var lockCount = 0; | |
| 1801 | -var unwrapHost = function(node) { | |
| 1802 | - return node && (node.host || unwrapHost(node.parentNode)); | |
| 15269 | +var TooltipStore = class extends ReactStore { | |
| 15270 | + constructor(initialState, floatingId, nested) { | |
| 15271 | + const triggerElements = new PopupTriggerMap(); | |
| 15272 | + super(createInitialState(initialState, triggerElements, floatingId, nested), createInitialContext(triggerElements), selectors3); | |
| 15273 | + } | |
| 15274 | + setOpen = (nextOpen, eventDetails) => { | |
| 15275 | + applyPopupOpenChange(this, nextOpen, eventDetails, { | |
| 15276 | + extraState: { | |
| 15277 | + openChangeReason: eventDetails.reason | |
| 15278 | + } | |
| 15279 | + }); | |
| 15280 | + }; | |
| 15281 | + // Used by trigger clicks to clear a delayed hover open without reporting a public open-state change. | |
| 15282 | + cancelPendingOpen(event) { | |
| 15283 | + this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event)); | |
| 15284 | + } | |
| 1803 | 15285 | }; |
| 1804 | -var correctTargets = function(parent, targets) { | |
| 1805 | - return targets.map(function(target) { | |
| 1806 | - if (parent.contains(target)) { | |
| 1807 | - return target; | |
| 15286 | +function createNullTooltipStore() { | |
| 15287 | + const triggerElements = new PopupTriggerMap(); | |
| 15288 | + const store = new NullStore(Object.freeze(createInitialState(void 0, triggerElements)), Object.freeze(createInitialContext(triggerElements)), selectors3); | |
| 15289 | + return Object.assign(store, { | |
| 15290 | + setOpen: NOOP, | |
| 15291 | + cancelPendingOpen: NOOP | |
| 15292 | + }); | |
| 15293 | +} | |
| 15294 | +function createInitialState(initialState, triggerElements, floatingId, nested = false) { | |
| 15295 | + const state = { | |
| 15296 | + ...createInitialPopupStoreState(triggerElements, floatingId, nested), | |
| 15297 | + disabled: false, | |
| 15298 | + instantType: void 0, | |
| 15299 | + isInstantPhase: false, | |
| 15300 | + trackCursorAxis: "none", | |
| 15301 | + disableHoverablePopup: false, | |
| 15302 | + openChangeReason: null, | |
| 15303 | + closeOnClick: true, | |
| 15304 | + closeDelay: 0, | |
| 15305 | + adaptiveOrigin: void 0, | |
| 15306 | + ...initialState | |
| 15307 | + }; | |
| 15308 | + return state; | |
| 15309 | +} | |
| 15310 | +function createInitialContext(triggerElements) { | |
| 15311 | + return { | |
| 15312 | + popupRef: /* @__PURE__ */ React105.createRef(), | |
| 15313 | + onOpenChange: void 0, | |
| 15314 | + onOpenChangeComplete: void 0, | |
| 15315 | + triggerElements | |
| 15316 | + }; | |
| 15317 | +} | |
| 15318 | + | |
| 15319 | +// node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs | |
| 15320 | +var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1); | |
| 15321 | +var TooltipRoot = fastComponent(function TooltipRoot2(props) { | |
| 15322 | + const { | |
| 15323 | + disabled: disabled2 = false, | |
| 15324 | + defaultOpen = false, | |
| 15325 | + open: openProp, | |
| 15326 | + disableHoverablePopup = false, | |
| 15327 | + trackCursorAxis = "none", | |
| 15328 | + actionsRef, | |
| 15329 | + onOpenChange, | |
| 15330 | + onOpenChangeComplete, | |
| 15331 | + handle, | |
| 15332 | + triggerId: triggerIdProp, | |
| 15333 | + defaultTriggerId: defaultTriggerIdProp = null, | |
| 15334 | + children | |
| 15335 | + } = props; | |
| 15336 | + const store = usePopupRootStore((floatingId, nested) => new TooltipStore({ | |
| 15337 | + open: defaultOpen, | |
| 15338 | + openProp, | |
| 15339 | + activeTriggerId: defaultTriggerIdProp, | |
| 15340 | + triggerIdProp | |
| 15341 | + }, floatingId, nested)); | |
| 15342 | + store.useControlledProp("openProp", openProp); | |
| 15343 | + store.useControlledProp("triggerIdProp", triggerIdProp); | |
| 15344 | + store.useContextCallback("onOpenChange", onOpenChange); | |
| 15345 | + store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete); | |
| 15346 | + const openState = store.useState("open"); | |
| 15347 | + const open2 = !disabled2 && openState; | |
| 15348 | + const activeTriggerId = store.useState("activeTriggerId"); | |
| 15349 | + const mounted = store.useState("mounted"); | |
| 15350 | + const payload = store.useState("payload"); | |
| 15351 | + store.useSyncedValues({ | |
| 15352 | + trackCursorAxis, | |
| 15353 | + disableHoverablePopup, | |
| 15354 | + disabled: disabled2 | |
| 15355 | + }); | |
| 15356 | + useImplicitActiveTrigger(store, { | |
| 15357 | + closeOnActiveTriggerUnmount: true | |
| 15358 | + }); | |
| 15359 | + const { | |
| 15360 | + forceUnmount, | |
| 15361 | + transitionStatus | |
| 15362 | + } = useOpenStateTransitions(open2, store); | |
| 15363 | + const isInstantPhase = store.useState("isInstantPhase"); | |
| 15364 | + const instantType = store.useState("instantType"); | |
| 15365 | + const lastOpenChangeReason = store.useState("lastOpenChangeReason"); | |
| 15366 | + const previousInstantTypeRef = React106.useRef(null); | |
| 15367 | + useIsoLayoutEffect(() => { | |
| 15368 | + if (openState && disabled2) { | |
| 15369 | + store.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled)); | |
| 1808 | 15370 | } |
| 1809 | - var correctedTarget = unwrapHost(target); | |
| 1810 | - if (correctedTarget && parent.contains(correctedTarget)) { | |
| 1811 | - return correctedTarget; | |
| 15371 | + }, [openState, disabled2, store]); | |
| 15372 | + useIsoLayoutEffect(() => { | |
| 15373 | + if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) { | |
| 15374 | + if (instantType !== "delay") { | |
| 15375 | + previousInstantTypeRef.current = instantType; | |
| 15376 | + } | |
| 15377 | + store.set("instantType", "delay"); | |
| 15378 | + } else if (previousInstantTypeRef.current !== null) { | |
| 15379 | + store.set("instantType", previousInstantTypeRef.current); | |
| 15380 | + previousInstantTypeRef.current = null; | |
| 1812 | 15381 | } |
| 1813 | - console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing"); | |
| 1814 | - return null; | |
| 1815 | - }).filter(function(x) { | |
| 1816 | - return Boolean(x); | |
| 15382 | + }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store]); | |
| 15383 | + useIsoLayoutEffect(() => { | |
| 15384 | + if (open2) { | |
| 15385 | + if (activeTriggerId == null) { | |
| 15386 | + store.set("payload", void 0); | |
| 15387 | + } | |
| 15388 | + } | |
| 15389 | + }, [store, activeTriggerId, open2]); | |
| 15390 | + React106.useImperativeHandle(actionsRef, () => ({ | |
| 15391 | + unmount: forceUnmount, | |
| 15392 | + close: () => store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)) | |
| 15393 | + }), [forceUnmount, store]); | |
| 15394 | + const shouldRenderInteractions = open2 || mounted || !disabled2 && trackCursorAxis !== "none"; | |
| 15395 | + return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(TooltipRootContext.Provider, { | |
| 15396 | + value: store, | |
| 15397 | + children: [handle && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PopupHandleAttachment, { | |
| 15398 | + handle, | |
| 15399 | + store | |
| 15400 | + }), shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipInteractions, { | |
| 15401 | + store, | |
| 15402 | + disabled: disabled2, | |
| 15403 | + trackCursorAxis | |
| 15404 | + }), typeof children === "function" ? children({ | |
| 15405 | + payload | |
| 15406 | + }) : children] | |
| 1817 | 15407 | }); |
| 1818 | -}; | |
| 1819 | -var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) { | |
| 1820 | - var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]); | |
| 1821 | - if (!markerMap[markerName]) { | |
| 1822 | - markerMap[markerName] = /* @__PURE__ */ new WeakMap(); | |
| 15408 | +}); | |
| 15409 | +if (true) TooltipRoot.displayName = "TooltipRoot"; | |
| 15410 | +function TooltipInteractions({ | |
| 15411 | + store, | |
| 15412 | + disabled: disabled2, | |
| 15413 | + trackCursorAxis | |
| 15414 | +}) { | |
| 15415 | + const floatingRootContext = store.useState("floatingRootContext"); | |
| 15416 | + const dismiss = useDismiss(floatingRootContext, { | |
| 15417 | + enabled: !disabled2, | |
| 15418 | + referencePress: () => store.select("closeOnClick") | |
| 15419 | + }); | |
| 15420 | + const clientPoint = useClientPoint(floatingRootContext, { | |
| 15421 | + enabled: !disabled2 && trackCursorAxis !== "none", | |
| 15422 | + axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis | |
| 15423 | + }); | |
| 15424 | + const triggerProps = React106.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]); | |
| 15425 | + usePopupInteractionProps(store, { | |
| 15426 | + activeTriggerProps: triggerProps, | |
| 15427 | + inactiveTriggerProps: triggerProps, | |
| 15428 | + popupProps: dismiss.floating ?? EMPTY_OBJECT | |
| 15429 | + }); | |
| 15430 | + return null; | |
| 15431 | +} | |
| 15432 | + | |
| 15433 | +// node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs | |
| 15434 | +var React108 = __toESM(require_react(), 1); | |
| 15435 | + | |
| 15436 | +// node_modules/@base-ui/react/tooltip/provider/TooltipProviderContext.mjs | |
| 15437 | +var React107 = __toESM(require_react(), 1); | |
| 15438 | +var TooltipProviderContext = /* @__PURE__ */ React107.createContext(void 0); | |
| 15439 | +if (true) TooltipProviderContext.displayName = "TooltipProviderContext"; | |
| 15440 | +function useTooltipProviderContext() { | |
| 15441 | + return React107.useContext(TooltipProviderContext); | |
| 15442 | +} | |
| 15443 | + | |
| 15444 | +// node_modules/@base-ui/react/tooltip/utils/constants.mjs | |
| 15445 | +var OPEN_DELAY = 600; | |
| 15446 | + | |
| 15447 | +// node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs | |
| 15448 | +var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger"; | |
| 15449 | +function getTargetElement(event) { | |
| 15450 | + if ("composedPath" in event) { | |
| 15451 | + const path = event.composedPath(); | |
| 15452 | + for (let i = 0; i < path.length; i += 1) { | |
| 15453 | + const element = path[i]; | |
| 15454 | + if (isElement(element)) { | |
| 15455 | + return element; | |
| 15456 | + } | |
| 15457 | + } | |
| 1823 | 15458 | } |
| 1824 | - var markerCounter = markerMap[markerName]; | |
| 1825 | - var hiddenNodes = []; | |
| 1826 | - var elementsToKeep = /* @__PURE__ */ new Set(); | |
| 1827 | - var elementsToStop = new Set(targets); | |
| 1828 | - var keep = function(el) { | |
| 1829 | - if (!el || elementsToKeep.has(el)) { | |
| 1830 | - return; | |
| 15459 | + const target = event.target; | |
| 15460 | + if (isElement(target)) { | |
| 15461 | + return target; | |
| 15462 | + } | |
| 15463 | + return null; | |
| 15464 | +} | |
| 15465 | +function closestEnabledTooltipTrigger(element) { | |
| 15466 | + let current = element; | |
| 15467 | + while (current) { | |
| 15468 | + const trigger = current.closest(`[${TOOLTIP_TRIGGER_IDENTIFIER}]`); | |
| 15469 | + if (trigger) { | |
| 15470 | + return trigger; | |
| 1831 | 15471 | } |
| 1832 | - elementsToKeep.add(el); | |
| 1833 | - keep(el.parentNode); | |
| 1834 | - }; | |
| 1835 | - targets.forEach(keep); | |
| 1836 | - var deep = function(parent) { | |
| 1837 | - if (!parent || elementsToStop.has(parent)) { | |
| 15472 | + const root2 = current.getRootNode(); | |
| 15473 | + current = "host" in root2 && isElement(root2.host) ? root2.host : null; | |
| 15474 | + } | |
| 15475 | + return null; | |
| 15476 | +} | |
| 15477 | +var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) { | |
| 15478 | + const { | |
| 15479 | + render, | |
| 15480 | + className, | |
| 15481 | + style, | |
| 15482 | + handle, | |
| 15483 | + payload, | |
| 15484 | + disabled: disabledProp, | |
| 15485 | + delay, | |
| 15486 | + closeOnClick = true, | |
| 15487 | + closeDelay, | |
| 15488 | + id: idProp, | |
| 15489 | + ...elementProps | |
| 15490 | + } = componentProps; | |
| 15491 | + const rootContext = useTooltipRootContext(true); | |
| 15492 | + const handleStore = usePopupHandleStore(handle); | |
| 15493 | + const store = handleStore ?? rootContext; | |
| 15494 | + if (!store) { | |
| 15495 | + throw new Error(true ? "Base UI: <Tooltip.Trigger> must be either used within a <Tooltip.Root> component or provided with a handle." : formatErrorMessage_default(82)); | |
| 15496 | + } | |
| 15497 | + const thisTriggerId = useBaseUiId(idProp); | |
| 15498 | + const isTriggerActive = store.useState("isTriggerActive", thisTriggerId); | |
| 15499 | + const isOpenedByThisTrigger = store.useState("isOpenedByTrigger", thisTriggerId); | |
| 15500 | + const floatingRootContext = store.useState("floatingRootContext"); | |
| 15501 | + const triggerElementRef = React108.useRef(null); | |
| 15502 | + const closeDelayWithDefault = closeDelay ?? 0; | |
| 15503 | + const { | |
| 15504 | + registerTrigger, | |
| 15505 | + isMountedByThisTrigger | |
| 15506 | + } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, { | |
| 15507 | + payload, | |
| 15508 | + closeOnClick, | |
| 15509 | + closeDelay: closeDelayWithDefault | |
| 15510 | + }); | |
| 15511 | + const providerDelay = useTooltipProviderContext(); | |
| 15512 | + const { | |
| 15513 | + activeIdRef, | |
| 15514 | + delayRef, | |
| 15515 | + isInstantPhase, | |
| 15516 | + hasProvider | |
| 15517 | + } = useDelayGroup(floatingRootContext, { | |
| 15518 | + open: isOpenedByThisTrigger | |
| 15519 | + }); | |
| 15520 | + const hoverInteraction = useHoverInteractionSharedState(floatingRootContext); | |
| 15521 | + store.useSyncedValue("isInstantPhase", isInstantPhase); | |
| 15522 | + const rootDisabled = store.useState("disabled"); | |
| 15523 | + const disabled2 = disabledProp ?? rootDisabled; | |
| 15524 | + const disabledRef = useValueAsRef(disabled2); | |
| 15525 | + const trackCursorAxis = store.useState("trackCursorAxis"); | |
| 15526 | + const disableHoverablePopup = store.useState("disableHoverablePopup"); | |
| 15527 | + const isNestedTriggerHoveredRef = React108.useRef(false); | |
| 15528 | + const nestedTriggerOpenTimeout = useTimeout(); | |
| 15529 | + const pointerTypeRef = React108.useRef(void 0); | |
| 15530 | + function getOpenDelay() { | |
| 15531 | + if (hasProvider && activeIdRef.current != null) { | |
| 15532 | + return 0; | |
| 15533 | + } | |
| 15534 | + return delay ?? providerDelay ?? OPEN_DELAY; | |
| 15535 | + } | |
| 15536 | + function isEnabledNestedTriggerTarget(target) { | |
| 15537 | + const triggerEl = triggerElementRef.current; | |
| 15538 | + if (!triggerEl || !target) { | |
| 15539 | + return false; | |
| 15540 | + } | |
| 15541 | + const nearestTrigger = closestEnabledTooltipTrigger(target); | |
| 15542 | + return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger); | |
| 15543 | + } | |
| 15544 | + function detectNestedTriggerHover(target) { | |
| 15545 | + const nestedTriggerHovered = isEnabledNestedTriggerTarget(target); | |
| 15546 | + isNestedTriggerHoveredRef.current = nestedTriggerHovered; | |
| 15547 | + if (nestedTriggerHovered) { | |
| 15548 | + hoverInteraction.openChangeTimeout.clear(); | |
| 15549 | + hoverInteraction.restTimeout.clear(); | |
| 15550 | + hoverInteraction.restTimeoutPending = false; | |
| 15551 | + nestedTriggerOpenTimeout.clear(); | |
| 15552 | + } | |
| 15553 | + return nestedTriggerHovered; | |
| 15554 | + } | |
| 15555 | + const hoverProps = useHoverReferenceInteraction(floatingRootContext, { | |
| 15556 | + enabled: !disabled2, | |
| 15557 | + mouseOnly: true, | |
| 15558 | + move: false, | |
| 15559 | + handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null, | |
| 15560 | + restMs: getOpenDelay, | |
| 15561 | + delay() { | |
| 15562 | + if (closeDelay == null && hasProvider) { | |
| 15563 | + return { | |
| 15564 | + close: getDelay(delayRef.current, "close") | |
| 15565 | + }; | |
| 15566 | + } | |
| 15567 | + return { | |
| 15568 | + close: closeDelayWithDefault | |
| 15569 | + }; | |
| 15570 | + }, | |
| 15571 | + triggerElementRef, | |
| 15572 | + isActiveTrigger: isTriggerActive, | |
| 15573 | + isClosing: () => store.select("transitionStatus") === "ending", | |
| 15574 | + shouldOpen() { | |
| 15575 | + return !isNestedTriggerHoveredRef.current; | |
| 15576 | + } | |
| 15577 | + }); | |
| 15578 | + const focusProps = useFocus(floatingRootContext, { | |
| 15579 | + enabled: !disabled2 | |
| 15580 | + }).reference; | |
| 15581 | + const handleNestedTriggerHover = (event) => { | |
| 15582 | + const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current; | |
| 15583 | + const target = getTargetElement(event); | |
| 15584 | + const nestedTriggerHovered = detectNestedTriggerHover(target); | |
| 15585 | + const triggerEl = triggerElementRef.current; | |
| 15586 | + const targetInsideTrigger = triggerEl && target && contains(triggerEl, target); | |
| 15587 | + if (nestedTriggerHovered && store.select("open") && store.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) { | |
| 15588 | + store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); | |
| 1838 | 15589 | return; |
| 1839 | 15590 | } |
| 1840 | - Array.prototype.forEach.call(parent.children, function(node) { | |
| 1841 | - if (elementsToKeep.has(node)) { | |
| 1842 | - deep(node); | |
| 15591 | + if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences. | |
| 15592 | + isMouseLikePointerType(pointerTypeRef.current)) { | |
| 15593 | + const open2 = () => { | |
| 15594 | + if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store.select("open")) { | |
| 15595 | + store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl)); | |
| 15596 | + } | |
| 15597 | + }; | |
| 15598 | + const openDelay = getOpenDelay(); | |
| 15599 | + if (openDelay === 0) { | |
| 15600 | + nestedTriggerOpenTimeout.clear(); | |
| 15601 | + open2(); | |
| 1843 | 15602 | } else { |
| 1844 | - try { | |
| 1845 | - var attr = node.getAttribute(controlAttribute); | |
| 1846 | - var alreadyHidden = attr !== null && attr !== "false"; | |
| 1847 | - var counterValue = (counterMap.get(node) || 0) + 1; | |
| 1848 | - var markerValue = (markerCounter.get(node) || 0) + 1; | |
| 1849 | - counterMap.set(node, counterValue); | |
| 1850 | - markerCounter.set(node, markerValue); | |
| 1851 | - hiddenNodes.push(node); | |
| 1852 | - if (counterValue === 1 && alreadyHidden) { | |
| 1853 | - uncontrolledNodes.set(node, true); | |
| 1854 | - } | |
| 1855 | - if (markerValue === 1) { | |
| 1856 | - node.setAttribute(markerName, "true"); | |
| 1857 | - } | |
| 1858 | - if (!alreadyHidden) { | |
| 1859 | - node.setAttribute(controlAttribute, "true"); | |
| 1860 | - } | |
| 1861 | - } catch (e) { | |
| 1862 | - console.error("aria-hidden: cannot operate on ", node, e); | |
| 1863 | - } | |
| 15603 | + nestedTriggerOpenTimeout.start(openDelay, open2); | |
| 1864 | 15604 | } |
| 1865 | - }); | |
| 15605 | + } | |
| 1866 | 15606 | }; |
| 1867 | - deep(parentNode); | |
| 1868 | - elementsToKeep.clear(); | |
| 1869 | - lockCount++; | |
| 1870 | - return function() { | |
| 1871 | - hiddenNodes.forEach(function(node) { | |
| 1872 | - var counterValue = counterMap.get(node) - 1; | |
| 1873 | - var markerValue = markerCounter.get(node) - 1; | |
| 1874 | - counterMap.set(node, counterValue); | |
| 1875 | - markerCounter.set(node, markerValue); | |
| 1876 | - if (!counterValue) { | |
| 1877 | - if (!uncontrolledNodes.has(node)) { | |
| 1878 | - node.removeAttribute(controlAttribute); | |
| 15607 | + const rootTriggerProps = store.useState("triggerProps", isMountedByThisTrigger); | |
| 15608 | + const shouldApplyRootTriggerProps = isMountedByThisTrigger || trackCursorAxis !== "none"; | |
| 15609 | + const state = { | |
| 15610 | + open: isOpenedByThisTrigger | |
| 15611 | + }; | |
| 15612 | + const element = useRenderElement("button", componentProps, { | |
| 15613 | + state, | |
| 15614 | + ref: [forwardedRef, registerTrigger, triggerElementRef], | |
| 15615 | + props: [hoverProps, focusProps, shouldApplyRootTriggerProps ? rootTriggerProps : void 0, { | |
| 15616 | + onMouseOver(event) { | |
| 15617 | + handleNestedTriggerHover(event.nativeEvent); | |
| 15618 | + }, | |
| 15619 | + onFocus(event) { | |
| 15620 | + if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) { | |
| 15621 | + event.preventBaseUIHandler(); | |
| 1879 | 15622 | } |
| 1880 | - uncontrolledNodes.delete(node); | |
| 15623 | + }, | |
| 15624 | + onMouseLeave() { | |
| 15625 | + isNestedTriggerHoveredRef.current = false; | |
| 15626 | + nestedTriggerOpenTimeout.clear(); | |
| 15627 | + pointerTypeRef.current = void 0; | |
| 15628 | + }, | |
| 15629 | + onPointerEnter(event) { | |
| 15630 | + pointerTypeRef.current = event.pointerType; | |
| 15631 | + }, | |
| 15632 | + onPointerDown(event) { | |
| 15633 | + pointerTypeRef.current = event.pointerType; | |
| 15634 | + store.set("closeOnClick", closeOnClick); | |
| 15635 | + if (closeOnClick && !store.select("open")) { | |
| 15636 | + store.cancelPendingOpen(event.nativeEvent); | |
| 15637 | + } | |
| 15638 | + }, | |
| 15639 | + onClick(event) { | |
| 15640 | + if (closeOnClick && !store.select("open")) { | |
| 15641 | + store.cancelPendingOpen(event.nativeEvent); | |
| 15642 | + } | |
| 15643 | + }, | |
| 15644 | + id: thisTriggerId, | |
| 15645 | + [triggerDisabled]: disabled2 ? "" : void 0, | |
| 15646 | + [TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : "" | |
| 15647 | + }, elementProps], | |
| 15648 | + stateAttributesMapping: triggerOpenStateMapping | |
| 15649 | + }); | |
| 15650 | + return element; | |
| 15651 | +}); | |
| 15652 | +if (true) TooltipTrigger.displayName = "TooltipTrigger"; | |
| 15653 | + | |
| 15654 | +// node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs | |
| 15655 | +var React110 = __toESM(require_react(), 1); | |
| 15656 | + | |
| 15657 | +// node_modules/@base-ui/react/tooltip/portal/TooltipPortalContext.mjs | |
| 15658 | +var React109 = __toESM(require_react(), 1); | |
| 15659 | +var TooltipPortalContext = /* @__PURE__ */ React109.createContext(void 0); | |
| 15660 | +if (true) TooltipPortalContext.displayName = "TooltipPortalContext"; | |
| 15661 | +function useTooltipPortalContext() { | |
| 15662 | + const value = React109.useContext(TooltipPortalContext); | |
| 15663 | + if (value === void 0) { | |
| 15664 | + throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70)); | |
| 15665 | + } | |
| 15666 | + return value; | |
| 15667 | +} | |
| 15668 | + | |
| 15669 | +// node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs | |
| 15670 | +var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1); | |
| 15671 | +var TooltipPortal = /* @__PURE__ */ React110.forwardRef(function TooltipPortal2(props, forwardedRef) { | |
| 15672 | + const { | |
| 15673 | + keepMounted = false, | |
| 15674 | + ...portalProps | |
| 15675 | + } = props; | |
| 15676 | + const store = useTooltipRootContext(); | |
| 15677 | + const mounted = store.useState("mounted"); | |
| 15678 | + const shouldRender = mounted || keepMounted; | |
| 15679 | + if (!shouldRender) { | |
| 15680 | + return null; | |
| 15681 | + } | |
| 15682 | + return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipPortalContext.Provider, { | |
| 15683 | + value: keepMounted, | |
| 15684 | + children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FloatingPortalLite, { | |
| 15685 | + ref: forwardedRef, | |
| 15686 | + ...portalProps | |
| 15687 | + }) | |
| 15688 | + }); | |
| 15689 | +}); | |
| 15690 | +if (true) TooltipPortal.displayName = "TooltipPortal"; | |
| 15691 | + | |
| 15692 | +// node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs | |
| 15693 | +var React112 = __toESM(require_react(), 1); | |
| 15694 | + | |
| 15695 | +// node_modules/@base-ui/react/tooltip/positioner/TooltipPositionerContext.mjs | |
| 15696 | +var React111 = __toESM(require_react(), 1); | |
| 15697 | +var TooltipPositionerContext = /* @__PURE__ */ React111.createContext(void 0); | |
| 15698 | +if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext"; | |
| 15699 | +function useTooltipPositionerContext() { | |
| 15700 | + const context = React111.useContext(TooltipPositionerContext); | |
| 15701 | + if (context === void 0) { | |
| 15702 | + throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71)); | |
| 15703 | + } | |
| 15704 | + return context; | |
| 15705 | +} | |
| 15706 | + | |
| 15707 | +// node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs | |
| 15708 | +var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1); | |
| 15709 | +var TooltipPositioner = /* @__PURE__ */ React112.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) { | |
| 15710 | + const { | |
| 15711 | + render, | |
| 15712 | + className, | |
| 15713 | + anchor, | |
| 15714 | + positionMethod = "absolute", | |
| 15715 | + side = "top", | |
| 15716 | + align = "center", | |
| 15717 | + sideOffset = 0, | |
| 15718 | + alignOffset = 0, | |
| 15719 | + collisionBoundary = "clipping-ancestors", | |
| 15720 | + collisionPadding = 5, | |
| 15721 | + arrowPadding = 5, | |
| 15722 | + sticky = false, | |
| 15723 | + disableAnchorTracking = false, | |
| 15724 | + collisionAvoidance = POPUP_COLLISION_AVOIDANCE, | |
| 15725 | + style, | |
| 15726 | + ...elementProps | |
| 15727 | + } = componentProps; | |
| 15728 | + const store = useTooltipRootContext(); | |
| 15729 | + const keepMounted = useTooltipPortalContext(); | |
| 15730 | + const open2 = store.useState("open"); | |
| 15731 | + const mounted = store.useState("mounted"); | |
| 15732 | + const trackCursorAxis = store.useState("trackCursorAxis"); | |
| 15733 | + const disableHoverablePopup = store.useState("disableHoverablePopup"); | |
| 15734 | + const floatingRootContext = store.useState("floatingRootContext"); | |
| 15735 | + const instantType = store.useState("instantType"); | |
| 15736 | + const transitionStatus = store.useState("transitionStatus"); | |
| 15737 | + const adaptiveOrigin2 = store.useState("adaptiveOrigin"); | |
| 15738 | + const positioning = useAnchorPositioning({ | |
| 15739 | + anchor, | |
| 15740 | + positionMethod, | |
| 15741 | + floatingRootContext, | |
| 15742 | + mounted, | |
| 15743 | + side, | |
| 15744 | + sideOffset, | |
| 15745 | + align, | |
| 15746 | + alignOffset, | |
| 15747 | + collisionBoundary, | |
| 15748 | + collisionPadding, | |
| 15749 | + sticky, | |
| 15750 | + arrowPadding, | |
| 15751 | + disableAnchorTracking, | |
| 15752 | + keepMounted, | |
| 15753 | + collisionAvoidance, | |
| 15754 | + adaptiveOrigin: adaptiveOrigin2 | |
| 15755 | + }); | |
| 15756 | + const state = React112.useMemo(() => ({ | |
| 15757 | + open: open2, | |
| 15758 | + side: positioning.side, | |
| 15759 | + align: positioning.align, | |
| 15760 | + anchorHidden: positioning.anchorHidden, | |
| 15761 | + instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType | |
| 15762 | + }), [open2, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]); | |
| 15763 | + const element = usePositioner(componentProps, state, { | |
| 15764 | + styles: positioning.positionerStyles, | |
| 15765 | + transitionStatus, | |
| 15766 | + props: elementProps, | |
| 15767 | + refs: [forwardedRef, store.useStateSetter("positionerElement")], | |
| 15768 | + hidden: !mounted, | |
| 15769 | + inert: !open2 || trackCursorAxis === "both" || disableHoverablePopup | |
| 15770 | + }); | |
| 15771 | + return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TooltipPositionerContext.Provider, { | |
| 15772 | + value: positioning, | |
| 15773 | + children: element | |
| 15774 | + }); | |
| 15775 | +}); | |
| 15776 | +if (true) TooltipPositioner.displayName = "TooltipPositioner"; | |
| 15777 | + | |
| 15778 | +// node_modules/@base-ui/react/tooltip/popup/TooltipPopup.mjs | |
| 15779 | +var React113 = __toESM(require_react(), 1); | |
| 15780 | +var TooltipPopup = /* @__PURE__ */ React113.forwardRef(function TooltipPopup2(componentProps, forwardedRef) { | |
| 15781 | + const { | |
| 15782 | + render, | |
| 15783 | + className, | |
| 15784 | + style, | |
| 15785 | + ...elementProps | |
| 15786 | + } = componentProps; | |
| 15787 | + const store = useTooltipRootContext(); | |
| 15788 | + const { | |
| 15789 | + side, | |
| 15790 | + align | |
| 15791 | + } = useTooltipPositionerContext(); | |
| 15792 | + const open2 = store.useState("open"); | |
| 15793 | + const instantType = store.useState("instantType"); | |
| 15794 | + const transitionStatus = store.useState("transitionStatus"); | |
| 15795 | + const popupProps = store.useState("popupProps"); | |
| 15796 | + const floatingContext = store.useState("floatingRootContext"); | |
| 15797 | + const disabled2 = store.useState("disabled"); | |
| 15798 | + const closeDelay = store.useState("closeDelay"); | |
| 15799 | + useOpenChangeComplete({ | |
| 15800 | + open: open2, | |
| 15801 | + ref: store.context.popupRef, | |
| 15802 | + onComplete() { | |
| 15803 | + if (open2) { | |
| 15804 | + store.context.onOpenChangeComplete?.(true); | |
| 1881 | 15805 | } |
| 1882 | - if (!markerValue) { | |
| 1883 | - node.removeAttribute(markerName); | |
| 1884 | - } | |
| 1885 | - }); | |
| 1886 | - lockCount--; | |
| 1887 | - if (!lockCount) { | |
| 1888 | - counterMap = /* @__PURE__ */ new WeakMap(); | |
| 1889 | - counterMap = /* @__PURE__ */ new WeakMap(); | |
| 1890 | - uncontrolledNodes = /* @__PURE__ */ new WeakMap(); | |
| 1891 | - markerMap = {}; | |
| 1892 | 15806 | } |
| 15807 | + }); | |
| 15808 | + useHoverFloatingInteraction(floatingContext, { | |
| 15809 | + enabled: !disabled2, | |
| 15810 | + closeDelay | |
| 15811 | + }); | |
| 15812 | + const setPopupElement = store.useStateSetter("popupElement"); | |
| 15813 | + const state = { | |
| 15814 | + open: open2, | |
| 15815 | + side, | |
| 15816 | + align, | |
| 15817 | + instant: instantType, | |
| 15818 | + transitionStatus | |
| 1893 | 15819 | }; |
| 15820 | + const element = useRenderElement("div", componentProps, { | |
| 15821 | + state, | |
| 15822 | + ref: [forwardedRef, store.context.popupRef, setPopupElement], | |
| 15823 | + props: [FOCUSABLE_POPUP_PROPS, popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps], | |
| 15824 | + stateAttributesMapping: popupTransitionStateMapping | |
| 15825 | + }); | |
| 15826 | + return element; | |
| 15827 | +}); | |
| 15828 | +if (true) TooltipPopup.displayName = "TooltipPopup"; | |
| 15829 | + | |
| 15830 | +// node_modules/@base-ui/react/tooltip/arrow/TooltipArrow.mjs | |
| 15831 | +var React114 = __toESM(require_react(), 1); | |
| 15832 | +var TooltipArrow = /* @__PURE__ */ React114.forwardRef(function TooltipArrow2(componentProps, forwardedRef) { | |
| 15833 | + const { | |
| 15834 | + render, | |
| 15835 | + className, | |
| 15836 | + style, | |
| 15837 | + ...elementProps | |
| 15838 | + } = componentProps; | |
| 15839 | + const store = useTooltipRootContext(); | |
| 15840 | + const { | |
| 15841 | + arrowRef, | |
| 15842 | + side, | |
| 15843 | + align, | |
| 15844 | + arrowUncentered, | |
| 15845 | + arrowStyles | |
| 15846 | + } = useTooltipPositionerContext(); | |
| 15847 | + const open2 = store.useState("open"); | |
| 15848 | + const instantType = store.useState("instantType"); | |
| 15849 | + const state = { | |
| 15850 | + open: open2, | |
| 15851 | + side, | |
| 15852 | + align, | |
| 15853 | + uncentered: arrowUncentered, | |
| 15854 | + instant: instantType | |
| 15855 | + }; | |
| 15856 | + const element = useRenderElement("div", componentProps, { | |
| 15857 | + state, | |
| 15858 | + ref: [forwardedRef, arrowRef], | |
| 15859 | + props: [{ | |
| 15860 | + style: arrowStyles, | |
| 15861 | + "aria-hidden": true | |
| 15862 | + }, elementProps], | |
| 15863 | + stateAttributesMapping: popupStateMapping | |
| 15864 | + }); | |
| 15865 | + return element; | |
| 15866 | +}); | |
| 15867 | +if (true) TooltipArrow.displayName = "TooltipArrow"; | |
| 15868 | + | |
| 15869 | +// node_modules/@base-ui/react/tooltip/provider/TooltipProvider.mjs | |
| 15870 | +var React115 = __toESM(require_react(), 1); | |
| 15871 | +var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1); | |
| 15872 | +var TooltipProvider = function TooltipProvider2(props) { | |
| 15873 | + const { | |
| 15874 | + delay, | |
| 15875 | + closeDelay, | |
| 15876 | + timeout = 400 | |
| 15877 | + } = props; | |
| 15878 | + const delayValue = React115.useMemo(() => ({ | |
| 15879 | + open: delay, | |
| 15880 | + close: closeDelay | |
| 15881 | + }), [delay, closeDelay]); | |
| 15882 | + return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipProviderContext.Provider, { | |
| 15883 | + value: delay, | |
| 15884 | + children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(FloatingDelayGroup, { | |
| 15885 | + delay: delayValue, | |
| 15886 | + timeoutMs: timeout, | |
| 15887 | + children: props.children | |
| 15888 | + }) | |
| 15889 | + }); | |
| 1894 | 15890 | }; |
| 1895 | -var hideOthers = function(originalTarget, parentNode, markerName) { | |
| 1896 | - if (markerName === void 0) { | |
| 1897 | - markerName = "data-aria-hidden"; | |
| 15891 | +if (true) TooltipProvider.displayName = "TooltipProvider"; | |
| 15892 | + | |
| 15893 | +// node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs | |
| 15894 | +var React116 = __toESM(require_react(), 1); | |
| 15895 | +var TooltipViewport = /* @__PURE__ */ React116.forwardRef(function TooltipViewport2(componentProps, forwardedRef) { | |
| 15896 | + const { | |
| 15897 | + render, | |
| 15898 | + className, | |
| 15899 | + style, | |
| 15900 | + children, | |
| 15901 | + ...elementProps | |
| 15902 | + } = componentProps; | |
| 15903 | + const store = useTooltipRootContext(); | |
| 15904 | + const positioner = useTooltipPositionerContext(); | |
| 15905 | + const instantType = store.useState("instantType"); | |
| 15906 | + const { | |
| 15907 | + children: childrenToRender, | |
| 15908 | + state: viewportState | |
| 15909 | + } = usePopupViewport({ | |
| 15910 | + store, | |
| 15911 | + side: positioner.side, | |
| 15912 | + children | |
| 15913 | + }); | |
| 15914 | + const state = { | |
| 15915 | + activationDirection: viewportState.activationDirection, | |
| 15916 | + transitioning: viewportState.transitioning, | |
| 15917 | + instant: instantType | |
| 15918 | + }; | |
| 15919 | + return useRenderElement("div", componentProps, { | |
| 15920 | + state, | |
| 15921 | + ref: forwardedRef, | |
| 15922 | + props: [elementProps, { | |
| 15923 | + children: childrenToRender | |
| 15924 | + }], | |
| 15925 | + stateAttributesMapping: popupViewportStateMapping | |
| 15926 | + }); | |
| 15927 | +}); | |
| 15928 | +if (true) TooltipViewport.displayName = "TooltipViewport"; | |
| 15929 | + | |
| 15930 | +// node_modules/@base-ui/react/tooltip/store/TooltipHandle.mjs | |
| 15931 | +var TooltipHandle = class extends BasePopupHandle { | |
| 15932 | + constructor() { | |
| 15933 | + super(createNullTooltipStore(), "Tooltip"); | |
| 1898 | 15934 | } |
| 1899 | - var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]); | |
| 1900 | - var activeParentNode = parentNode || getDefaultParent(originalTarget); | |
| 1901 | - if (!activeParentNode) { | |
| 1902 | - return function() { | |
| 1903 | - return null; | |
| 1904 | - }; | |
| 15935 | + /** | |
| 15936 | + * Opens the tooltip and associates it with the trigger with the given id. | |
| 15937 | + * | |
| 15938 | + * This method should only be called in an event handler or an effect (not during rendering). | |
| 15939 | + * | |
| 15940 | + * @param triggerId ID of the trigger to associate with the tooltip. The trigger must be a matching | |
| 15941 | + * `Tooltip.Trigger` with this handle passed as a prop. | |
| 15942 | + */ | |
| 15943 | + open(triggerId) { | |
| 15944 | + this.openByTrigger(triggerId); | |
| 1905 | 15945 | } |
| 1906 | - targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script"))); | |
| 1907 | - return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden"); | |
| 15946 | + /** | |
| 15947 | + * Closes the tooltip. | |
| 15948 | + * | |
| 15949 | + * This method should only be called in an event handler or an effect (not during rendering). | |
| 15950 | + */ | |
| 15951 | + close() { | |
| 15952 | + this.closePopup(); | |
| 15953 | + } | |
| 15954 | + /** | |
| 15955 | + * Whether the tooltip is currently open. Returns `false` while no root is attached to the handle. | |
| 15956 | + */ | |
| 15957 | + get isOpen() { | |
| 15958 | + return this.attachedStore?.select("open") ?? false; | |
| 15959 | + } | |
| 1908 | 15960 | }; |
| 15961 | +function createTooltipHandle() { | |
| 15962 | + return new TooltipHandle(); | |
| 15963 | +} | |
| 1909 | 15964 | |
| 1910 | -// node_modules/@radix-ui/react-dialog/dist/index.mjs | |
| 1911 | -var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); | |
| 1912 | -var DIALOG_NAME = "Dialog"; | |
| 1913 | -var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME); | |
| 1914 | -var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME); | |
| 1915 | -var Dialog = (props) => { | |
| 1916 | - const { | |
| 1917 | - __scopeDialog, | |
| 1918 | - children, | |
| 1919 | - open: openProp, | |
| 1920 | - defaultOpen, | |
| 1921 | - onOpenChange, | |
| 1922 | - modal = true | |
| 1923 | - } = props; | |
| 1924 | - const triggerRef = React24.useRef(null); | |
| 1925 | - const contentRef = React24.useRef(null); | |
| 1926 | - const [open, setOpen] = useControllableState({ | |
| 1927 | - prop: openProp, | |
| 1928 | - defaultProp: defaultOpen ?? false, | |
| 1929 | - onChange: onOpenChange, | |
| 1930 | - caller: DIALOG_NAME | |
| 15965 | +// node_modules/@base-ui/react/use-render/useRender.mjs | |
| 15966 | +function useRender(params) { | |
| 15967 | + return useRenderElement(params.defaultTagName ?? "div", params, params); | |
| 15968 | +} | |
| 15969 | + | |
| 15970 | +// packages/ui/build-module/text/text.mjs | |
| 15971 | +var import_element16 = __toESM(require_element(), 1); | |
| 15972 | +var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; | |
| 15973 | +function getRuntime() { | |
| 15974 | + const globalScope = globalThis; | |
| 15975 | + if (globalScope.__wpStyleRuntime) { | |
| 15976 | + return globalScope.__wpStyleRuntime; | |
| 15977 | + } | |
| 15978 | + globalScope.__wpStyleRuntime = { | |
| 15979 | + documents: /* @__PURE__ */ new Map(), | |
| 15980 | + styles: /* @__PURE__ */ new Map(), | |
| 15981 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 15982 | + }; | |
| 15983 | + if (typeof document !== "undefined") { | |
| 15984 | + registerDocument(document); | |
| 15985 | + } | |
| 15986 | + return globalScope.__wpStyleRuntime; | |
| 15987 | +} | |
| 15988 | +function documentContainsStyleHash(targetDocument, hash) { | |
| 15989 | + if (!targetDocument.head) { | |
| 15990 | + return false; | |
| 15991 | + } | |
| 15992 | + for (const style of targetDocument.head.querySelectorAll( | |
| 15993 | + `style[${STYLE_HASH_ATTRIBUTE}]` | |
| 15994 | + )) { | |
| 15995 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) { | |
| 15996 | + return true; | |
| 15997 | + } | |
| 15998 | + } | |
| 15999 | + return false; | |
| 16000 | +} | |
| 16001 | +function injectStyle(targetDocument, hash, css) { | |
| 16002 | + if (!targetDocument.head) { | |
| 16003 | + return; | |
| 16004 | + } | |
| 16005 | + const runtime = getRuntime(); | |
| 16006 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 16007 | + if (!injectedStyles) { | |
| 16008 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 16009 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 16010 | + } | |
| 16011 | + if (injectedStyles.has(hash)) { | |
| 16012 | + return; | |
| 16013 | + } | |
| 16014 | + if (documentContainsStyleHash(targetDocument, hash)) { | |
| 16015 | + injectedStyles.add(hash); | |
| 16016 | + return; | |
| 16017 | + } | |
| 16018 | + const style = targetDocument.createElement("style"); | |
| 16019 | + style.setAttribute(STYLE_HASH_ATTRIBUTE, hash); | |
| 16020 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 16021 | + targetDocument.head.appendChild(style); | |
| 16022 | + injectedStyles.add(hash); | |
| 16023 | +} | |
| 16024 | +function registerDocument(targetDocument) { | |
| 16025 | + const runtime = getRuntime(); | |
| 16026 | + runtime.documents.set( | |
| 16027 | + targetDocument, | |
| 16028 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 16029 | + ); | |
| 16030 | + for (const [hash, css] of runtime.styles) { | |
| 16031 | + injectStyle(targetDocument, hash, css); | |
| 16032 | + } | |
| 16033 | + return () => { | |
| 16034 | + const count = runtime.documents.get(targetDocument); | |
| 16035 | + if (count === void 0) { | |
| 16036 | + return; | |
| 16037 | + } | |
| 16038 | + if (count <= 1) { | |
| 16039 | + runtime.documents.delete(targetDocument); | |
| 16040 | + return; | |
| 16041 | + } | |
| 16042 | + runtime.documents.set(targetDocument, count - 1); | |
| 16043 | + }; | |
| 16044 | +} | |
| 16045 | +function registerStyle(hash, css) { | |
| 16046 | + const runtime = getRuntime(); | |
| 16047 | + runtime.styles.set(hash, css); | |
| 16048 | + for (const targetDocument of runtime.documents.keys()) { | |
| 16049 | + injectStyle(targetDocument, hash, css); | |
| 16050 | + } | |
| 16051 | +} | |
| 16052 | +if (typeof process === "undefined" || true) { | |
| 16053 | + registerStyle("3167e7d116", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._83ed8a8da5dd50ea__text{text-wrap:pretty;margin:0}._14437cfb77831647__heading-2xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-p-line-height:var(--wpds-typography-line-height-2xl,40px);font-size:var(--wpds-typography-font-size-2xl,32px);line-height:var(--wpds-typography-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-md,24px)}.aa58f227716bcde2__heading-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-xl,32px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-lg,15px);line-height:var(--wpds-typography-line-height-md,24px)}._131101940be12424__body-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}'); | |
| 16054 | +} | |
| 16055 | +var style_default = { "text": "_83ed8a8da5dd50ea__text", "heading-2xl": "_14437cfb77831647__heading-2xl", "heading-xl": "_3c78b7fa9b4072dd__heading-xl", "heading-lg": "aa58f227716bcde2__heading-lg", "heading-md": "fc4da56d8dfe52c4__heading-md", "heading-sm": "a9b78c7c82e8dff7__heading-sm", "body-xl": "_305ff559e52180d5__body-xl", "body-lg": "ca1aa3fc2029e958__body-lg", "body-md": "_131101940be12424__body-md", "body-sm": "_0e8d87a42c1f75fa__body-sm" }; | |
| 16056 | +if (typeof process === "undefined" || true) { | |
| 16057 | + registerStyle("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); | |
| 16058 | +} | |
| 16059 | +var global_css_defense_default = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; | |
| 16060 | +var Text = (0, import_element16.forwardRef)(function Text2({ variant = "body-md", render, className, ...props }, ref) { | |
| 16061 | + const element = useRender({ | |
| 16062 | + render, | |
| 16063 | + defaultTagName: "span", | |
| 16064 | + ref, | |
| 16065 | + props: mergeProps(props, { | |
| 16066 | + className: clsx_default( | |
| 16067 | + style_default.text, | |
| 16068 | + global_css_defense_default.heading, | |
| 16069 | + global_css_defense_default.p, | |
| 16070 | + style_default[variant], | |
| 16071 | + className | |
| 16072 | + ) | |
| 16073 | + }) | |
| 1931 | 16074 | }); |
| 1932 | - return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)( | |
| 1933 | - DialogProvider, | |
| 1934 | - { | |
| 1935 | - scope: __scopeDialog, | |
| 1936 | - triggerRef, | |
| 1937 | - contentRef, | |
| 1938 | - contentId: useId(), | |
| 1939 | - titleId: useId(), | |
| 1940 | - descriptionId: useId(), | |
| 1941 | - open, | |
| 1942 | - onOpenChange: setOpen, | |
| 1943 | - onOpenToggle: React24.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]), | |
| 1944 | - modal, | |
| 1945 | - children | |
| 16075 | + return element; | |
| 16076 | +}); | |
| 16077 | + | |
| 16078 | +// packages/ui/build-module/tooltip/popup.mjs | |
| 16079 | +var import_element20 = __toESM(require_element(), 1); | |
| 16080 | + | |
| 16081 | +// packages/ui/build-module/tooltip/portal.mjs | |
| 16082 | +var import_element17 = __toESM(require_element(), 1); | |
| 16083 | + | |
| 16084 | +// packages/ui/build-module/utils/wp-compat-overlay-slot.mjs | |
| 16085 | +var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash"; | |
| 16086 | +function getRuntime2() { | |
| 16087 | + const globalScope = globalThis; | |
| 16088 | + if (globalScope.__wpStyleRuntime) { | |
| 16089 | + return globalScope.__wpStyleRuntime; | |
| 16090 | + } | |
| 16091 | + globalScope.__wpStyleRuntime = { | |
| 16092 | + documents: /* @__PURE__ */ new Map(), | |
| 16093 | + styles: /* @__PURE__ */ new Map(), | |
| 16094 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 16095 | + }; | |
| 16096 | + if (typeof document !== "undefined") { | |
| 16097 | + registerDocument2(document); | |
| 16098 | + } | |
| 16099 | + return globalScope.__wpStyleRuntime; | |
| 16100 | +} | |
| 16101 | +function documentContainsStyleHash2(targetDocument, hash) { | |
| 16102 | + if (!targetDocument.head) { | |
| 16103 | + return false; | |
| 16104 | + } | |
| 16105 | + for (const style of targetDocument.head.querySelectorAll( | |
| 16106 | + `style[${STYLE_HASH_ATTRIBUTE2}]` | |
| 16107 | + )) { | |
| 16108 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) { | |
| 16109 | + return true; | |
| 1946 | 16110 | } |
| 16111 | + } | |
| 16112 | + return false; | |
| 16113 | +} | |
| 16114 | +function injectStyle2(targetDocument, hash, css) { | |
| 16115 | + if (!targetDocument.head) { | |
| 16116 | + return; | |
| 16117 | + } | |
| 16118 | + const runtime = getRuntime2(); | |
| 16119 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 16120 | + if (!injectedStyles) { | |
| 16121 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 16122 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 16123 | + } | |
| 16124 | + if (injectedStyles.has(hash)) { | |
| 16125 | + return; | |
| 16126 | + } | |
| 16127 | + if (documentContainsStyleHash2(targetDocument, hash)) { | |
| 16128 | + injectedStyles.add(hash); | |
| 16129 | + return; | |
| 16130 | + } | |
| 16131 | + const style = targetDocument.createElement("style"); | |
| 16132 | + style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash); | |
| 16133 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 16134 | + targetDocument.head.appendChild(style); | |
| 16135 | + injectedStyles.add(hash); | |
| 16136 | +} | |
| 16137 | +function registerDocument2(targetDocument) { | |
| 16138 | + const runtime = getRuntime2(); | |
| 16139 | + runtime.documents.set( | |
| 16140 | + targetDocument, | |
| 16141 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 1947 | 16142 | ); |
| 1948 | -}; | |
| 1949 | -Dialog.displayName = DIALOG_NAME; | |
| 1950 | -var TRIGGER_NAME = "DialogTrigger"; | |
| 1951 | -var DialogTrigger = React24.forwardRef( | |
| 1952 | - (props, forwardedRef) => { | |
| 1953 | - const { __scopeDialog, ...triggerProps } = props; | |
| 1954 | - const context = useDialogContext(TRIGGER_NAME, __scopeDialog); | |
| 1955 | - const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef); | |
| 1956 | - return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)( | |
| 1957 | - Primitive.button, | |
| 16143 | + for (const [hash, css] of runtime.styles) { | |
| 16144 | + injectStyle2(targetDocument, hash, css); | |
| 16145 | + } | |
| 16146 | + return () => { | |
| 16147 | + const count = runtime.documents.get(targetDocument); | |
| 16148 | + if (count === void 0) { | |
| 16149 | + return; | |
| 16150 | + } | |
| 16151 | + if (count <= 1) { | |
| 16152 | + runtime.documents.delete(targetDocument); | |
| 16153 | + return; | |
| 16154 | + } | |
| 16155 | + runtime.documents.set(targetDocument, count - 1); | |
| 16156 | + }; | |
| 16157 | +} | |
| 16158 | +function registerStyle2(hash, css) { | |
| 16159 | + const runtime = getRuntime2(); | |
| 16160 | + runtime.styles.set(hash, css); | |
| 16161 | + for (const targetDocument of runtime.documents.keys()) { | |
| 16162 | + injectStyle2(targetDocument, hash, css); | |
| 16163 | + } | |
| 16164 | +} | |
| 16165 | +if (typeof process === "undefined" || true) { | |
| 16166 | + registerStyle2("be37f31c1e", "._11fc52b637ff8a7e__slot{inset:0;isolation:isolate;pointer-events:none;position:fixed;z-index:1000000003}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._11fc52b637ff8a7e__slot>*{pointer-events:auto}}}"); | |
| 16167 | +} | |
| 16168 | +var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" }; | |
| 16169 | +var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot"; | |
| 16170 | +function resolveOwnerDocument() { | |
| 16171 | + return typeof document === "undefined" ? null : document; | |
| 16172 | +} | |
| 16173 | +function isInWordPressEnvironment() { | |
| 16174 | + let topWp; | |
| 16175 | + try { | |
| 16176 | + topWp = window.top?.wp; | |
| 16177 | + } catch { | |
| 16178 | + } | |
| 16179 | + const wp = topWp ?? window.wp; | |
| 16180 | + return typeof wp?.components === "object" && wp.components !== null; | |
| 16181 | +} | |
| 16182 | +var cachedSlot = null; | |
| 16183 | +function ensureSlotIsAccessible(element) { | |
| 16184 | + element.setAttribute("aria-hidden", "false"); | |
| 16185 | + return element; | |
| 16186 | +} | |
| 16187 | +function createSlot(ownerDocument2) { | |
| 16188 | + const element = ownerDocument2.createElement("div"); | |
| 16189 | + element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, ""); | |
| 16190 | + if (wp_compat_overlay_slot_default.slot) { | |
| 16191 | + element.classList.add(wp_compat_overlay_slot_default.slot); | |
| 16192 | + } | |
| 16193 | + ownerDocument2.body.appendChild(element); | |
| 16194 | + return element; | |
| 16195 | +} | |
| 16196 | +function getWpCompatOverlaySlot() { | |
| 16197 | + if (typeof window === "undefined") { | |
| 16198 | + return void 0; | |
| 16199 | + } | |
| 16200 | + if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) { | |
| 16201 | + return void 0; | |
| 16202 | + } | |
| 16203 | + const ownerDocument2 = resolveOwnerDocument(); | |
| 16204 | + if (!ownerDocument2 || !ownerDocument2.body) { | |
| 16205 | + return void 0; | |
| 16206 | + } | |
| 16207 | + if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) { | |
| 16208 | + return ensureSlotIsAccessible(cachedSlot); | |
| 16209 | + } | |
| 16210 | + const existing = ownerDocument2.querySelector( | |
| 16211 | + `[${WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]` | |
| 16212 | + ); | |
| 16213 | + if (existing instanceof HTMLDivElement) { | |
| 16214 | + cachedSlot = ensureSlotIsAccessible(existing); | |
| 16215 | + return cachedSlot; | |
| 16216 | + } | |
| 16217 | + if (cachedSlot?.isConnected) { | |
| 16218 | + cachedSlot.remove(); | |
| 16219 | + } | |
| 16220 | + cachedSlot = ensureSlotIsAccessible(createSlot(ownerDocument2)); | |
| 16221 | + return cachedSlot; | |
| 16222 | +} | |
| 16223 | + | |
| 16224 | +// packages/ui/build-module/tooltip/portal.mjs | |
| 16225 | +var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1); | |
| 16226 | +var Portal = (0, import_element17.forwardRef)( | |
| 16227 | + function TooltipPortal3({ container, ...restProps }, ref) { | |
| 16228 | + return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( | |
| 16229 | + index_parts_exports3.Portal, | |
| 1958 | 16230 | { |
| 1959 | - type: "button", | |
| 1960 | - "aria-haspopup": "dialog", | |
| 1961 | - "aria-expanded": context.open, | |
| 1962 | - "aria-controls": context.contentId, | |
| 1963 | - "data-state": getState(context.open), | |
| 1964 | - ...triggerProps, | |
| 1965 | - ref: composedTriggerRef, | |
| 1966 | - onClick: composeEventHandlers(props.onClick, context.onOpenToggle) | |
| 16231 | + container: container ?? getWpCompatOverlaySlot(), | |
| 16232 | + ...restProps, | |
| 16233 | + ref | |
| 1967 | 16234 | } |
| 1968 | 16235 | ); |
| 1969 | 16236 | } |
| 1970 | 16237 | ); |
| 1971 | -DialogTrigger.displayName = TRIGGER_NAME; | |
| 1972 | -var PORTAL_NAME2 = "DialogPortal"; | |
| 1973 | -var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME2, { | |
| 1974 | - forceMount: void 0 | |
| 16238 | + | |
| 16239 | +// packages/ui/build-module/tooltip/positioner.mjs | |
| 16240 | +var import_element18 = __toESM(require_element(), 1); | |
| 16241 | +var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1); | |
| 16242 | +var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash"; | |
| 16243 | +function getRuntime3() { | |
| 16244 | + const globalScope = globalThis; | |
| 16245 | + if (globalScope.__wpStyleRuntime) { | |
| 16246 | + return globalScope.__wpStyleRuntime; | |
| 16247 | + } | |
| 16248 | + globalScope.__wpStyleRuntime = { | |
| 16249 | + documents: /* @__PURE__ */ new Map(), | |
| 16250 | + styles: /* @__PURE__ */ new Map(), | |
| 16251 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 16252 | + }; | |
| 16253 | + if (typeof document !== "undefined") { | |
| 16254 | + registerDocument3(document); | |
| 16255 | + } | |
| 16256 | + return globalScope.__wpStyleRuntime; | |
| 16257 | +} | |
| 16258 | +function documentContainsStyleHash3(targetDocument, hash) { | |
| 16259 | + if (!targetDocument.head) { | |
| 16260 | + return false; | |
| 16261 | + } | |
| 16262 | + for (const style of targetDocument.head.querySelectorAll( | |
| 16263 | + `style[${STYLE_HASH_ATTRIBUTE3}]` | |
| 16264 | + )) { | |
| 16265 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) { | |
| 16266 | + return true; | |
| 16267 | + } | |
| 16268 | + } | |
| 16269 | + return false; | |
| 16270 | +} | |
| 16271 | +function injectStyle3(targetDocument, hash, css) { | |
| 16272 | + if (!targetDocument.head) { | |
| 16273 | + return; | |
| 16274 | + } | |
| 16275 | + const runtime = getRuntime3(); | |
| 16276 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 16277 | + if (!injectedStyles) { | |
| 16278 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 16279 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 16280 | + } | |
| 16281 | + if (injectedStyles.has(hash)) { | |
| 16282 | + return; | |
| 16283 | + } | |
| 16284 | + if (documentContainsStyleHash3(targetDocument, hash)) { | |
| 16285 | + injectedStyles.add(hash); | |
| 16286 | + return; | |
| 16287 | + } | |
| 16288 | + const style = targetDocument.createElement("style"); | |
| 16289 | + style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash); | |
| 16290 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 16291 | + targetDocument.head.appendChild(style); | |
| 16292 | + injectedStyles.add(hash); | |
| 16293 | +} | |
| 16294 | +function registerDocument3(targetDocument) { | |
| 16295 | + const runtime = getRuntime3(); | |
| 16296 | + runtime.documents.set( | |
| 16297 | + targetDocument, | |
| 16298 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 16299 | + ); | |
| 16300 | + for (const [hash, css] of runtime.styles) { | |
| 16301 | + injectStyle3(targetDocument, hash, css); | |
| 16302 | + } | |
| 16303 | + return () => { | |
| 16304 | + const count = runtime.documents.get(targetDocument); | |
| 16305 | + if (count === void 0) { | |
| 16306 | + return; | |
| 16307 | + } | |
| 16308 | + if (count <= 1) { | |
| 16309 | + runtime.documents.delete(targetDocument); | |
| 16310 | + return; | |
| 16311 | + } | |
| 16312 | + runtime.documents.set(targetDocument, count - 1); | |
| 16313 | + }; | |
| 16314 | +} | |
| 16315 | +function registerStyle3(hash, css) { | |
| 16316 | + const runtime = getRuntime3(); | |
| 16317 | + runtime.styles.set(hash, css); | |
| 16318 | + for (const targetDocument of runtime.documents.keys()) { | |
| 16319 | + injectStyle3(targetDocument, hash, css); | |
| 16320 | + } | |
| 16321 | +} | |
| 16322 | +if (typeof process === "undefined" || true) { | |
| 16323 | + registerStyle3("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); | |
| 16324 | +} | |
| 16325 | +var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; | |
| 16326 | +if (typeof process === "undefined" || true) { | |
| 16327 | + registerStyle3("19fcc06039", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{--_wp-ui-elevation-sm:0 1px 2px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.04),0 6px 6px rgba(0,0,0,.03),0 8px 8px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-sm);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}}'); | |
| 16328 | +} | |
| 16329 | +var style_default2 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; | |
| 16330 | +var Positioner = (0, import_element18.forwardRef)( | |
| 16331 | + function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) { | |
| 16332 | + return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( | |
| 16333 | + index_parts_exports3.Positioner, | |
| 16334 | + { | |
| 16335 | + ref, | |
| 16336 | + align, | |
| 16337 | + side, | |
| 16338 | + sideOffset, | |
| 16339 | + ...props, | |
| 16340 | + className: clsx_default( | |
| 16341 | + resets_default["box-sizing"], | |
| 16342 | + style_default2.positioner, | |
| 16343 | + className | |
| 16344 | + ) | |
| 16345 | + } | |
| 16346 | + ); | |
| 16347 | + } | |
| 16348 | +); | |
| 16349 | + | |
| 16350 | +// packages/ui/build-module/utils/render-slot-with-children.mjs | |
| 16351 | +var import_element19 = __toESM(require_element(), 1); | |
| 16352 | +function renderSlotWithChildren(slot, defaultSlot, children) { | |
| 16353 | + return (0, import_element19.cloneElement)(slot ?? defaultSlot, { children }); | |
| 16354 | +} | |
| 16355 | + | |
| 16356 | +// packages/ui/build-module/utils/theme-provider.mjs | |
| 16357 | +var theme = __toESM(require_theme(), 1); | |
| 16358 | + | |
| 16359 | +// packages/ui/build-module/lock-unlock.mjs | |
| 16360 | +var import_private_apis = __toESM(require_private_apis(), 1); | |
| 16361 | +var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( | |
| 16362 | + "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", | |
| 16363 | + "@wordpress/ui" | |
| 16364 | +); | |
| 16365 | + | |
| 16366 | +// packages/ui/build-module/utils/theme-provider.mjs | |
| 16367 | +function getThemeProvider() { | |
| 16368 | + const themePackage = theme; | |
| 16369 | + if (themePackage.ThemeProvider) { | |
| 16370 | + return themePackage.ThemeProvider; | |
| 16371 | + } | |
| 16372 | + if (!themePackage.privateApis) { | |
| 16373 | + throw new Error( | |
| 16374 | + "@wordpress/ui: @wordpress/theme must expose `ThemeProvider` or `privateApis.ThemeProvider`." | |
| 16375 | + ); | |
| 16376 | + } | |
| 16377 | + return unlock( | |
| 16378 | + themePackage.privateApis | |
| 16379 | + ).ThemeProvider; | |
| 16380 | +} | |
| 16381 | +var ThemeProvider = getThemeProvider(); | |
| 16382 | + | |
| 16383 | +// packages/ui/build-module/tooltip/popup.mjs | |
| 16384 | +var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1); | |
| 16385 | +var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash"; | |
| 16386 | +function getRuntime4() { | |
| 16387 | + const globalScope = globalThis; | |
| 16388 | + if (globalScope.__wpStyleRuntime) { | |
| 16389 | + return globalScope.__wpStyleRuntime; | |
| 16390 | + } | |
| 16391 | + globalScope.__wpStyleRuntime = { | |
| 16392 | + documents: /* @__PURE__ */ new Map(), | |
| 16393 | + styles: /* @__PURE__ */ new Map(), | |
| 16394 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 16395 | + }; | |
| 16396 | + if (typeof document !== "undefined") { | |
| 16397 | + registerDocument4(document); | |
| 16398 | + } | |
| 16399 | + return globalScope.__wpStyleRuntime; | |
| 16400 | +} | |
| 16401 | +function documentContainsStyleHash4(targetDocument, hash) { | |
| 16402 | + if (!targetDocument.head) { | |
| 16403 | + return false; | |
| 16404 | + } | |
| 16405 | + for (const style of targetDocument.head.querySelectorAll( | |
| 16406 | + `style[${STYLE_HASH_ATTRIBUTE4}]` | |
| 16407 | + )) { | |
| 16408 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) { | |
| 16409 | + return true; | |
| 16410 | + } | |
| 16411 | + } | |
| 16412 | + return false; | |
| 16413 | +} | |
| 16414 | +function injectStyle4(targetDocument, hash, css) { | |
| 16415 | + if (!targetDocument.head) { | |
| 16416 | + return; | |
| 16417 | + } | |
| 16418 | + const runtime = getRuntime4(); | |
| 16419 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 16420 | + if (!injectedStyles) { | |
| 16421 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 16422 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 16423 | + } | |
| 16424 | + if (injectedStyles.has(hash)) { | |
| 16425 | + return; | |
| 16426 | + } | |
| 16427 | + if (documentContainsStyleHash4(targetDocument, hash)) { | |
| 16428 | + injectedStyles.add(hash); | |
| 16429 | + return; | |
| 16430 | + } | |
| 16431 | + const style = targetDocument.createElement("style"); | |
| 16432 | + style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash); | |
| 16433 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 16434 | + targetDocument.head.appendChild(style); | |
| 16435 | + injectedStyles.add(hash); | |
| 16436 | +} | |
| 16437 | +function registerDocument4(targetDocument) { | |
| 16438 | + const runtime = getRuntime4(); | |
| 16439 | + runtime.documents.set( | |
| 16440 | + targetDocument, | |
| 16441 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 16442 | + ); | |
| 16443 | + for (const [hash, css] of runtime.styles) { | |
| 16444 | + injectStyle4(targetDocument, hash, css); | |
| 16445 | + } | |
| 16446 | + return () => { | |
| 16447 | + const count = runtime.documents.get(targetDocument); | |
| 16448 | + if (count === void 0) { | |
| 16449 | + return; | |
| 16450 | + } | |
| 16451 | + if (count <= 1) { | |
| 16452 | + runtime.documents.delete(targetDocument); | |
| 16453 | + return; | |
| 16454 | + } | |
| 16455 | + runtime.documents.set(targetDocument, count - 1); | |
| 16456 | + }; | |
| 16457 | +} | |
| 16458 | +function registerStyle4(hash, css) { | |
| 16459 | + const runtime = getRuntime4(); | |
| 16460 | + runtime.styles.set(hash, css); | |
| 16461 | + for (const targetDocument of runtime.documents.keys()) { | |
| 16462 | + injectStyle4(targetDocument, hash, css); | |
| 16463 | + } | |
| 16464 | +} | |
| 16465 | +if (typeof process === "undefined" || true) { | |
| 16466 | + registerStyle4("19fcc06039", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{--_wp-ui-elevation-sm:0 1px 2px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.04),0 6px 6px rgba(0,0,0,.03),0 8px 8px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-sm);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}}'); | |
| 16467 | +} | |
| 16468 | +var style_default3 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; | |
| 16469 | +var POPUP_COLOR = { background: "#1e1e1e" }; | |
| 16470 | +var Popup = (0, import_element20.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) { | |
| 16471 | + const popupContent = /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( | |
| 16472 | + index_parts_exports3.Popup, | |
| 16473 | + { | |
| 16474 | + ref, | |
| 16475 | + className: clsx_default(style_default3.popup, className), | |
| 16476 | + ...props, | |
| 16477 | + children | |
| 16478 | + } | |
| 16479 | + ) }); | |
| 16480 | + const positionedPopup = renderSlotWithChildren( | |
| 16481 | + positioner, | |
| 16482 | + /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Positioner, {}), | |
| 16483 | + popupContent | |
| 16484 | + ); | |
| 16485 | + return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Portal, {}), positionedPopup); | |
| 1975 | 16486 | }); |
| 1976 | -var DialogPortal = (props) => { | |
| 1977 | - const { __scopeDialog, forceMount, children, container } = props; | |
| 1978 | - const context = useDialogContext(PORTAL_NAME2, __scopeDialog); | |
| 1979 | - return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PortalProvider, { scope: __scopeDialog, forceMount, children: React24.Children.map(children, (child) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Portal, { asChild: true, container, children: child }) })) }); | |
| 1980 | -}; | |
| 1981 | -DialogPortal.displayName = PORTAL_NAME2; | |
| 1982 | -var OVERLAY_NAME = "DialogOverlay"; | |
| 1983 | -var DialogOverlay = React24.forwardRef( | |
| 1984 | - (props, forwardedRef) => { | |
| 1985 | - const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog); | |
| 1986 | - const { forceMount = portalContext.forceMount, ...overlayProps } = props; | |
| 1987 | - const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog); | |
| 1988 | - return context.modal ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null; | |
| 16487 | + | |
| 16488 | +// packages/ui/build-module/tooltip/trigger.mjs | |
| 16489 | +var import_element21 = __toESM(require_element(), 1); | |
| 16490 | +var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1); | |
| 16491 | +var Trigger = (0, import_element21.forwardRef)( | |
| 16492 | + function TooltipTrigger3(props, ref) { | |
| 16493 | + return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(index_parts_exports3.Trigger, { ref, ...props }); | |
| 1989 | 16494 | } |
| 1990 | 16495 | ); |
| 1991 | -DialogOverlay.displayName = OVERLAY_NAME; | |
| 1992 | -var Slot = createSlot("DialogOverlay.RemoveScroll"); | |
| 1993 | -var DialogOverlayImpl = React24.forwardRef( | |
| 1994 | - (props, forwardedRef) => { | |
| 1995 | - const { __scopeDialog, ...overlayProps } = props; | |
| 1996 | - const context = useDialogContext(OVERLAY_NAME, __scopeDialog); | |
| 1997 | - return ( | |
| 1998 | - // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll` | |
| 1999 | - // ie. when `Overlay` and `Content` are siblings | |
| 2000 | - /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Combination_default, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)( | |
| 2001 | - Primitive.div, | |
| 16496 | + | |
| 16497 | +// packages/ui/build-module/utils/direction-provider.mjs | |
| 16498 | +var import_i18n = __toESM(require_i18n(), 1); | |
| 16499 | +var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1); | |
| 16500 | +function DirectionProvider3({ children }) { | |
| 16501 | + return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(DirectionProvider, { direction: (0, import_i18n.isRTL)() ? "rtl" : "ltr", children }); | |
| 16502 | +} | |
| 16503 | + | |
| 16504 | +// packages/ui/build-module/tooltip/root.mjs | |
| 16505 | +var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1); | |
| 16506 | +function Root(props) { | |
| 16507 | + return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DirectionProvider3, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(index_parts_exports3.Root, { ...props }) }); | |
| 16508 | +} | |
| 16509 | + | |
| 16510 | +// packages/icons/build-module/library/close-small.mjs | |
| 16511 | +var import_primitives = __toESM(require_primitives(), 1); | |
| 16512 | +var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1); | |
| 16513 | +var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_primitives.Path, { d: "M7.75 16.25L16.25 7.75M16.25 16.25L7.75 7.75", vectorEffect: "non-scaling-stroke" }) }); | |
| 16514 | + | |
| 16515 | +// packages/icons/build-module/library/search.mjs | |
| 16516 | +var import_primitives2 = __toESM(require_primitives(), 1); | |
| 16517 | +var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1); | |
| 16518 | +var search_default = /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_primitives2.Path, { d: "M5 19L9.28769 14.7123M18.25 11C18.25 13.8995 15.8995 16.25 13 16.25C10.1005 16.25 7.75 13.8995 7.75 11C7.75 8.10051 10.1005 5.75 13 5.75C15.8995 5.75 18.25 8.10051 18.25 11Z", vectorEffect: "non-scaling-stroke" }) }); | |
| 16519 | + | |
| 16520 | +// packages/ui/build-module/icon/icon.mjs | |
| 16521 | +var import_element22 = __toESM(require_element(), 1); | |
| 16522 | +var import_primitives3 = __toESM(require_primitives(), 1); | |
| 16523 | +var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1); | |
| 16524 | +var Icon = (0, import_element22.forwardRef)(function Icon2({ icon, size: size4 = 24, style, ...restProps }, ref) { | |
| 16525 | + const mergedStyle = icon.props.style || style ? { ...icon.props.style, ...style } : void 0; | |
| 16526 | + return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)( | |
| 16527 | + import_primitives3.SVG, | |
| 16528 | + { | |
| 16529 | + ref, | |
| 16530 | + ...icon.props, | |
| 16531 | + ...restProps, | |
| 16532 | + ...mergedStyle ? { style: mergedStyle } : {}, | |
| 16533 | + width: size4, | |
| 16534 | + height: size4 | |
| 16535 | + } | |
| 16536 | + ); | |
| 16537 | +}); | |
| 16538 | + | |
| 16539 | +// packages/ui/build-module/utils/keyboard-shortcut.mjs | |
| 16540 | +var import_element24 = __toESM(require_element(), 1); | |
| 16541 | +var import_i18n2 = __toESM(require_i18n(), 1); | |
| 16542 | + | |
| 16543 | +// packages/ui/build-module/visually-hidden/visually-hidden.mjs | |
| 16544 | +var import_element23 = __toESM(require_element(), 1); | |
| 16545 | +var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash"; | |
| 16546 | +function getRuntime5() { | |
| 16547 | + const globalScope = globalThis; | |
| 16548 | + if (globalScope.__wpStyleRuntime) { | |
| 16549 | + return globalScope.__wpStyleRuntime; | |
| 16550 | + } | |
| 16551 | + globalScope.__wpStyleRuntime = { | |
| 16552 | + documents: /* @__PURE__ */ new Map(), | |
| 16553 | + styles: /* @__PURE__ */ new Map(), | |
| 16554 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 16555 | + }; | |
| 16556 | + if (typeof document !== "undefined") { | |
| 16557 | + registerDocument5(document); | |
| 16558 | + } | |
| 16559 | + return globalScope.__wpStyleRuntime; | |
| 16560 | +} | |
| 16561 | +function documentContainsStyleHash5(targetDocument, hash) { | |
| 16562 | + if (!targetDocument.head) { | |
| 16563 | + return false; | |
| 16564 | + } | |
| 16565 | + for (const style of targetDocument.head.querySelectorAll( | |
| 16566 | + `style[${STYLE_HASH_ATTRIBUTE5}]` | |
| 16567 | + )) { | |
| 16568 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) { | |
| 16569 | + return true; | |
| 16570 | + } | |
| 16571 | + } | |
| 16572 | + return false; | |
| 16573 | +} | |
| 16574 | +function injectStyle5(targetDocument, hash, css) { | |
| 16575 | + if (!targetDocument.head) { | |
| 16576 | + return; | |
| 16577 | + } | |
| 16578 | + const runtime = getRuntime5(); | |
| 16579 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 16580 | + if (!injectedStyles) { | |
| 16581 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 16582 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 16583 | + } | |
| 16584 | + if (injectedStyles.has(hash)) { | |
| 16585 | + return; | |
| 16586 | + } | |
| 16587 | + if (documentContainsStyleHash5(targetDocument, hash)) { | |
| 16588 | + injectedStyles.add(hash); | |
| 16589 | + return; | |
| 16590 | + } | |
| 16591 | + const style = targetDocument.createElement("style"); | |
| 16592 | + style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash); | |
| 16593 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 16594 | + targetDocument.head.appendChild(style); | |
| 16595 | + injectedStyles.add(hash); | |
| 16596 | +} | |
| 16597 | +function registerDocument5(targetDocument) { | |
| 16598 | + const runtime = getRuntime5(); | |
| 16599 | + runtime.documents.set( | |
| 16600 | + targetDocument, | |
| 16601 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 16602 | + ); | |
| 16603 | + for (const [hash, css] of runtime.styles) { | |
| 16604 | + injectStyle5(targetDocument, hash, css); | |
| 16605 | + } | |
| 16606 | + return () => { | |
| 16607 | + const count = runtime.documents.get(targetDocument); | |
| 16608 | + if (count === void 0) { | |
| 16609 | + return; | |
| 16610 | + } | |
| 16611 | + if (count <= 1) { | |
| 16612 | + runtime.documents.delete(targetDocument); | |
| 16613 | + return; | |
| 16614 | + } | |
| 16615 | + runtime.documents.set(targetDocument, count - 1); | |
| 16616 | + }; | |
| 16617 | +} | |
| 16618 | +function registerStyle5(hash, css) { | |
| 16619 | + const runtime = getRuntime5(); | |
| 16620 | + runtime.styles.set(hash, css); | |
| 16621 | + for (const targetDocument of runtime.documents.keys()) { | |
| 16622 | + injectStyle5(targetDocument, hash, css); | |
| 16623 | + } | |
| 16624 | +} | |
| 16625 | +if (typeof process === "undefined" || true) { | |
| 16626 | + registerStyle5("f4df7461e9", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.f37b9e2e191ebd66__visually-hidden{border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;overflow-wrap:normal;padding:0;position:absolute;width:1px;word-break:normal}}}"); | |
| 16627 | +} | |
| 16628 | +var style_default4 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" }; | |
| 16629 | +var VisuallyHidden = (0, import_element23.forwardRef)( | |
| 16630 | + function VisuallyHidden2({ render, ...restProps }, ref) { | |
| 16631 | + const element = useRender({ | |
| 16632 | + render, | |
| 16633 | + ref, | |
| 16634 | + props: mergeProps( | |
| 16635 | + { className: style_default4["visually-hidden"] }, | |
| 16636 | + restProps, | |
| 2002 | 16637 | { |
| 2003 | - "data-state": getState(context.open), | |
| 2004 | - ...overlayProps, | |
| 2005 | - ref: forwardedRef, | |
| 2006 | - style: { pointerEvents: "auto", ...overlayProps.style } | |
| 16638 | + // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it. | |
| 16639 | + "data-visually-hidden": "" | |
| 2007 | 16640 | } |
| 2008 | - ) }) | |
| 2009 | - ); | |
| 16641 | + ) | |
| 16642 | + }); | |
| 16643 | + return element; | |
| 2010 | 16644 | } |
| 2011 | 16645 | ); |
| 2012 | -var CONTENT_NAME = "DialogContent"; | |
| 2013 | -var DialogContent = React24.forwardRef( | |
| 2014 | - (props, forwardedRef) => { | |
| 2015 | - const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog); | |
| 2016 | - const { forceMount = portalContext.forceMount, ...contentProps } = props; | |
| 2017 | - const context = useDialogContext(CONTENT_NAME, props.__scopeDialog); | |
| 2018 | - return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) }); | |
| 16646 | + | |
| 16647 | +// packages/ui/build-module/utils/keyboard-shortcut.mjs | |
| 16648 | +var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1); | |
| 16649 | +function useKeyboardShortcutProps({ | |
| 16650 | + "aria-describedby": ariaDescribedBy, | |
| 16651 | + "aria-keyshortcuts": ariaKeyShortcuts, | |
| 16652 | + shortcut | |
| 16653 | +}) { | |
| 16654 | + const generatedDescriptionId = (0, import_element24.useId)(); | |
| 16655 | + const descriptionId = shortcut ? generatedDescriptionId : void 0; | |
| 16656 | + const describedBy = [ariaDescribedBy, descriptionId].filter(Boolean).join(" "); | |
| 16657 | + return { | |
| 16658 | + descriptionId, | |
| 16659 | + targetProps: { | |
| 16660 | + "aria-describedby": describedBy || void 0, | |
| 16661 | + "aria-keyshortcuts": shortcut?.ariaKeyShortcut ?? ariaKeyShortcuts | |
| 16662 | + } | |
| 16663 | + }; | |
| 16664 | +} | |
| 16665 | +var KeyboardShortcutDescription = (0, import_element24.forwardRef)(function KeyboardShortcutDescription2({ descriptionId, shortcut }, ref) { | |
| 16666 | + return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( | |
| 16667 | + VisuallyHidden, | |
| 16668 | + { | |
| 16669 | + id: descriptionId, | |
| 16670 | + "aria-hidden": "true", | |
| 16671 | + render: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { ref }), | |
| 16672 | + children: (0, import_i18n2.sprintf)( | |
| 16673 | + /* translators: %s: keyboard shortcut. */ | |
| 16674 | + (0, import_i18n2.__)("Keyboard shortcut: %s"), | |
| 16675 | + shortcut.label ?? shortcut.ariaKeyShortcut | |
| 16676 | + ) | |
| 16677 | + } | |
| 16678 | + ); | |
| 16679 | +}); | |
| 16680 | +var KeyboardShortcutDisplay = (0, import_element24.forwardRef)(function KeyboardShortcutDisplay2({ className, shortcut }, ref) { | |
| 16681 | + return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { ref, "aria-hidden": "true", className, dir: "ltr", children: shortcut.displayShortcut }); | |
| 16682 | +}); | |
| 16683 | + | |
| 16684 | +// packages/ui/build-module/form/primitives/constants.mjs | |
| 16685 | +var ITEM_POPUP_POSITIONER_PROPS = { | |
| 16686 | + align: "start", | |
| 16687 | + sideOffset: 8, | |
| 16688 | + collisionPadding: 12 | |
| 16689 | +}; | |
| 16690 | + | |
| 16691 | +// packages/ui/build-module/button/button.mjs | |
| 16692 | +var import_element25 = __toESM(require_element(), 1); | |
| 16693 | +var import_i18n3 = __toESM(require_i18n(), 1); | |
| 16694 | +var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1); | |
| 16695 | +import { speak } from "@wordpress/a11y"; | |
| 16696 | +var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash"; | |
| 16697 | +function getRuntime6() { | |
| 16698 | + const globalScope = globalThis; | |
| 16699 | + if (globalScope.__wpStyleRuntime) { | |
| 16700 | + return globalScope.__wpStyleRuntime; | |
| 2019 | 16701 | } |
| 2020 | -); | |
| 2021 | -DialogContent.displayName = CONTENT_NAME; | |
| 2022 | -var DialogContentModal = React24.forwardRef( | |
| 2023 | - (props, forwardedRef) => { | |
| 2024 | - const context = useDialogContext(CONTENT_NAME, props.__scopeDialog); | |
| 2025 | - const contentRef = React24.useRef(null); | |
| 2026 | - const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef); | |
| 2027 | - React24.useEffect(() => { | |
| 2028 | - const content = contentRef.current; | |
| 2029 | - if (content) return hideOthers(content); | |
| 2030 | - }, []); | |
| 2031 | - return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)( | |
| 2032 | - DialogContentImpl, | |
| 16702 | + globalScope.__wpStyleRuntime = { | |
| 16703 | + documents: /* @__PURE__ */ new Map(), | |
| 16704 | + styles: /* @__PURE__ */ new Map(), | |
| 16705 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 16706 | + }; | |
| 16707 | + if (typeof document !== "undefined") { | |
| 16708 | + registerDocument6(document); | |
| 16709 | + } | |
| 16710 | + return globalScope.__wpStyleRuntime; | |
| 16711 | +} | |
| 16712 | +function documentContainsStyleHash6(targetDocument, hash) { | |
| 16713 | + if (!targetDocument.head) { | |
| 16714 | + return false; | |
| 16715 | + } | |
| 16716 | + for (const style of targetDocument.head.querySelectorAll( | |
| 16717 | + `style[${STYLE_HASH_ATTRIBUTE6}]` | |
| 16718 | + )) { | |
| 16719 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) { | |
| 16720 | + return true; | |
| 16721 | + } | |
| 16722 | + } | |
| 16723 | + return false; | |
| 16724 | +} | |
| 16725 | +function injectStyle6(targetDocument, hash, css) { | |
| 16726 | + if (!targetDocument.head) { | |
| 16727 | + return; | |
| 16728 | + } | |
| 16729 | + const runtime = getRuntime6(); | |
| 16730 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 16731 | + if (!injectedStyles) { | |
| 16732 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 16733 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 16734 | + } | |
| 16735 | + if (injectedStyles.has(hash)) { | |
| 16736 | + return; | |
| 16737 | + } | |
| 16738 | + if (documentContainsStyleHash6(targetDocument, hash)) { | |
| 16739 | + injectedStyles.add(hash); | |
| 16740 | + return; | |
| 16741 | + } | |
| 16742 | + const style = targetDocument.createElement("style"); | |
| 16743 | + style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash); | |
| 16744 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 16745 | + targetDocument.head.appendChild(style); | |
| 16746 | + injectedStyles.add(hash); | |
| 16747 | +} | |
| 16748 | +function registerDocument6(targetDocument) { | |
| 16749 | + const runtime = getRuntime6(); | |
| 16750 | + runtime.documents.set( | |
| 16751 | + targetDocument, | |
| 16752 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 16753 | + ); | |
| 16754 | + for (const [hash, css] of runtime.styles) { | |
| 16755 | + injectStyle6(targetDocument, hash, css); | |
| 16756 | + } | |
| 16757 | + return () => { | |
| 16758 | + const count = runtime.documents.get(targetDocument); | |
| 16759 | + if (count === void 0) { | |
| 16760 | + return; | |
| 16761 | + } | |
| 16762 | + if (count <= 1) { | |
| 16763 | + runtime.documents.delete(targetDocument); | |
| 16764 | + return; | |
| 16765 | + } | |
| 16766 | + runtime.documents.set(targetDocument, count - 1); | |
| 16767 | + }; | |
| 16768 | +} | |
| 16769 | +function registerStyle6(hash, css) { | |
| 16770 | + const runtime = getRuntime6(); | |
| 16771 | + runtime.styles.set(hash, css); | |
| 16772 | + for (const targetDocument of runtime.documents.keys()) { | |
| 16773 | + injectStyle6(targetDocument, hash, css); | |
| 16774 | + } | |
| 16775 | +} | |
| 16776 | +if (typeof process === "undefined" || true) { | |
| 16777 | + registerStyle6("effc4e3032", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._97b0fc33c028be1a__button,.abbb272e2ce49bd6__is-unstyled{appearance:none;padding:0}._97b0fc33c028be1a__button{--wp-ui-button-font-weight:var(--wpds-typography-font-weight-emphasis,600);--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-strong,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-strong-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 93%,#000));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand-strong,#fff);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-strong-active,#fff);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-strong-disabled,#8d8d8d);--wp-ui-button-padding-block:var(--wpds-dimension-padding-xs,4px);--wp-ui-button-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-button-height:var(--wpds-dimension-size-lg,40px);--wp-ui-button-aspect-ratio:auto;--wp-ui-button-font-size:var(--wpds-typography-font-size-md,13px);--wp-ui-button-min-width:calc(4ch + var(--wp-ui-button-padding-inline)*2);--wp-ui-button-icon-margin:calc((var(--wpds-dimension-size-2xs, 16px) - var(--wpds-dimension-size-sm, 24px))/2);--wp-ui-button-border-color:var(--wp-ui-button-background-color);--wp-ui-button-border-color-active:var(--wp-ui-button-background-color-active);--wp-ui-button-border-color-disabled:var(--wp-ui-button-background-color-disabled);--_gcd-button-font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);--_gcd-button-font-size:var(--wp-ui-button-font-size);--_gcd-button-font-weight:var(--wp-ui-button-font-weight);align-items:center;aspect-ratio:var(--wp-ui-button-aspect-ratio);background-clip:border-box;background-color:var(--wp-ui-button-background-color);border-color:var(--wp-ui-button-border-color);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:1px;color:var(--wp-ui-button-foreground-color);display:inline-flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wp-ui-button-font-size);font-weight:var(--wp-ui-button-font-weight);gap:var(--wpds-dimension-gap-sm,8px);justify-content:center;line-height:var(--wpds-typography-line-height-sm,20px);max-width:100%;min-height:var(--wp-ui-button-height);min-width:var(--wp-ui-button-min-width);overflow-wrap:anywhere;padding-block:var(--wp-ui-button-padding-block);padding-inline:var(--wp-ui-button-padding-inline);position:relative;text-align:center;text-decoration:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}@media not (prefers-reduced-motion){transition:color .1s ease-out;*{transition:opacity .1s ease-out}}&[href]{cursor:pointer}[href]{color:inherit;text-decoration:inherit}&:not([data-disabled]):is(:hover,:active,:focus){background-color:var(--wp-ui-button-background-color-active);border-color:var(--wp-ui-button-border-color-active);color:var(--wp-ui-button-foreground-color-active)}&[data-disabled]:not(._914b42f315c0e580__is-loading){background-color:var(--wp-ui-button-background-color-disabled);border-color:var(--wp-ui-button-border-color-disabled);color:var(--wp-ui-button-foreground-color-disabled);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&:before{aspect-ratio:1;border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid;border-block-end-color:transparent;border-block-start-color:var(--wp-ui-button-foreground-color);border-inline-end-color:var(--wp-ui-button-foreground-color);border-inline-start-color:transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:var(--wp-ui-button-font-size);left:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}@media (forced-colors:active){border-block-end-style:none;border-bottom-color:ButtonText;border-inline-start-style:none;border-left-color:ButtonText;border-right-color:ButtonText;border-top-color:ButtonText}}}._908205475f9f2a92__is-small{--wp-ui-button-padding-block:0px;--wp-ui-button-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-button-height:var(--wpds-dimension-size-sm,24px)}._9f6fc6553aeb36fe__icon{margin:var(--wp-ui-button-icon-margin)}.dd460c965226cc77__is-brand{&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 85%,#000));--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-brand-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000)}}.e722a8f96726aa99__is-neutral{&.ad0619a3217c6a5b__is-minimal[aria-pressed=true],&.b50b3358c5fb4d0b__is-solid{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-strong,#2d2d2d);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-strong-active,#1e1e1e);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral-strong,#f0f0f0);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-strong-active,#f0f0f0);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-strong-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e);--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000)}}.abbb272e2ce49bd6__is-unstyled{background:none;border:none;min-width:unset}.cf59cf1b69629838__is-compact{--wp-ui-button-height:var(--wpds-dimension-size-md,32px)}._914b42f315c0e580__is-loading:not(.abbb272e2ce49bd6__is-unstyled){color:transparent;&:not([data-disabled]):is(:hover,:active,:focus){color:transparent}@media (forced-colors:active){color:ButtonFace}*{opacity:0}&:before{opacity:1;transition-delay:.05s;@media not (prefers-reduced-motion){animation:_5a1d53da6f830c8d__loading-animation 1s linear infinite}}}}@keyframes _5a1d53da6f830c8d__loading-animation{0%{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(1turn)}}}'); | |
| 16778 | +} | |
| 16779 | +var style_default5 = { "button": "_97b0fc33c028be1a__button", "is-unstyled": "abbb272e2ce49bd6__is-unstyled", "is-loading": "_914b42f315c0e580__is-loading", "is-small": "_908205475f9f2a92__is-small", "icon": "_9f6fc6553aeb36fe__icon", "is-brand": "dd460c965226cc77__is-brand", "is-outline": "_62d5a778b7b258ee__is-outline", "is-minimal": "ad0619a3217c6a5b__is-minimal", "is-neutral": "e722a8f96726aa99__is-neutral", "is-solid": "b50b3358c5fb4d0b__is-solid", "is-compact": "cf59cf1b69629838__is-compact", "loading-animation": "_5a1d53da6f830c8d__loading-animation" }; | |
| 16780 | +if (typeof process === "undefined" || true) { | |
| 16781 | + registerStyle6("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); | |
| 16782 | +} | |
| 16783 | +var resets_default2 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; | |
| 16784 | +if (typeof process === "undefined" || true) { | |
| 16785 | + registerStyle6("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}"); | |
| 16786 | +} | |
| 16787 | +var focus_module_default = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" }; | |
| 16788 | +if (typeof process === "undefined" || true) { | |
| 16789 | + registerStyle6("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); | |
| 16790 | +} | |
| 16791 | +var global_css_defense_default2 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; | |
| 16792 | +var Button3 = (0, import_element25.forwardRef)( | |
| 16793 | + function Button22({ | |
| 16794 | + tone = "brand", | |
| 16795 | + variant = "solid", | |
| 16796 | + size: size4 = "default", | |
| 16797 | + className, | |
| 16798 | + focusableWhenDisabled = true, | |
| 16799 | + disabled: disabled2, | |
| 16800 | + loading, | |
| 16801 | + loadingAnnouncement = (0, import_i18n3.__)("Loading"), | |
| 16802 | + children, | |
| 16803 | + ...props | |
| 16804 | + }, ref) { | |
| 16805 | + const mergedClassName = clsx_default( | |
| 16806 | + global_css_defense_default2.button, | |
| 16807 | + resets_default2["box-sizing"], | |
| 16808 | + focus_module_default["outset-ring--focus-except-active"], | |
| 16809 | + variant !== "unstyled" && style_default5.button, | |
| 16810 | + style_default5[`is-${tone}`], | |
| 16811 | + style_default5[`is-${variant}`], | |
| 16812 | + style_default5[`is-${size4}`], | |
| 16813 | + loading && style_default5["is-loading"], | |
| 16814 | + className | |
| 16815 | + ); | |
| 16816 | + (0, import_element25.useEffect)(() => { | |
| 16817 | + if (loading && loadingAnnouncement) { | |
| 16818 | + speak(loadingAnnouncement); | |
| 16819 | + } | |
| 16820 | + }, [loading, loadingAnnouncement]); | |
| 16821 | + return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)( | |
| 16822 | + Button, | |
| 2033 | 16823 | { |
| 16824 | + ref, | |
| 16825 | + className: mergedClassName, | |
| 16826 | + focusableWhenDisabled, | |
| 16827 | + disabled: disabled2 ?? loading, | |
| 2034 | 16828 | ...props, |
| 2035 | - ref: composedRefs, | |
| 2036 | - trapFocus: context.open, | |
| 2037 | - disableOutsidePointerEvents: true, | |
| 2038 | - onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => { | |
| 2039 | - event.preventDefault(); | |
| 2040 | - context.triggerRef.current?.focus(); | |
| 2041 | - }), | |
| 2042 | - onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => { | |
| 2043 | - const originalEvent = event.detail.originalEvent; | |
| 2044 | - const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true; | |
| 2045 | - const isRightClick = originalEvent.button === 2 || ctrlLeftClick; | |
| 2046 | - if (isRightClick) event.preventDefault(); | |
| 2047 | - }), | |
| 2048 | - onFocusOutside: composeEventHandlers( | |
| 2049 | - props.onFocusOutside, | |
| 2050 | - (event) => event.preventDefault() | |
| 2051 | - ) | |
| 16829 | + children | |
| 2052 | 16830 | } |
| 2053 | 16831 | ); |
| 2054 | 16832 | } |
| 2055 | 16833 | ); |
| 2056 | -var DialogContentNonModal = React24.forwardRef( | |
| 2057 | - (props, forwardedRef) => { | |
| 2058 | - const context = useDialogContext(CONTENT_NAME, props.__scopeDialog); | |
| 2059 | - const hasInteractedOutsideRef = React24.useRef(false); | |
| 2060 | - const hasPointerDownOutsideRef = React24.useRef(false); | |
| 2061 | - return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)( | |
| 2062 | - DialogContentImpl, | |
| 16834 | + | |
| 16835 | +// packages/ui/build-module/button/icon.mjs | |
| 16836 | +var import_element26 = __toESM(require_element(), 1); | |
| 16837 | +var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1); | |
| 16838 | +var STYLE_HASH_ATTRIBUTE7 = "data-wp-hash"; | |
| 16839 | +function getRuntime7() { | |
| 16840 | + const globalScope = globalThis; | |
| 16841 | + if (globalScope.__wpStyleRuntime) { | |
| 16842 | + return globalScope.__wpStyleRuntime; | |
| 16843 | + } | |
| 16844 | + globalScope.__wpStyleRuntime = { | |
| 16845 | + documents: /* @__PURE__ */ new Map(), | |
| 16846 | + styles: /* @__PURE__ */ new Map(), | |
| 16847 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 16848 | + }; | |
| 16849 | + if (typeof document !== "undefined") { | |
| 16850 | + registerDocument7(document); | |
| 16851 | + } | |
| 16852 | + return globalScope.__wpStyleRuntime; | |
| 16853 | +} | |
| 16854 | +function documentContainsStyleHash7(targetDocument, hash) { | |
| 16855 | + if (!targetDocument.head) { | |
| 16856 | + return false; | |
| 16857 | + } | |
| 16858 | + for (const style of targetDocument.head.querySelectorAll( | |
| 16859 | + `style[${STYLE_HASH_ATTRIBUTE7}]` | |
| 16860 | + )) { | |
| 16861 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE7) === hash) { | |
| 16862 | + return true; | |
| 16863 | + } | |
| 16864 | + } | |
| 16865 | + return false; | |
| 16866 | +} | |
| 16867 | +function injectStyle7(targetDocument, hash, css) { | |
| 16868 | + if (!targetDocument.head) { | |
| 16869 | + return; | |
| 16870 | + } | |
| 16871 | + const runtime = getRuntime7(); | |
| 16872 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 16873 | + if (!injectedStyles) { | |
| 16874 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 16875 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 16876 | + } | |
| 16877 | + if (injectedStyles.has(hash)) { | |
| 16878 | + return; | |
| 16879 | + } | |
| 16880 | + if (documentContainsStyleHash7(targetDocument, hash)) { | |
| 16881 | + injectedStyles.add(hash); | |
| 16882 | + return; | |
| 16883 | + } | |
| 16884 | + const style = targetDocument.createElement("style"); | |
| 16885 | + style.setAttribute(STYLE_HASH_ATTRIBUTE7, hash); | |
| 16886 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 16887 | + targetDocument.head.appendChild(style); | |
| 16888 | + injectedStyles.add(hash); | |
| 16889 | +} | |
| 16890 | +function registerDocument7(targetDocument) { | |
| 16891 | + const runtime = getRuntime7(); | |
| 16892 | + runtime.documents.set( | |
| 16893 | + targetDocument, | |
| 16894 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 16895 | + ); | |
| 16896 | + for (const [hash, css] of runtime.styles) { | |
| 16897 | + injectStyle7(targetDocument, hash, css); | |
| 16898 | + } | |
| 16899 | + return () => { | |
| 16900 | + const count = runtime.documents.get(targetDocument); | |
| 16901 | + if (count === void 0) { | |
| 16902 | + return; | |
| 16903 | + } | |
| 16904 | + if (count <= 1) { | |
| 16905 | + runtime.documents.delete(targetDocument); | |
| 16906 | + return; | |
| 16907 | + } | |
| 16908 | + runtime.documents.set(targetDocument, count - 1); | |
| 16909 | + }; | |
| 16910 | +} | |
| 16911 | +function registerStyle7(hash, css) { | |
| 16912 | + const runtime = getRuntime7(); | |
| 16913 | + runtime.styles.set(hash, css); | |
| 16914 | + for (const targetDocument of runtime.documents.keys()) { | |
| 16915 | + injectStyle7(targetDocument, hash, css); | |
| 16916 | + } | |
| 16917 | +} | |
| 16918 | +if (typeof process === "undefined" || true) { | |
| 16919 | + registerStyle7("effc4e3032", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._97b0fc33c028be1a__button,.abbb272e2ce49bd6__is-unstyled{appearance:none;padding:0}._97b0fc33c028be1a__button{--wp-ui-button-font-weight:var(--wpds-typography-font-weight-emphasis,600);--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-strong,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-strong-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 93%,#000));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand-strong,#fff);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-strong-active,#fff);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-strong-disabled,#8d8d8d);--wp-ui-button-padding-block:var(--wpds-dimension-padding-xs,4px);--wp-ui-button-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-button-height:var(--wpds-dimension-size-lg,40px);--wp-ui-button-aspect-ratio:auto;--wp-ui-button-font-size:var(--wpds-typography-font-size-md,13px);--wp-ui-button-min-width:calc(4ch + var(--wp-ui-button-padding-inline)*2);--wp-ui-button-icon-margin:calc((var(--wpds-dimension-size-2xs, 16px) - var(--wpds-dimension-size-sm, 24px))/2);--wp-ui-button-border-color:var(--wp-ui-button-background-color);--wp-ui-button-border-color-active:var(--wp-ui-button-background-color-active);--wp-ui-button-border-color-disabled:var(--wp-ui-button-background-color-disabled);--_gcd-button-font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);--_gcd-button-font-size:var(--wp-ui-button-font-size);--_gcd-button-font-weight:var(--wp-ui-button-font-weight);align-items:center;aspect-ratio:var(--wp-ui-button-aspect-ratio);background-clip:border-box;background-color:var(--wp-ui-button-background-color);border-color:var(--wp-ui-button-border-color);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:1px;color:var(--wp-ui-button-foreground-color);display:inline-flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wp-ui-button-font-size);font-weight:var(--wp-ui-button-font-weight);gap:var(--wpds-dimension-gap-sm,8px);justify-content:center;line-height:var(--wpds-typography-line-height-sm,20px);max-width:100%;min-height:var(--wp-ui-button-height);min-width:var(--wp-ui-button-min-width);overflow-wrap:anywhere;padding-block:var(--wp-ui-button-padding-block);padding-inline:var(--wp-ui-button-padding-inline);position:relative;text-align:center;text-decoration:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}@media not (prefers-reduced-motion){transition:color .1s ease-out;*{transition:opacity .1s ease-out}}&[href]{cursor:pointer}[href]{color:inherit;text-decoration:inherit}&:not([data-disabled]):is(:hover,:active,:focus){background-color:var(--wp-ui-button-background-color-active);border-color:var(--wp-ui-button-border-color-active);color:var(--wp-ui-button-foreground-color-active)}&[data-disabled]:not(._914b42f315c0e580__is-loading){background-color:var(--wp-ui-button-background-color-disabled);border-color:var(--wp-ui-button-border-color-disabled);color:var(--wp-ui-button-foreground-color-disabled);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&:before{aspect-ratio:1;border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid;border-block-end-color:transparent;border-block-start-color:var(--wp-ui-button-foreground-color);border-inline-end-color:var(--wp-ui-button-foreground-color);border-inline-start-color:transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:var(--wp-ui-button-font-size);left:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}@media (forced-colors:active){border-block-end-style:none;border-bottom-color:ButtonText;border-inline-start-style:none;border-left-color:ButtonText;border-right-color:ButtonText;border-top-color:ButtonText}}}._908205475f9f2a92__is-small{--wp-ui-button-padding-block:0px;--wp-ui-button-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-button-height:var(--wpds-dimension-size-sm,24px)}._9f6fc6553aeb36fe__icon{margin:var(--wp-ui-button-icon-margin)}.dd460c965226cc77__is-brand{&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 85%,#000));--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-brand-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000)}}.e722a8f96726aa99__is-neutral{&.ad0619a3217c6a5b__is-minimal[aria-pressed=true],&.b50b3358c5fb4d0b__is-solid{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-strong,#2d2d2d);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-strong-active,#1e1e1e);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral-strong,#f0f0f0);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-strong-active,#f0f0f0);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-strong-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e);--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000)}}.abbb272e2ce49bd6__is-unstyled{background:none;border:none;min-width:unset}.cf59cf1b69629838__is-compact{--wp-ui-button-height:var(--wpds-dimension-size-md,32px)}._914b42f315c0e580__is-loading:not(.abbb272e2ce49bd6__is-unstyled){color:transparent;&:not([data-disabled]):is(:hover,:active,:focus){color:transparent}@media (forced-colors:active){color:ButtonFace}*{opacity:0}&:before{opacity:1;transition-delay:.05s;@media not (prefers-reduced-motion){animation:_5a1d53da6f830c8d__loading-animation 1s linear infinite}}}}@keyframes _5a1d53da6f830c8d__loading-animation{0%{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(1turn)}}}'); | |
| 16920 | +} | |
| 16921 | +var style_default6 = { "button": "_97b0fc33c028be1a__button", "is-unstyled": "abbb272e2ce49bd6__is-unstyled", "is-loading": "_914b42f315c0e580__is-loading", "is-small": "_908205475f9f2a92__is-small", "icon": "_9f6fc6553aeb36fe__icon", "is-brand": "dd460c965226cc77__is-brand", "is-outline": "_62d5a778b7b258ee__is-outline", "is-minimal": "ad0619a3217c6a5b__is-minimal", "is-neutral": "e722a8f96726aa99__is-neutral", "is-solid": "b50b3358c5fb4d0b__is-solid", "is-compact": "cf59cf1b69629838__is-compact", "loading-animation": "_5a1d53da6f830c8d__loading-animation" }; | |
| 16922 | +var ButtonIcon = (0, import_element26.forwardRef)( | |
| 16923 | + function ButtonIcon2({ className, icon, ...props }, ref) { | |
| 16924 | + return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)( | |
| 16925 | + Icon, | |
| 2063 | 16926 | { |
| 2064 | - ...props, | |
| 2065 | - ref: forwardedRef, | |
| 2066 | - trapFocus: false, | |
| 2067 | - disableOutsidePointerEvents: false, | |
| 2068 | - onCloseAutoFocus: (event) => { | |
| 2069 | - props.onCloseAutoFocus?.(event); | |
| 2070 | - if (!event.defaultPrevented) { | |
| 2071 | - if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus(); | |
| 2072 | - event.preventDefault(); | |
| 2073 | - } | |
| 2074 | - hasInteractedOutsideRef.current = false; | |
| 2075 | - hasPointerDownOutsideRef.current = false; | |
| 2076 | - }, | |
| 2077 | - onInteractOutside: (event) => { | |
| 2078 | - props.onInteractOutside?.(event); | |
| 2079 | - if (!event.defaultPrevented) { | |
| 2080 | - hasInteractedOutsideRef.current = true; | |
| 2081 | - if (event.detail.originalEvent.type === "pointerdown") { | |
| 2082 | - hasPointerDownOutsideRef.current = true; | |
| 2083 | - } | |
| 2084 | - } | |
| 2085 | - const target = event.target; | |
| 2086 | - const targetIsTrigger = context.triggerRef.current?.contains(target); | |
| 2087 | - if (targetIsTrigger) event.preventDefault(); | |
| 2088 | - if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) { | |
| 2089 | - event.preventDefault(); | |
| 2090 | - } | |
| 2091 | - } | |
| 16927 | + ref, | |
| 16928 | + icon, | |
| 16929 | + className: clsx_default(style_default6.icon, className), | |
| 16930 | + size: 24, | |
| 16931 | + ...props | |
| 2092 | 16932 | } |
| 2093 | 16933 | ); |
| 2094 | 16934 | } |
| 2095 | 16935 | ); |
| 2096 | -var DialogContentImpl = React24.forwardRef( | |
| 2097 | - (props, forwardedRef) => { | |
| 2098 | - const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props; | |
| 2099 | - const context = useDialogContext(CONTENT_NAME, __scopeDialog); | |
| 2100 | - const contentRef = React24.useRef(null); | |
| 2101 | - const composedRefs = useComposedRefs(forwardedRef, contentRef); | |
| 2102 | - useFocusGuards(); | |
| 2103 | - return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [ | |
| 2104 | - /* @__PURE__ */ (0, import_jsx_runtime7.jsx)( | |
| 2105 | - FocusScope, | |
| 16936 | + | |
| 16937 | +// packages/ui/build-module/button/index.mjs | |
| 16938 | +ButtonIcon.displayName = "Button.Icon"; | |
| 16939 | +var Button4 = Object.assign(Button3, { | |
| 16940 | + /** | |
| 16941 | + * An icon component specifically designed to work well when rendered inside | |
| 16942 | + * a `Button` component. | |
| 16943 | + */ | |
| 16944 | + Icon: ButtonIcon | |
| 16945 | +}); | |
| 16946 | + | |
| 16947 | +// packages/ui/build-module/icon-button/icon-button.mjs | |
| 16948 | +var import_element27 = __toESM(require_element(), 1); | |
| 16949 | +var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1); | |
| 16950 | +var STYLE_HASH_ATTRIBUTE8 = "data-wp-hash"; | |
| 16951 | +function getRuntime8() { | |
| 16952 | + const globalScope = globalThis; | |
| 16953 | + if (globalScope.__wpStyleRuntime) { | |
| 16954 | + return globalScope.__wpStyleRuntime; | |
| 16955 | + } | |
| 16956 | + globalScope.__wpStyleRuntime = { | |
| 16957 | + documents: /* @__PURE__ */ new Map(), | |
| 16958 | + styles: /* @__PURE__ */ new Map(), | |
| 16959 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 16960 | + }; | |
| 16961 | + if (typeof document !== "undefined") { | |
| 16962 | + registerDocument8(document); | |
| 16963 | + } | |
| 16964 | + return globalScope.__wpStyleRuntime; | |
| 16965 | +} | |
| 16966 | +function documentContainsStyleHash8(targetDocument, hash) { | |
| 16967 | + if (!targetDocument.head) { | |
| 16968 | + return false; | |
| 16969 | + } | |
| 16970 | + for (const style of targetDocument.head.querySelectorAll( | |
| 16971 | + `style[${STYLE_HASH_ATTRIBUTE8}]` | |
| 16972 | + )) { | |
| 16973 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE8) === hash) { | |
| 16974 | + return true; | |
| 16975 | + } | |
| 16976 | + } | |
| 16977 | + return false; | |
| 16978 | +} | |
| 16979 | +function injectStyle8(targetDocument, hash, css) { | |
| 16980 | + if (!targetDocument.head) { | |
| 16981 | + return; | |
| 16982 | + } | |
| 16983 | + const runtime = getRuntime8(); | |
| 16984 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 16985 | + if (!injectedStyles) { | |
| 16986 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 16987 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 16988 | + } | |
| 16989 | + if (injectedStyles.has(hash)) { | |
| 16990 | + return; | |
| 16991 | + } | |
| 16992 | + if (documentContainsStyleHash8(targetDocument, hash)) { | |
| 16993 | + injectedStyles.add(hash); | |
| 16994 | + return; | |
| 16995 | + } | |
| 16996 | + const style = targetDocument.createElement("style"); | |
| 16997 | + style.setAttribute(STYLE_HASH_ATTRIBUTE8, hash); | |
| 16998 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 16999 | + targetDocument.head.appendChild(style); | |
| 17000 | + injectedStyles.add(hash); | |
| 17001 | +} | |
| 17002 | +function registerDocument8(targetDocument) { | |
| 17003 | + const runtime = getRuntime8(); | |
| 17004 | + runtime.documents.set( | |
| 17005 | + targetDocument, | |
| 17006 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 17007 | + ); | |
| 17008 | + for (const [hash, css] of runtime.styles) { | |
| 17009 | + injectStyle8(targetDocument, hash, css); | |
| 17010 | + } | |
| 17011 | + return () => { | |
| 17012 | + const count = runtime.documents.get(targetDocument); | |
| 17013 | + if (count === void 0) { | |
| 17014 | + return; | |
| 17015 | + } | |
| 17016 | + if (count <= 1) { | |
| 17017 | + runtime.documents.delete(targetDocument); | |
| 17018 | + return; | |
| 17019 | + } | |
| 17020 | + runtime.documents.set(targetDocument, count - 1); | |
| 17021 | + }; | |
| 17022 | +} | |
| 17023 | +function registerStyle8(hash, css) { | |
| 17024 | + const runtime = getRuntime8(); | |
| 17025 | + runtime.styles.set(hash, css); | |
| 17026 | + for (const targetDocument of runtime.documents.keys()) { | |
| 17027 | + injectStyle8(targetDocument, hash, css); | |
| 17028 | + } | |
| 17029 | +} | |
| 17030 | +if (typeof process === "undefined" || true) { | |
| 17031 | + registerStyle8("c5cdafb1bc", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer compositions{._28cfdc260e755391__icon-button{--wp-ui-button-aspect-ratio:1;--wp-ui-button-padding-inline:0px;--wp-ui-button-min-width:unset}.f1c70d719989a85a__icon{margin:-1px}}}"); | |
| 17032 | +} | |
| 17033 | +var style_default7 = { "icon-button": "_28cfdc260e755391__icon-button", "icon": "f1c70d719989a85a__icon" }; | |
| 17034 | +var IconButton = (0, import_element27.forwardRef)( | |
| 17035 | + function IconButton2({ | |
| 17036 | + label, | |
| 17037 | + className, | |
| 17038 | + // Prevent accidental forwarding of `children` | |
| 17039 | + children: _children, | |
| 17040 | + disabled: disabled2, | |
| 17041 | + focusableWhenDisabled = true, | |
| 17042 | + icon, | |
| 17043 | + size: size4, | |
| 17044 | + shortcut, | |
| 17045 | + positioner, | |
| 17046 | + "aria-describedby": ariaDescribedBy, | |
| 17047 | + "aria-keyshortcuts": ariaKeyShortcuts, | |
| 17048 | + ...restProps | |
| 17049 | + }, ref) { | |
| 17050 | + const classes = clsx_default(style_default7["icon-button"], className); | |
| 17051 | + const { descriptionId, targetProps } = useKeyboardShortcutProps({ | |
| 17052 | + "aria-describedby": ariaDescribedBy, | |
| 17053 | + "aria-keyshortcuts": ariaKeyShortcuts, | |
| 17054 | + shortcut | |
| 17055 | + }); | |
| 17056 | + return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(Root, { children: [ | |
| 17057 | + /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)( | |
| 17058 | + Trigger, | |
| 2106 | 17059 | { |
| 2107 | - asChild: true, | |
| 2108 | - loop: true, | |
| 2109 | - trapped: trapFocus, | |
| 2110 | - onMountAutoFocus: onOpenAutoFocus, | |
| 2111 | - onUnmountAutoFocus: onCloseAutoFocus, | |
| 2112 | - children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)( | |
| 2113 | - DismissableLayer, | |
| 17060 | + ref, | |
| 17061 | + ...targetProps, | |
| 17062 | + disabled: disabled2 && !focusableWhenDisabled, | |
| 17063 | + render: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)( | |
| 17064 | + Button4, | |
| 2114 | 17065 | { |
| 2115 | - role: "dialog", | |
| 2116 | - id: context.contentId, | |
| 2117 | - "aria-describedby": context.descriptionId, | |
| 2118 | - "aria-labelledby": context.titleId, | |
| 2119 | - "data-state": getState(context.open), | |
| 2120 | - ...contentProps, | |
| 2121 | - ref: composedRefs, | |
| 2122 | - onDismiss: () => context.onOpenChange(false) | |
| 17066 | + ...restProps, | |
| 17067 | + size: size4, | |
| 17068 | + "aria-label": label, | |
| 17069 | + disabled: disabled2, | |
| 17070 | + focusableWhenDisabled | |
| 2123 | 17071 | } |
| 2124 | - ) | |
| 17072 | + ), | |
| 17073 | + className: classes, | |
| 17074 | + children: [ | |
| 17075 | + /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Icon, { icon, size: 24, className: style_default7.icon }), | |
| 17076 | + shortcut && descriptionId && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)( | |
| 17077 | + KeyboardShortcutDescription, | |
| 17078 | + { | |
| 17079 | + descriptionId, | |
| 17080 | + shortcut | |
| 17081 | + } | |
| 17082 | + ) | |
| 17083 | + ] | |
| 2125 | 17084 | } |
| 2126 | 17085 | ), |
| 2127 | - /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [ | |
| 2128 | - /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TitleWarning, { titleId: context.titleId }), | |
| 2129 | - /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DescriptionWarning, { contentRef, descriptionId: context.descriptionId }) | |
| 17086 | + /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(Popup, { positioner, children: [ | |
| 17087 | + label, | |
| 17088 | + shortcut && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [ | |
| 17089 | + " ", | |
| 17090 | + /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(KeyboardShortcutDisplay, { shortcut }) | |
| 17091 | + ] }) | |
| 2130 | 17092 | ] }) |
| 2131 | 17093 | ] }); |
| 2132 | 17094 | } |
| 2133 | 17095 | ); |
| 2134 | -var TITLE_NAME = "DialogTitle"; | |
| 2135 | -var DialogTitle = React24.forwardRef( | |
| 2136 | - (props, forwardedRef) => { | |
| 2137 | - const { __scopeDialog, ...titleProps } = props; | |
| 2138 | - const context = useDialogContext(TITLE_NAME, __scopeDialog); | |
| 2139 | - return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef }); | |
| 17096 | + | |
| 17097 | +// packages/ui/build-module/form/primitives/autocomplete/index.mjs | |
| 17098 | +var autocomplete_exports = {}; | |
| 17099 | +__export(autocomplete_exports, { | |
| 17100 | + Clear: () => Clear, | |
| 17101 | + Collection: () => Collection, | |
| 17102 | + Empty: () => Empty, | |
| 17103 | + Group: () => Group, | |
| 17104 | + GroupLabel: () => GroupLabel, | |
| 17105 | + Input: () => Input4, | |
| 17106 | + InputGroup: () => InputGroup, | |
| 17107 | + Item: () => Item, | |
| 17108 | + List: () => List, | |
| 17109 | + ListBody: () => ListBody, | |
| 17110 | + Popup: () => Popup2, | |
| 17111 | + Portal: () => Portal2, | |
| 17112 | + Positioner: () => Positioner2, | |
| 17113 | + Root: () => Root2, | |
| 17114 | + Row: () => Row, | |
| 17115 | + Status: () => Status, | |
| 17116 | + Value: () => Value, | |
| 17117 | + useFilteredItems: () => useFilteredItems2 | |
| 17118 | +}); | |
| 17119 | + | |
| 17120 | +// packages/ui/build-module/form/primitives/autocomplete/clear.mjs | |
| 17121 | +var import_element28 = __toESM(require_element(), 1); | |
| 17122 | +var import_i18n4 = __toESM(require_i18n(), 1); | |
| 17123 | +var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1); | |
| 17124 | +var DEFAULT_RENDER = ({ | |
| 17125 | + "aria-label": ariaLabel = (0, import_i18n4.__)("Clear"), | |
| 17126 | + ...props | |
| 17127 | +}, { disabled: disabled2 }) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( | |
| 17128 | + IconButton, | |
| 17129 | + { | |
| 17130 | + icon: close_small_default, | |
| 17131 | + focusableWhenDisabled: false, | |
| 17132 | + disabled: disabled2, | |
| 17133 | + "aria-hidden": disabled2 || void 0, | |
| 17134 | + size: "small", | |
| 17135 | + variant: "minimal", | |
| 17136 | + tone: "neutral", | |
| 17137 | + label: ariaLabel, | |
| 17138 | + ...props | |
| 2140 | 17139 | } |
| 2141 | 17140 | ); |
| 2142 | -DialogTitle.displayName = TITLE_NAME; | |
| 2143 | -var DESCRIPTION_NAME = "DialogDescription"; | |
| 2144 | -var DialogDescription = React24.forwardRef( | |
| 2145 | - (props, forwardedRef) => { | |
| 2146 | - const { __scopeDialog, ...descriptionProps } = props; | |
| 2147 | - const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog); | |
| 2148 | - return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef }); | |
| 17141 | +var Clear = (0, import_element28.forwardRef)( | |
| 17142 | + function Clear2({ render = DEFAULT_RENDER, ...restProps }, ref) { | |
| 17143 | + return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( | |
| 17144 | + index_parts_exports.Clear, | |
| 17145 | + { | |
| 17146 | + ref, | |
| 17147 | + render, | |
| 17148 | + ...restProps | |
| 17149 | + } | |
| 17150 | + ); | |
| 2149 | 17151 | } |
| 2150 | 17152 | ); |
| 2151 | -DialogDescription.displayName = DESCRIPTION_NAME; | |
| 2152 | -var CLOSE_NAME = "DialogClose"; | |
| 2153 | -var DialogClose = React24.forwardRef( | |
| 2154 | - (props, forwardedRef) => { | |
| 2155 | - const { __scopeDialog, ...closeProps } = props; | |
| 2156 | - const context = useDialogContext(CLOSE_NAME, __scopeDialog); | |
| 2157 | - return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)( | |
| 2158 | - Primitive.button, | |
| 17153 | + | |
| 17154 | +// packages/ui/build-module/form/primitives/autocomplete/collection.mjs | |
| 17155 | +var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1); | |
| 17156 | +function Collection({ | |
| 17157 | + children, | |
| 17158 | + ...restProps | |
| 17159 | +}) { | |
| 17160 | + return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(index_parts_exports.Collection, { ...restProps, children }); | |
| 17161 | +} | |
| 17162 | + | |
| 17163 | +// packages/ui/build-module/form/primitives/autocomplete/empty.mjs | |
| 17164 | +var import_element29 = __toESM(require_element(), 1); | |
| 17165 | +var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1); | |
| 17166 | +var STYLE_HASH_ATTRIBUTE9 = "data-wp-hash"; | |
| 17167 | +function getRuntime9() { | |
| 17168 | + const globalScope = globalThis; | |
| 17169 | + if (globalScope.__wpStyleRuntime) { | |
| 17170 | + return globalScope.__wpStyleRuntime; | |
| 17171 | + } | |
| 17172 | + globalScope.__wpStyleRuntime = { | |
| 17173 | + documents: /* @__PURE__ */ new Map(), | |
| 17174 | + styles: /* @__PURE__ */ new Map(), | |
| 17175 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 17176 | + }; | |
| 17177 | + if (typeof document !== "undefined") { | |
| 17178 | + registerDocument9(document); | |
| 17179 | + } | |
| 17180 | + return globalScope.__wpStyleRuntime; | |
| 17181 | +} | |
| 17182 | +function documentContainsStyleHash9(targetDocument, hash) { | |
| 17183 | + if (!targetDocument.head) { | |
| 17184 | + return false; | |
| 17185 | + } | |
| 17186 | + for (const style of targetDocument.head.querySelectorAll( | |
| 17187 | + `style[${STYLE_HASH_ATTRIBUTE9}]` | |
| 17188 | + )) { | |
| 17189 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE9) === hash) { | |
| 17190 | + return true; | |
| 17191 | + } | |
| 17192 | + } | |
| 17193 | + return false; | |
| 17194 | +} | |
| 17195 | +function injectStyle9(targetDocument, hash, css) { | |
| 17196 | + if (!targetDocument.head) { | |
| 17197 | + return; | |
| 17198 | + } | |
| 17199 | + const runtime = getRuntime9(); | |
| 17200 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 17201 | + if (!injectedStyles) { | |
| 17202 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 17203 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 17204 | + } | |
| 17205 | + if (injectedStyles.has(hash)) { | |
| 17206 | + return; | |
| 17207 | + } | |
| 17208 | + if (documentContainsStyleHash9(targetDocument, hash)) { | |
| 17209 | + injectedStyles.add(hash); | |
| 17210 | + return; | |
| 17211 | + } | |
| 17212 | + const style = targetDocument.createElement("style"); | |
| 17213 | + style.setAttribute(STYLE_HASH_ATTRIBUTE9, hash); | |
| 17214 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 17215 | + targetDocument.head.appendChild(style); | |
| 17216 | + injectedStyles.add(hash); | |
| 17217 | +} | |
| 17218 | +function registerDocument9(targetDocument) { | |
| 17219 | + const runtime = getRuntime9(); | |
| 17220 | + runtime.documents.set( | |
| 17221 | + targetDocument, | |
| 17222 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 17223 | + ); | |
| 17224 | + for (const [hash, css] of runtime.styles) { | |
| 17225 | + injectStyle9(targetDocument, hash, css); | |
| 17226 | + } | |
| 17227 | + return () => { | |
| 17228 | + const count = runtime.documents.get(targetDocument); | |
| 17229 | + if (count === void 0) { | |
| 17230 | + return; | |
| 17231 | + } | |
| 17232 | + if (count <= 1) { | |
| 17233 | + runtime.documents.delete(targetDocument); | |
| 17234 | + return; | |
| 17235 | + } | |
| 17236 | + runtime.documents.set(targetDocument, count - 1); | |
| 17237 | + }; | |
| 17238 | +} | |
| 17239 | +function registerStyle9(hash, css) { | |
| 17240 | + const runtime = getRuntime9(); | |
| 17241 | + runtime.styles.set(hash, css); | |
| 17242 | + for (const targetDocument of runtime.documents.keys()) { | |
| 17243 | + injectStyle9(targetDocument, hash, css); | |
| 17244 | + } | |
| 17245 | +} | |
| 17246 | +if (typeof process === "undefined" || true) { | |
| 17247 | + registerStyle9("ff021bf4fe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);--_wp-ui-elevation-md:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-md);display:grid;grid-template-areas:"header" "status" "main";grid-template-rows:auto auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width);&.b9a9946a395ccad8__is-width-anchor{width:var(--anchor-width)}&._7c9f1b268b013f02__is-width-content{width:auto}&._6f31db51d79ec899__is-width-sm{width:min(var(--available-width),var(--wpds-dimension-surface-width-sm,320px))}&.fa45cdb5f45e57fb__is-width-md{width:min(var(--available-width),var(--wpds-dimension-surface-width-md,400px))}&._46a909337f6be21c__is-width-lg{width:min(var(--available-width),var(--wpds-dimension-surface-width-lg,560px))}&._6083938dff06df34__is-width-available{width:var(--available-width)}}._101852fa256bb935__is-align-item-with-trigger ._234b520016b4e56f__popup{max-height:none}._2fff4e9defe85de5__list-chrome{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px)}.f43dc7c768d7b622__list{display:grid;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);min-width:0;overflow-wrap:anywhere;padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._41f0dd875c005a48__item-text{display:flex;flex:1;flex-direction:column;gap:2px;min-width:0}._12335b76ada0b1f5__item-label{min-width:0}._160635254c702623__item-description{color:var(--wpds-color-foreground-content-neutral-weak,#707070)}._684ccb7988365b4f__item[aria-disabled=true] ._160635254c702623__item-description,._684ccb7988365b4f__item[data-highlighted]:not([aria-disabled=true]) ._160635254c702623__item-description{color:inherit}._6eb78bc92f8d7795__status{grid-area:status}._06c7ff39d2f685b9__empty:not(:empty){grid-area:main}._06c7ff39d2f685b9__empty:not(:empty),._6eb78bc92f8d7795__status:not(:empty):not(:has([data-visually-hidden])){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}'); | |
| 17248 | +} | |
| 17249 | +var item_popup_default = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "is-width-anchor": "b9a9946a395ccad8__is-width-anchor", "is-width-content": "_7c9f1b268b013f02__is-width-content", "is-width-sm": "_6f31db51d79ec899__is-width-sm", "is-width-md": "fa45cdb5f45e57fb__is-width-md", "is-width-lg": "_46a909337f6be21c__is-width-lg", "is-width-available": "_6083938dff06df34__is-width-available", "is-align-item-with-trigger": "_101852fa256bb935__is-align-item-with-trigger", "list-chrome": "_2fff4e9defe85de5__list-chrome", "list": "f43dc7c768d7b622__list _2fff4e9defe85de5__list-chrome", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "item-text": "_41f0dd875c005a48__item-text", "item-label": "_12335b76ada0b1f5__item-label", "item-description": "_160635254c702623__item-description", "status": "_6eb78bc92f8d7795__status", "empty": "_06c7ff39d2f685b9__empty" }; | |
| 17250 | +var Empty = (0, import_element29.forwardRef)( | |
| 17251 | + function Empty2({ className, ...restProps }, ref) { | |
| 17252 | + return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)( | |
| 17253 | + index_parts_exports.Empty, | |
| 2159 | 17254 | { |
| 2160 | - type: "button", | |
| 2161 | - ...closeProps, | |
| 2162 | - ref: forwardedRef, | |
| 2163 | - onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false)) | |
| 17255 | + className: clsx_default(item_popup_default.empty, className), | |
| 17256 | + ref, | |
| 17257 | + ...restProps | |
| 2164 | 17258 | } |
| 2165 | 17259 | ); |
| 2166 | 17260 | } |
| 2167 | 17261 | ); |
| 2168 | -DialogClose.displayName = CLOSE_NAME; | |
| 2169 | -function getState(open) { | |
| 2170 | - return open ? "open" : "closed"; | |
| 17262 | + | |
| 17263 | +// packages/ui/build-module/form/primitives/autocomplete/group.mjs | |
| 17264 | +var import_element30 = __toESM(require_element(), 1); | |
| 17265 | +var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1); | |
| 17266 | +var STYLE_HASH_ATTRIBUTE10 = "data-wp-hash"; | |
| 17267 | +function getRuntime10() { | |
| 17268 | + const globalScope = globalThis; | |
| 17269 | + if (globalScope.__wpStyleRuntime) { | |
| 17270 | + return globalScope.__wpStyleRuntime; | |
| 17271 | + } | |
| 17272 | + globalScope.__wpStyleRuntime = { | |
| 17273 | + documents: /* @__PURE__ */ new Map(), | |
| 17274 | + styles: /* @__PURE__ */ new Map(), | |
| 17275 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 17276 | + }; | |
| 17277 | + if (typeof document !== "undefined") { | |
| 17278 | + registerDocument10(document); | |
| 17279 | + } | |
| 17280 | + return globalScope.__wpStyleRuntime; | |
| 2171 | 17281 | } |
| 2172 | -var TITLE_WARNING_NAME = "DialogTitleWarning"; | |
| 2173 | -var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, { | |
| 2174 | - contentName: CONTENT_NAME, | |
| 2175 | - titleName: TITLE_NAME, | |
| 2176 | - docsSlug: "dialog" | |
| 17282 | +function documentContainsStyleHash10(targetDocument, hash) { | |
| 17283 | + if (!targetDocument.head) { | |
| 17284 | + return false; | |
| 17285 | + } | |
| 17286 | + for (const style of targetDocument.head.querySelectorAll( | |
| 17287 | + `style[${STYLE_HASH_ATTRIBUTE10}]` | |
| 17288 | + )) { | |
| 17289 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE10) === hash) { | |
| 17290 | + return true; | |
| 17291 | + } | |
| 17292 | + } | |
| 17293 | + return false; | |
| 17294 | +} | |
| 17295 | +function injectStyle10(targetDocument, hash, css) { | |
| 17296 | + if (!targetDocument.head) { | |
| 17297 | + return; | |
| 17298 | + } | |
| 17299 | + const runtime = getRuntime10(); | |
| 17300 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 17301 | + if (!injectedStyles) { | |
| 17302 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 17303 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 17304 | + } | |
| 17305 | + if (injectedStyles.has(hash)) { | |
| 17306 | + return; | |
| 17307 | + } | |
| 17308 | + if (documentContainsStyleHash10(targetDocument, hash)) { | |
| 17309 | + injectedStyles.add(hash); | |
| 17310 | + return; | |
| 17311 | + } | |
| 17312 | + const style = targetDocument.createElement("style"); | |
| 17313 | + style.setAttribute(STYLE_HASH_ATTRIBUTE10, hash); | |
| 17314 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 17315 | + targetDocument.head.appendChild(style); | |
| 17316 | + injectedStyles.add(hash); | |
| 17317 | +} | |
| 17318 | +function registerDocument10(targetDocument) { | |
| 17319 | + const runtime = getRuntime10(); | |
| 17320 | + runtime.documents.set( | |
| 17321 | + targetDocument, | |
| 17322 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 17323 | + ); | |
| 17324 | + for (const [hash, css] of runtime.styles) { | |
| 17325 | + injectStyle10(targetDocument, hash, css); | |
| 17326 | + } | |
| 17327 | + return () => { | |
| 17328 | + const count = runtime.documents.get(targetDocument); | |
| 17329 | + if (count === void 0) { | |
| 17330 | + return; | |
| 17331 | + } | |
| 17332 | + if (count <= 1) { | |
| 17333 | + runtime.documents.delete(targetDocument); | |
| 17334 | + return; | |
| 17335 | + } | |
| 17336 | + runtime.documents.set(targetDocument, count - 1); | |
| 17337 | + }; | |
| 17338 | +} | |
| 17339 | +function registerStyle10(hash, css) { | |
| 17340 | + const runtime = getRuntime10(); | |
| 17341 | + runtime.styles.set(hash, css); | |
| 17342 | + for (const targetDocument of runtime.documents.keys()) { | |
| 17343 | + injectStyle10(targetDocument, hash, css); | |
| 17344 | + } | |
| 17345 | +} | |
| 17346 | +if (typeof process === "undefined" || true) { | |
| 17347 | + registerStyle10("ff021bf4fe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);--_wp-ui-elevation-md:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-md);display:grid;grid-template-areas:"header" "status" "main";grid-template-rows:auto auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width);&.b9a9946a395ccad8__is-width-anchor{width:var(--anchor-width)}&._7c9f1b268b013f02__is-width-content{width:auto}&._6f31db51d79ec899__is-width-sm{width:min(var(--available-width),var(--wpds-dimension-surface-width-sm,320px))}&.fa45cdb5f45e57fb__is-width-md{width:min(var(--available-width),var(--wpds-dimension-surface-width-md,400px))}&._46a909337f6be21c__is-width-lg{width:min(var(--available-width),var(--wpds-dimension-surface-width-lg,560px))}&._6083938dff06df34__is-width-available{width:var(--available-width)}}._101852fa256bb935__is-align-item-with-trigger ._234b520016b4e56f__popup{max-height:none}._2fff4e9defe85de5__list-chrome{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px)}.f43dc7c768d7b622__list{display:grid;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);min-width:0;overflow-wrap:anywhere;padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._41f0dd875c005a48__item-text{display:flex;flex:1;flex-direction:column;gap:2px;min-width:0}._12335b76ada0b1f5__item-label{min-width:0}._160635254c702623__item-description{color:var(--wpds-color-foreground-content-neutral-weak,#707070)}._684ccb7988365b4f__item[aria-disabled=true] ._160635254c702623__item-description,._684ccb7988365b4f__item[data-highlighted]:not([aria-disabled=true]) ._160635254c702623__item-description{color:inherit}._6eb78bc92f8d7795__status{grid-area:status}._06c7ff39d2f685b9__empty:not(:empty){grid-area:main}._06c7ff39d2f685b9__empty:not(:empty),._6eb78bc92f8d7795__status:not(:empty):not(:has([data-visually-hidden])){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}'); | |
| 17348 | +} | |
| 17349 | +var item_popup_default2 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "is-width-anchor": "b9a9946a395ccad8__is-width-anchor", "is-width-content": "_7c9f1b268b013f02__is-width-content", "is-width-sm": "_6f31db51d79ec899__is-width-sm", "is-width-md": "fa45cdb5f45e57fb__is-width-md", "is-width-lg": "_46a909337f6be21c__is-width-lg", "is-width-available": "_6083938dff06df34__is-width-available", "is-align-item-with-trigger": "_101852fa256bb935__is-align-item-with-trigger", "list-chrome": "_2fff4e9defe85de5__list-chrome", "list": "f43dc7c768d7b622__list _2fff4e9defe85de5__list-chrome", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "item-text": "_41f0dd875c005a48__item-text", "item-label": "_12335b76ada0b1f5__item-label", "item-description": "_160635254c702623__item-description", "status": "_6eb78bc92f8d7795__status", "empty": "_06c7ff39d2f685b9__empty" }; | |
| 17350 | +var Group = (0, import_element30.forwardRef)( | |
| 17351 | + function Group2({ className, children, ...restProps }, ref) { | |
| 17352 | + return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( | |
| 17353 | + index_parts_exports.Group, | |
| 17354 | + { | |
| 17355 | + className: clsx_default(item_popup_default2.group, className), | |
| 17356 | + ref, | |
| 17357 | + ...restProps, | |
| 17358 | + children | |
| 17359 | + } | |
| 17360 | + ); | |
| 17361 | + } | |
| 17362 | +); | |
| 17363 | + | |
| 17364 | +// packages/ui/build-module/form/primitives/autocomplete/group-label.mjs | |
| 17365 | +var import_element31 = __toESM(require_element(), 1); | |
| 17366 | +var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1); | |
| 17367 | +var STYLE_HASH_ATTRIBUTE11 = "data-wp-hash"; | |
| 17368 | +function getRuntime11() { | |
| 17369 | + const globalScope = globalThis; | |
| 17370 | + if (globalScope.__wpStyleRuntime) { | |
| 17371 | + return globalScope.__wpStyleRuntime; | |
| 17372 | + } | |
| 17373 | + globalScope.__wpStyleRuntime = { | |
| 17374 | + documents: /* @__PURE__ */ new Map(), | |
| 17375 | + styles: /* @__PURE__ */ new Map(), | |
| 17376 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 17377 | + }; | |
| 17378 | + if (typeof document !== "undefined") { | |
| 17379 | + registerDocument11(document); | |
| 17380 | + } | |
| 17381 | + return globalScope.__wpStyleRuntime; | |
| 17382 | +} | |
| 17383 | +function documentContainsStyleHash11(targetDocument, hash) { | |
| 17384 | + if (!targetDocument.head) { | |
| 17385 | + return false; | |
| 17386 | + } | |
| 17387 | + for (const style of targetDocument.head.querySelectorAll( | |
| 17388 | + `style[${STYLE_HASH_ATTRIBUTE11}]` | |
| 17389 | + )) { | |
| 17390 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE11) === hash) { | |
| 17391 | + return true; | |
| 17392 | + } | |
| 17393 | + } | |
| 17394 | + return false; | |
| 17395 | +} | |
| 17396 | +function injectStyle11(targetDocument, hash, css) { | |
| 17397 | + if (!targetDocument.head) { | |
| 17398 | + return; | |
| 17399 | + } | |
| 17400 | + const runtime = getRuntime11(); | |
| 17401 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 17402 | + if (!injectedStyles) { | |
| 17403 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 17404 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 17405 | + } | |
| 17406 | + if (injectedStyles.has(hash)) { | |
| 17407 | + return; | |
| 17408 | + } | |
| 17409 | + if (documentContainsStyleHash11(targetDocument, hash)) { | |
| 17410 | + injectedStyles.add(hash); | |
| 17411 | + return; | |
| 17412 | + } | |
| 17413 | + const style = targetDocument.createElement("style"); | |
| 17414 | + style.setAttribute(STYLE_HASH_ATTRIBUTE11, hash); | |
| 17415 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 17416 | + targetDocument.head.appendChild(style); | |
| 17417 | + injectedStyles.add(hash); | |
| 17418 | +} | |
| 17419 | +function registerDocument11(targetDocument) { | |
| 17420 | + const runtime = getRuntime11(); | |
| 17421 | + runtime.documents.set( | |
| 17422 | + targetDocument, | |
| 17423 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 17424 | + ); | |
| 17425 | + for (const [hash, css] of runtime.styles) { | |
| 17426 | + injectStyle11(targetDocument, hash, css); | |
| 17427 | + } | |
| 17428 | + return () => { | |
| 17429 | + const count = runtime.documents.get(targetDocument); | |
| 17430 | + if (count === void 0) { | |
| 17431 | + return; | |
| 17432 | + } | |
| 17433 | + if (count <= 1) { | |
| 17434 | + runtime.documents.delete(targetDocument); | |
| 17435 | + return; | |
| 17436 | + } | |
| 17437 | + runtime.documents.set(targetDocument, count - 1); | |
| 17438 | + }; | |
| 17439 | +} | |
| 17440 | +function registerStyle11(hash, css) { | |
| 17441 | + const runtime = getRuntime11(); | |
| 17442 | + runtime.styles.set(hash, css); | |
| 17443 | + for (const targetDocument of runtime.documents.keys()) { | |
| 17444 | + injectStyle11(targetDocument, hash, css); | |
| 17445 | + } | |
| 17446 | +} | |
| 17447 | +if (typeof process === "undefined" || true) { | |
| 17448 | + registerStyle11("ff021bf4fe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);--_wp-ui-elevation-md:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-md);display:grid;grid-template-areas:"header" "status" "main";grid-template-rows:auto auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width);&.b9a9946a395ccad8__is-width-anchor{width:var(--anchor-width)}&._7c9f1b268b013f02__is-width-content{width:auto}&._6f31db51d79ec899__is-width-sm{width:min(var(--available-width),var(--wpds-dimension-surface-width-sm,320px))}&.fa45cdb5f45e57fb__is-width-md{width:min(var(--available-width),var(--wpds-dimension-surface-width-md,400px))}&._46a909337f6be21c__is-width-lg{width:min(var(--available-width),var(--wpds-dimension-surface-width-lg,560px))}&._6083938dff06df34__is-width-available{width:var(--available-width)}}._101852fa256bb935__is-align-item-with-trigger ._234b520016b4e56f__popup{max-height:none}._2fff4e9defe85de5__list-chrome{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px)}.f43dc7c768d7b622__list{display:grid;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);min-width:0;overflow-wrap:anywhere;padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._41f0dd875c005a48__item-text{display:flex;flex:1;flex-direction:column;gap:2px;min-width:0}._12335b76ada0b1f5__item-label{min-width:0}._160635254c702623__item-description{color:var(--wpds-color-foreground-content-neutral-weak,#707070)}._684ccb7988365b4f__item[aria-disabled=true] ._160635254c702623__item-description,._684ccb7988365b4f__item[data-highlighted]:not([aria-disabled=true]) ._160635254c702623__item-description{color:inherit}._6eb78bc92f8d7795__status{grid-area:status}._06c7ff39d2f685b9__empty:not(:empty){grid-area:main}._06c7ff39d2f685b9__empty:not(:empty),._6eb78bc92f8d7795__status:not(:empty):not(:has([data-visually-hidden])){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}'); | |
| 17449 | +} | |
| 17450 | +var item_popup_default3 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "is-width-anchor": "b9a9946a395ccad8__is-width-anchor", "is-width-content": "_7c9f1b268b013f02__is-width-content", "is-width-sm": "_6f31db51d79ec899__is-width-sm", "is-width-md": "fa45cdb5f45e57fb__is-width-md", "is-width-lg": "_46a909337f6be21c__is-width-lg", "is-width-available": "_6083938dff06df34__is-width-available", "is-align-item-with-trigger": "_101852fa256bb935__is-align-item-with-trigger", "list-chrome": "_2fff4e9defe85de5__list-chrome", "list": "f43dc7c768d7b622__list _2fff4e9defe85de5__list-chrome", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "item-text": "_41f0dd875c005a48__item-text", "item-label": "_12335b76ada0b1f5__item-label", "item-description": "_160635254c702623__item-description", "status": "_6eb78bc92f8d7795__status", "empty": "_06c7ff39d2f685b9__empty" }; | |
| 17451 | +var GroupLabel = (0, import_element31.forwardRef)(function GroupLabel2({ className, children, ...restProps }, ref) { | |
| 17452 | + return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)( | |
| 17453 | + Text, | |
| 17454 | + { | |
| 17455 | + variant: "heading-sm", | |
| 17456 | + className: clsx_default(item_popup_default3["group-label"], className), | |
| 17457 | + render: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(index_parts_exports.GroupLabel, { ref, ...restProps }), | |
| 17458 | + children | |
| 17459 | + } | |
| 17460 | + ); | |
| 2177 | 17461 | }); |
| 2178 | -var TitleWarning = ({ titleId }) => { | |
| 2179 | - const titleWarningContext = useWarningContext(TITLE_WARNING_NAME); | |
| 2180 | - const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users. | |
| 2181 | 17462 | |
| 2182 | -If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component. | |
| 17463 | +// packages/ui/build-module/form/primitives/autocomplete/input-group.mjs | |
| 17464 | +var import_element32 = __toESM(require_element(), 1); | |
| 17465 | +var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1); | |
| 17466 | +var InputGroup = (0, import_element32.forwardRef)(function InputGroup2(props, ref) { | |
| 17467 | + return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(index_parts_exports.InputGroup, { ref, ...props }); | |
| 17468 | +}); | |
| 2183 | 17469 | |
| 2184 | -For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`; | |
| 2185 | - React24.useEffect(() => { | |
| 2186 | - if (titleId) { | |
| 2187 | - const hasTitle = document.getElementById(titleId); | |
| 2188 | - if (!hasTitle) console.error(MESSAGE); | |
| 17470 | +// packages/ui/build-module/form/primitives/autocomplete/input.mjs | |
| 17471 | +var import_element36 = __toESM(require_element(), 1); | |
| 17472 | + | |
| 17473 | +// packages/ui/build-module/form/primitives/input/input.mjs | |
| 17474 | +var import_element35 = __toESM(require_element(), 1); | |
| 17475 | + | |
| 17476 | +// packages/ui/build-module/form/primitives/input-layout/input-layout.mjs | |
| 17477 | +var import_element33 = __toESM(require_element(), 1); | |
| 17478 | +var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1); | |
| 17479 | +var STYLE_HASH_ATTRIBUTE12 = "data-wp-hash"; | |
| 17480 | +function getRuntime12() { | |
| 17481 | + const globalScope = globalThis; | |
| 17482 | + if (globalScope.__wpStyleRuntime) { | |
| 17483 | + return globalScope.__wpStyleRuntime; | |
| 17484 | + } | |
| 17485 | + globalScope.__wpStyleRuntime = { | |
| 17486 | + documents: /* @__PURE__ */ new Map(), | |
| 17487 | + styles: /* @__PURE__ */ new Map(), | |
| 17488 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 17489 | + }; | |
| 17490 | + if (typeof document !== "undefined") { | |
| 17491 | + registerDocument12(document); | |
| 17492 | + } | |
| 17493 | + return globalScope.__wpStyleRuntime; | |
| 17494 | +} | |
| 17495 | +function documentContainsStyleHash12(targetDocument, hash) { | |
| 17496 | + if (!targetDocument.head) { | |
| 17497 | + return false; | |
| 17498 | + } | |
| 17499 | + for (const style of targetDocument.head.querySelectorAll( | |
| 17500 | + `style[${STYLE_HASH_ATTRIBUTE12}]` | |
| 17501 | + )) { | |
| 17502 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE12) === hash) { | |
| 17503 | + return true; | |
| 2189 | 17504 | } |
| 2190 | - }, [MESSAGE, titleId]); | |
| 2191 | - return null; | |
| 2192 | -}; | |
| 2193 | -var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning"; | |
| 2194 | -var DescriptionWarning = ({ contentRef, descriptionId }) => { | |
| 2195 | - const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME); | |
| 2196 | - const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`; | |
| 2197 | - React24.useEffect(() => { | |
| 2198 | - const describedById = contentRef.current?.getAttribute("aria-describedby"); | |
| 2199 | - if (descriptionId && describedById) { | |
| 2200 | - const hasDescription = document.getElementById(descriptionId); | |
| 2201 | - if (!hasDescription) console.warn(MESSAGE); | |
| 17505 | + } | |
| 17506 | + return false; | |
| 17507 | +} | |
| 17508 | +function injectStyle12(targetDocument, hash, css) { | |
| 17509 | + if (!targetDocument.head) { | |
| 17510 | + return; | |
| 17511 | + } | |
| 17512 | + const runtime = getRuntime12(); | |
| 17513 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 17514 | + if (!injectedStyles) { | |
| 17515 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 17516 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 17517 | + } | |
| 17518 | + if (injectedStyles.has(hash)) { | |
| 17519 | + return; | |
| 17520 | + } | |
| 17521 | + if (documentContainsStyleHash12(targetDocument, hash)) { | |
| 17522 | + injectedStyles.add(hash); | |
| 17523 | + return; | |
| 17524 | + } | |
| 17525 | + const style = targetDocument.createElement("style"); | |
| 17526 | + style.setAttribute(STYLE_HASH_ATTRIBUTE12, hash); | |
| 17527 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 17528 | + targetDocument.head.appendChild(style); | |
| 17529 | + injectedStyles.add(hash); | |
| 17530 | +} | |
| 17531 | +function registerDocument12(targetDocument) { | |
| 17532 | + const runtime = getRuntime12(); | |
| 17533 | + runtime.documents.set( | |
| 17534 | + targetDocument, | |
| 17535 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 17536 | + ); | |
| 17537 | + for (const [hash, css] of runtime.styles) { | |
| 17538 | + injectStyle12(targetDocument, hash, css); | |
| 17539 | + } | |
| 17540 | + return () => { | |
| 17541 | + const count = runtime.documents.get(targetDocument); | |
| 17542 | + if (count === void 0) { | |
| 17543 | + return; | |
| 2202 | 17544 | } |
| 2203 | - }, [MESSAGE, contentRef, descriptionId]); | |
| 2204 | - return null; | |
| 2205 | -}; | |
| 2206 | -var Root = Dialog; | |
| 2207 | -var Portal2 = DialogPortal; | |
| 2208 | -var Overlay = DialogOverlay; | |
| 2209 | -var Content = DialogContent; | |
| 2210 | - | |
| 2211 | -// node_modules/cmdk/dist/index.mjs | |
| 2212 | -var t = __toESM(require_react(), 1); | |
| 2213 | -var N = '[cmdk-group=""]'; | |
| 2214 | -var Y2 = '[cmdk-group-items=""]'; | |
| 2215 | -var be = '[cmdk-group-heading=""]'; | |
| 2216 | -var le = '[cmdk-item=""]'; | |
| 2217 | -var ce = `${le}:not([aria-disabled="true"])`; | |
| 2218 | -var Z = "cmdk-item-select"; | |
| 2219 | -var T = "data-value"; | |
| 2220 | -var Re = (r, o, n) => W(r, o, n); | |
| 2221 | -var ue = t.createContext(void 0); | |
| 2222 | -var K2 = () => t.useContext(ue); | |
| 2223 | -var de = t.createContext(void 0); | |
| 2224 | -var ee = () => t.useContext(de); | |
| 2225 | -var fe = t.createContext(void 0); | |
| 2226 | -var me = t.forwardRef((r, o) => { | |
| 2227 | - let n = L(() => { | |
| 2228 | - var e, a; | |
| 2229 | - 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() } }; | |
| 2230 | - }), 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 = useId(), q = useId(), _ = useId(), I = t.useRef(null), v = ke(); | |
| 2231 | - k2(() => { | |
| 2232 | - if (R !== void 0) { | |
| 2233 | - let e = R.trim(); | |
| 2234 | - n.current.value = e, E.emit(); | |
| 17545 | + if (count <= 1) { | |
| 17546 | + runtime.documents.delete(targetDocument); | |
| 17547 | + return; | |
| 2235 | 17548 | } |
| 2236 | - }, [R]), k2(() => { | |
| 2237 | - v(6, ne); | |
| 2238 | - }, []); | |
| 2239 | - let E = t.useMemo(() => ({ subscribe: (e) => (f.current.add(e), () => f.current.delete(e)), snapshot: () => n.current, setState: (e, a, s) => { | |
| 2240 | - var i, l, g, y; | |
| 2241 | - if (!Object.is(n.current[e], a)) { | |
| 2242 | - if (n.current[e] = a, e === "search") J2(), z(), v(1, W2); | |
| 2243 | - else if (e === "value") { | |
| 2244 | - if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) { | |
| 2245 | - let h = document.getElementById(_); | |
| 2246 | - h ? h.focus() : (i = document.getElementById($2)) == null || i.focus(); | |
| 2247 | - } | |
| 2248 | - if (v(7, () => { | |
| 2249 | - var h; | |
| 2250 | - n.current.selectedItemId = (h = M()) == null ? void 0 : h.id, E.emit(); | |
| 2251 | - }), s || v(5, ne), ((l = p2.current) == null ? void 0 : l.value) !== void 0) { | |
| 2252 | - let h = a != null ? a : ""; | |
| 2253 | - (y = (g = p2.current).onValueChange) == null || y.call(g, h); | |
| 2254 | - return; | |
| 2255 | - } | |
| 17549 | + runtime.documents.set(targetDocument, count - 1); | |
| 17550 | + }; | |
| 17551 | +} | |
| 17552 | +function registerStyle12(hash, css) { | |
| 17553 | + const runtime = getRuntime12(); | |
| 17554 | + runtime.styles.set(hash, css); | |
| 17555 | + for (const targetDocument of runtime.documents.keys()) { | |
| 17556 | + injectStyle12(targetDocument, hash, css); | |
| 17557 | + } | |
| 17558 | +} | |
| 17559 | +if (typeof process === "undefined" || true) { | |
| 17560 | + registerStyle12("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); | |
| 17561 | +} | |
| 17562 | +var global_css_defense_default3 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; | |
| 17563 | +if (typeof process === "undefined" || true) { | |
| 17564 | + registerStyle12("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); | |
| 17565 | +} | |
| 17566 | +var resets_default3 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; | |
| 17567 | +if (typeof process === "undefined" || true) { | |
| 17568 | + registerStyle12("e4f4f9600b", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.cb2baafdc08746bb__input-layout{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-md,12px);background-color:var(--wpds-color-background-interactive-neutral,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:var(--wpds-border-width-xs,1px);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:max(var(--wpds-typography-font-size-md,13px),16px);height:var(--wpds-dimension-size-lg,40px);line-height:1;@media (min-width:600px){font-size:var(--wpds-typography-font-size-md,13px)}&._0c807a84cbb94e0c__is-size-compact{height:var(--wpds-dimension-size-md,32px)}&._0c807a84cbb94e0c__is-size-compact,&.ed67cda122dc1e7b__is-size-small{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-sm,8px)}&.ed67cda122dc1e7b__is-size-small{height:var(--wpds-dimension-size-sm,24px)}&._6fb7104732387680__is-disabled,&:has([data-can-disable-input-layout][data-disabled]){color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}&:not(._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-disabled,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText}}}&._8097270636ca6100__is-borderless{background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);border-color:transparent}&:has(._0d7afad74a057888__input-layout-slot:focus-within){--_gcd-div-outline:none;outline:none}&:hover:not(._6fb7104732387680__is-disabled,:has([data-can-disable-input-layout][data-disabled]),._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-active,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e)}&:has(:invalid[data-validity-visible]){--focus-color:var(--wpds-color-stroke-interactive-error,#cc1818);border-color:var(--wpds-color-stroke-interactive-error,#cc1818);&:hover{border-color:var(--wpds-color-stroke-interactive-error-active,#9d0000)}}}.c192b41a12b4387b__slot-wrapper{display:contents}._0d7afad74a057888__input-layout-slot{align-items:center;display:flex;&._0c952682762ca288__is-padding-minimal{--wp-ui-input-layout-prefix-padding-start:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px));--wp-ui-input-layout-suffix-padding-end:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px))}[data-slot-type=prefix] &{padding-inline-start:var(--wp-ui-input-layout-prefix-padding-start,var(--wp-ui-input-layout-padding-inline))}[data-slot-type=suffix] &{padding-inline-end:var(--wp-ui-input-layout-suffix-padding-end,var(--wp-ui-input-layout-padding-inline))}}}}'); | |
| 17569 | +} | |
| 17570 | +var style_default8 = { "input-layout": "cb2baafdc08746bb__input-layout", "is-size-compact": "_0c807a84cbb94e0c__is-size-compact", "is-size-small": "ed67cda122dc1e7b__is-size-small", "is-disabled": "_6fb7104732387680__is-disabled", "is-borderless": "_8097270636ca6100__is-borderless", "input-layout-slot": "_0d7afad74a057888__input-layout-slot", "slot-wrapper": "c192b41a12b4387b__slot-wrapper", "is-padding-minimal": "_0c952682762ca288__is-padding-minimal" }; | |
| 17571 | +var InputLayout = (0, import_element33.forwardRef)( | |
| 17572 | + function InputLayout2({ | |
| 17573 | + className, | |
| 17574 | + children, | |
| 17575 | + visuallyDisabled, | |
| 17576 | + size: size4 = "default", | |
| 17577 | + isBorderless, | |
| 17578 | + prefix, | |
| 17579 | + suffix, | |
| 17580 | + ...restProps | |
| 17581 | + }, ref) { | |
| 17582 | + return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)( | |
| 17583 | + "div", | |
| 17584 | + { | |
| 17585 | + ref, | |
| 17586 | + className: clsx_default( | |
| 17587 | + global_css_defense_default3.div, | |
| 17588 | + resets_default3["box-sizing"], | |
| 17589 | + style_default8["input-layout"], | |
| 17590 | + style_default8[`is-size-${size4}`], | |
| 17591 | + visuallyDisabled && style_default8["is-disabled"], | |
| 17592 | + isBorderless && style_default8["is-borderless"], | |
| 17593 | + className | |
| 17594 | + ), | |
| 17595 | + ...restProps, | |
| 17596 | + children: [ | |
| 17597 | + import_element33.Children.count(prefix) > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)( | |
| 17598 | + "div", | |
| 17599 | + { | |
| 17600 | + className: style_default8["slot-wrapper"], | |
| 17601 | + "data-slot-type": "prefix", | |
| 17602 | + children: prefix | |
| 17603 | + } | |
| 17604 | + ), | |
| 17605 | + children, | |
| 17606 | + import_element33.Children.count(suffix) > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)( | |
| 17607 | + "div", | |
| 17608 | + { | |
| 17609 | + className: style_default8["slot-wrapper"], | |
| 17610 | + "data-slot-type": "suffix", | |
| 17611 | + children: suffix | |
| 17612 | + } | |
| 17613 | + ) | |
| 17614 | + ] | |
| 2256 | 17615 | } |
| 2257 | - E.emit(); | |
| 17616 | + ); | |
| 17617 | + } | |
| 17618 | +); | |
| 17619 | + | |
| 17620 | +// packages/ui/build-module/form/primitives/input-layout/slot.mjs | |
| 17621 | +var import_element34 = __toESM(require_element(), 1); | |
| 17622 | +var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1); | |
| 17623 | +var STYLE_HASH_ATTRIBUTE13 = "data-wp-hash"; | |
| 17624 | +function getRuntime13() { | |
| 17625 | + const globalScope = globalThis; | |
| 17626 | + if (globalScope.__wpStyleRuntime) { | |
| 17627 | + return globalScope.__wpStyleRuntime; | |
| 17628 | + } | |
| 17629 | + globalScope.__wpStyleRuntime = { | |
| 17630 | + documents: /* @__PURE__ */ new Map(), | |
| 17631 | + styles: /* @__PURE__ */ new Map(), | |
| 17632 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 17633 | + }; | |
| 17634 | + if (typeof document !== "undefined") { | |
| 17635 | + registerDocument13(document); | |
| 17636 | + } | |
| 17637 | + return globalScope.__wpStyleRuntime; | |
| 17638 | +} | |
| 17639 | +function documentContainsStyleHash13(targetDocument, hash) { | |
| 17640 | + if (!targetDocument.head) { | |
| 17641 | + return false; | |
| 17642 | + } | |
| 17643 | + for (const style of targetDocument.head.querySelectorAll( | |
| 17644 | + `style[${STYLE_HASH_ATTRIBUTE13}]` | |
| 17645 | + )) { | |
| 17646 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE13) === hash) { | |
| 17647 | + return true; | |
| 2258 | 17648 | } |
| 2259 | - }, emit: () => { | |
| 2260 | - f.current.forEach((e) => e()); | |
| 2261 | - } }), []), U2 = t.useMemo(() => ({ value: (e, a, s) => { | |
| 2262 | - var i; | |
| 2263 | - 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, () => { | |
| 2264 | - z(), E.emit(); | |
| 2265 | - })); | |
| 2266 | - }, 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, () => { | |
| 2267 | - J2(), z(), n.current.value || W2(), E.emit(); | |
| 2268 | - }), () => { | |
| 2269 | - d.current.delete(e), u2.current.delete(e), n.current.filtered.items.delete(e); | |
| 2270 | - let s = M(); | |
| 2271 | - v(4, () => { | |
| 2272 | - J2(), (s == null ? void 0 : s.getAttribute("id")) === e && W2(), E.emit(); | |
| 2273 | - }); | |
| 2274 | - }), group: (e) => (c.current.has(e) || c.current.set(e, /* @__PURE__ */ new Set()), () => { | |
| 2275 | - d.current.delete(e), c.current.delete(e); | |
| 2276 | - }), filter: () => p2.current.shouldFilter, label: b || r["aria-label"], getDisablePointerSelection: () => p2.current.disablePointerSelection, listId: $2, inputId: _, labelId: q, listInnerRef: I }), []); | |
| 2277 | - function te(e, a) { | |
| 2278 | - var i, l; | |
| 2279 | - let s = (l = (i = p2.current) == null ? void 0 : i.filter) != null ? l : Re; | |
| 2280 | - return e ? s(e, n.current.search, a) : 0; | |
| 2281 | 17649 | } |
| 2282 | - function z() { | |
| 2283 | - if (!n.current.search || p2.current.shouldFilter === false) return; | |
| 2284 | - let e = n.current.filtered.items, a = []; | |
| 2285 | - n.current.filtered.groups.forEach((i) => { | |
| 2286 | - let l = c.current.get(i), g = 0; | |
| 2287 | - l.forEach((y) => { | |
| 2288 | - let h = e.get(y); | |
| 2289 | - g = Math.max(h, g); | |
| 2290 | - }), a.push([i, g]); | |
| 2291 | - }); | |
| 2292 | - let s = I.current; | |
| 2293 | - V().sort((i, l) => { | |
| 2294 | - var h, F; | |
| 2295 | - let g = i.getAttribute("id"), y = l.getAttribute("id"); | |
| 2296 | - return ((h = e.get(y)) != null ? h : 0) - ((F = e.get(g)) != null ? F : 0); | |
| 2297 | - }).forEach((i) => { | |
| 2298 | - let l = i.closest(Y2); | |
| 2299 | - l ? l.appendChild(i.parentElement === l ? i : i.closest(`${Y2} > *`)) : s.appendChild(i.parentElement === s ? i : i.closest(`${Y2} > *`)); | |
| 2300 | - }), a.sort((i, l) => l[1] - i[1]).forEach((i) => { | |
| 2301 | - var g; | |
| 2302 | - let l = (g = I.current) == null ? void 0 : g.querySelector(`${N}[${T}="${encodeURIComponent(i[0])}"]`); | |
| 2303 | - l == null || l.parentElement.appendChild(l); | |
| 2304 | - }); | |
| 17650 | + return false; | |
| 17651 | +} | |
| 17652 | +function injectStyle13(targetDocument, hash, css) { | |
| 17653 | + if (!targetDocument.head) { | |
| 17654 | + return; | |
| 2305 | 17655 | } |
| 2306 | - function W2() { | |
| 2307 | - let e = V().find((s) => s.getAttribute("aria-disabled") !== "true"), a = e == null ? void 0 : e.getAttribute(T); | |
| 2308 | - E.setState("value", a || void 0); | |
| 17656 | + const runtime = getRuntime13(); | |
| 17657 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 17658 | + if (!injectedStyles) { | |
| 17659 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 17660 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 2309 | 17661 | } |
| 2310 | - function J2() { | |
| 2311 | - var a, s, i, l; | |
| 2312 | - if (!n.current.search || p2.current.shouldFilter === false) { | |
| 2313 | - n.current.filtered.count = u2.current.size; | |
| 17662 | + if (injectedStyles.has(hash)) { | |
| 17663 | + return; | |
| 17664 | + } | |
| 17665 | + if (documentContainsStyleHash13(targetDocument, hash)) { | |
| 17666 | + injectedStyles.add(hash); | |
| 17667 | + return; | |
| 17668 | + } | |
| 17669 | + const style = targetDocument.createElement("style"); | |
| 17670 | + style.setAttribute(STYLE_HASH_ATTRIBUTE13, hash); | |
| 17671 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 17672 | + targetDocument.head.appendChild(style); | |
| 17673 | + injectedStyles.add(hash); | |
| 17674 | +} | |
| 17675 | +function registerDocument13(targetDocument) { | |
| 17676 | + const runtime = getRuntime13(); | |
| 17677 | + runtime.documents.set( | |
| 17678 | + targetDocument, | |
| 17679 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 17680 | + ); | |
| 17681 | + for (const [hash, css] of runtime.styles) { | |
| 17682 | + injectStyle13(targetDocument, hash, css); | |
| 17683 | + } | |
| 17684 | + return () => { | |
| 17685 | + const count = runtime.documents.get(targetDocument); | |
| 17686 | + if (count === void 0) { | |
| 2314 | 17687 | return; |
| 2315 | 17688 | } |
| 2316 | - n.current.filtered.groups = /* @__PURE__ */ new Set(); | |
| 2317 | - let e = 0; | |
| 2318 | - for (let g of u2.current) { | |
| 2319 | - 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); | |
| 2320 | - n.current.filtered.items.set(g, F), F > 0 && e++; | |
| 17689 | + if (count <= 1) { | |
| 17690 | + runtime.documents.delete(targetDocument); | |
| 17691 | + return; | |
| 2321 | 17692 | } |
| 2322 | - for (let [g, y] of c.current) for (let h of y) if (n.current.filtered.items.get(h) > 0) { | |
| 2323 | - n.current.filtered.groups.add(g); | |
| 2324 | - break; | |
| 17693 | + runtime.documents.set(targetDocument, count - 1); | |
| 17694 | + }; | |
| 17695 | +} | |
| 17696 | +function registerStyle13(hash, css) { | |
| 17697 | + const runtime = getRuntime13(); | |
| 17698 | + runtime.styles.set(hash, css); | |
| 17699 | + for (const targetDocument of runtime.documents.keys()) { | |
| 17700 | + injectStyle13(targetDocument, hash, css); | |
| 17701 | + } | |
| 17702 | +} | |
| 17703 | +if (typeof process === "undefined" || true) { | |
| 17704 | + registerStyle13("e4f4f9600b", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.cb2baafdc08746bb__input-layout{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-md,12px);background-color:var(--wpds-color-background-interactive-neutral,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:var(--wpds-border-width-xs,1px);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:max(var(--wpds-typography-font-size-md,13px),16px);height:var(--wpds-dimension-size-lg,40px);line-height:1;@media (min-width:600px){font-size:var(--wpds-typography-font-size-md,13px)}&._0c807a84cbb94e0c__is-size-compact{height:var(--wpds-dimension-size-md,32px)}&._0c807a84cbb94e0c__is-size-compact,&.ed67cda122dc1e7b__is-size-small{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-sm,8px)}&.ed67cda122dc1e7b__is-size-small{height:var(--wpds-dimension-size-sm,24px)}&._6fb7104732387680__is-disabled,&:has([data-can-disable-input-layout][data-disabled]){color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}&:not(._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-disabled,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText}}}&._8097270636ca6100__is-borderless{background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);border-color:transparent}&:has(._0d7afad74a057888__input-layout-slot:focus-within){--_gcd-div-outline:none;outline:none}&:hover:not(._6fb7104732387680__is-disabled,:has([data-can-disable-input-layout][data-disabled]),._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-active,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e)}&:has(:invalid[data-validity-visible]){--focus-color:var(--wpds-color-stroke-interactive-error,#cc1818);border-color:var(--wpds-color-stroke-interactive-error,#cc1818);&:hover{border-color:var(--wpds-color-stroke-interactive-error-active,#9d0000)}}}.c192b41a12b4387b__slot-wrapper{display:contents}._0d7afad74a057888__input-layout-slot{align-items:center;display:flex;&._0c952682762ca288__is-padding-minimal{--wp-ui-input-layout-prefix-padding-start:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px));--wp-ui-input-layout-suffix-padding-end:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px))}[data-slot-type=prefix] &{padding-inline-start:var(--wp-ui-input-layout-prefix-padding-start,var(--wp-ui-input-layout-padding-inline))}[data-slot-type=suffix] &{padding-inline-end:var(--wp-ui-input-layout-suffix-padding-end,var(--wp-ui-input-layout-padding-inline))}}}}'); | |
| 17705 | +} | |
| 17706 | +var style_default9 = { "input-layout": "cb2baafdc08746bb__input-layout", "is-size-compact": "_0c807a84cbb94e0c__is-size-compact", "is-size-small": "ed67cda122dc1e7b__is-size-small", "is-disabled": "_6fb7104732387680__is-disabled", "is-borderless": "_8097270636ca6100__is-borderless", "input-layout-slot": "_0d7afad74a057888__input-layout-slot", "slot-wrapper": "c192b41a12b4387b__slot-wrapper", "is-padding-minimal": "_0c952682762ca288__is-padding-minimal" }; | |
| 17707 | +var InputLayoutSlot = (0, import_element34.forwardRef)(function InputLayoutSlot2({ padding = "default", className, ...restProps }, ref) { | |
| 17708 | + return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)( | |
| 17709 | + "div", | |
| 17710 | + { | |
| 17711 | + ref, | |
| 17712 | + className: clsx_default( | |
| 17713 | + style_default9["input-layout-slot"], | |
| 17714 | + style_default9[`is-padding-${padding}`], | |
| 17715 | + className | |
| 17716 | + ), | |
| 17717 | + ...restProps | |
| 2325 | 17718 | } |
| 2326 | - n.current.filtered.count = e; | |
| 17719 | + ); | |
| 17720 | +}); | |
| 17721 | +InputLayoutSlot.displayName = "InputLayout.Slot"; | |
| 17722 | + | |
| 17723 | +// packages/ui/build-module/form/primitives/input-layout/index.mjs | |
| 17724 | +var InputLayout3 = Object.assign(InputLayout, { | |
| 17725 | + Slot: InputLayoutSlot | |
| 17726 | +}); | |
| 17727 | + | |
| 17728 | +// packages/ui/build-module/form/primitives/input/input.mjs | |
| 17729 | +var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1); | |
| 17730 | +var STYLE_HASH_ATTRIBUTE14 = "data-wp-hash"; | |
| 17731 | +function getRuntime14() { | |
| 17732 | + const globalScope = globalThis; | |
| 17733 | + if (globalScope.__wpStyleRuntime) { | |
| 17734 | + return globalScope.__wpStyleRuntime; | |
| 2327 | 17735 | } |
| 2328 | - function ne() { | |
| 2329 | - var a, s, i; | |
| 2330 | - let e = M(); | |
| 2331 | - 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" })); | |
| 17736 | + globalScope.__wpStyleRuntime = { | |
| 17737 | + documents: /* @__PURE__ */ new Map(), | |
| 17738 | + styles: /* @__PURE__ */ new Map(), | |
| 17739 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 17740 | + }; | |
| 17741 | + if (typeof document !== "undefined") { | |
| 17742 | + registerDocument14(document); | |
| 2332 | 17743 | } |
| 2333 | - function M() { | |
| 2334 | - var e; | |
| 2335 | - return (e = I.current) == null ? void 0 : e.querySelector(`${le}[aria-selected="true"]`); | |
| 17744 | + return globalScope.__wpStyleRuntime; | |
| 17745 | +} | |
| 17746 | +function documentContainsStyleHash14(targetDocument, hash) { | |
| 17747 | + if (!targetDocument.head) { | |
| 17748 | + return false; | |
| 2336 | 17749 | } |
| 2337 | - function V() { | |
| 2338 | - var e; | |
| 2339 | - return Array.from(((e = I.current) == null ? void 0 : e.querySelectorAll(ce)) || []); | |
| 17750 | + for (const style of targetDocument.head.querySelectorAll( | |
| 17751 | + `style[${STYLE_HASH_ATTRIBUTE14}]` | |
| 17752 | + )) { | |
| 17753 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE14) === hash) { | |
| 17754 | + return true; | |
| 17755 | + } | |
| 2340 | 17756 | } |
| 2341 | - function X2(e) { | |
| 2342 | - let s = V()[e]; | |
| 2343 | - s && E.setState("value", s.getAttribute(T)); | |
| 17757 | + return false; | |
| 17758 | +} | |
| 17759 | +function injectStyle14(targetDocument, hash, css) { | |
| 17760 | + if (!targetDocument.head) { | |
| 17761 | + return; | |
| 2344 | 17762 | } |
| 2345 | - function Q(e) { | |
| 2346 | - var g; | |
| 2347 | - let a = M(), s = V(), i = s.findIndex((y) => y === a), l = s[i + e]; | |
| 2348 | - (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)); | |
| 17763 | + const runtime = getRuntime14(); | |
| 17764 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 17765 | + if (!injectedStyles) { | |
| 17766 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 17767 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 2349 | 17768 | } |
| 2350 | - function re(e) { | |
| 2351 | - let a = M(), s = a == null ? void 0 : a.closest(N), i; | |
| 2352 | - for (; s && !i; ) s = e > 0 ? we(s, N) : De(s, N), i = s == null ? void 0 : s.querySelector(ce); | |
| 2353 | - i ? E.setState("value", i.getAttribute(T)) : Q(e); | |
| 17769 | + if (injectedStyles.has(hash)) { | |
| 17770 | + return; | |
| 2354 | 17771 | } |
| 2355 | - let oe = () => X2(V().length - 1), ie = (e) => { | |
| 2356 | - e.preventDefault(), e.metaKey ? oe() : e.altKey ? re(1) : Q(1); | |
| 2357 | - }, se = (e) => { | |
| 2358 | - e.preventDefault(), e.metaKey ? X2(0) : e.altKey ? re(-1) : Q(-1); | |
| 17772 | + if (documentContainsStyleHash14(targetDocument, hash)) { | |
| 17773 | + injectedStyles.add(hash); | |
| 17774 | + return; | |
| 17775 | + } | |
| 17776 | + const style = targetDocument.createElement("style"); | |
| 17777 | + style.setAttribute(STYLE_HASH_ATTRIBUTE14, hash); | |
| 17778 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 17779 | + targetDocument.head.appendChild(style); | |
| 17780 | + injectedStyles.add(hash); | |
| 17781 | +} | |
| 17782 | +function registerDocument14(targetDocument) { | |
| 17783 | + const runtime = getRuntime14(); | |
| 17784 | + runtime.documents.set( | |
| 17785 | + targetDocument, | |
| 17786 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 17787 | + ); | |
| 17788 | + for (const [hash, css] of runtime.styles) { | |
| 17789 | + injectStyle14(targetDocument, hash, css); | |
| 17790 | + } | |
| 17791 | + return () => { | |
| 17792 | + const count = runtime.documents.get(targetDocument); | |
| 17793 | + if (count === void 0) { | |
| 17794 | + return; | |
| 17795 | + } | |
| 17796 | + if (count <= 1) { | |
| 17797 | + runtime.documents.delete(targetDocument); | |
| 17798 | + return; | |
| 17799 | + } | |
| 17800 | + runtime.documents.set(targetDocument, count - 1); | |
| 2359 | 17801 | }; |
| 2360 | - return t.createElement(Primitive.div, { ref: o, tabIndex: -1, ...O, "cmdk-root": "", onKeyDown: (e) => { | |
| 2361 | - var s; | |
| 2362 | - (s = O.onKeyDown) == null || s.call(O, e); | |
| 2363 | - let a = e.nativeEvent.isComposing || e.keyCode === 229; | |
| 2364 | - if (!(e.defaultPrevented || a)) switch (e.key) { | |
| 2365 | - case "n": | |
| 2366 | - case "j": { | |
| 2367 | - j && e.ctrlKey && ie(e); | |
| 2368 | - break; | |
| 2369 | - } | |
| 2370 | - case "ArrowDown": { | |
| 2371 | - ie(e); | |
| 2372 | - break; | |
| 2373 | - } | |
| 2374 | - case "p": | |
| 2375 | - case "k": { | |
| 2376 | - j && e.ctrlKey && se(e); | |
| 2377 | - break; | |
| 2378 | - } | |
| 2379 | - case "ArrowUp": { | |
| 2380 | - se(e); | |
| 2381 | - break; | |
| 2382 | - } | |
| 2383 | - case "Home": { | |
| 2384 | - e.preventDefault(), X2(0); | |
| 2385 | - break; | |
| 2386 | - } | |
| 2387 | - case "End": { | |
| 2388 | - e.preventDefault(), oe(); | |
| 2389 | - break; | |
| 2390 | - } | |
| 2391 | - case "Enter": { | |
| 2392 | - e.preventDefault(); | |
| 2393 | - let i = M(); | |
| 2394 | - if (i) { | |
| 2395 | - let l = new Event(Z); | |
| 2396 | - i.dispatchEvent(l); | |
| 17802 | +} | |
| 17803 | +function registerStyle14(hash, css) { | |
| 17804 | + const runtime = getRuntime14(); | |
| 17805 | + runtime.styles.set(hash, css); | |
| 17806 | + for (const targetDocument of runtime.documents.keys()) { | |
| 17807 | + injectStyle14(targetDocument, hash, css); | |
| 17808 | + } | |
| 17809 | +} | |
| 17810 | +if (typeof process === "undefined" || true) { | |
| 17811 | + registerStyle14("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); | |
| 17812 | +} | |
| 17813 | +var global_css_defense_default4 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; | |
| 17814 | +if (typeof process === "undefined" || true) { | |
| 17815 | + registerStyle14("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}"); | |
| 17816 | +} | |
| 17817 | +var focus_module_default2 = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" }; | |
| 17818 | +if (typeof process === "undefined" || true) { | |
| 17819 | + registerStyle14("1a25f6a232", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._2ae7be2fc1bb17a3__input{--_gcd-input-padding:var(--wp-ui-input-padding-block,0px) var(--wp-ui-input-layout-padding-inline,0px);background:transparent;border:none;color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:inherit;font-size:inherit;line-height:inherit;outline:none;padding-block:var(--wp-ui-input-padding-block,0);padding-inline:var(--wp-ui-input-layout-padding-inline,0);width:100%;&::placeholder{color:var(--wpds-color-foreground-interactive-neutral-weak,#707070)}&:disabled,&[aria-disabled=true]{--_gcd-input-placeholder-color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);&::placeholder{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}@media (forced-colors:active){color:GrayText}}&[type=email],&[type=url]{direction:ltr}&[type=number]{appearance:textfield;&::-webkit-inner-spin-button,&::-webkit-outer-spin-button{appearance:none;margin:0}}}}}"); | |
| 17820 | +} | |
| 17821 | +var style_default10 = { "input": "_2ae7be2fc1bb17a3__input" }; | |
| 17822 | +var Input3 = (0, import_element35.forwardRef)(function Input22({ className, size: size4 = "default", prefix, suffix, style, ...restProps }, ref) { | |
| 17823 | + return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)( | |
| 17824 | + InputLayout3, | |
| 17825 | + { | |
| 17826 | + className: clsx_default( | |
| 17827 | + focus_module_default2["outset-ring--focus-within"], | |
| 17828 | + className | |
| 17829 | + ), | |
| 17830 | + style, | |
| 17831 | + size: size4, | |
| 17832 | + visuallyDisabled: restProps.disabled, | |
| 17833 | + prefix, | |
| 17834 | + suffix, | |
| 17835 | + children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)( | |
| 17836 | + Input, | |
| 17837 | + { | |
| 17838 | + ref, | |
| 17839 | + className: clsx_default(global_css_defense_default4.input, style_default10.input), | |
| 17840 | + ...restProps | |
| 2397 | 17841 | } |
| 2398 | - } | |
| 17842 | + ) | |
| 2399 | 17843 | } |
| 2400 | - } }, 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)))); | |
| 17844 | + ); | |
| 2401 | 17845 | }); |
| 2402 | -var he = t.forwardRef((r, o) => { | |
| 2403 | - var _, I; | |
| 2404 | - let n = useId(), 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; | |
| 2405 | - k2(() => { | |
| 2406 | - if (!p2) return d.item(n, c == null ? void 0 : c.id); | |
| 2407 | - }, [p2]); | |
| 2408 | - 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); | |
| 2409 | - t.useEffect(() => { | |
| 2410 | - let v = u2.current; | |
| 2411 | - if (!(!v || r.disabled)) return v.addEventListener(Z, C), () => v.removeEventListener(Z, C); | |
| 2412 | - }, [x, r.onSelect, r.disabled]); | |
| 2413 | - function C() { | |
| 2414 | - var v, E; | |
| 2415 | - S(), (E = (v = f.current).onSelect) == null || E.call(v, b.current); | |
| 17846 | + | |
| 17847 | +// packages/ui/build-module/form/primitives/autocomplete/input.mjs | |
| 17848 | +var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1); | |
| 17849 | +var DEFAULT_RENDER2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Input3, { ...props }); | |
| 17850 | +var Input4 = (0, import_element36.forwardRef)( | |
| 17851 | + function Input23({ render = DEFAULT_RENDER2, ...restProps }, ref) { | |
| 17852 | + return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)( | |
| 17853 | + index_parts_exports.Input, | |
| 17854 | + { | |
| 17855 | + ref, | |
| 17856 | + render, | |
| 17857 | + ...restProps | |
| 17858 | + } | |
| 17859 | + ); | |
| 2416 | 17860 | } |
| 2417 | - function S() { | |
| 2418 | - m2.setState("value", b.current, true); | |
| 17861 | +); | |
| 17862 | + | |
| 17863 | +// packages/ui/build-module/form/primitives/autocomplete/item.mjs | |
| 17864 | +var import_element37 = __toESM(require_element(), 1); | |
| 17865 | +var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1); | |
| 17866 | +var STYLE_HASH_ATTRIBUTE15 = "data-wp-hash"; | |
| 17867 | +function getRuntime15() { | |
| 17868 | + const globalScope = globalThis; | |
| 17869 | + if (globalScope.__wpStyleRuntime) { | |
| 17870 | + return globalScope.__wpStyleRuntime; | |
| 2419 | 17871 | } |
| 2420 | - if (!x) return null; | |
| 2421 | - let { disabled: A, value: ge, onSelect: j, forceMount: O, keywords: $2, ...q } = r; | |
| 2422 | - return t.createElement(Primitive.div, { ref: composeRefs(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); | |
| 2423 | -}); | |
| 2424 | -var Ee = t.forwardRef((r, o) => { | |
| 2425 | - let { heading: n, children: u2, forceMount: c, ...d } = r, f = useId(), p2 = t.useRef(null), b = t.useRef(null), m2 = useId(), R = K2(), x = P((S) => c || R.filter() === false ? true : S.search ? S.filtered.groups.has(f) : true); | |
| 2426 | - k2(() => R.group(f), []), ve(f, p2, [r.value, r.heading, b]); | |
| 2427 | - let C = t.useMemo(() => ({ id: f, forceMount: c }), [c]); | |
| 2428 | - return t.createElement(Primitive.div, { ref: composeRefs(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)))); | |
| 2429 | -}); | |
| 2430 | -var ye = t.forwardRef((r, o) => { | |
| 2431 | - let { alwaysRender: n, ...u2 } = r, c = t.useRef(null), d = P((f) => !f.search); | |
| 2432 | - return !n && !d ? null : t.createElement(Primitive.div, { ref: composeRefs(c, o), ...u2, "cmdk-separator": "", role: "separator" }); | |
| 2433 | -}); | |
| 2434 | -var Se = t.forwardRef((r, o) => { | |
| 2435 | - let { onValueChange: n, ...u2 } = r, c = r.value != null, d = ee(), f = P((m2) => m2.search), p2 = P((m2) => m2.selectedItemId), b = K2(); | |
| 2436 | - return t.useEffect(() => { | |
| 2437 | - r.value != null && d.setState("search", r.value); | |
| 2438 | - }, [r.value]), t.createElement(Primitive.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) => { | |
| 2439 | - c || d.setState("search", m2.target.value), n == null || n(m2.target.value); | |
| 2440 | - } }); | |
| 2441 | -}); | |
| 2442 | -var Ce = t.forwardRef((r, o) => { | |
| 2443 | - let { children: n, label: u2 = "Suggestions", ...c } = r, d = t.useRef(null), f = t.useRef(null), p2 = P((m2) => m2.selectedItemId), b = K2(); | |
| 2444 | - return t.useEffect(() => { | |
| 2445 | - if (f.current && d.current) { | |
| 2446 | - let m2 = f.current, R = d.current, x, C = new ResizeObserver(() => { | |
| 2447 | - x = requestAnimationFrame(() => { | |
| 2448 | - let S = m2.offsetHeight; | |
| 2449 | - R.style.setProperty("--cmdk-list-height", S.toFixed(1) + "px"); | |
| 2450 | - }); | |
| 2451 | - }); | |
| 2452 | - return C.observe(m2), () => { | |
| 2453 | - cancelAnimationFrame(x), C.unobserve(m2); | |
| 2454 | - }; | |
| 17872 | + globalScope.__wpStyleRuntime = { | |
| 17873 | + documents: /* @__PURE__ */ new Map(), | |
| 17874 | + styles: /* @__PURE__ */ new Map(), | |
| 17875 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 17876 | + }; | |
| 17877 | + if (typeof document !== "undefined") { | |
| 17878 | + registerDocument15(document); | |
| 17879 | + } | |
| 17880 | + return globalScope.__wpStyleRuntime; | |
| 17881 | +} | |
| 17882 | +function documentContainsStyleHash15(targetDocument, hash) { | |
| 17883 | + if (!targetDocument.head) { | |
| 17884 | + return false; | |
| 17885 | + } | |
| 17886 | + for (const style of targetDocument.head.querySelectorAll( | |
| 17887 | + `style[${STYLE_HASH_ATTRIBUTE15}]` | |
| 17888 | + )) { | |
| 17889 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE15) === hash) { | |
| 17890 | + return true; | |
| 2455 | 17891 | } |
| 2456 | - }, []), t.createElement(Primitive.div, { ref: composeRefs(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: composeRefs(f, b.listInnerRef), "cmdk-list-sizer": "" }, m2))); | |
| 2457 | -}); | |
| 2458 | -var xe = t.forwardRef((r, o) => { | |
| 2459 | - let { open: n, onOpenChange: u2, overlayClassName: c, contentClassName: d, container: f, ...p2 } = r; | |
| 2460 | - 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 })))); | |
| 2461 | -}); | |
| 2462 | -var Ie = t.forwardRef((r, o) => P((u2) => u2.filtered.count === 0) ? t.createElement(Primitive.div, { ref: o, ...r, "cmdk-empty": "", role: "presentation" }) : null); | |
| 2463 | -var Pe = t.forwardRef((r, o) => { | |
| 2464 | - let { progress: n, children: u2, label: c = "Loading...", ...d } = r; | |
| 2465 | - return t.createElement(Primitive.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))); | |
| 2466 | -}); | |
| 2467 | -var _e = Object.assign(me, { List: Ce, Item: he, Input: Se, Group: Ee, Separator: ye, Dialog: xe, Empty: Ie, Loading: Pe }); | |
| 2468 | -function we(r, o) { | |
| 2469 | - let n = r.nextElementSibling; | |
| 2470 | - for (; n; ) { | |
| 2471 | - if (n.matches(o)) return n; | |
| 2472 | - n = n.nextElementSibling; | |
| 2473 | 17892 | } |
| 17893 | + return false; | |
| 2474 | 17894 | } |
| 2475 | -function De(r, o) { | |
| 2476 | - let n = r.previousElementSibling; | |
| 2477 | - for (; n; ) { | |
| 2478 | - if (n.matches(o)) return n; | |
| 2479 | - n = n.previousElementSibling; | |
| 17895 | +function injectStyle15(targetDocument, hash, css) { | |
| 17896 | + if (!targetDocument.head) { | |
| 17897 | + return; | |
| 2480 | 17898 | } |
| 17899 | + const runtime = getRuntime15(); | |
| 17900 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 17901 | + if (!injectedStyles) { | |
| 17902 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 17903 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 17904 | + } | |
| 17905 | + if (injectedStyles.has(hash)) { | |
| 17906 | + return; | |
| 17907 | + } | |
| 17908 | + if (documentContainsStyleHash15(targetDocument, hash)) { | |
| 17909 | + injectedStyles.add(hash); | |
| 17910 | + return; | |
| 17911 | + } | |
| 17912 | + const style = targetDocument.createElement("style"); | |
| 17913 | + style.setAttribute(STYLE_HASH_ATTRIBUTE15, hash); | |
| 17914 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 17915 | + targetDocument.head.appendChild(style); | |
| 17916 | + injectedStyles.add(hash); | |
| 2481 | 17917 | } |
| 2482 | -function pe(r) { | |
| 2483 | - let o = t.useRef(r); | |
| 2484 | - return k2(() => { | |
| 2485 | - o.current = r; | |
| 2486 | - }), o; | |
| 17918 | +function registerDocument15(targetDocument) { | |
| 17919 | + const runtime = getRuntime15(); | |
| 17920 | + runtime.documents.set( | |
| 17921 | + targetDocument, | |
| 17922 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 17923 | + ); | |
| 17924 | + for (const [hash, css] of runtime.styles) { | |
| 17925 | + injectStyle15(targetDocument, hash, css); | |
| 17926 | + } | |
| 17927 | + return () => { | |
| 17928 | + const count = runtime.documents.get(targetDocument); | |
| 17929 | + if (count === void 0) { | |
| 17930 | + return; | |
| 17931 | + } | |
| 17932 | + if (count <= 1) { | |
| 17933 | + runtime.documents.delete(targetDocument); | |
| 17934 | + return; | |
| 17935 | + } | |
| 17936 | + runtime.documents.set(targetDocument, count - 1); | |
| 17937 | + }; | |
| 2487 | 17938 | } |
| 2488 | -var k2 = typeof window == "undefined" ? t.useEffect : t.useLayoutEffect; | |
| 2489 | -function L(r) { | |
| 2490 | - let o = t.useRef(); | |
| 2491 | - return o.current === void 0 && (o.current = r()), o; | |
| 17939 | +function registerStyle15(hash, css) { | |
| 17940 | + const runtime = getRuntime15(); | |
| 17941 | + runtime.styles.set(hash, css); | |
| 17942 | + for (const targetDocument of runtime.documents.keys()) { | |
| 17943 | + injectStyle15(targetDocument, hash, css); | |
| 17944 | + } | |
| 2492 | 17945 | } |
| 2493 | -function P(r) { | |
| 2494 | - let o = ee(), n = () => r(o.snapshot()); | |
| 2495 | - return t.useSyncExternalStore(o.subscribe, n, n); | |
| 17946 | +if (typeof process === "undefined" || true) { | |
| 17947 | + registerStyle15("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); | |
| 2496 | 17948 | } |
| 2497 | -function ve(r, o, n, u2 = []) { | |
| 2498 | - let c = t.useRef(), d = K2(); | |
| 2499 | - return k2(() => { | |
| 2500 | - var b; | |
| 2501 | - let f = (() => { | |
| 2502 | - var m2; | |
| 2503 | - for (let R of n) { | |
| 2504 | - if (typeof R == "string") return R.trim(); | |
| 2505 | - if (typeof R == "object" && "current" in R) return R.current ? (m2 = R.current.textContent) == null ? void 0 : m2.trim() : c.current; | |
| 17949 | +var global_css_defense_default5 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; | |
| 17950 | +if (typeof process === "undefined" || true) { | |
| 17951 | + registerStyle15("ff021bf4fe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);--_wp-ui-elevation-md:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-md);display:grid;grid-template-areas:"header" "status" "main";grid-template-rows:auto auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width);&.b9a9946a395ccad8__is-width-anchor{width:var(--anchor-width)}&._7c9f1b268b013f02__is-width-content{width:auto}&._6f31db51d79ec899__is-width-sm{width:min(var(--available-width),var(--wpds-dimension-surface-width-sm,320px))}&.fa45cdb5f45e57fb__is-width-md{width:min(var(--available-width),var(--wpds-dimension-surface-width-md,400px))}&._46a909337f6be21c__is-width-lg{width:min(var(--available-width),var(--wpds-dimension-surface-width-lg,560px))}&._6083938dff06df34__is-width-available{width:var(--available-width)}}._101852fa256bb935__is-align-item-with-trigger ._234b520016b4e56f__popup{max-height:none}._2fff4e9defe85de5__list-chrome{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px)}.f43dc7c768d7b622__list{display:grid;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);min-width:0;overflow-wrap:anywhere;padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._41f0dd875c005a48__item-text{display:flex;flex:1;flex-direction:column;gap:2px;min-width:0}._12335b76ada0b1f5__item-label{min-width:0}._160635254c702623__item-description{color:var(--wpds-color-foreground-content-neutral-weak,#707070)}._684ccb7988365b4f__item[aria-disabled=true] ._160635254c702623__item-description,._684ccb7988365b4f__item[data-highlighted]:not([aria-disabled=true]) ._160635254c702623__item-description{color:inherit}._6eb78bc92f8d7795__status{grid-area:status}._06c7ff39d2f685b9__empty:not(:empty){grid-area:main}._06c7ff39d2f685b9__empty:not(:empty),._6eb78bc92f8d7795__status:not(:empty):not(:has([data-visually-hidden])){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}'); | |
| 17952 | +} | |
| 17953 | +var item_popup_default4 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "is-width-anchor": "b9a9946a395ccad8__is-width-anchor", "is-width-content": "_7c9f1b268b013f02__is-width-content", "is-width-sm": "_6f31db51d79ec899__is-width-sm", "is-width-md": "fa45cdb5f45e57fb__is-width-md", "is-width-lg": "_46a909337f6be21c__is-width-lg", "is-width-available": "_6083938dff06df34__is-width-available", "is-align-item-with-trigger": "_101852fa256bb935__is-align-item-with-trigger", "list-chrome": "_2fff4e9defe85de5__list-chrome", "list": "f43dc7c768d7b622__list _2fff4e9defe85de5__list-chrome", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "item-text": "_41f0dd875c005a48__item-text", "item-label": "_12335b76ada0b1f5__item-label", "item-description": "_160635254c702623__item-description", "status": "_6eb78bc92f8d7795__status", "empty": "_06c7ff39d2f685b9__empty" }; | |
| 17954 | +if (typeof process === "undefined" || true) { | |
| 17955 | + registerStyle15("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); | |
| 17956 | +} | |
| 17957 | +var resets_default4 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; | |
| 17958 | +var Item = (0, import_element37.forwardRef)( | |
| 17959 | + function Item2({ className, children, ...restProps }, ref) { | |
| 17960 | + return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)( | |
| 17961 | + index_parts_exports.Item, | |
| 17962 | + { | |
| 17963 | + className: clsx_default( | |
| 17964 | + global_css_defense_default5.div, | |
| 17965 | + resets_default4["box-sizing"], | |
| 17966 | + item_popup_default4.item, | |
| 17967 | + className | |
| 17968 | + ), | |
| 17969 | + ref, | |
| 17970 | + ...restProps, | |
| 17971 | + children | |
| 2506 | 17972 | } |
| 2507 | - })(), p2 = u2.map((m2) => m2.trim()); | |
| 2508 | - d.value(r, f, p2), (b = o.current) == null || b.setAttribute(T, f), c.current = f; | |
| 2509 | - }), c; | |
| 17973 | + ); | |
| 17974 | + } | |
| 17975 | +); | |
| 17976 | + | |
| 17977 | +// packages/ui/build-module/form/primitives/autocomplete/list.mjs | |
| 17978 | +var import_element38 = __toESM(require_element(), 1); | |
| 17979 | +var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1); | |
| 17980 | +var STYLE_HASH_ATTRIBUTE16 = "data-wp-hash"; | |
| 17981 | +function getRuntime16() { | |
| 17982 | + const globalScope = globalThis; | |
| 17983 | + if (globalScope.__wpStyleRuntime) { | |
| 17984 | + return globalScope.__wpStyleRuntime; | |
| 17985 | + } | |
| 17986 | + globalScope.__wpStyleRuntime = { | |
| 17987 | + documents: /* @__PURE__ */ new Map(), | |
| 17988 | + styles: /* @__PURE__ */ new Map(), | |
| 17989 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 17990 | + }; | |
| 17991 | + if (typeof document !== "undefined") { | |
| 17992 | + registerDocument16(document); | |
| 17993 | + } | |
| 17994 | + return globalScope.__wpStyleRuntime; | |
| 2510 | 17995 | } |
| 2511 | -var ke = () => { | |
| 2512 | - let [r, o] = t.useState(), n = L(() => /* @__PURE__ */ new Map()); | |
| 2513 | - return k2(() => { | |
| 2514 | - n.current.forEach((u2) => u2()), n.current = /* @__PURE__ */ new Map(); | |
| 2515 | - }, [r]), (u2, c) => { | |
| 2516 | - n.current.set(u2, c), o({}); | |
| 17996 | +function documentContainsStyleHash16(targetDocument, hash) { | |
| 17997 | + if (!targetDocument.head) { | |
| 17998 | + return false; | |
| 17999 | + } | |
| 18000 | + for (const style of targetDocument.head.querySelectorAll( | |
| 18001 | + `style[${STYLE_HASH_ATTRIBUTE16}]` | |
| 18002 | + )) { | |
| 18003 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE16) === hash) { | |
| 18004 | + return true; | |
| 18005 | + } | |
| 18006 | + } | |
| 18007 | + return false; | |
| 18008 | +} | |
| 18009 | +function injectStyle16(targetDocument, hash, css) { | |
| 18010 | + if (!targetDocument.head) { | |
| 18011 | + return; | |
| 18012 | + } | |
| 18013 | + const runtime = getRuntime16(); | |
| 18014 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 18015 | + if (!injectedStyles) { | |
| 18016 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 18017 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 18018 | + } | |
| 18019 | + if (injectedStyles.has(hash)) { | |
| 18020 | + return; | |
| 18021 | + } | |
| 18022 | + if (documentContainsStyleHash16(targetDocument, hash)) { | |
| 18023 | + injectedStyles.add(hash); | |
| 18024 | + return; | |
| 18025 | + } | |
| 18026 | + const style = targetDocument.createElement("style"); | |
| 18027 | + style.setAttribute(STYLE_HASH_ATTRIBUTE16, hash); | |
| 18028 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 18029 | + targetDocument.head.appendChild(style); | |
| 18030 | + injectedStyles.add(hash); | |
| 18031 | +} | |
| 18032 | +function registerDocument16(targetDocument) { | |
| 18033 | + const runtime = getRuntime16(); | |
| 18034 | + runtime.documents.set( | |
| 18035 | + targetDocument, | |
| 18036 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 18037 | + ); | |
| 18038 | + for (const [hash, css] of runtime.styles) { | |
| 18039 | + injectStyle16(targetDocument, hash, css); | |
| 18040 | + } | |
| 18041 | + return () => { | |
| 18042 | + const count = runtime.documents.get(targetDocument); | |
| 18043 | + if (count === void 0) { | |
| 18044 | + return; | |
| 18045 | + } | |
| 18046 | + if (count <= 1) { | |
| 18047 | + runtime.documents.delete(targetDocument); | |
| 18048 | + return; | |
| 18049 | + } | |
| 18050 | + runtime.documents.set(targetDocument, count - 1); | |
| 2517 | 18051 | }; |
| 2518 | -}; | |
| 2519 | -function Me(r) { | |
| 2520 | - let o = r.type; | |
| 2521 | - return typeof o == "function" ? o(r.props) : "render" in o ? o.render(r.props) : r; | |
| 2522 | 18052 | } |
| 2523 | -function B2({ asChild: r, children: o }, n) { | |
| 2524 | - return r && t.isValidElement(o) ? t.cloneElement(Me(o), { ref: o.ref }, n(o.props.children)) : n(o); | |
| 18053 | +function registerStyle16(hash, css) { | |
| 18054 | + const runtime = getRuntime16(); | |
| 18055 | + runtime.styles.set(hash, css); | |
| 18056 | + for (const targetDocument of runtime.documents.keys()) { | |
| 18057 | + injectStyle16(targetDocument, hash, css); | |
| 18058 | + } | |
| 2525 | 18059 | } |
| 2526 | -var Te = { position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" }; | |
| 18060 | +if (typeof process === "undefined" || true) { | |
| 18061 | + registerStyle16("ff021bf4fe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);--_wp-ui-elevation-md:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-md);display:grid;grid-template-areas:"header" "status" "main";grid-template-rows:auto auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width);&.b9a9946a395ccad8__is-width-anchor{width:var(--anchor-width)}&._7c9f1b268b013f02__is-width-content{width:auto}&._6f31db51d79ec899__is-width-sm{width:min(var(--available-width),var(--wpds-dimension-surface-width-sm,320px))}&.fa45cdb5f45e57fb__is-width-md{width:min(var(--available-width),var(--wpds-dimension-surface-width-md,400px))}&._46a909337f6be21c__is-width-lg{width:min(var(--available-width),var(--wpds-dimension-surface-width-lg,560px))}&._6083938dff06df34__is-width-available{width:var(--available-width)}}._101852fa256bb935__is-align-item-with-trigger ._234b520016b4e56f__popup{max-height:none}._2fff4e9defe85de5__list-chrome{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px)}.f43dc7c768d7b622__list{display:grid;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);min-width:0;overflow-wrap:anywhere;padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._41f0dd875c005a48__item-text{display:flex;flex:1;flex-direction:column;gap:2px;min-width:0}._12335b76ada0b1f5__item-label{min-width:0}._160635254c702623__item-description{color:var(--wpds-color-foreground-content-neutral-weak,#707070)}._684ccb7988365b4f__item[aria-disabled=true] ._160635254c702623__item-description,._684ccb7988365b4f__item[data-highlighted]:not([aria-disabled=true]) ._160635254c702623__item-description{color:inherit}._6eb78bc92f8d7795__status{grid-area:status}._06c7ff39d2f685b9__empty:not(:empty){grid-area:main}._06c7ff39d2f685b9__empty:not(:empty),._6eb78bc92f8d7795__status:not(:empty):not(:has([data-visually-hidden])){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}'); | |
| 18062 | +} | |
| 18063 | +var item_popup_default5 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "is-width-anchor": "b9a9946a395ccad8__is-width-anchor", "is-width-content": "_7c9f1b268b013f02__is-width-content", "is-width-sm": "_6f31db51d79ec899__is-width-sm", "is-width-md": "fa45cdb5f45e57fb__is-width-md", "is-width-lg": "_46a909337f6be21c__is-width-lg", "is-width-available": "_6083938dff06df34__is-width-available", "is-align-item-with-trigger": "_101852fa256bb935__is-align-item-with-trigger", "list-chrome": "_2fff4e9defe85de5__list-chrome", "list": "f43dc7c768d7b622__list _2fff4e9defe85de5__list-chrome", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "item-text": "_41f0dd875c005a48__item-text", "item-label": "_12335b76ada0b1f5__item-label", "item-description": "_160635254c702623__item-description", "status": "_6eb78bc92f8d7795__status", "empty": "_06c7ff39d2f685b9__empty" }; | |
| 18064 | +var List = (0, import_element38.forwardRef)( | |
| 18065 | + function List2({ className, ...restProps }, ref) { | |
| 18066 | + return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)( | |
| 18067 | + index_parts_exports.List, | |
| 18068 | + { | |
| 18069 | + className: clsx_default(item_popup_default5.list, className), | |
| 18070 | + ref, | |
| 18071 | + ...restProps | |
| 18072 | + } | |
| 18073 | + ); | |
| 18074 | + } | |
| 18075 | +); | |
| 2527 | 18076 | |
| 2528 | -// packages/workflow/build-module/components/workflow-menu.mjs | |
| 2529 | -var import_data = __toESM(require_data(), 1); | |
| 2530 | -var import_element2 = __toESM(require_element(), 1); | |
| 2531 | -var import_i18n = __toESM(require_i18n(), 1); | |
| 2532 | -var import_components = __toESM(require_components(), 1); | |
| 2533 | -var import_keyboard_shortcuts = __toESM(require_keyboard_shortcuts(), 1); | |
| 2534 | - | |
| 2535 | -// packages/icons/build-module/icon/index.mjs | |
| 2536 | -var import_element = __toESM(require_element(), 1); | |
| 2537 | -var icon_default = (0, import_element.forwardRef)( | |
| 2538 | - ({ icon, size = 24, ...props }, ref) => { | |
| 2539 | - return (0, import_element.cloneElement)(icon, { | |
| 2540 | - width: size, | |
| 2541 | - height: size, | |
| 2542 | - ...props, | |
| 2543 | - ref | |
| 18077 | +// packages/ui/build-module/form/primitives/autocomplete/list-body.mjs | |
| 18078 | +var import_element39 = __toESM(require_element(), 1); | |
| 18079 | +var STYLE_HASH_ATTRIBUTE17 = "data-wp-hash"; | |
| 18080 | +function getRuntime17() { | |
| 18081 | + const globalScope = globalThis; | |
| 18082 | + if (globalScope.__wpStyleRuntime) { | |
| 18083 | + return globalScope.__wpStyleRuntime; | |
| 18084 | + } | |
| 18085 | + globalScope.__wpStyleRuntime = { | |
| 18086 | + documents: /* @__PURE__ */ new Map(), | |
| 18087 | + styles: /* @__PURE__ */ new Map(), | |
| 18088 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 18089 | + }; | |
| 18090 | + if (typeof document !== "undefined") { | |
| 18091 | + registerDocument17(document); | |
| 18092 | + } | |
| 18093 | + return globalScope.__wpStyleRuntime; | |
| 18094 | +} | |
| 18095 | +function documentContainsStyleHash17(targetDocument, hash) { | |
| 18096 | + if (!targetDocument.head) { | |
| 18097 | + return false; | |
| 18098 | + } | |
| 18099 | + for (const style of targetDocument.head.querySelectorAll( | |
| 18100 | + `style[${STYLE_HASH_ATTRIBUTE17}]` | |
| 18101 | + )) { | |
| 18102 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE17) === hash) { | |
| 18103 | + return true; | |
| 18104 | + } | |
| 18105 | + } | |
| 18106 | + return false; | |
| 18107 | +} | |
| 18108 | +function injectStyle17(targetDocument, hash, css) { | |
| 18109 | + if (!targetDocument.head) { | |
| 18110 | + return; | |
| 18111 | + } | |
| 18112 | + const runtime = getRuntime17(); | |
| 18113 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 18114 | + if (!injectedStyles) { | |
| 18115 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 18116 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 18117 | + } | |
| 18118 | + if (injectedStyles.has(hash)) { | |
| 18119 | + return; | |
| 18120 | + } | |
| 18121 | + if (documentContainsStyleHash17(targetDocument, hash)) { | |
| 18122 | + injectedStyles.add(hash); | |
| 18123 | + return; | |
| 18124 | + } | |
| 18125 | + const style = targetDocument.createElement("style"); | |
| 18126 | + style.setAttribute(STYLE_HASH_ATTRIBUTE17, hash); | |
| 18127 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 18128 | + targetDocument.head.appendChild(style); | |
| 18129 | + injectedStyles.add(hash); | |
| 18130 | +} | |
| 18131 | +function registerDocument17(targetDocument) { | |
| 18132 | + const runtime = getRuntime17(); | |
| 18133 | + runtime.documents.set( | |
| 18134 | + targetDocument, | |
| 18135 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 18136 | + ); | |
| 18137 | + for (const [hash, css] of runtime.styles) { | |
| 18138 | + injectStyle17(targetDocument, hash, css); | |
| 18139 | + } | |
| 18140 | + return () => { | |
| 18141 | + const count = runtime.documents.get(targetDocument); | |
| 18142 | + if (count === void 0) { | |
| 18143 | + return; | |
| 18144 | + } | |
| 18145 | + if (count <= 1) { | |
| 18146 | + runtime.documents.delete(targetDocument); | |
| 18147 | + return; | |
| 18148 | + } | |
| 18149 | + runtime.documents.set(targetDocument, count - 1); | |
| 18150 | + }; | |
| 18151 | +} | |
| 18152 | +function registerStyle17(hash, css) { | |
| 18153 | + const runtime = getRuntime17(); | |
| 18154 | + runtime.styles.set(hash, css); | |
| 18155 | + for (const targetDocument of runtime.documents.keys()) { | |
| 18156 | + injectStyle17(targetDocument, hash, css); | |
| 18157 | + } | |
| 18158 | +} | |
| 18159 | +if (typeof process === "undefined" || true) { | |
| 18160 | + registerStyle17("ff021bf4fe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);--_wp-ui-elevation-md:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-md);display:grid;grid-template-areas:"header" "status" "main";grid-template-rows:auto auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width);&.b9a9946a395ccad8__is-width-anchor{width:var(--anchor-width)}&._7c9f1b268b013f02__is-width-content{width:auto}&._6f31db51d79ec899__is-width-sm{width:min(var(--available-width),var(--wpds-dimension-surface-width-sm,320px))}&.fa45cdb5f45e57fb__is-width-md{width:min(var(--available-width),var(--wpds-dimension-surface-width-md,400px))}&._46a909337f6be21c__is-width-lg{width:min(var(--available-width),var(--wpds-dimension-surface-width-lg,560px))}&._6083938dff06df34__is-width-available{width:var(--available-width)}}._101852fa256bb935__is-align-item-with-trigger ._234b520016b4e56f__popup{max-height:none}._2fff4e9defe85de5__list-chrome{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px)}.f43dc7c768d7b622__list{display:grid;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);min-width:0;overflow-wrap:anywhere;padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._41f0dd875c005a48__item-text{display:flex;flex:1;flex-direction:column;gap:2px;min-width:0}._12335b76ada0b1f5__item-label{min-width:0}._160635254c702623__item-description{color:var(--wpds-color-foreground-content-neutral-weak,#707070)}._684ccb7988365b4f__item[aria-disabled=true] ._160635254c702623__item-description,._684ccb7988365b4f__item[data-highlighted]:not([aria-disabled=true]) ._160635254c702623__item-description{color:inherit}._6eb78bc92f8d7795__status{grid-area:status}._06c7ff39d2f685b9__empty:not(:empty){grid-area:main}._06c7ff39d2f685b9__empty:not(:empty),._6eb78bc92f8d7795__status:not(:empty):not(:has([data-visually-hidden])){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}'); | |
| 18161 | +} | |
| 18162 | +var item_popup_default6 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "is-width-anchor": "b9a9946a395ccad8__is-width-anchor", "is-width-content": "_7c9f1b268b013f02__is-width-content", "is-width-sm": "_6f31db51d79ec899__is-width-sm", "is-width-md": "fa45cdb5f45e57fb__is-width-md", "is-width-lg": "_46a909337f6be21c__is-width-lg", "is-width-available": "_6083938dff06df34__is-width-available", "is-align-item-with-trigger": "_101852fa256bb935__is-align-item-with-trigger", "list-chrome": "_2fff4e9defe85de5__list-chrome", "list": "f43dc7c768d7b622__list _2fff4e9defe85de5__list-chrome", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "item-text": "_41f0dd875c005a48__item-text", "item-label": "_12335b76ada0b1f5__item-label", "item-description": "_160635254c702623__item-description", "status": "_6eb78bc92f8d7795__status", "empty": "_06c7ff39d2f685b9__empty" }; | |
| 18163 | +var ListBody = (0, import_element39.forwardRef)( | |
| 18164 | + function ListBody2({ render, ...props }, ref) { | |
| 18165 | + const element = useRender({ | |
| 18166 | + defaultTagName: "div", | |
| 18167 | + render, | |
| 18168 | + ref, | |
| 18169 | + props: mergeProps( | |
| 18170 | + { className: item_popup_default6["list-scrollable-container"] }, | |
| 18171 | + props | |
| 18172 | + ) | |
| 2544 | 18173 | }); |
| 18174 | + return element; | |
| 2545 | 18175 | } |
| 2546 | 18176 | ); |
| 2547 | 18177 | |
| 2548 | -// packages/icons/build-module/library/search.mjs | |
| 2549 | -var import_primitives = __toESM(require_primitives(), 1); | |
| 2550 | -var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); | |
| 2551 | -var search_default = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime8.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" }) }); | |
| 18178 | +// packages/ui/build-module/form/primitives/autocomplete/popup.mjs | |
| 18179 | +var import_element42 = __toESM(require_element(), 1); | |
| 2552 | 18180 | |
| 2553 | -// packages/workflow/build-module/components/workflow-menu.mjs | |
| 2554 | -import { executeAbility, store as abilitiesStore } from "@wordpress/abilities"; | |
| 18181 | +// packages/ui/build-module/utils/css/item-popup.mjs | |
| 18182 | +var STYLE_HASH_ATTRIBUTE18 = "data-wp-hash"; | |
| 18183 | +function getRuntime18() { | |
| 18184 | + const globalScope = globalThis; | |
| 18185 | + if (globalScope.__wpStyleRuntime) { | |
| 18186 | + return globalScope.__wpStyleRuntime; | |
| 18187 | + } | |
| 18188 | + globalScope.__wpStyleRuntime = { | |
| 18189 | + documents: /* @__PURE__ */ new Map(), | |
| 18190 | + styles: /* @__PURE__ */ new Map(), | |
| 18191 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 18192 | + }; | |
| 18193 | + if (typeof document !== "undefined") { | |
| 18194 | + registerDocument18(document); | |
| 18195 | + } | |
| 18196 | + return globalScope.__wpStyleRuntime; | |
| 18197 | +} | |
| 18198 | +function documentContainsStyleHash18(targetDocument, hash) { | |
| 18199 | + if (!targetDocument.head) { | |
| 18200 | + return false; | |
| 18201 | + } | |
| 18202 | + for (const style of targetDocument.head.querySelectorAll( | |
| 18203 | + `style[${STYLE_HASH_ATTRIBUTE18}]` | |
| 18204 | + )) { | |
| 18205 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE18) === hash) { | |
| 18206 | + return true; | |
| 18207 | + } | |
| 18208 | + } | |
| 18209 | + return false; | |
| 18210 | +} | |
| 18211 | +function injectStyle18(targetDocument, hash, css) { | |
| 18212 | + if (!targetDocument.head) { | |
| 18213 | + return; | |
| 18214 | + } | |
| 18215 | + const runtime = getRuntime18(); | |
| 18216 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 18217 | + if (!injectedStyles) { | |
| 18218 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 18219 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 18220 | + } | |
| 18221 | + if (injectedStyles.has(hash)) { | |
| 18222 | + return; | |
| 18223 | + } | |
| 18224 | + if (documentContainsStyleHash18(targetDocument, hash)) { | |
| 18225 | + injectedStyles.add(hash); | |
| 18226 | + return; | |
| 18227 | + } | |
| 18228 | + const style = targetDocument.createElement("style"); | |
| 18229 | + style.setAttribute(STYLE_HASH_ATTRIBUTE18, hash); | |
| 18230 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 18231 | + targetDocument.head.appendChild(style); | |
| 18232 | + injectedStyles.add(hash); | |
| 18233 | +} | |
| 18234 | +function registerDocument18(targetDocument) { | |
| 18235 | + const runtime = getRuntime18(); | |
| 18236 | + runtime.documents.set( | |
| 18237 | + targetDocument, | |
| 18238 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 18239 | + ); | |
| 18240 | + for (const [hash, css] of runtime.styles) { | |
| 18241 | + injectStyle18(targetDocument, hash, css); | |
| 18242 | + } | |
| 18243 | + return () => { | |
| 18244 | + const count = runtime.documents.get(targetDocument); | |
| 18245 | + if (count === void 0) { | |
| 18246 | + return; | |
| 18247 | + } | |
| 18248 | + if (count <= 1) { | |
| 18249 | + runtime.documents.delete(targetDocument); | |
| 18250 | + return; | |
| 18251 | + } | |
| 18252 | + runtime.documents.set(targetDocument, count - 1); | |
| 18253 | + }; | |
| 18254 | +} | |
| 18255 | +function registerStyle18(hash, css) { | |
| 18256 | + const runtime = getRuntime18(); | |
| 18257 | + runtime.styles.set(hash, css); | |
| 18258 | + for (const targetDocument of runtime.documents.keys()) { | |
| 18259 | + injectStyle18(targetDocument, hash, css); | |
| 18260 | + } | |
| 18261 | +} | |
| 18262 | +if (typeof process === "undefined" || true) { | |
| 18263 | + registerStyle18("ff021bf4fe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);--_wp-ui-elevation-md:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-md);display:grid;grid-template-areas:"header" "status" "main";grid-template-rows:auto auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width);&.b9a9946a395ccad8__is-width-anchor{width:var(--anchor-width)}&._7c9f1b268b013f02__is-width-content{width:auto}&._6f31db51d79ec899__is-width-sm{width:min(var(--available-width),var(--wpds-dimension-surface-width-sm,320px))}&.fa45cdb5f45e57fb__is-width-md{width:min(var(--available-width),var(--wpds-dimension-surface-width-md,400px))}&._46a909337f6be21c__is-width-lg{width:min(var(--available-width),var(--wpds-dimension-surface-width-lg,560px))}&._6083938dff06df34__is-width-available{width:var(--available-width)}}._101852fa256bb935__is-align-item-with-trigger ._234b520016b4e56f__popup{max-height:none}._2fff4e9defe85de5__list-chrome{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px)}.f43dc7c768d7b622__list{display:grid;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);min-width:0;overflow-wrap:anywhere;padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._41f0dd875c005a48__item-text{display:flex;flex:1;flex-direction:column;gap:2px;min-width:0}._12335b76ada0b1f5__item-label{min-width:0}._160635254c702623__item-description{color:var(--wpds-color-foreground-content-neutral-weak,#707070)}._684ccb7988365b4f__item[aria-disabled=true] ._160635254c702623__item-description,._684ccb7988365b4f__item[data-highlighted]:not([aria-disabled=true]) ._160635254c702623__item-description{color:inherit}._6eb78bc92f8d7795__status{grid-area:status}._06c7ff39d2f685b9__empty:not(:empty){grid-area:main}._06c7ff39d2f685b9__empty:not(:empty),._6eb78bc92f8d7795__status:not(:empty):not(:has([data-visually-hidden])){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}'); | |
| 18264 | +} | |
| 18265 | +var item_popup_default7 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "is-width-anchor": "b9a9946a395ccad8__is-width-anchor", "is-width-content": "_7c9f1b268b013f02__is-width-content", "is-width-sm": "_6f31db51d79ec899__is-width-sm", "is-width-md": "fa45cdb5f45e57fb__is-width-md", "is-width-lg": "_46a909337f6be21c__is-width-lg", "is-width-available": "_6083938dff06df34__is-width-available", "is-align-item-with-trigger": "_101852fa256bb935__is-align-item-with-trigger", "list-chrome": "_2fff4e9defe85de5__list-chrome", "list": "f43dc7c768d7b622__list _2fff4e9defe85de5__list-chrome", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "item-text": "_41f0dd875c005a48__item-text", "item-label": "_12335b76ada0b1f5__item-label", "item-description": "_160635254c702623__item-description", "status": "_6eb78bc92f8d7795__status", "empty": "_06c7ff39d2f685b9__empty" }; | |
| 18266 | +function getItemPopupWidthClassName(width = "anchor") { | |
| 18267 | + switch (width) { | |
| 18268 | + case "available": | |
| 18269 | + return item_popup_default7["is-width-available"]; | |
| 18270 | + case "content": | |
| 18271 | + return item_popup_default7["is-width-content"]; | |
| 18272 | + case "lg": | |
| 18273 | + return item_popup_default7["is-width-lg"]; | |
| 18274 | + case "md": | |
| 18275 | + return item_popup_default7["is-width-md"]; | |
| 18276 | + case "sm": | |
| 18277 | + return item_popup_default7["is-width-sm"]; | |
| 18278 | + case "anchor": | |
| 18279 | + return item_popup_default7["is-width-anchor"]; | |
| 18280 | + default: | |
| 18281 | + return false; | |
| 18282 | + } | |
| 18283 | +} | |
| 2555 | 18284 | |
| 2556 | -// packages/workflow/build-module/lock-unlock.mjs | |
| 2557 | -var import_private_apis = __toESM(require_private_apis(), 1); | |
| 2558 | -var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( | |
| 2559 | - "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", | |
| 2560 | - "@wordpress/workflows" | |
| 18285 | +// packages/ui/build-module/form/primitives/autocomplete/portal.mjs | |
| 18286 | +var import_element40 = __toESM(require_element(), 1); | |
| 18287 | +var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1); | |
| 18288 | +var Portal2 = (0, import_element40.forwardRef)( | |
| 18289 | + function AutocompletePortal({ container, ...restProps }, ref) { | |
| 18290 | + return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)( | |
| 18291 | + index_parts_exports.Portal, | |
| 18292 | + { | |
| 18293 | + container: container ?? getWpCompatOverlaySlot(), | |
| 18294 | + ...restProps, | |
| 18295 | + ref | |
| 18296 | + } | |
| 18297 | + ); | |
| 18298 | + } | |
| 2561 | 18299 | ); |
| 2562 | 18300 | |
| 2563 | -// packages/workflow/build-module/components/workflow-menu.mjs | |
| 2564 | -var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); | |
| 2565 | -if (typeof document !== "undefined" && true && !document.head.querySelector("style[data-wp-hash='846895dde0']")) { | |
| 2566 | - const style = document.createElement("style"); | |
| 2567 | - style.setAttribute("data-wp-hash", "846895dde0"); | |
| 2568 | - 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:var(--wpds-typography-font-weight-emphasis,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:var(--wpds-typography-font-weight-emphasis,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}")); | |
| 2569 | - document.head.appendChild(style); | |
| 18301 | +// packages/ui/build-module/form/primitives/autocomplete/positioner.mjs | |
| 18302 | +var import_element41 = __toESM(require_element(), 1); | |
| 18303 | +var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1); | |
| 18304 | +var STYLE_HASH_ATTRIBUTE19 = "data-wp-hash"; | |
| 18305 | +function getRuntime19() { | |
| 18306 | + const globalScope = globalThis; | |
| 18307 | + if (globalScope.__wpStyleRuntime) { | |
| 18308 | + return globalScope.__wpStyleRuntime; | |
| 18309 | + } | |
| 18310 | + globalScope.__wpStyleRuntime = { | |
| 18311 | + documents: /* @__PURE__ */ new Map(), | |
| 18312 | + styles: /* @__PURE__ */ new Map(), | |
| 18313 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 18314 | + }; | |
| 18315 | + if (typeof document !== "undefined") { | |
| 18316 | + registerDocument19(document); | |
| 18317 | + } | |
| 18318 | + return globalScope.__wpStyleRuntime; | |
| 2570 | 18319 | } |
| 2571 | -var { withIgnoreIMEEvents } = unlock(import_components.privateApis); | |
| 2572 | -var EMPTY_ARRAY = []; | |
| 2573 | -var inputLabel = (0, import_i18n.__)("Run abilities and workflows"); | |
| 2574 | -function WorkflowInput({ isOpen, search, setSearch, abilities }) { | |
| 2575 | - const workflowMenuInput = (0, import_element2.useRef)(); | |
| 2576 | - const _value = P((state) => state.value); | |
| 2577 | - const selectedItemId = (0, import_element2.useMemo)(() => { | |
| 2578 | - const ability = abilities.find((a) => a.label === _value); | |
| 2579 | - return ability?.name; | |
| 2580 | - }, [_value, abilities]); | |
| 2581 | - (0, import_element2.useEffect)(() => { | |
| 2582 | - if (isOpen) { | |
| 2583 | - workflowMenuInput.current.focus(); | |
| 18320 | +function documentContainsStyleHash19(targetDocument, hash) { | |
| 18321 | + if (!targetDocument.head) { | |
| 18322 | + return false; | |
| 18323 | + } | |
| 18324 | + for (const style of targetDocument.head.querySelectorAll( | |
| 18325 | + `style[${STYLE_HASH_ATTRIBUTE19}]` | |
| 18326 | + )) { | |
| 18327 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE19) === hash) { | |
| 18328 | + return true; | |
| 2584 | 18329 | } |
| 2585 | - }, [isOpen]); | |
| 2586 | - return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( | |
| 2587 | - _e.Input, | |
| 2588 | - { | |
| 2589 | - ref: workflowMenuInput, | |
| 2590 | - value: search, | |
| 2591 | - onValueChange: setSearch, | |
| 2592 | - placeholder: inputLabel, | |
| 2593 | - "aria-activedescendant": selectedItemId | |
| 18330 | + } | |
| 18331 | + return false; | |
| 18332 | +} | |
| 18333 | +function injectStyle19(targetDocument, hash, css) { | |
| 18334 | + if (!targetDocument.head) { | |
| 18335 | + return; | |
| 18336 | + } | |
| 18337 | + const runtime = getRuntime19(); | |
| 18338 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 18339 | + if (!injectedStyles) { | |
| 18340 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 18341 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 18342 | + } | |
| 18343 | + if (injectedStyles.has(hash)) { | |
| 18344 | + return; | |
| 18345 | + } | |
| 18346 | + if (documentContainsStyleHash19(targetDocument, hash)) { | |
| 18347 | + injectedStyles.add(hash); | |
| 18348 | + return; | |
| 18349 | + } | |
| 18350 | + const style = targetDocument.createElement("style"); | |
| 18351 | + style.setAttribute(STYLE_HASH_ATTRIBUTE19, hash); | |
| 18352 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 18353 | + targetDocument.head.appendChild(style); | |
| 18354 | + injectedStyles.add(hash); | |
| 18355 | +} | |
| 18356 | +function registerDocument19(targetDocument) { | |
| 18357 | + const runtime = getRuntime19(); | |
| 18358 | + runtime.documents.set( | |
| 18359 | + targetDocument, | |
| 18360 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 18361 | + ); | |
| 18362 | + for (const [hash, css] of runtime.styles) { | |
| 18363 | + injectStyle19(targetDocument, hash, css); | |
| 18364 | + } | |
| 18365 | + return () => { | |
| 18366 | + const count = runtime.documents.get(targetDocument); | |
| 18367 | + if (count === void 0) { | |
| 18368 | + return; | |
| 2594 | 18369 | } |
| 18370 | + if (count <= 1) { | |
| 18371 | + runtime.documents.delete(targetDocument); | |
| 18372 | + return; | |
| 18373 | + } | |
| 18374 | + runtime.documents.set(targetDocument, count - 1); | |
| 18375 | + }; | |
| 18376 | +} | |
| 18377 | +function registerStyle19(hash, css) { | |
| 18378 | + const runtime = getRuntime19(); | |
| 18379 | + runtime.styles.set(hash, css); | |
| 18380 | + for (const targetDocument of runtime.documents.keys()) { | |
| 18381 | + injectStyle19(targetDocument, hash, css); | |
| 18382 | + } | |
| 18383 | +} | |
| 18384 | +if (typeof process === "undefined" || true) { | |
| 18385 | + registerStyle19("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); | |
| 18386 | +} | |
| 18387 | +var resets_default5 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; | |
| 18388 | +if (typeof process === "undefined" || true) { | |
| 18389 | + registerStyle19("e61eb95308", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._8eb0a29484225eea__positioner{z-index:var(--wp-ui-autocomplete-z-index,initial)}}}"); | |
| 18390 | +} | |
| 18391 | +var style_default11 = { "positioner": "_8eb0a29484225eea__positioner" }; | |
| 18392 | +var Positioner2 = (0, import_element41.forwardRef)( | |
| 18393 | + function AutocompletePositioner({ className, ...props }, ref) { | |
| 18394 | + return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)( | |
| 18395 | + index_parts_exports.Positioner, | |
| 18396 | + { | |
| 18397 | + ...ITEM_POPUP_POSITIONER_PROPS, | |
| 18398 | + ...props, | |
| 18399 | + ref, | |
| 18400 | + className: clsx_default( | |
| 18401 | + resets_default5["box-sizing"], | |
| 18402 | + style_default11.positioner, | |
| 18403 | + className | |
| 18404 | + ) | |
| 18405 | + } | |
| 18406 | + ); | |
| 18407 | + } | |
| 18408 | +); | |
| 18409 | + | |
| 18410 | +// packages/ui/build-module/form/primitives/autocomplete/popup.mjs | |
| 18411 | +var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1); | |
| 18412 | +var STYLE_HASH_ATTRIBUTE20 = "data-wp-hash"; | |
| 18413 | +function getRuntime20() { | |
| 18414 | + const globalScope = globalThis; | |
| 18415 | + if (globalScope.__wpStyleRuntime) { | |
| 18416 | + return globalScope.__wpStyleRuntime; | |
| 18417 | + } | |
| 18418 | + globalScope.__wpStyleRuntime = { | |
| 18419 | + documents: /* @__PURE__ */ new Map(), | |
| 18420 | + styles: /* @__PURE__ */ new Map(), | |
| 18421 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 18422 | + }; | |
| 18423 | + if (typeof document !== "undefined") { | |
| 18424 | + registerDocument20(document); | |
| 18425 | + } | |
| 18426 | + return globalScope.__wpStyleRuntime; | |
| 18427 | +} | |
| 18428 | +function documentContainsStyleHash20(targetDocument, hash) { | |
| 18429 | + if (!targetDocument.head) { | |
| 18430 | + return false; | |
| 18431 | + } | |
| 18432 | + for (const style of targetDocument.head.querySelectorAll( | |
| 18433 | + `style[${STYLE_HASH_ATTRIBUTE20}]` | |
| 18434 | + )) { | |
| 18435 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE20) === hash) { | |
| 18436 | + return true; | |
| 18437 | + } | |
| 18438 | + } | |
| 18439 | + return false; | |
| 18440 | +} | |
| 18441 | +function injectStyle20(targetDocument, hash, css) { | |
| 18442 | + if (!targetDocument.head) { | |
| 18443 | + return; | |
| 18444 | + } | |
| 18445 | + const runtime = getRuntime20(); | |
| 18446 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 18447 | + if (!injectedStyles) { | |
| 18448 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 18449 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 18450 | + } | |
| 18451 | + if (injectedStyles.has(hash)) { | |
| 18452 | + return; | |
| 18453 | + } | |
| 18454 | + if (documentContainsStyleHash20(targetDocument, hash)) { | |
| 18455 | + injectedStyles.add(hash); | |
| 18456 | + return; | |
| 18457 | + } | |
| 18458 | + const style = targetDocument.createElement("style"); | |
| 18459 | + style.setAttribute(STYLE_HASH_ATTRIBUTE20, hash); | |
| 18460 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 18461 | + targetDocument.head.appendChild(style); | |
| 18462 | + injectedStyles.add(hash); | |
| 18463 | +} | |
| 18464 | +function registerDocument20(targetDocument) { | |
| 18465 | + const runtime = getRuntime20(); | |
| 18466 | + runtime.documents.set( | |
| 18467 | + targetDocument, | |
| 18468 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 2595 | 18469 | ); |
| 18470 | + for (const [hash, css] of runtime.styles) { | |
| 18471 | + injectStyle20(targetDocument, hash, css); | |
| 18472 | + } | |
| 18473 | + return () => { | |
| 18474 | + const count = runtime.documents.get(targetDocument); | |
| 18475 | + if (count === void 0) { | |
| 18476 | + return; | |
| 18477 | + } | |
| 18478 | + if (count <= 1) { | |
| 18479 | + runtime.documents.delete(targetDocument); | |
| 18480 | + return; | |
| 18481 | + } | |
| 18482 | + runtime.documents.set(targetDocument, count - 1); | |
| 18483 | + }; | |
| 2596 | 18484 | } |
| 18485 | +function registerStyle20(hash, css) { | |
| 18486 | + const runtime = getRuntime20(); | |
| 18487 | + runtime.styles.set(hash, css); | |
| 18488 | + for (const targetDocument of runtime.documents.keys()) { | |
| 18489 | + injectStyle20(targetDocument, hash, css); | |
| 18490 | + } | |
| 18491 | +} | |
| 18492 | +if (typeof process === "undefined" || true) { | |
| 18493 | + registerStyle20("ff021bf4fe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);--_wp-ui-elevation-md:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-md);display:grid;grid-template-areas:"header" "status" "main";grid-template-rows:auto auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width);&.b9a9946a395ccad8__is-width-anchor{width:var(--anchor-width)}&._7c9f1b268b013f02__is-width-content{width:auto}&._6f31db51d79ec899__is-width-sm{width:min(var(--available-width),var(--wpds-dimension-surface-width-sm,320px))}&.fa45cdb5f45e57fb__is-width-md{width:min(var(--available-width),var(--wpds-dimension-surface-width-md,400px))}&._46a909337f6be21c__is-width-lg{width:min(var(--available-width),var(--wpds-dimension-surface-width-lg,560px))}&._6083938dff06df34__is-width-available{width:var(--available-width)}}._101852fa256bb935__is-align-item-with-trigger ._234b520016b4e56f__popup{max-height:none}._2fff4e9defe85de5__list-chrome{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px)}.f43dc7c768d7b622__list{display:grid;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);min-width:0;overflow-wrap:anywhere;padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._41f0dd875c005a48__item-text{display:flex;flex:1;flex-direction:column;gap:2px;min-width:0}._12335b76ada0b1f5__item-label{min-width:0}._160635254c702623__item-description{color:var(--wpds-color-foreground-content-neutral-weak,#707070)}._684ccb7988365b4f__item[aria-disabled=true] ._160635254c702623__item-description,._684ccb7988365b4f__item[data-highlighted]:not([aria-disabled=true]) ._160635254c702623__item-description{color:inherit}._6eb78bc92f8d7795__status{grid-area:status}._06c7ff39d2f685b9__empty:not(:empty){grid-area:main}._06c7ff39d2f685b9__empty:not(:empty),._6eb78bc92f8d7795__status:not(:empty):not(:has([data-visually-hidden])){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}'); | |
| 18494 | +} | |
| 18495 | +var item_popup_default8 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "is-width-anchor": "b9a9946a395ccad8__is-width-anchor", "is-width-content": "_7c9f1b268b013f02__is-width-content", "is-width-sm": "_6f31db51d79ec899__is-width-sm", "is-width-md": "fa45cdb5f45e57fb__is-width-md", "is-width-lg": "_46a909337f6be21c__is-width-lg", "is-width-available": "_6083938dff06df34__is-width-available", "is-align-item-with-trigger": "_101852fa256bb935__is-align-item-with-trigger", "list-chrome": "_2fff4e9defe85de5__list-chrome", "list": "f43dc7c768d7b622__list _2fff4e9defe85de5__list-chrome", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "item-text": "_41f0dd875c005a48__item-text", "item-label": "_12335b76ada0b1f5__item-label", "item-description": "_160635254c702623__item-description", "status": "_6eb78bc92f8d7795__status", "empty": "_06c7ff39d2f685b9__empty" }; | |
| 18496 | +var Popup2 = (0, import_element42.forwardRef)( | |
| 18497 | + function Popup22({ className, portal, positioner, width, ...restProps }, ref) { | |
| 18498 | + const popupContent = /* @__PURE__ */ (0, import_jsx_runtime63.jsx)( | |
| 18499 | + index_parts_exports.Popup, | |
| 18500 | + { | |
| 18501 | + ref, | |
| 18502 | + className: clsx_default( | |
| 18503 | + item_popup_default8.popup, | |
| 18504 | + getItemPopupWidthClassName(width), | |
| 18505 | + className | |
| 18506 | + ), | |
| 18507 | + ...restProps | |
| 18508 | + } | |
| 18509 | + ); | |
| 18510 | + const positionedPopup = renderSlotWithChildren( | |
| 18511 | + positioner, | |
| 18512 | + /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Positioner2, {}), | |
| 18513 | + popupContent | |
| 18514 | + ); | |
| 18515 | + return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Portal2, {}), positionedPopup); | |
| 18516 | + } | |
| 18517 | +); | |
| 18518 | + | |
| 18519 | +// packages/ui/build-module/form/primitives/autocomplete/context.mjs | |
| 18520 | +var import_element43 = __toESM(require_element(), 1); | |
| 18521 | +var AutocompleteGridContext = (0, import_element43.createContext)(false); | |
| 18522 | +var useAutocompleteGridContext = () => (0, import_element43.useContext)(AutocompleteGridContext); | |
| 18523 | + | |
| 18524 | +// packages/ui/build-module/form/primitives/autocomplete/root.mjs | |
| 18525 | +var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1); | |
| 18526 | +function Root2(props) { | |
| 18527 | + return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(AutocompleteGridContext.Provider, { value: Boolean(props.grid), children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DirectionProvider3, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(index_parts_exports.Root, { ...props }) }) }); | |
| 18528 | +} | |
| 18529 | + | |
| 18530 | +// packages/ui/build-module/form/primitives/autocomplete/row.mjs | |
| 18531 | +var import_element44 = __toESM(require_element(), 1); | |
| 18532 | +var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1); | |
| 18533 | +var Row = (0, import_element44.forwardRef)( | |
| 18534 | + function Row2({ children, ...restProps }, ref) { | |
| 18535 | + const isGrid = useAutocompleteGridContext(); | |
| 18536 | + if (!isGrid) { | |
| 18537 | + throw new Error( | |
| 18538 | + "Autocomplete.Row: Missing parent <Autocomplete.Root grid>. Render <Autocomplete.Row> inside <Autocomplete.Root grid>." | |
| 18539 | + ); | |
| 18540 | + } | |
| 18541 | + return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(index_parts_exports.Row, { ref, ...restProps, children }); | |
| 18542 | + } | |
| 18543 | +); | |
| 18544 | + | |
| 18545 | +// packages/ui/build-module/form/primitives/autocomplete/status.mjs | |
| 18546 | +var import_element45 = __toESM(require_element(), 1); | |
| 18547 | +var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1); | |
| 18548 | +var STYLE_HASH_ATTRIBUTE21 = "data-wp-hash"; | |
| 18549 | +function getRuntime21() { | |
| 18550 | + const globalScope = globalThis; | |
| 18551 | + if (globalScope.__wpStyleRuntime) { | |
| 18552 | + return globalScope.__wpStyleRuntime; | |
| 18553 | + } | |
| 18554 | + globalScope.__wpStyleRuntime = { | |
| 18555 | + documents: /* @__PURE__ */ new Map(), | |
| 18556 | + styles: /* @__PURE__ */ new Map(), | |
| 18557 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 18558 | + }; | |
| 18559 | + if (typeof document !== "undefined") { | |
| 18560 | + registerDocument21(document); | |
| 18561 | + } | |
| 18562 | + return globalScope.__wpStyleRuntime; | |
| 18563 | +} | |
| 18564 | +function documentContainsStyleHash21(targetDocument, hash) { | |
| 18565 | + if (!targetDocument.head) { | |
| 18566 | + return false; | |
| 18567 | + } | |
| 18568 | + for (const style of targetDocument.head.querySelectorAll( | |
| 18569 | + `style[${STYLE_HASH_ATTRIBUTE21}]` | |
| 18570 | + )) { | |
| 18571 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE21) === hash) { | |
| 18572 | + return true; | |
| 18573 | + } | |
| 18574 | + } | |
| 18575 | + return false; | |
| 18576 | +} | |
| 18577 | +function injectStyle21(targetDocument, hash, css) { | |
| 18578 | + if (!targetDocument.head) { | |
| 18579 | + return; | |
| 18580 | + } | |
| 18581 | + const runtime = getRuntime21(); | |
| 18582 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 18583 | + if (!injectedStyles) { | |
| 18584 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 18585 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 18586 | + } | |
| 18587 | + if (injectedStyles.has(hash)) { | |
| 18588 | + return; | |
| 18589 | + } | |
| 18590 | + if (documentContainsStyleHash21(targetDocument, hash)) { | |
| 18591 | + injectedStyles.add(hash); | |
| 18592 | + return; | |
| 18593 | + } | |
| 18594 | + const style = targetDocument.createElement("style"); | |
| 18595 | + style.setAttribute(STYLE_HASH_ATTRIBUTE21, hash); | |
| 18596 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 18597 | + targetDocument.head.appendChild(style); | |
| 18598 | + injectedStyles.add(hash); | |
| 18599 | +} | |
| 18600 | +function registerDocument21(targetDocument) { | |
| 18601 | + const runtime = getRuntime21(); | |
| 18602 | + runtime.documents.set( | |
| 18603 | + targetDocument, | |
| 18604 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 18605 | + ); | |
| 18606 | + for (const [hash, css] of runtime.styles) { | |
| 18607 | + injectStyle21(targetDocument, hash, css); | |
| 18608 | + } | |
| 18609 | + return () => { | |
| 18610 | + const count = runtime.documents.get(targetDocument); | |
| 18611 | + if (count === void 0) { | |
| 18612 | + return; | |
| 18613 | + } | |
| 18614 | + if (count <= 1) { | |
| 18615 | + runtime.documents.delete(targetDocument); | |
| 18616 | + return; | |
| 18617 | + } | |
| 18618 | + runtime.documents.set(targetDocument, count - 1); | |
| 18619 | + }; | |
| 18620 | +} | |
| 18621 | +function registerStyle21(hash, css) { | |
| 18622 | + const runtime = getRuntime21(); | |
| 18623 | + runtime.styles.set(hash, css); | |
| 18624 | + for (const targetDocument of runtime.documents.keys()) { | |
| 18625 | + injectStyle21(targetDocument, hash, css); | |
| 18626 | + } | |
| 18627 | +} | |
| 18628 | +if (typeof process === "undefined" || true) { | |
| 18629 | + registerStyle21("ff021bf4fe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);--_wp-ui-elevation-md:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-md);display:grid;grid-template-areas:"header" "status" "main";grid-template-rows:auto auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width);&.b9a9946a395ccad8__is-width-anchor{width:var(--anchor-width)}&._7c9f1b268b013f02__is-width-content{width:auto}&._6f31db51d79ec899__is-width-sm{width:min(var(--available-width),var(--wpds-dimension-surface-width-sm,320px))}&.fa45cdb5f45e57fb__is-width-md{width:min(var(--available-width),var(--wpds-dimension-surface-width-md,400px))}&._46a909337f6be21c__is-width-lg{width:min(var(--available-width),var(--wpds-dimension-surface-width-lg,560px))}&._6083938dff06df34__is-width-available{width:var(--available-width)}}._101852fa256bb935__is-align-item-with-trigger ._234b520016b4e56f__popup{max-height:none}._2fff4e9defe85de5__list-chrome{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px)}.f43dc7c768d7b622__list{display:grid;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);min-width:0;overflow-wrap:anywhere;padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._41f0dd875c005a48__item-text{display:flex;flex:1;flex-direction:column;gap:2px;min-width:0}._12335b76ada0b1f5__item-label{min-width:0}._160635254c702623__item-description{color:var(--wpds-color-foreground-content-neutral-weak,#707070)}._684ccb7988365b4f__item[aria-disabled=true] ._160635254c702623__item-description,._684ccb7988365b4f__item[data-highlighted]:not([aria-disabled=true]) ._160635254c702623__item-description{color:inherit}._6eb78bc92f8d7795__status{grid-area:status}._06c7ff39d2f685b9__empty:not(:empty){grid-area:main}._06c7ff39d2f685b9__empty:not(:empty),._6eb78bc92f8d7795__status:not(:empty):not(:has([data-visually-hidden])){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}'); | |
| 18630 | +} | |
| 18631 | +var item_popup_default9 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "is-width-anchor": "b9a9946a395ccad8__is-width-anchor", "is-width-content": "_7c9f1b268b013f02__is-width-content", "is-width-sm": "_6f31db51d79ec899__is-width-sm", "is-width-md": "fa45cdb5f45e57fb__is-width-md", "is-width-lg": "_46a909337f6be21c__is-width-lg", "is-width-available": "_6083938dff06df34__is-width-available", "is-align-item-with-trigger": "_101852fa256bb935__is-align-item-with-trigger", "list-chrome": "_2fff4e9defe85de5__list-chrome", "list": "f43dc7c768d7b622__list _2fff4e9defe85de5__list-chrome", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "item-text": "_41f0dd875c005a48__item-text", "item-label": "_12335b76ada0b1f5__item-label", "item-description": "_160635254c702623__item-description", "status": "_6eb78bc92f8d7795__status", "empty": "_06c7ff39d2f685b9__empty" }; | |
| 18632 | +var Status = (0, import_element45.forwardRef)( | |
| 18633 | + function Status2({ className, ...restProps }, ref) { | |
| 18634 | + return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)( | |
| 18635 | + index_parts_exports.Status, | |
| 18636 | + { | |
| 18637 | + className: clsx_default(item_popup_default9.status, className), | |
| 18638 | + ref, | |
| 18639 | + ...restProps | |
| 18640 | + } | |
| 18641 | + ); | |
| 18642 | + } | |
| 18643 | +); | |
| 18644 | + | |
| 18645 | +// packages/ui/build-module/form/primitives/autocomplete/use-filtered-items.mjs | |
| 18646 | +function useFilteredItems2() { | |
| 18647 | + return index_parts_exports.useFilteredItems(); | |
| 18648 | +} | |
| 18649 | + | |
| 18650 | +// packages/ui/build-module/form/primitives/autocomplete/value.mjs | |
| 18651 | +var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1); | |
| 18652 | +function Value(props) { | |
| 18653 | + return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(index_parts_exports.Value, { ...props }); | |
| 18654 | +} | |
| 18655 | + | |
| 18656 | +// packages/workflow/build-module/components/workflow-menu.mjs | |
| 18657 | +var import_data = __toESM(require_data(), 1); | |
| 18658 | +var import_element46 = __toESM(require_element(), 1); | |
| 18659 | +var import_i18n5 = __toESM(require_i18n(), 1); | |
| 18660 | +var import_components = __toESM(require_components(), 1); | |
| 18661 | +var import_keyboard_shortcuts = __toESM(require_keyboard_shortcuts(), 1); | |
| 18662 | +var import_keycodes = __toESM(require_keycodes(), 1); | |
| 18663 | +var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1); | |
| 18664 | +import { executeAbility, store as abilitiesStore } from "@wordpress/abilities"; | |
| 18665 | +if (typeof document !== "undefined" && (typeof process === "undefined" || true) && !document.head.querySelector("style[data-wp-hash='620127f239']")) { | |
| 18666 | + const style = document.createElement("style"); | |
| 18667 | + style.setAttribute("data-wp-hash", "620127f239"); | |
| 18668 | + 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__container{will-change:transform}.workflows-workflow-menu__container:focus{outline:none}.workflows-workflow-menu__input{margin:8px}.workflows-workflow-menu__list{max-height:376px}.workflows-workflow-menu__list-body{padding:0 8px 8px}.workflows-workflow-menu__item-label{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.workflows-workflow-menu__item mark{background:unset;color:inherit;font-weight:var(--wpds-typography-font-weight-emphasis,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:var(--wpds-typography-font-weight-emphasis,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;overflow-wrap:anywhere;padding:12px;white-space:pre-wrap}.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__empty:not(:empty),.workflows-workflow-menu__executing:not(:empty){justify-content:center;padding:8px 0 16px}")); | |
| 18669 | + document.head.appendChild(style); | |
| 18670 | +} | |
| 18671 | +var EMPTY_ARRAY2 = []; | |
| 18672 | +var inputLabel = (0, import_i18n5.__)("Run abilities and workflows"); | |
| 2597 | 18673 | function WorkflowMenu() { |
| 2598 | 18674 | const { registerShortcut } = (0, import_data.useDispatch)(import_keyboard_shortcuts.store); |
| 2599 | - const [search, setSearch] = (0, import_element2.useState)(""); | |
| 2600 | - const [isOpen, setIsOpen] = (0, import_element2.useState)(false); | |
| 2601 | - const [abilityOutput, setAbilityOutput] = (0, import_element2.useState)(null); | |
| 2602 | - const [isExecuting, setIsExecuting] = (0, import_element2.useState)(false); | |
| 2603 | - const containerRef = (0, import_element2.useRef)(); | |
| 18675 | + const [search, setSearch] = (0, import_element46.useState)(""); | |
| 18676 | + const [isOpen, setIsOpen] = (0, import_element46.useState)(false); | |
| 18677 | + const [abilityOutput, setAbilityOutput] = (0, import_element46.useState)(null); | |
| 18678 | + const [isExecuting, setIsExecuting] = (0, import_element46.useState)(false); | |
| 18679 | + const containerRef = (0, import_element46.useRef)(); | |
| 18680 | + const inputRef = (0, import_element46.useRef)(); | |
| 2604 | 18681 | const abilities = (0, import_data.useSelect)((select) => { |
| 2605 | 18682 | const allAbilities = select(abilitiesStore).getAbilities(); |
| 2606 | - return allAbilities || EMPTY_ARRAY; | |
| 18683 | + return allAbilities || EMPTY_ARRAY2; | |
| 2607 | 18684 | }, []); |
| 2608 | - const filteredAbilities = (0, import_element2.useMemo)(() => { | |
| 18685 | + const filteredAbilities = (0, import_element46.useMemo)(() => { | |
| 2609 | 18686 | if (!search) { |
| 2610 | 18687 | return abilities; |
| 2611 | 18688 | } |
| 2612 | 18689 | const searchLower = search.toLowerCase(); |
| @@ -2613,18 +18690,23 @@ | ||
| 2613 | 18690 | return abilities.filter( |
| 2614 | 18691 | (ability) => ability.label?.toLowerCase().includes(searchLower) || ability.name?.toLowerCase().includes(searchLower) |
| 2615 | 18692 | ); |
| 2616 | 18693 | }, [abilities, search]); |
| 2617 | - (0, import_element2.useEffect)(() => { | |
| 18694 | + (0, import_element46.useEffect)(() => { | |
| 2618 | 18695 | if (abilityOutput && containerRef.current) { |
| 2619 | 18696 | containerRef.current.focus(); |
| 2620 | 18697 | } |
| 2621 | 18698 | }, [abilityOutput]); |
| 2622 | - (0, import_element2.useEffect)(() => { | |
| 18699 | + (0, import_element46.useEffect)(() => { | |
| 18700 | + if (isOpen && !abilityOutput) { | |
| 18701 | + inputRef.current?.focus(); | |
| 18702 | + } | |
| 18703 | + }, [isOpen, abilityOutput]); | |
| 18704 | + (0, import_element46.useEffect)(() => { | |
| 2623 | 18705 | registerShortcut({ |
| 2624 | 18706 | name: "core/workflows", |
| 2625 | 18707 | category: "global", |
| 2626 | - description: (0, import_i18n.__)("Open the workflow palette."), | |
| 18708 | + description: (0, import_i18n5.__)("Open the workflow palette."), | |
| 2627 | 18709 | keyCombination: { |
| 2628 | 18710 | modifier: "primary", |
| 2629 | 18711 | character: "j" |
| 2630 | 18712 | } |
| @@ -2632,9 +18714,9 @@ | ||
| 2632 | 18714 | }, [registerShortcut]); |
| 2633 | 18715 | (0, import_keyboard_shortcuts.useShortcut)( |
| 2634 | 18716 | "core/workflows", |
| 2635 | 18717 | /** @type {React.KeyboardEventHandler} */ |
| 2636 | - withIgnoreIMEEvents((event) => { | |
| 18718 | + (0, import_keycodes.withIgnoreIMEEvents)((event) => { | |
| 2637 | 18719 | if (event.defaultPrevented) { |
| 2638 | 18720 | return; |
| 2639 | 18721 | } |
| 2640 | 18722 | event.preventDefault(); |
| @@ -2643,9 +18725,9 @@ | ||
| 2643 | 18725 | { |
| 2644 | 18726 | bindGlobal: true |
| 2645 | 18727 | } |
| 2646 | 18728 | ); |
| 2647 | - (0, import_element2.useEffect)(() => { | |
| 18729 | + (0, import_element46.useEffect)(() => { | |
| 2648 | 18730 | if (isOpen) { |
| 2649 | 18731 | import("@wordpress/core-abilities"); |
| 2650 | 18732 | } |
| 2651 | 18733 | }, [isOpen]); |
| @@ -2670,15 +18752,15 @@ | ||
| 2670 | 18752 | description: ability?.description || "", |
| 2671 | 18753 | success: true, |
| 2672 | 18754 | data: result |
| 2673 | 18755 | }); |
| 2674 | - } catch (error) { | |
| 18756 | + } catch (error2) { | |
| 2675 | 18757 | setAbilityOutput({ |
| 2676 | 18758 | name: ability.name, |
| 2677 | 18759 | label: ability?.label || ability.name, |
| 2678 | 18760 | description: ability?.description || "", |
| 2679 | 18761 | success: false, |
| 2680 | - error: error.message || String(error) | |
| 18762 | + error: error2.message || String(error2) | |
| 2681 | 18763 | }); |
| 2682 | 18764 | } finally { |
| 2683 | 18765 | setIsExecuting(false); |
| 2684 | 18766 | } |
| @@ -2692,9 +18774,11 @@ | ||
| 2692 | 18774 | }; |
| 2693 | 18775 | if (!isOpen) { |
| 2694 | 18776 | return null; |
| 2695 | 18777 | } |
| 2696 | - return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( | |
| 18778 | + const items = isExecuting ? EMPTY_ARRAY2 : filteredAbilities; | |
| 18779 | + const showEmpty = !isExecuting && !!search && !filteredAbilities.length; | |
| 18780 | + return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( | |
| 2697 | 18781 | import_components.Modal, |
| 2698 | 18782 | { |
| 2699 | 18783 | className: "workflows-workflow-menu", |
| 2700 | 18784 | overlayClassName: "workflows-workflow-menu__overlay", |
| @@ -2699,75 +18783,90 @@ | ||
| 2699 | 18783 | className: "workflows-workflow-menu", |
| 2700 | 18784 | overlayClassName: "workflows-workflow-menu__overlay", |
| 2701 | 18785 | onRequestClose: abilityOutput ? goBack : closeAndReset, |
| 2702 | 18786 | __experimentalHideHeader: true, |
| 2703 | - contentLabel: (0, import_i18n.__)("Workflow palette"), | |
| 2704 | - children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( | |
| 18787 | + contentLabel: (0, import_i18n5.__)("Workflow palette"), | |
| 18788 | + children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( | |
| 2705 | 18789 | "div", |
| 2706 | 18790 | { |
| 2707 | 18791 | className: "workflows-workflow-menu__container", |
| 2708 | - onKeyDown: withIgnoreIMEEvents(onContainerKeyDown), | |
| 18792 | + onKeyDown: (0, import_keycodes.withIgnoreIMEEvents)(onContainerKeyDown), | |
| 2709 | 18793 | ref: containerRef, |
| 2710 | 18794 | tabIndex: -1, |
| 2711 | 18795 | role: "presentation", |
| 2712 | - children: abilityOutput ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "workflows-workflow-menu__output", children: [ | |
| 2713 | - /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "workflows-workflow-menu__output-header", children: [ | |
| 2714 | - /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { children: abilityOutput.label }), | |
| 2715 | - abilityOutput.description && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "workflows-workflow-menu__output-hint", children: abilityOutput.description }) | |
| 18796 | + children: abilityOutput ? /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "workflows-workflow-menu__output", children: [ | |
| 18797 | + /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "workflows-workflow-menu__output-header", children: [ | |
| 18798 | + /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("h3", { children: abilityOutput.label }), | |
| 18799 | + abilityOutput.description && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "workflows-workflow-menu__output-hint", children: abilityOutput.description }) | |
| 2716 | 18800 | ] }), |
| 2717 | - /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "workflows-workflow-menu__output-content", children: abilityOutput.success ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("pre", { children: JSON.stringify( | |
| 18801 | + /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "workflows-workflow-menu__output-content", children: abilityOutput.success ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("pre", { children: JSON.stringify( | |
| 2718 | 18802 | abilityOutput.data, |
| 2719 | 18803 | null, |
| 2720 | 18804 | 2 |
| 2721 | - ) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "workflows-workflow-menu__output-error", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: abilityOutput.error }) }) }) | |
| 2722 | - ] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(_e, { label: inputLabel, shouldFilter: false, children: [ | |
| 2723 | - /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_components.__experimentalHStack, { className: "workflows-workflow-menu__header", children: [ | |
| 2724 | - /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( | |
| 2725 | - icon_default, | |
| 2726 | - { | |
| 2727 | - className: "workflows-workflow-menu__header-search-icon", | |
| 2728 | - icon: search_default | |
| 2729 | - } | |
| 2730 | - ), | |
| 2731 | - /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( | |
| 2732 | - WorkflowInput, | |
| 2733 | - { | |
| 2734 | - search, | |
| 2735 | - setSearch, | |
| 2736 | - isOpen, | |
| 2737 | - abilities | |
| 2738 | - } | |
| 2739 | - ) | |
| 2740 | - ] }), | |
| 2741 | - /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(_e.List, { label: (0, import_i18n.__)("Workflow suggestions"), children: [ | |
| 2742 | - isExecuting && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( | |
| 2743 | - import_components.__experimentalHStack, | |
| 2744 | - { | |
| 2745 | - className: "workflows-workflow-menu__executing", | |
| 2746 | - align: "center", | |
| 2747 | - children: (0, import_i18n.__)("Executing ability…") | |
| 2748 | - } | |
| 2749 | - ), | |
| 2750 | - !isExecuting && search && filteredAbilities.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(_e.Empty, { children: (0, import_i18n.__)("No results found.") }), | |
| 2751 | - !isExecuting && filteredAbilities.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(_e.Group, { children: filteredAbilities.map((ability) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( | |
| 2752 | - _e.Item, | |
| 2753 | - { | |
| 2754 | - value: ability.label, | |
| 2755 | - className: "workflows-workflow-menu__item", | |
| 2756 | - onSelect: () => handleExecuteAbility(ability), | |
| 2757 | - id: ability.name, | |
| 2758 | - children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components.__experimentalHStack, { alignment: "left", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( | |
| 2759 | - import_components.TextHighlight, | |
| 2760 | - { | |
| 2761 | - text: ability.label, | |
| 2762 | - highlight: search | |
| 2763 | - } | |
| 2764 | - ) }) }) | |
| 2765 | - }, | |
| 2766 | - ability.name | |
| 2767 | - )) }) | |
| 2768 | - ] }) | |
| 2769 | - ] }) | |
| 18805 | + ) }) : /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "workflows-workflow-menu__output-error", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { children: abilityOutput.error }) }) }) | |
| 18806 | + ] }) : /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)( | |
| 18807 | + autocomplete_exports.Root, | |
| 18808 | + { | |
| 18809 | + items: abilities, | |
| 18810 | + filteredItems: items, | |
| 18811 | + mode: "list", | |
| 18812 | + value: search, | |
| 18813 | + onValueChange: setSearch, | |
| 18814 | + open: true, | |
| 18815 | + inline: true, | |
| 18816 | + autoHighlight: true, | |
| 18817 | + children: [ | |
| 18818 | + /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( | |
| 18819 | + autocomplete_exports.Input, | |
| 18820 | + { | |
| 18821 | + ref: inputRef, | |
| 18822 | + placeholder: inputLabel, | |
| 18823 | + "aria-label": inputLabel, | |
| 18824 | + className: "workflows-workflow-menu__input", | |
| 18825 | + render: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( | |
| 18826 | + Input3, | |
| 18827 | + { | |
| 18828 | + prefix: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( | |
| 18829 | + Icon, | |
| 18830 | + { | |
| 18831 | + icon: search_default, | |
| 18832 | + style: (0, import_i18n5.isRTL)() ? void 0 : { | |
| 18833 | + transform: "scaleX(-1)" | |
| 18834 | + } | |
| 18835 | + } | |
| 18836 | + ) }) | |
| 18837 | + } | |
| 18838 | + ) | |
| 18839 | + } | |
| 18840 | + ), | |
| 18841 | + /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(autocomplete_exports.Status, { className: "workflows-workflow-menu__executing", children: isExecuting ? (0, import_i18n5.__)("Executing ability…") : null }), | |
| 18842 | + /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(autocomplete_exports.Empty, { className: "workflows-workflow-menu__empty", children: showEmpty ? (0, import_i18n5.__)("No results found.") : null }), | |
| 18843 | + /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( | |
| 18844 | + autocomplete_exports.List, | |
| 18845 | + { | |
| 18846 | + className: "workflows-workflow-menu__list", | |
| 18847 | + "aria-label": (0, import_i18n5.__)("Workflow suggestions"), | |
| 18848 | + children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(autocomplete_exports.ListBody, { className: "workflows-workflow-menu__list-body", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(autocomplete_exports.Collection, { children: (item) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( | |
| 18849 | + autocomplete_exports.Item, | |
| 18850 | + { | |
| 18851 | + value: item, | |
| 18852 | + className: "workflows-workflow-menu__item", | |
| 18853 | + onClick: () => handleExecuteAbility(item), | |
| 18854 | + children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "workflows-workflow-menu__item-label", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( | |
| 18855 | + import_components.TextHighlight, | |
| 18856 | + { | |
| 18857 | + text: item.label, | |
| 18858 | + highlight: search | |
| 18859 | + } | |
| 18860 | + ) }) | |
| 18861 | + }, | |
| 18862 | + item.name | |
| 18863 | + ) }) }) | |
| 18864 | + } | |
| 18865 | + ) | |
| 18866 | + ] | |
| 18867 | + } | |
| 18868 | + ) | |
| 2770 | 18869 | } |
| 2771 | 18870 | ) |
| 2772 | 18871 | } |
| 2773 | 18872 | ); |
| @@ -2775,6 +18874,30 @@ | ||
| 2775 | 18874 | |
| 2776 | 18875 | // packages/workflow/build-module/index.mjs |
| 2777 | 18876 | var root = document.createElement("div"); |
| 2778 | 18877 | document.body.appendChild(root); |
| 2779 | -(0, import_element3.createRoot)(root).render((0, import_element3.createElement)(WorkflowMenu)); | |
| 18878 | +(0, import_element47.createRoot)(root).render((0, import_element47.createElement)(WorkflowMenu)); | |
| 18879 | +/*! Bundled license information: | |
| 18880 | + | |
| 18881 | +use-sync-external-store/cjs/use-sync-external-store-shim.development.js: | |
| 18882 | + (** | |
| 18883 | + * @license React | |
| 18884 | + * use-sync-external-store-shim.development.js | |
| 18885 | + * | |
| 18886 | + * Copyright (c) Meta Platforms, Inc. and affiliates. | |
| 18887 | + * | |
| 18888 | + * This source code is licensed under the MIT license found in the | |
| 18889 | + * LICENSE file in the root directory of this source tree. | |
| 18890 | + *) | |
| 18891 | + | |
| 18892 | +use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js: | |
| 18893 | + (** | |
| 18894 | + * @license React | |
| 18895 | + * use-sync-external-store-shim/with-selector.development.js | |
| 18896 | + * | |
| 18897 | + * Copyright (c) Meta Platforms, Inc. and affiliates. | |
| 18898 | + * | |
| 18899 | + * This source code is licensed under the MIT license found in the | |
| 18900 | + * LICENSE file in the root directory of this source tree. | |
| 18901 | + *) | |
| 18902 | +*/ | |
| 2780 | 18903 | //# sourceMappingURL=index.js.map |