| @@ -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) |
| @@ -37,8 +41,212 @@ | ||
| 37 | 41 | module.exports = window.wp.coreData; |
| 38 | 42 | } |
| 39 | 43 | }); |
| 40 | 44 | |
| 45 | +// package-external:@wordpress/element | |
| 46 | +var require_element = __commonJS({ | |
| 47 | + "package-external:@wordpress/element"(exports, module) { | |
| 48 | + module.exports = window.wp.element; | |
| 49 | + } | |
| 50 | +}); | |
| 51 | + | |
| 52 | +// package-external:@wordpress/compose | |
| 53 | +var require_compose = __commonJS({ | |
| 54 | + "package-external:@wordpress/compose"(exports, module) { | |
| 55 | + module.exports = window.wp.compose; | |
| 56 | + } | |
| 57 | +}); | |
| 58 | + | |
| 59 | +// vendor-external:react | |
| 60 | +var require_react = __commonJS({ | |
| 61 | + "vendor-external:react"(exports, module) { | |
| 62 | + module.exports = window.React; | |
| 63 | + } | |
| 64 | +}); | |
| 65 | + | |
| 66 | +// vendor-external:react/jsx-runtime | |
| 67 | +var require_jsx_runtime = __commonJS({ | |
| 68 | + "vendor-external:react/jsx-runtime"(exports, module) { | |
| 69 | + module.exports = window.ReactJSXRuntime; | |
| 70 | + } | |
| 71 | +}); | |
| 72 | + | |
| 73 | +// vendor-external:react-dom | |
| 74 | +var require_react_dom = __commonJS({ | |
| 75 | + "vendor-external:react-dom"(exports, module) { | |
| 76 | + module.exports = window.ReactDOM; | |
| 77 | + } | |
| 78 | +}); | |
| 79 | + | |
| 80 | +// node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js | |
| 81 | +var require_use_sync_external_store_shim_development = __commonJS({ | |
| 82 | + "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) { | |
| 83 | + "use strict"; | |
| 84 | + (function() { | |
| 85 | + function is(x2, y2) { | |
| 86 | + return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2; | |
| 87 | + } | |
| 88 | + function useSyncExternalStore$2(subscribe, getSnapshot) { | |
| 89 | + didWarnOld18Alpha || void 0 === React97.startTransition || (didWarnOld18Alpha = true, console.error( | |
| 90 | + "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." | |
| 91 | + )); | |
| 92 | + var value = getSnapshot(); | |
| 93 | + if (!didWarnUncachedGetSnapshot) { | |
| 94 | + var cachedValue = getSnapshot(); | |
| 95 | + objectIs(value, cachedValue) || (console.error( | |
| 96 | + "The result of getSnapshot should be cached to avoid an infinite loop" | |
| 97 | + ), didWarnUncachedGetSnapshot = true); | |
| 98 | + } | |
| 99 | + cachedValue = useState25({ | |
| 100 | + inst: { value, getSnapshot } | |
| 101 | + }); | |
| 102 | + var inst = cachedValue[0].inst, forceUpdate = cachedValue[1]; | |
| 103 | + useLayoutEffect4( | |
| 104 | + function() { | |
| 105 | + inst.value = value; | |
| 106 | + inst.getSnapshot = getSnapshot; | |
| 107 | + checkIfSnapshotChanged(inst) && forceUpdate({ inst }); | |
| 108 | + }, | |
| 109 | + [subscribe, value, getSnapshot] | |
| 110 | + ); | |
| 111 | + useEffect22( | |
| 112 | + function() { | |
| 113 | + checkIfSnapshotChanged(inst) && forceUpdate({ inst }); | |
| 114 | + return subscribe(function() { | |
| 115 | + checkIfSnapshotChanged(inst) && forceUpdate({ inst }); | |
| 116 | + }); | |
| 117 | + }, | |
| 118 | + [subscribe] | |
| 119 | + ); | |
| 120 | + useDebugValue2(value); | |
| 121 | + return value; | |
| 122 | + } | |
| 123 | + function checkIfSnapshotChanged(inst) { | |
| 124 | + var latestGetSnapshot = inst.getSnapshot; | |
| 125 | + inst = inst.value; | |
| 126 | + try { | |
| 127 | + var nextValue = latestGetSnapshot(); | |
| 128 | + return !objectIs(inst, nextValue); | |
| 129 | + } catch (error2) { | |
| 130 | + return true; | |
| 131 | + } | |
| 132 | + } | |
| 133 | + function useSyncExternalStore$1(subscribe, getSnapshot) { | |
| 134 | + return getSnapshot(); | |
| 135 | + } | |
| 136 | + "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); | |
| 137 | + var React97 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState25 = React97.useState, useEffect22 = React97.useEffect, useLayoutEffect4 = React97.useLayoutEffect, useDebugValue2 = React97.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2; | |
| 138 | + exports.useSyncExternalStore = void 0 !== React97.useSyncExternalStore ? React97.useSyncExternalStore : shim; | |
| 139 | + "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); | |
| 140 | + })(); | |
| 141 | + } | |
| 142 | +}); | |
| 143 | + | |
| 144 | +// node_modules/use-sync-external-store/shim/index.js | |
| 145 | +var require_shim = __commonJS({ | |
| 146 | + "node_modules/use-sync-external-store/shim/index.js"(exports, module) { | |
| 147 | + "use strict"; | |
| 148 | + if (false) { | |
| 149 | + module.exports = null; | |
| 150 | + } else { | |
| 151 | + module.exports = require_use_sync_external_store_shim_development(); | |
| 152 | + } | |
| 153 | + } | |
| 154 | +}); | |
| 155 | + | |
| 156 | +// node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js | |
| 157 | +var require_with_selector_development = __commonJS({ | |
| 158 | + "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) { | |
| 159 | + "use strict"; | |
| 160 | + (function() { | |
| 161 | + function is(x2, y2) { | |
| 162 | + return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2; | |
| 163 | + } | |
| 164 | + "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); | |
| 165 | + var React97 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore3 = shim.useSyncExternalStore, useRef44 = React97.useRef, useEffect22 = React97.useEffect, useMemo31 = React97.useMemo, useDebugValue2 = React97.useDebugValue; | |
| 166 | + exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) { | |
| 167 | + var instRef = useRef44(null); | |
| 168 | + if (null === instRef.current) { | |
| 169 | + var inst = { hasValue: false, value: null }; | |
| 170 | + instRef.current = inst; | |
| 171 | + } else inst = instRef.current; | |
| 172 | + instRef = useMemo31( | |
| 173 | + function() { | |
| 174 | + function memoizedSelector(nextSnapshot) { | |
| 175 | + if (!hasMemo) { | |
| 176 | + hasMemo = true; | |
| 177 | + memoizedSnapshot = nextSnapshot; | |
| 178 | + nextSnapshot = selector(nextSnapshot); | |
| 179 | + if (void 0 !== isEqual && inst.hasValue) { | |
| 180 | + var currentSelection = inst.value; | |
| 181 | + if (isEqual(currentSelection, nextSnapshot)) | |
| 182 | + return memoizedSelection = currentSelection; | |
| 183 | + } | |
| 184 | + return memoizedSelection = nextSnapshot; | |
| 185 | + } | |
| 186 | + currentSelection = memoizedSelection; | |
| 187 | + if (objectIs(memoizedSnapshot, nextSnapshot)) | |
| 188 | + return currentSelection; | |
| 189 | + var nextSelection = selector(nextSnapshot); | |
| 190 | + if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) | |
| 191 | + return memoizedSnapshot = nextSnapshot, currentSelection; | |
| 192 | + memoizedSnapshot = nextSnapshot; | |
| 193 | + return memoizedSelection = nextSelection; | |
| 194 | + } | |
| 195 | + var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot; | |
| 196 | + return [ | |
| 197 | + function() { | |
| 198 | + return memoizedSelector(getSnapshot()); | |
| 199 | + }, | |
| 200 | + null === maybeGetServerSnapshot ? void 0 : function() { | |
| 201 | + return memoizedSelector(maybeGetServerSnapshot()); | |
| 202 | + } | |
| 203 | + ]; | |
| 204 | + }, | |
| 205 | + [getSnapshot, getServerSnapshot, selector, isEqual] | |
| 206 | + ); | |
| 207 | + var value = useSyncExternalStore3(subscribe, instRef[0], instRef[1]); | |
| 208 | + useEffect22( | |
| 209 | + function() { | |
| 210 | + inst.hasValue = true; | |
| 211 | + inst.value = value; | |
| 212 | + }, | |
| 213 | + [value] | |
| 214 | + ); | |
| 215 | + useDebugValue2(value); | |
| 216 | + return value; | |
| 217 | + }; | |
| 218 | + "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); | |
| 219 | + })(); | |
| 220 | + } | |
| 221 | +}); | |
| 222 | + | |
| 223 | +// node_modules/use-sync-external-store/shim/with-selector.js | |
| 224 | +var require_with_selector = __commonJS({ | |
| 225 | + "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) { | |
| 226 | + "use strict"; | |
| 227 | + if (false) { | |
| 228 | + module.exports = null; | |
| 229 | + } else { | |
| 230 | + module.exports = require_with_selector_development(); | |
| 231 | + } | |
| 232 | + } | |
| 233 | +}); | |
| 234 | + | |
| 235 | +// package-external:@wordpress/theme | |
| 236 | +var require_theme = __commonJS({ | |
| 237 | + "package-external:@wordpress/theme"(exports, module) { | |
| 238 | + module.exports = window.wp.theme; | |
| 239 | + } | |
| 240 | +}); | |
| 241 | + | |
| 242 | +// package-external:@wordpress/private-apis | |
| 243 | +var require_private_apis = __commonJS({ | |
| 244 | + "package-external:@wordpress/private-apis"(exports, module) { | |
| 245 | + module.exports = window.wp.privateApis; | |
| 246 | + } | |
| 247 | +}); | |
| 248 | + | |
| 41 | 249 | // package-external:@wordpress/i18n |
| 42 | 250 | var require_i18n = __commonJS({ |
| 43 | 251 | "package-external:@wordpress/i18n"(exports, module) { |
| 44 | 252 | module.exports = window.wp.i18n; |
| @@ -44,15 +252,518 @@ | ||
| 44 | 252 | module.exports = window.wp.i18n; |
| 45 | 253 | } |
| 46 | 254 | }); |
| 47 | 255 | |
| 48 | -// package-external:@wordpress/element | |
| 49 | -var require_element = __commonJS({ | |
| 50 | - "package-external:@wordpress/element"(exports, module) { | |
| 51 | - module.exports = window.wp.element; | |
| 256 | +// package-external:@wordpress/primitives | |
| 257 | +var require_primitives = __commonJS({ | |
| 258 | + "package-external:@wordpress/primitives"(exports, module) { | |
| 259 | + module.exports = window.wp.primitives; | |
| 52 | 260 | } |
| 53 | 261 | }); |
| 54 | 262 | |
| 263 | +// package-external:@wordpress/components | |
| 264 | +var require_components = __commonJS({ | |
| 265 | + "package-external:@wordpress/components"(exports, module) { | |
| 266 | + module.exports = window.wp.components; | |
| 267 | + } | |
| 268 | +}); | |
| 269 | + | |
| 270 | +// node_modules/remove-accents/index.js | |
| 271 | +var require_remove_accents = __commonJS({ | |
| 272 | + "node_modules/remove-accents/index.js"(exports, module) { | |
| 273 | + var characterMap = { | |
| 274 | + "\xC0": "A", | |
| 275 | + "\xC1": "A", | |
| 276 | + "\xC2": "A", | |
| 277 | + "\xC3": "A", | |
| 278 | + "\xC4": "A", | |
| 279 | + "\xC5": "A", | |
| 280 | + "\u1EA4": "A", | |
| 281 | + "\u1EAE": "A", | |
| 282 | + "\u1EB2": "A", | |
| 283 | + "\u1EB4": "A", | |
| 284 | + "\u1EB6": "A", | |
| 285 | + "\xC6": "AE", | |
| 286 | + "\u1EA6": "A", | |
| 287 | + "\u1EB0": "A", | |
| 288 | + "\u0202": "A", | |
| 289 | + "\u1EA2": "A", | |
| 290 | + "\u1EA0": "A", | |
| 291 | + "\u1EA8": "A", | |
| 292 | + "\u1EAA": "A", | |
| 293 | + "\u1EAC": "A", | |
| 294 | + "\xC7": "C", | |
| 295 | + "\u1E08": "C", | |
| 296 | + "\xC8": "E", | |
| 297 | + "\xC9": "E", | |
| 298 | + "\xCA": "E", | |
| 299 | + "\xCB": "E", | |
| 300 | + "\u1EBE": "E", | |
| 301 | + "\u1E16": "E", | |
| 302 | + "\u1EC0": "E", | |
| 303 | + "\u1E14": "E", | |
| 304 | + "\u1E1C": "E", | |
| 305 | + "\u0206": "E", | |
| 306 | + "\u1EBA": "E", | |
| 307 | + "\u1EBC": "E", | |
| 308 | + "\u1EB8": "E", | |
| 309 | + "\u1EC2": "E", | |
| 310 | + "\u1EC4": "E", | |
| 311 | + "\u1EC6": "E", | |
| 312 | + "\xCC": "I", | |
| 313 | + "\xCD": "I", | |
| 314 | + "\xCE": "I", | |
| 315 | + "\xCF": "I", | |
| 316 | + "\u1E2E": "I", | |
| 317 | + "\u020A": "I", | |
| 318 | + "\u1EC8": "I", | |
| 319 | + "\u1ECA": "I", | |
| 320 | + "\xD0": "D", | |
| 321 | + "\xD1": "N", | |
| 322 | + "\xD2": "O", | |
| 323 | + "\xD3": "O", | |
| 324 | + "\xD4": "O", | |
| 325 | + "\xD5": "O", | |
| 326 | + "\xD6": "O", | |
| 327 | + "\xD8": "O", | |
| 328 | + "\u1ED0": "O", | |
| 329 | + "\u1E4C": "O", | |
| 330 | + "\u1E52": "O", | |
| 331 | + "\u020E": "O", | |
| 332 | + "\u1ECE": "O", | |
| 333 | + "\u1ECC": "O", | |
| 334 | + "\u1ED4": "O", | |
| 335 | + "\u1ED6": "O", | |
| 336 | + "\u1ED8": "O", | |
| 337 | + "\u1EDC": "O", | |
| 338 | + "\u1EDE": "O", | |
| 339 | + "\u1EE0": "O", | |
| 340 | + "\u1EDA": "O", | |
| 341 | + "\u1EE2": "O", | |
| 342 | + "\xD9": "U", | |
| 343 | + "\xDA": "U", | |
| 344 | + "\xDB": "U", | |
| 345 | + "\xDC": "U", | |
| 346 | + "\u1EE6": "U", | |
| 347 | + "\u1EE4": "U", | |
| 348 | + "\u1EEC": "U", | |
| 349 | + "\u1EEE": "U", | |
| 350 | + "\u1EF0": "U", | |
| 351 | + "\xDD": "Y", | |
| 352 | + "\xE0": "a", | |
| 353 | + "\xE1": "a", | |
| 354 | + "\xE2": "a", | |
| 355 | + "\xE3": "a", | |
| 356 | + "\xE4": "a", | |
| 357 | + "\xE5": "a", | |
| 358 | + "\u1EA5": "a", | |
| 359 | + "\u1EAF": "a", | |
| 360 | + "\u1EB3": "a", | |
| 361 | + "\u1EB5": "a", | |
| 362 | + "\u1EB7": "a", | |
| 363 | + "\xE6": "ae", | |
| 364 | + "\u1EA7": "a", | |
| 365 | + "\u1EB1": "a", | |
| 366 | + "\u0203": "a", | |
| 367 | + "\u1EA3": "a", | |
| 368 | + "\u1EA1": "a", | |
| 369 | + "\u1EA9": "a", | |
| 370 | + "\u1EAB": "a", | |
| 371 | + "\u1EAD": "a", | |
| 372 | + "\xE7": "c", | |
| 373 | + "\u1E09": "c", | |
| 374 | + "\xE8": "e", | |
| 375 | + "\xE9": "e", | |
| 376 | + "\xEA": "e", | |
| 377 | + "\xEB": "e", | |
| 378 | + "\u1EBF": "e", | |
| 379 | + "\u1E17": "e", | |
| 380 | + "\u1EC1": "e", | |
| 381 | + "\u1E15": "e", | |
| 382 | + "\u1E1D": "e", | |
| 383 | + "\u0207": "e", | |
| 384 | + "\u1EBB": "e", | |
| 385 | + "\u1EBD": "e", | |
| 386 | + "\u1EB9": "e", | |
| 387 | + "\u1EC3": "e", | |
| 388 | + "\u1EC5": "e", | |
| 389 | + "\u1EC7": "e", | |
| 390 | + "\xEC": "i", | |
| 391 | + "\xED": "i", | |
| 392 | + "\xEE": "i", | |
| 393 | + "\xEF": "i", | |
| 394 | + "\u1E2F": "i", | |
| 395 | + "\u020B": "i", | |
| 396 | + "\u1EC9": "i", | |
| 397 | + "\u1ECB": "i", | |
| 398 | + "\xF0": "d", | |
| 399 | + "\xF1": "n", | |
| 400 | + "\xF2": "o", | |
| 401 | + "\xF3": "o", | |
| 402 | + "\xF4": "o", | |
| 403 | + "\xF5": "o", | |
| 404 | + "\xF6": "o", | |
| 405 | + "\xF8": "o", | |
| 406 | + "\u1ED1": "o", | |
| 407 | + "\u1E4D": "o", | |
| 408 | + "\u1E53": "o", | |
| 409 | + "\u020F": "o", | |
| 410 | + "\u1ECF": "o", | |
| 411 | + "\u1ECD": "o", | |
| 412 | + "\u1ED5": "o", | |
| 413 | + "\u1ED7": "o", | |
| 414 | + "\u1ED9": "o", | |
| 415 | + "\u1EDD": "o", | |
| 416 | + "\u1EDF": "o", | |
| 417 | + "\u1EE1": "o", | |
| 418 | + "\u1EDB": "o", | |
| 419 | + "\u1EE3": "o", | |
| 420 | + "\xF9": "u", | |
| 421 | + "\xFA": "u", | |
| 422 | + "\xFB": "u", | |
| 423 | + "\xFC": "u", | |
| 424 | + "\u1EE7": "u", | |
| 425 | + "\u1EE5": "u", | |
| 426 | + "\u1EED": "u", | |
| 427 | + "\u1EEF": "u", | |
| 428 | + "\u1EF1": "u", | |
| 429 | + "\xFD": "y", | |
| 430 | + "\xFF": "y", | |
| 431 | + "\u0100": "A", | |
| 432 | + "\u0101": "a", | |
| 433 | + "\u0102": "A", | |
| 434 | + "\u0103": "a", | |
| 435 | + "\u0104": "A", | |
| 436 | + "\u0105": "a", | |
| 437 | + "\u0106": "C", | |
| 438 | + "\u0107": "c", | |
| 439 | + "\u0108": "C", | |
| 440 | + "\u0109": "c", | |
| 441 | + "\u010A": "C", | |
| 442 | + "\u010B": "c", | |
| 443 | + "\u010C": "C", | |
| 444 | + "\u010D": "c", | |
| 445 | + "C\u0306": "C", | |
| 446 | + "c\u0306": "c", | |
| 447 | + "\u010E": "D", | |
| 448 | + "\u010F": "d", | |
| 449 | + "\u0110": "D", | |
| 450 | + "\u0111": "d", | |
| 451 | + "\u0112": "E", | |
| 452 | + "\u0113": "e", | |
| 453 | + "\u0114": "E", | |
| 454 | + "\u0115": "e", | |
| 455 | + "\u0116": "E", | |
| 456 | + "\u0117": "e", | |
| 457 | + "\u0118": "E", | |
| 458 | + "\u0119": "e", | |
| 459 | + "\u011A": "E", | |
| 460 | + "\u011B": "e", | |
| 461 | + "\u011C": "G", | |
| 462 | + "\u01F4": "G", | |
| 463 | + "\u011D": "g", | |
| 464 | + "\u01F5": "g", | |
| 465 | + "\u011E": "G", | |
| 466 | + "\u011F": "g", | |
| 467 | + "\u0120": "G", | |
| 468 | + "\u0121": "g", | |
| 469 | + "\u0122": "G", | |
| 470 | + "\u0123": "g", | |
| 471 | + "\u0124": "H", | |
| 472 | + "\u0125": "h", | |
| 473 | + "\u0126": "H", | |
| 474 | + "\u0127": "h", | |
| 475 | + "\u1E2A": "H", | |
| 476 | + "\u1E2B": "h", | |
| 477 | + "\u0128": "I", | |
| 478 | + "\u0129": "i", | |
| 479 | + "\u012A": "I", | |
| 480 | + "\u012B": "i", | |
| 481 | + "\u012C": "I", | |
| 482 | + "\u012D": "i", | |
| 483 | + "\u012E": "I", | |
| 484 | + "\u012F": "i", | |
| 485 | + "\u0130": "I", | |
| 486 | + "\u0131": "i", | |
| 487 | + "\u0132": "IJ", | |
| 488 | + "\u0133": "ij", | |
| 489 | + "\u0134": "J", | |
| 490 | + "\u0135": "j", | |
| 491 | + "\u0136": "K", | |
| 492 | + "\u0137": "k", | |
| 493 | + "\u1E30": "K", | |
| 494 | + "\u1E31": "k", | |
| 495 | + "K\u0306": "K", | |
| 496 | + "k\u0306": "k", | |
| 497 | + "\u0139": "L", | |
| 498 | + "\u013A": "l", | |
| 499 | + "\u013B": "L", | |
| 500 | + "\u013C": "l", | |
| 501 | + "\u013D": "L", | |
| 502 | + "\u013E": "l", | |
| 503 | + "\u013F": "L", | |
| 504 | + "\u0140": "l", | |
| 505 | + "\u0141": "l", | |
| 506 | + "\u0142": "l", | |
| 507 | + "\u1E3E": "M", | |
| 508 | + "\u1E3F": "m", | |
| 509 | + "M\u0306": "M", | |
| 510 | + "m\u0306": "m", | |
| 511 | + "\u0143": "N", | |
| 512 | + "\u0144": "n", | |
| 513 | + "\u0145": "N", | |
| 514 | + "\u0146": "n", | |
| 515 | + "\u0147": "N", | |
| 516 | + "\u0148": "n", | |
| 517 | + "\u0149": "n", | |
| 518 | + "N\u0306": "N", | |
| 519 | + "n\u0306": "n", | |
| 520 | + "\u014C": "O", | |
| 521 | + "\u014D": "o", | |
| 522 | + "\u014E": "O", | |
| 523 | + "\u014F": "o", | |
| 524 | + "\u0150": "O", | |
| 525 | + "\u0151": "o", | |
| 526 | + "\u0152": "OE", | |
| 527 | + "\u0153": "oe", | |
| 528 | + "P\u0306": "P", | |
| 529 | + "p\u0306": "p", | |
| 530 | + "\u0154": "R", | |
| 531 | + "\u0155": "r", | |
| 532 | + "\u0156": "R", | |
| 533 | + "\u0157": "r", | |
| 534 | + "\u0158": "R", | |
| 535 | + "\u0159": "r", | |
| 536 | + "R\u0306": "R", | |
| 537 | + "r\u0306": "r", | |
| 538 | + "\u0212": "R", | |
| 539 | + "\u0213": "r", | |
| 540 | + "\u015A": "S", | |
| 541 | + "\u015B": "s", | |
| 542 | + "\u015C": "S", | |
| 543 | + "\u015D": "s", | |
| 544 | + "\u015E": "S", | |
| 545 | + "\u0218": "S", | |
| 546 | + "\u0219": "s", | |
| 547 | + "\u015F": "s", | |
| 548 | + "\u0160": "S", | |
| 549 | + "\u0161": "s", | |
| 550 | + "\u0162": "T", | |
| 551 | + "\u0163": "t", | |
| 552 | + "\u021B": "t", | |
| 553 | + "\u021A": "T", | |
| 554 | + "\u0164": "T", | |
| 555 | + "\u0165": "t", | |
| 556 | + "\u0166": "T", | |
| 557 | + "\u0167": "t", | |
| 558 | + "T\u0306": "T", | |
| 559 | + "t\u0306": "t", | |
| 560 | + "\u0168": "U", | |
| 561 | + "\u0169": "u", | |
| 562 | + "\u016A": "U", | |
| 563 | + "\u016B": "u", | |
| 564 | + "\u016C": "U", | |
| 565 | + "\u016D": "u", | |
| 566 | + "\u016E": "U", | |
| 567 | + "\u016F": "u", | |
| 568 | + "\u0170": "U", | |
| 569 | + "\u0171": "u", | |
| 570 | + "\u0172": "U", | |
| 571 | + "\u0173": "u", | |
| 572 | + "\u0216": "U", | |
| 573 | + "\u0217": "u", | |
| 574 | + "V\u0306": "V", | |
| 575 | + "v\u0306": "v", | |
| 576 | + "\u0174": "W", | |
| 577 | + "\u0175": "w", | |
| 578 | + "\u1E82": "W", | |
| 579 | + "\u1E83": "w", | |
| 580 | + "X\u0306": "X", | |
| 581 | + "x\u0306": "x", | |
| 582 | + "\u0176": "Y", | |
| 583 | + "\u0177": "y", | |
| 584 | + "\u0178": "Y", | |
| 585 | + "Y\u0306": "Y", | |
| 586 | + "y\u0306": "y", | |
| 587 | + "\u0179": "Z", | |
| 588 | + "\u017A": "z", | |
| 589 | + "\u017B": "Z", | |
| 590 | + "\u017C": "z", | |
| 591 | + "\u017D": "Z", | |
| 592 | + "\u017E": "z", | |
| 593 | + "\u017F": "s", | |
| 594 | + "\u0192": "f", | |
| 595 | + "\u01A0": "O", | |
| 596 | + "\u01A1": "o", | |
| 597 | + "\u01AF": "U", | |
| 598 | + "\u01B0": "u", | |
| 599 | + "\u01CD": "A", | |
| 600 | + "\u01CE": "a", | |
| 601 | + "\u01CF": "I", | |
| 602 | + "\u01D0": "i", | |
| 603 | + "\u01D1": "O", | |
| 604 | + "\u01D2": "o", | |
| 605 | + "\u01D3": "U", | |
| 606 | + "\u01D4": "u", | |
| 607 | + "\u01D5": "U", | |
| 608 | + "\u01D6": "u", | |
| 609 | + "\u01D7": "U", | |
| 610 | + "\u01D8": "u", | |
| 611 | + "\u01D9": "U", | |
| 612 | + "\u01DA": "u", | |
| 613 | + "\u01DB": "U", | |
| 614 | + "\u01DC": "u", | |
| 615 | + "\u1EE8": "U", | |
| 616 | + "\u1EE9": "u", | |
| 617 | + "\u1E78": "U", | |
| 618 | + "\u1E79": "u", | |
| 619 | + "\u01FA": "A", | |
| 620 | + "\u01FB": "a", | |
| 621 | + "\u01FC": "AE", | |
| 622 | + "\u01FD": "ae", | |
| 623 | + "\u01FE": "O", | |
| 624 | + "\u01FF": "o", | |
| 625 | + "\xDE": "TH", | |
| 626 | + "\xFE": "th", | |
| 627 | + "\u1E54": "P", | |
| 628 | + "\u1E55": "p", | |
| 629 | + "\u1E64": "S", | |
| 630 | + "\u1E65": "s", | |
| 631 | + "X\u0301": "X", | |
| 632 | + "x\u0301": "x", | |
| 633 | + "\u0403": "\u0413", | |
| 634 | + "\u0453": "\u0433", | |
| 635 | + "\u040C": "\u041A", | |
| 636 | + "\u045C": "\u043A", | |
| 637 | + "A\u030B": "A", | |
| 638 | + "a\u030B": "a", | |
| 639 | + "E\u030B": "E", | |
| 640 | + "e\u030B": "e", | |
| 641 | + "I\u030B": "I", | |
| 642 | + "i\u030B": "i", | |
| 643 | + "\u01F8": "N", | |
| 644 | + "\u01F9": "n", | |
| 645 | + "\u1ED2": "O", | |
| 646 | + "\u1ED3": "o", | |
| 647 | + "\u1E50": "O", | |
| 648 | + "\u1E51": "o", | |
| 649 | + "\u1EEA": "U", | |
| 650 | + "\u1EEB": "u", | |
| 651 | + "\u1E80": "W", | |
| 652 | + "\u1E81": "w", | |
| 653 | + "\u1EF2": "Y", | |
| 654 | + "\u1EF3": "y", | |
| 655 | + "\u0200": "A", | |
| 656 | + "\u0201": "a", | |
| 657 | + "\u0204": "E", | |
| 658 | + "\u0205": "e", | |
| 659 | + "\u0208": "I", | |
| 660 | + "\u0209": "i", | |
| 661 | + "\u020C": "O", | |
| 662 | + "\u020D": "o", | |
| 663 | + "\u0210": "R", | |
| 664 | + "\u0211": "r", | |
| 665 | + "\u0214": "U", | |
| 666 | + "\u0215": "u", | |
| 667 | + "B\u030C": "B", | |
| 668 | + "b\u030C": "b", | |
| 669 | + "\u010C\u0323": "C", | |
| 670 | + "\u010D\u0323": "c", | |
| 671 | + "\xCA\u030C": "E", | |
| 672 | + "\xEA\u030C": "e", | |
| 673 | + "F\u030C": "F", | |
| 674 | + "f\u030C": "f", | |
| 675 | + "\u01E6": "G", | |
| 676 | + "\u01E7": "g", | |
| 677 | + "\u021E": "H", | |
| 678 | + "\u021F": "h", | |
| 679 | + "J\u030C": "J", | |
| 680 | + "\u01F0": "j", | |
| 681 | + "\u01E8": "K", | |
| 682 | + "\u01E9": "k", | |
| 683 | + "M\u030C": "M", | |
| 684 | + "m\u030C": "m", | |
| 685 | + "P\u030C": "P", | |
| 686 | + "p\u030C": "p", | |
| 687 | + "Q\u030C": "Q", | |
| 688 | + "q\u030C": "q", | |
| 689 | + "\u0158\u0329": "R", | |
| 690 | + "\u0159\u0329": "r", | |
| 691 | + "\u1E66": "S", | |
| 692 | + "\u1E67": "s", | |
| 693 | + "V\u030C": "V", | |
| 694 | + "v\u030C": "v", | |
| 695 | + "W\u030C": "W", | |
| 696 | + "w\u030C": "w", | |
| 697 | + "X\u030C": "X", | |
| 698 | + "x\u030C": "x", | |
| 699 | + "Y\u030C": "Y", | |
| 700 | + "y\u030C": "y", | |
| 701 | + "A\u0327": "A", | |
| 702 | + "a\u0327": "a", | |
| 703 | + "B\u0327": "B", | |
| 704 | + "b\u0327": "b", | |
| 705 | + "\u1E10": "D", | |
| 706 | + "\u1E11": "d", | |
| 707 | + "\u0228": "E", | |
| 708 | + "\u0229": "e", | |
| 709 | + "\u0190\u0327": "E", | |
| 710 | + "\u025B\u0327": "e", | |
| 711 | + "\u1E28": "H", | |
| 712 | + "\u1E29": "h", | |
| 713 | + "I\u0327": "I", | |
| 714 | + "i\u0327": "i", | |
| 715 | + "\u0197\u0327": "I", | |
| 716 | + "\u0268\u0327": "i", | |
| 717 | + "M\u0327": "M", | |
| 718 | + "m\u0327": "m", | |
| 719 | + "O\u0327": "O", | |
| 720 | + "o\u0327": "o", | |
| 721 | + "Q\u0327": "Q", | |
| 722 | + "q\u0327": "q", | |
| 723 | + "U\u0327": "U", | |
| 724 | + "u\u0327": "u", | |
| 725 | + "X\u0327": "X", | |
| 726 | + "x\u0327": "x", | |
| 727 | + "Z\u0327": "Z", | |
| 728 | + "z\u0327": "z", | |
| 729 | + "\u0439": "\u0438", | |
| 730 | + "\u0419": "\u0418", | |
| 731 | + "\u0451": "\u0435", | |
| 732 | + "\u0401": "\u0415" | |
| 733 | + }; | |
| 734 | + var chars = Object.keys(characterMap).join("|"); | |
| 735 | + var allAccents = new RegExp(chars, "g"); | |
| 736 | + var firstAccent = new RegExp(chars, ""); | |
| 737 | + function matcher(match2) { | |
| 738 | + return characterMap[match2]; | |
| 739 | + } | |
| 740 | + var removeAccents2 = function(string) { | |
| 741 | + return string.replace(allAccents, matcher); | |
| 742 | + }; | |
| 743 | + var hasAccents = function(string) { | |
| 744 | + return !!string.match(firstAccent); | |
| 745 | + }; | |
| 746 | + module.exports = removeAccents2; | |
| 747 | + module.exports.has = hasAccents; | |
| 748 | + module.exports.remove = removeAccents2; | |
| 749 | + } | |
| 750 | +}); | |
| 751 | + | |
| 752 | +// package-external:@wordpress/date | |
| 753 | +var require_date = __commonJS({ | |
| 754 | + "package-external:@wordpress/date"(exports, module) { | |
| 755 | + module.exports = window.wp.date; | |
| 756 | + } | |
| 757 | +}); | |
| 758 | + | |
| 759 | +// package-external:@wordpress/deprecated | |
| 760 | +var require_deprecated = __commonJS({ | |
| 761 | + "package-external:@wordpress/deprecated"(exports, module) { | |
| 762 | + module.exports = window.wp.deprecated; | |
| 763 | + } | |
| 764 | +}); | |
| 765 | + | |
| 55 | 766 | // package-external:@wordpress/preferences |
| 56 | 767 | var require_preferences = __commonJS({ |
| 57 | 768 | "package-external:@wordpress/preferences"(exports, module) { |
| 58 | 769 | module.exports = window.wp.preferences; |
| @@ -58,200 +769,24791 @@ | ||
| 58 | 769 | module.exports = window.wp.preferences; |
| 59 | 770 | } |
| 60 | 771 | }); |
| 61 | 772 | |
| 62 | -// package-external:@wordpress/private-apis | |
| 63 | -var require_private_apis = __commonJS({ | |
| 64 | - "package-external:@wordpress/private-apis"(exports, module) { | |
| 65 | - module.exports = window.wp.privateApis; | |
| 773 | +// package-external:@wordpress/editor | |
| 774 | +var require_editor = __commonJS({ | |
| 775 | + "package-external:@wordpress/editor"(exports, module) { | |
| 776 | + module.exports = window.wp.editor; | |
| 66 | 777 | } |
| 67 | 778 | }); |
| 68 | 779 | |
| 69 | 780 | // routes/template-list/route.ts |
| 70 | -var import_data4 = __toESM(require_data()); | |
| 71 | -var import_core_data2 = __toESM(require_core_data()); | |
| 72 | -var import_i18n = __toESM(require_i18n()); | |
| 781 | +var import_data5 = __toESM(require_data()); | |
| 782 | +var import_core_data3 = __toESM(require_core_data()); | |
| 73 | 783 | |
| 74 | -// packages/views/build-module/use-view.mjs | |
| 75 | -var import_element = __toESM(require_element(), 1); | |
| 76 | -var import_data = __toESM(require_data(), 1); | |
| 77 | -var import_preferences = __toESM(require_preferences(), 1); | |
| 784 | +// node_modules/clsx/dist/clsx.mjs | |
| 785 | +function r(e) { | |
| 786 | + var t, f, n = ""; | |
| 787 | + if ("string" == typeof e || "number" == typeof e) n += e; | |
| 788 | + else if ("object" == typeof e) if (Array.isArray(e)) { | |
| 789 | + var o = e.length; | |
| 790 | + for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); | |
| 791 | + } else for (f in e) e[f] && (n && (n += " "), n += f); | |
| 792 | + return n; | |
| 793 | +} | |
| 794 | +function clsx() { | |
| 795 | + for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); | |
| 796 | + return n; | |
| 797 | +} | |
| 798 | +var clsx_default = clsx; | |
| 78 | 799 | |
| 79 | -// packages/views/build-module/preference-keys.mjs | |
| 80 | -function generatePreferenceKey(kind, name, slug) { | |
| 81 | - return `dataviews-${kind}-${name}-${slug}`; | |
| 800 | +// node_modules/@base-ui/utils/useControlled.mjs | |
| 801 | +var React = __toESM(require_react(), 1); | |
| 802 | + | |
| 803 | +// node_modules/@base-ui/utils/createLogOnce.mjs | |
| 804 | +var loggedMessages; | |
| 805 | +if (true) { | |
| 806 | + loggedMessages = /* @__PURE__ */ new Set(); | |
| 82 | 807 | } |
| 808 | +function createLogOnce(severity, prefix) { | |
| 809 | + return function logOnce(...messages) { | |
| 810 | + if (true) { | |
| 811 | + const message2 = messages.join(" "); | |
| 812 | + const output = prefix ? `${prefix}: ${message2}` : message2; | |
| 813 | + const key = `${severity}:${output}`; | |
| 814 | + if (!loggedMessages.has(key)) { | |
| 815 | + loggedMessages.add(key); | |
| 816 | + if (severity === "warn") { | |
| 817 | + console.warn(output); | |
| 818 | + } else { | |
| 819 | + console.error(output); | |
| 820 | + } | |
| 821 | + } | |
| 822 | + } | |
| 823 | + }; | |
| 824 | +} | |
| 83 | 825 | |
| 84 | -// packages/views/build-module/filter-utils.mjs | |
| 85 | -var SCALAR_VALUES = [ | |
| 86 | - "titleField", | |
| 87 | - "mediaField", | |
| 88 | - "descriptionField", | |
| 89 | - "showTitle", | |
| 90 | - "showMedia", | |
| 91 | - "showDescription", | |
| 92 | - "showLevels", | |
| 93 | - "infiniteScrollEnabled" | |
| 94 | -]; | |
| 95 | -function mergeActiveViewOverrides(view, activeViewOverrides, defaultView) { | |
| 96 | - if (!activeViewOverrides) { | |
| 97 | - return view; | |
| 826 | +// node_modules/@base-ui/utils/error.mjs | |
| 827 | +var error = createLogOnce("error", "Base UI"); | |
| 828 | + | |
| 829 | +// node_modules/@base-ui/utils/useControlled.mjs | |
| 830 | +function useControlled({ | |
| 831 | + controlled, | |
| 832 | + default: defaultProp, | |
| 833 | + name, | |
| 834 | + state = "value" | |
| 835 | +}) { | |
| 836 | + const { | |
| 837 | + current: isControlled | |
| 838 | + } = React.useRef(controlled !== void 0); | |
| 839 | + const [valueState, setValue] = React.useState(defaultProp); | |
| 840 | + const value = isControlled && controlled !== void 0 ? controlled : valueState; | |
| 841 | + if (true) { | |
| 842 | + React.useEffect(() => { | |
| 843 | + if (isControlled !== (controlled !== void 0)) { | |
| 844 | + 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")); | |
| 845 | + } | |
| 846 | + }, [state, name, controlled]); | |
| 847 | + const { | |
| 848 | + current: defaultValue | |
| 849 | + } = React.useRef(defaultProp); | |
| 850 | + React.useEffect(() => { | |
| 851 | + if (!isControlled && serializeToDevModeString(defaultValue) !== serializeToDevModeString(defaultProp)) { | |
| 852 | + 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")); | |
| 853 | + } | |
| 854 | + }, [defaultProp]); | |
| 98 | 855 | } |
| 99 | - let result = view; | |
| 100 | - for (const key of SCALAR_VALUES) { | |
| 101 | - if (key in activeViewOverrides) { | |
| 102 | - result = { ...result, [key]: activeViewOverrides[key] }; | |
| 856 | + const setValueIfUncontrolled = React.useCallback((newValue) => { | |
| 857 | + if (!isControlled) { | |
| 858 | + setValue(newValue); | |
| 103 | 859 | } |
| 860 | + }, []); | |
| 861 | + return [value, setValueIfUncontrolled]; | |
| 862 | +} | |
| 863 | +function serializeToDevModeString(input) { | |
| 864 | + let nextId = 0; | |
| 865 | + const seen = /* @__PURE__ */ new WeakMap(); | |
| 866 | + try { | |
| 867 | + const result = JSON.stringify(input, function replacer(key, value) { | |
| 868 | + if (key === "_owner" && this != null && typeof this === "object" && "$$typeof" in this) { | |
| 869 | + return void 0; | |
| 870 | + } | |
| 871 | + if (typeof value === "bigint") { | |
| 872 | + return `__bigint__:${value}`; | |
| 873 | + } | |
| 874 | + if (value !== null && typeof value === "object") { | |
| 875 | + const id = seen.get(value); | |
| 876 | + if (id !== void 0) { | |
| 877 | + return `__object__:${id}`; | |
| 878 | + } | |
| 879 | + seen.set(value, nextId); | |
| 880 | + nextId += 1; | |
| 881 | + } | |
| 882 | + return value; | |
| 883 | + }); | |
| 884 | + return result ?? `__top__:${typeof input}`; | |
| 885 | + } catch { | |
| 886 | + return "__unserializable__"; | |
| 104 | 887 | } |
| 105 | - if (activeViewOverrides.filters && activeViewOverrides.filters.length > 0) { | |
| 106 | - const activeFields = new Set( | |
| 107 | - activeViewOverrides.filters.map((f) => f.field) | |
| 888 | +} | |
| 889 | + | |
| 890 | +// node_modules/@base-ui/utils/safeReact.mjs | |
| 891 | +var React2 = __toESM(require_react(), 1); | |
| 892 | +var SafeReact = { | |
| 893 | + ...React2 | |
| 894 | +}; | |
| 895 | + | |
| 896 | +// node_modules/@base-ui/utils/useRefWithInit.mjs | |
| 897 | +var React3 = __toESM(require_react(), 1); | |
| 898 | +var UNINITIALIZED = {}; | |
| 899 | +function useRefWithInit(init, initArg) { | |
| 900 | + const ref = React3.useRef(UNINITIALIZED); | |
| 901 | + if (ref.current === UNINITIALIZED) { | |
| 902 | + ref.current = init(initArg); | |
| 903 | + } | |
| 904 | + return ref; | |
| 905 | +} | |
| 906 | + | |
| 907 | +// node_modules/@base-ui/utils/useStableCallback.mjs | |
| 908 | +var useInsertionEffect = SafeReact.useInsertionEffect; | |
| 909 | +var useSafeInsertionEffect = ( | |
| 910 | + // React 17 doesn't have useInsertionEffect. | |
| 911 | + useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late. | |
| 912 | + useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn() | |
| 913 | +); | |
| 914 | +function useStableCallback(callback) { | |
| 915 | + const stable = useRefWithInit(createStableCallback).current; | |
| 916 | + stable.next = callback; | |
| 917 | + useSafeInsertionEffect(stable.effect); | |
| 918 | + return stable.trampoline; | |
| 919 | +} | |
| 920 | +function createStableCallback() { | |
| 921 | + const stable = { | |
| 922 | + next: void 0, | |
| 923 | + callback: assertNotCalled, | |
| 924 | + trampoline: (...args) => stable.callback?.(...args), | |
| 925 | + effect: () => { | |
| 926 | + stable.callback = stable.next; | |
| 927 | + } | |
| 928 | + }; | |
| 929 | + return stable; | |
| 930 | +} | |
| 931 | +function assertNotCalled() { | |
| 932 | + if (true) { | |
| 933 | + throw ( | |
| 934 | + /* minify-error-disabled */ | |
| 935 | + new Error("Base UI: Cannot call an event handler while rendering.") | |
| 108 | 936 | ); |
| 109 | - const preserved = (view.filters ?? []).filter( | |
| 110 | - (f) => !activeFields.has(f.field) | |
| 111 | - ); | |
| 112 | - result = { | |
| 113 | - ...result, | |
| 114 | - filters: [...preserved, ...activeViewOverrides.filters] | |
| 937 | + } | |
| 938 | +} | |
| 939 | + | |
| 940 | +// node_modules/@base-ui/utils/warn.mjs | |
| 941 | +var warn = createLogOnce("warn", "Base UI"); | |
| 942 | + | |
| 943 | +// node_modules/@base-ui/utils/empty.mjs | |
| 944 | +function NOOP() { | |
| 945 | +} | |
| 946 | +var EMPTY_ARRAY = Object.freeze([]); | |
| 947 | +var EMPTY_OBJECT = Object.freeze({}); | |
| 948 | + | |
| 949 | +// node_modules/@base-ui/utils/useIsoLayoutEffect.mjs | |
| 950 | +var React4 = __toESM(require_react(), 1); | |
| 951 | +var noop = () => { | |
| 952 | +}; | |
| 953 | +var useIsoLayoutEffect = typeof document !== "undefined" ? React4.useLayoutEffect : noop; | |
| 954 | + | |
| 955 | +// node_modules/@base-ui/react/internals/useRenderElement.mjs | |
| 956 | +var React7 = __toESM(require_react(), 1); | |
| 957 | + | |
| 958 | +// node_modules/@base-ui/utils/useMergedRefs.mjs | |
| 959 | +function useMergedRefs(a, b, c2, d) { | |
| 960 | + const forkRef = useRefWithInit(createForkRef).current; | |
| 961 | + if (didChange(forkRef, a, b, c2, d)) { | |
| 962 | + update(forkRef, [a, b, c2, d]); | |
| 963 | + } | |
| 964 | + return forkRef.callback; | |
| 965 | +} | |
| 966 | +function useMergedRefsN(refs) { | |
| 967 | + const forkRef = useRefWithInit(createForkRef).current; | |
| 968 | + if (didChangeN(forkRef, refs)) { | |
| 969 | + update(forkRef, refs); | |
| 970 | + } | |
| 971 | + return forkRef.callback; | |
| 972 | +} | |
| 973 | +function createForkRef() { | |
| 974 | + return { | |
| 975 | + callback: null, | |
| 976 | + cleanup: null, | |
| 977 | + refs: [] | |
| 978 | + }; | |
| 979 | +} | |
| 980 | +function didChange(forkRef, a, b, c2, d) { | |
| 981 | + return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c2 || forkRef.refs[3] !== d; | |
| 982 | +} | |
| 983 | +function didChangeN(forkRef, newRefs) { | |
| 984 | + return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]); | |
| 985 | +} | |
| 986 | +function update(forkRef, refs) { | |
| 987 | + forkRef.refs = refs; | |
| 988 | + if (refs.every((ref) => ref == null)) { | |
| 989 | + forkRef.callback = null; | |
| 990 | + return; | |
| 991 | + } | |
| 992 | + forkRef.callback = (instance) => { | |
| 993 | + if (forkRef.cleanup) { | |
| 994 | + forkRef.cleanup(); | |
| 995 | + forkRef.cleanup = null; | |
| 996 | + } | |
| 997 | + if (instance != null) { | |
| 998 | + const cleanupCallbacks = Array(refs.length).fill(null); | |
| 999 | + for (let i = 0; i < refs.length; i += 1) { | |
| 1000 | + const ref = refs[i]; | |
| 1001 | + if (ref == null) { | |
| 1002 | + continue; | |
| 1003 | + } | |
| 1004 | + switch (typeof ref) { | |
| 1005 | + case "function": { | |
| 1006 | + const refCleanup = ref(instance); | |
| 1007 | + if (typeof refCleanup === "function") { | |
| 1008 | + cleanupCallbacks[i] = refCleanup; | |
| 1009 | + } | |
| 1010 | + break; | |
| 1011 | + } | |
| 1012 | + case "object": { | |
| 1013 | + ref.current = instance; | |
| 1014 | + break; | |
| 1015 | + } | |
| 1016 | + default: | |
| 1017 | + } | |
| 1018 | + } | |
| 1019 | + forkRef.cleanup = () => { | |
| 1020 | + for (let i = 0; i < refs.length; i += 1) { | |
| 1021 | + const ref = refs[i]; | |
| 1022 | + if (ref == null) { | |
| 1023 | + continue; | |
| 1024 | + } | |
| 1025 | + switch (typeof ref) { | |
| 1026 | + case "function": { | |
| 1027 | + const cleanupCallback = cleanupCallbacks[i]; | |
| 1028 | + if (typeof cleanupCallback === "function") { | |
| 1029 | + cleanupCallback(); | |
| 1030 | + } else { | |
| 1031 | + void ref(null); | |
| 1032 | + } | |
| 1033 | + break; | |
| 1034 | + } | |
| 1035 | + case "object": { | |
| 1036 | + ref.current = null; | |
| 1037 | + break; | |
| 1038 | + } | |
| 1039 | + default: | |
| 1040 | + } | |
| 1041 | + } | |
| 1042 | + }; | |
| 1043 | + } | |
| 1044 | + }; | |
| 1045 | +} | |
| 1046 | + | |
| 1047 | +// node_modules/@base-ui/utils/getReactElementRef.mjs | |
| 1048 | +var React6 = __toESM(require_react(), 1); | |
| 1049 | + | |
| 1050 | +// node_modules/@base-ui/utils/reactVersion.mjs | |
| 1051 | +var React5 = __toESM(require_react(), 1); | |
| 1052 | +var majorVersion = parseInt(React5.version, 10); | |
| 1053 | +function isReactVersionAtLeast(reactVersionToCheck) { | |
| 1054 | + return majorVersion >= reactVersionToCheck; | |
| 1055 | +} | |
| 1056 | + | |
| 1057 | +// node_modules/@base-ui/utils/getReactElementRef.mjs | |
| 1058 | +function getReactElementRef(element) { | |
| 1059 | + if (!/* @__PURE__ */ React6.isValidElement(element)) { | |
| 1060 | + return null; | |
| 1061 | + } | |
| 1062 | + const reactElement = element; | |
| 1063 | + const propsWithRef = reactElement.props; | |
| 1064 | + return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; | |
| 1065 | +} | |
| 1066 | + | |
| 1067 | +// node_modules/@base-ui/utils/mergeObjects.mjs | |
| 1068 | +function mergeObjects(a, b) { | |
| 1069 | + if (a && !b) { | |
| 1070 | + return a; | |
| 1071 | + } | |
| 1072 | + if (!a && b) { | |
| 1073 | + return b; | |
| 1074 | + } | |
| 1075 | + if (a || b) { | |
| 1076 | + return { | |
| 1077 | + ...a, | |
| 1078 | + ...b | |
| 115 | 1079 | }; |
| 116 | 1080 | } |
| 117 | - if (activeViewOverrides.sort) { | |
| 118 | - const isDefaultSort = defaultView && view.sort?.field === defaultView.sort?.field && view.sort?.direction === defaultView.sort?.direction; | |
| 119 | - if (isDefaultSort) { | |
| 120 | - result = { | |
| 121 | - ...result, | |
| 122 | - sort: activeViewOverrides.sort | |
| 1081 | + return void 0; | |
| 1082 | +} | |
| 1083 | + | |
| 1084 | +// node_modules/@base-ui/react/internals/getStateAttributesProps.mjs | |
| 1085 | +function getStateAttributesProps(state, customMapping) { | |
| 1086 | + const props = {}; | |
| 1087 | + for (const key in state) { | |
| 1088 | + const value = state[key]; | |
| 1089 | + if (customMapping?.hasOwnProperty(key)) { | |
| 1090 | + const customProps = customMapping[key](value); | |
| 1091 | + if (customProps != null) { | |
| 1092 | + Object.assign(props, customProps); | |
| 1093 | + } | |
| 1094 | + continue; | |
| 1095 | + } | |
| 1096 | + if (value === true) { | |
| 1097 | + props[`data-${key.toLowerCase()}`] = ""; | |
| 1098 | + } else if (value) { | |
| 1099 | + props[`data-${key.toLowerCase()}`] = value.toString(); | |
| 1100 | + } | |
| 1101 | + } | |
| 1102 | + return props; | |
| 1103 | +} | |
| 1104 | + | |
| 1105 | +// node_modules/@base-ui/react/utils/resolveClassName.mjs | |
| 1106 | +function resolveClassName(className, state) { | |
| 1107 | + return typeof className === "function" ? className(state) : className; | |
| 1108 | +} | |
| 1109 | + | |
| 1110 | +// node_modules/@base-ui/react/utils/resolveStyle.mjs | |
| 1111 | +function resolveStyle(style, state) { | |
| 1112 | + return typeof style === "function" ? style(state) : style; | |
| 1113 | +} | |
| 1114 | + | |
| 1115 | +// node_modules/@base-ui/react/merge-props/mergeProps.mjs | |
| 1116 | +var EMPTY_PROPS = {}; | |
| 1117 | +function mergeProps(a, b, c2, d, e) { | |
| 1118 | + if (!c2 && !d && !e && !a) { | |
| 1119 | + return createInitialMergedProps(b); | |
| 1120 | + } | |
| 1121 | + let merged = createInitialMergedProps(a); | |
| 1122 | + if (b) { | |
| 1123 | + merged = mergeInto(merged, b); | |
| 1124 | + } | |
| 1125 | + if (c2) { | |
| 1126 | + merged = mergeInto(merged, c2); | |
| 1127 | + } | |
| 1128 | + if (d) { | |
| 1129 | + merged = mergeInto(merged, d); | |
| 1130 | + } | |
| 1131 | + if (e) { | |
| 1132 | + merged = mergeInto(merged, e); | |
| 1133 | + } | |
| 1134 | + return merged; | |
| 1135 | +} | |
| 1136 | +function mergePropsN(props) { | |
| 1137 | + if (props.length === 0) { | |
| 1138 | + return EMPTY_PROPS; | |
| 1139 | + } | |
| 1140 | + if (props.length === 1) { | |
| 1141 | + return createInitialMergedProps(props[0]); | |
| 1142 | + } | |
| 1143 | + let merged = createInitialMergedProps(props[0]); | |
| 1144 | + for (let i = 1; i < props.length; i += 1) { | |
| 1145 | + merged = mergeInto(merged, props[i]); | |
| 1146 | + } | |
| 1147 | + return merged; | |
| 1148 | +} | |
| 1149 | +function createInitialMergedProps(inputProps) { | |
| 1150 | + if (isPropsGetter(inputProps)) { | |
| 1151 | + return { | |
| 1152 | + ...resolvePropsGetter(inputProps, EMPTY_PROPS) | |
| 1153 | + }; | |
| 1154 | + } | |
| 1155 | + return copyInitialProps(inputProps); | |
| 1156 | +} | |
| 1157 | +function mergeInto(merged, inputProps) { | |
| 1158 | + if (isPropsGetter(inputProps)) { | |
| 1159 | + return resolvePropsGetter(inputProps, merged); | |
| 1160 | + } | |
| 1161 | + return mutablyMergeInto(merged, inputProps); | |
| 1162 | +} | |
| 1163 | +function copyInitialProps(inputProps) { | |
| 1164 | + const copiedProps = { | |
| 1165 | + ...inputProps | |
| 1166 | + }; | |
| 1167 | + for (const propName in copiedProps) { | |
| 1168 | + const propValue = copiedProps[propName]; | |
| 1169 | + if (isEventHandler(propName, propValue)) { | |
| 1170 | + copiedProps[propName] = wrapEventHandler(propValue); | |
| 1171 | + } | |
| 1172 | + } | |
| 1173 | + return copiedProps; | |
| 1174 | +} | |
| 1175 | +function mutablyMergeInto(mergedProps, externalProps) { | |
| 1176 | + if (!externalProps) { | |
| 1177 | + return mergedProps; | |
| 1178 | + } | |
| 1179 | + for (const propName in externalProps) { | |
| 1180 | + const externalPropValue = externalProps[propName]; | |
| 1181 | + switch (propName) { | |
| 1182 | + case "style": { | |
| 1183 | + mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); | |
| 1184 | + break; | |
| 1185 | + } | |
| 1186 | + case "className": { | |
| 1187 | + mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); | |
| 1188 | + break; | |
| 1189 | + } | |
| 1190 | + default: { | |
| 1191 | + if (isEventHandler(propName, externalPropValue)) { | |
| 1192 | + mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); | |
| 1193 | + } else { | |
| 1194 | + mergedProps[propName] = externalPropValue; | |
| 1195 | + } | |
| 1196 | + } | |
| 1197 | + } | |
| 1198 | + } | |
| 1199 | + return mergedProps; | |
| 1200 | +} | |
| 1201 | +function isEventHandler(key, value) { | |
| 1202 | + const code0 = key.charCodeAt(0); | |
| 1203 | + const code1 = key.charCodeAt(1); | |
| 1204 | + const code2 = key.charCodeAt(2); | |
| 1205 | + return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); | |
| 1206 | +} | |
| 1207 | +function isPropsGetter(inputProps) { | |
| 1208 | + return typeof inputProps === "function"; | |
| 1209 | +} | |
| 1210 | +function resolvePropsGetter(inputProps, previousProps) { | |
| 1211 | + if (isPropsGetter(inputProps)) { | |
| 1212 | + return inputProps(previousProps); | |
| 1213 | + } | |
| 1214 | + return inputProps ?? EMPTY_PROPS; | |
| 1215 | +} | |
| 1216 | +function mergeEventHandlers(ourHandler, theirHandler) { | |
| 1217 | + if (!theirHandler) { | |
| 1218 | + return ourHandler; | |
| 1219 | + } | |
| 1220 | + if (!ourHandler) { | |
| 1221 | + return wrapEventHandler(theirHandler); | |
| 1222 | + } | |
| 1223 | + return (...args) => { | |
| 1224 | + const event = args[0]; | |
| 1225 | + if (isSyntheticEvent(event)) { | |
| 1226 | + const baseUIEvent = event; | |
| 1227 | + makeEventPreventable(baseUIEvent); | |
| 1228 | + const result2 = theirHandler(...args); | |
| 1229 | + if (!baseUIEvent.baseUIHandlerPrevented) { | |
| 1230 | + ourHandler?.(...args); | |
| 1231 | + } | |
| 1232 | + return result2; | |
| 1233 | + } | |
| 1234 | + const result = theirHandler(...args); | |
| 1235 | + ourHandler?.(...args); | |
| 1236 | + return result; | |
| 1237 | + }; | |
| 1238 | +} | |
| 1239 | +function wrapEventHandler(handler) { | |
| 1240 | + if (!handler) { | |
| 1241 | + return handler; | |
| 1242 | + } | |
| 1243 | + return (...args) => { | |
| 1244 | + const event = args[0]; | |
| 1245 | + if (isSyntheticEvent(event)) { | |
| 1246 | + makeEventPreventable(event); | |
| 1247 | + } | |
| 1248 | + return handler(...args); | |
| 1249 | + }; | |
| 1250 | +} | |
| 1251 | +function makeEventPreventable(event) { | |
| 1252 | + event.preventBaseUIHandler = () => { | |
| 1253 | + event.baseUIHandlerPrevented = true; | |
| 1254 | + }; | |
| 1255 | + return event; | |
| 1256 | +} | |
| 1257 | +function mergeClassNames(ourClassName, theirClassName) { | |
| 1258 | + if (theirClassName) { | |
| 1259 | + if (ourClassName) { | |
| 1260 | + return theirClassName + " " + ourClassName; | |
| 1261 | + } | |
| 1262 | + return theirClassName; | |
| 1263 | + } | |
| 1264 | + return ourClassName; | |
| 1265 | +} | |
| 1266 | +function isSyntheticEvent(event) { | |
| 1267 | + return event != null && typeof event === "object" && "nativeEvent" in event; | |
| 1268 | +} | |
| 1269 | + | |
| 1270 | +// node_modules/@base-ui/react/internals/useRenderElement.mjs | |
| 1271 | +var import_react = __toESM(require_react(), 1); | |
| 1272 | +function useRenderElement(element, componentProps, params = {}) { | |
| 1273 | + let renderProp = componentProps.render; | |
| 1274 | + if (params.enabled !== false) { | |
| 1275 | + renderProp = unwrapLazyRenderProp(renderProp); | |
| 1276 | + } | |
| 1277 | + const outProps = useRenderElementProps(componentProps, params, renderProp); | |
| 1278 | + if (params.enabled === false) { | |
| 1279 | + return null; | |
| 1280 | + } | |
| 1281 | + const state = params.state ?? EMPTY_OBJECT; | |
| 1282 | + return evaluateRenderProp(element, renderProp, outProps, state); | |
| 1283 | +} | |
| 1284 | +function useRenderElementProps(componentProps, params, renderProp) { | |
| 1285 | + const { | |
| 1286 | + className: classNameProp, | |
| 1287 | + style: styleProp | |
| 1288 | + } = componentProps; | |
| 1289 | + const { | |
| 1290 | + state = EMPTY_OBJECT, | |
| 1291 | + ref, | |
| 1292 | + props, | |
| 1293 | + stateAttributesMapping: stateAttributesMapping2, | |
| 1294 | + enabled = true | |
| 1295 | + } = params; | |
| 1296 | + const className = enabled ? resolveClassName(classNameProp, state) : void 0; | |
| 1297 | + const style = enabled ? resolveStyle(styleProp, state) : void 0; | |
| 1298 | + const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping2) : EMPTY_OBJECT; | |
| 1299 | + const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; | |
| 1300 | + const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; | |
| 1301 | + if (typeof document !== "undefined") { | |
| 1302 | + if (!enabled) { | |
| 1303 | + void useMergedRefs(null, null); | |
| 1304 | + } else if (Array.isArray(ref)) { | |
| 1305 | + outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); | |
| 1306 | + } else { | |
| 1307 | + outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); | |
| 1308 | + } | |
| 1309 | + } | |
| 1310 | + if (!enabled) { | |
| 1311 | + return EMPTY_OBJECT; | |
| 1312 | + } | |
| 1313 | + if (className !== void 0) { | |
| 1314 | + outProps.className = mergeClassNames(outProps.className, className); | |
| 1315 | + } | |
| 1316 | + if (style !== void 0) { | |
| 1317 | + outProps.style = mergeObjects(outProps.style, style); | |
| 1318 | + } | |
| 1319 | + return outProps; | |
| 1320 | +} | |
| 1321 | +function resolveRenderFunctionProps(props) { | |
| 1322 | + if (Array.isArray(props)) { | |
| 1323 | + return mergePropsN(props); | |
| 1324 | + } | |
| 1325 | + return mergeProps(void 0, props); | |
| 1326 | +} | |
| 1327 | +var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); | |
| 1328 | +var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; | |
| 1329 | +var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; | |
| 1330 | +function unwrapLazyRenderProp(render4) { | |
| 1331 | + if (render4?.$$typeof !== REACT_LAZY_TYPE) { | |
| 1332 | + return render4; | |
| 1333 | + } | |
| 1334 | + const unwrapped = React7.Children.toArray(render4)[0]; | |
| 1335 | + return /* @__PURE__ */ React7.isValidElement(unwrapped) ? unwrapped : render4; | |
| 1336 | +} | |
| 1337 | +function evaluateRenderProp(element, render4, props, state) { | |
| 1338 | + if (render4) { | |
| 1339 | + if (typeof render4 === "function") { | |
| 1340 | + if (true) { | |
| 1341 | + warnIfRenderPropLooksLikeComponent(render4); | |
| 1342 | + } | |
| 1343 | + return render4(props, state); | |
| 1344 | + } | |
| 1345 | + const mergedProps = mergeProps(props, render4.props); | |
| 1346 | + mergedProps.ref = props.ref; | |
| 1347 | + if (true) { | |
| 1348 | + if (!/* @__PURE__ */ React7.isValidElement(render4)) { | |
| 1349 | + 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")); | |
| 1350 | + } | |
| 1351 | + } | |
| 1352 | + return /* @__PURE__ */ React7.cloneElement(render4, mergedProps); | |
| 1353 | + } | |
| 1354 | + if (element) { | |
| 1355 | + if (typeof element === "string") { | |
| 1356 | + return renderTag(element, props); | |
| 1357 | + } | |
| 1358 | + } | |
| 1359 | + throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8)); | |
| 1360 | +} | |
| 1361 | +function warnIfRenderPropLooksLikeComponent(renderFn) { | |
| 1362 | + const functionName = renderFn.name; | |
| 1363 | + if (functionName.length === 0) { | |
| 1364 | + return; | |
| 1365 | + } | |
| 1366 | + if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { | |
| 1367 | + return; | |
| 1368 | + } | |
| 1369 | + if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { | |
| 1370 | + return; | |
| 1371 | + } | |
| 1372 | + 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"); | |
| 1373 | +} | |
| 1374 | +function renderTag(Tag, props) { | |
| 1375 | + if (Tag === "button") { | |
| 1376 | + return /* @__PURE__ */ (0, import_react.createElement)("button", { | |
| 1377 | + type: "button", | |
| 1378 | + ...props, | |
| 1379 | + key: props.key | |
| 1380 | + }); | |
| 1381 | + } | |
| 1382 | + if (Tag === "img") { | |
| 1383 | + return /* @__PURE__ */ (0, import_react.createElement)("img", { | |
| 1384 | + alt: "", | |
| 1385 | + ...props, | |
| 1386 | + key: props.key | |
| 1387 | + }); | |
| 1388 | + } | |
| 1389 | + return /* @__PURE__ */ React7.createElement(Tag, props); | |
| 1390 | +} | |
| 1391 | + | |
| 1392 | +// node_modules/@base-ui/utils/useId.mjs | |
| 1393 | +var React8 = __toESM(require_react(), 1); | |
| 1394 | +var globalId = 0; | |
| 1395 | +function useGlobalId(idOverride, prefix = "mui") { | |
| 1396 | + const [defaultId, setDefaultId] = React8.useState(idOverride); | |
| 1397 | + const id = idOverride || defaultId; | |
| 1398 | + React8.useEffect(() => { | |
| 1399 | + if (defaultId == null) { | |
| 1400 | + globalId += 1; | |
| 1401 | + setDefaultId(`${prefix}-${globalId}`); | |
| 1402 | + } | |
| 1403 | + }, [defaultId, prefix]); | |
| 1404 | + return id; | |
| 1405 | +} | |
| 1406 | +var maybeReactUseId = SafeReact.useId; | |
| 1407 | +function useId(idOverride, prefix) { | |
| 1408 | + if (maybeReactUseId !== void 0) { | |
| 1409 | + const reactId = maybeReactUseId(); | |
| 1410 | + return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId); | |
| 1411 | + } | |
| 1412 | + return useGlobalId(idOverride, prefix); | |
| 1413 | +} | |
| 1414 | + | |
| 1415 | +// node_modules/@base-ui/react/internals/useBaseUiId.mjs | |
| 1416 | +function useBaseUiId(idOverride) { | |
| 1417 | + return useId(idOverride, "base-ui"); | |
| 1418 | +} | |
| 1419 | + | |
| 1420 | +// node_modules/@base-ui/react/internals/reason-parts.mjs | |
| 1421 | +var reason_parts_exports = {}; | |
| 1422 | +__export(reason_parts_exports, { | |
| 1423 | + cancelOpen: () => cancelOpen, | |
| 1424 | + chipRemovePress: () => chipRemovePress, | |
| 1425 | + clearPress: () => clearPress, | |
| 1426 | + closePress: () => closePress, | |
| 1427 | + closeWatcher: () => closeWatcher, | |
| 1428 | + decrementPress: () => decrementPress, | |
| 1429 | + disabled: () => disabled, | |
| 1430 | + drag: () => drag, | |
| 1431 | + escapeKey: () => escapeKey, | |
| 1432 | + focusOut: () => focusOut, | |
| 1433 | + imperativeAction: () => imperativeAction, | |
| 1434 | + incrementPress: () => incrementPress, | |
| 1435 | + initial: () => initial, | |
| 1436 | + inputBlur: () => inputBlur, | |
| 1437 | + inputChange: () => inputChange, | |
| 1438 | + inputClear: () => inputClear, | |
| 1439 | + inputPaste: () => inputPaste, | |
| 1440 | + inputPress: () => inputPress, | |
| 1441 | + itemPress: () => itemPress, | |
| 1442 | + keyboard: () => keyboard, | |
| 1443 | + linkPress: () => linkPress, | |
| 1444 | + listNavigation: () => listNavigation, | |
| 1445 | + missing: () => missing, | |
| 1446 | + none: () => none, | |
| 1447 | + outsidePress: () => outsidePress, | |
| 1448 | + pointer: () => pointer, | |
| 1449 | + scrub: () => scrub, | |
| 1450 | + siblingOpen: () => siblingOpen, | |
| 1451 | + swipe: () => swipe, | |
| 1452 | + trackPress: () => trackPress, | |
| 1453 | + triggerFocus: () => triggerFocus, | |
| 1454 | + triggerHover: () => triggerHover, | |
| 1455 | + triggerPress: () => triggerPress, | |
| 1456 | + wheel: () => wheel, | |
| 1457 | + windowResize: () => windowResize | |
| 1458 | +}); | |
| 1459 | +var none = "none"; | |
| 1460 | +var triggerPress = "trigger-press"; | |
| 1461 | +var triggerHover = "trigger-hover"; | |
| 1462 | +var triggerFocus = "trigger-focus"; | |
| 1463 | +var outsidePress = "outside-press"; | |
| 1464 | +var itemPress = "item-press"; | |
| 1465 | +var closePress = "close-press"; | |
| 1466 | +var linkPress = "link-press"; | |
| 1467 | +var clearPress = "clear-press"; | |
| 1468 | +var chipRemovePress = "chip-remove-press"; | |
| 1469 | +var trackPress = "track-press"; | |
| 1470 | +var incrementPress = "increment-press"; | |
| 1471 | +var decrementPress = "decrement-press"; | |
| 1472 | +var inputChange = "input-change"; | |
| 1473 | +var inputClear = "input-clear"; | |
| 1474 | +var inputBlur = "input-blur"; | |
| 1475 | +var inputPaste = "input-paste"; | |
| 1476 | +var inputPress = "input-press"; | |
| 1477 | +var focusOut = "focus-out"; | |
| 1478 | +var escapeKey = "escape-key"; | |
| 1479 | +var closeWatcher = "close-watcher"; | |
| 1480 | +var listNavigation = "list-navigation"; | |
| 1481 | +var keyboard = "keyboard"; | |
| 1482 | +var pointer = "pointer"; | |
| 1483 | +var drag = "drag"; | |
| 1484 | +var wheel = "wheel"; | |
| 1485 | +var scrub = "scrub"; | |
| 1486 | +var cancelOpen = "cancel-open"; | |
| 1487 | +var siblingOpen = "sibling-open"; | |
| 1488 | +var disabled = "disabled"; | |
| 1489 | +var missing = "missing"; | |
| 1490 | +var initial = "initial"; | |
| 1491 | +var imperativeAction = "imperative-action"; | |
| 1492 | +var swipe = "swipe"; | |
| 1493 | +var windowResize = "window-resize"; | |
| 1494 | + | |
| 1495 | +// node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs | |
| 1496 | +function createChangeEventDetails(reason, event, trigger, customProperties) { | |
| 1497 | + let canceled = false; | |
| 1498 | + let allowPropagation = false; | |
| 1499 | + const custom = customProperties ?? EMPTY_OBJECT; | |
| 1500 | + const details = { | |
| 1501 | + reason, | |
| 1502 | + event: event ?? new Event("base-ui"), | |
| 1503 | + cancel() { | |
| 1504 | + canceled = true; | |
| 1505 | + }, | |
| 1506 | + allowPropagation() { | |
| 1507 | + allowPropagation = true; | |
| 1508 | + }, | |
| 1509 | + get isCanceled() { | |
| 1510 | + return canceled; | |
| 1511 | + }, | |
| 1512 | + get isPropagationAllowed() { | |
| 1513 | + return allowPropagation; | |
| 1514 | + }, | |
| 1515 | + trigger, | |
| 1516 | + ...custom | |
| 1517 | + }; | |
| 1518 | + return details; | |
| 1519 | +} | |
| 1520 | + | |
| 1521 | +// node_modules/@base-ui/react/internals/useTransitionStatus.mjs | |
| 1522 | +var React10 = __toESM(require_react(), 1); | |
| 1523 | + | |
| 1524 | +// node_modules/@base-ui/utils/useOnMount.mjs | |
| 1525 | +var React9 = __toESM(require_react(), 1); | |
| 1526 | +function useOnMount(fn) { | |
| 1527 | + React9.useEffect(fn, EMPTY_ARRAY); | |
| 1528 | +} | |
| 1529 | + | |
| 1530 | +// node_modules/@base-ui/utils/useAnimationFrame.mjs | |
| 1531 | +var EMPTY = null; | |
| 1532 | +var LAST_RAF = globalThis.requestAnimationFrame; | |
| 1533 | +var Scheduler = class { | |
| 1534 | + /* This implementation uses an array as a backing data-structure for frame callbacks. | |
| 1535 | + * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it | |
| 1536 | + * never calls the native `cancelAnimationFrame` if there are no frames left. This can | |
| 1537 | + * be much more efficient if there is a call pattern that alterns as | |
| 1538 | + * "request-cancel-request-cancel-…". | |
| 1539 | + * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation | |
| 1540 | + * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */ | |
| 1541 | + callbacks = []; | |
| 1542 | + callbacksCount = 0; | |
| 1543 | + nextId = 1; | |
| 1544 | + startId = 1; | |
| 1545 | + isScheduled = false; | |
| 1546 | + tick = (timestamp) => { | |
| 1547 | + this.isScheduled = false; | |
| 1548 | + const currentCallbacks = this.callbacks; | |
| 1549 | + const currentCallbacksCount = this.callbacksCount; | |
| 1550 | + this.callbacks = []; | |
| 1551 | + this.callbacksCount = 0; | |
| 1552 | + this.startId = this.nextId; | |
| 1553 | + if (currentCallbacksCount > 0) { | |
| 1554 | + for (let i = 0; i < currentCallbacks.length; i += 1) { | |
| 1555 | + currentCallbacks[i]?.(timestamp); | |
| 1556 | + } | |
| 1557 | + } | |
| 1558 | + }; | |
| 1559 | + request(fn) { | |
| 1560 | + const id = this.nextId; | |
| 1561 | + this.nextId += 1; | |
| 1562 | + this.callbacks.push(fn); | |
| 1563 | + this.callbacksCount += 1; | |
| 1564 | + const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true); | |
| 1565 | + if (!this.isScheduled || didRAFChange) { | |
| 1566 | + requestAnimationFrame(this.tick); | |
| 1567 | + this.isScheduled = true; | |
| 1568 | + } | |
| 1569 | + return id; | |
| 1570 | + } | |
| 1571 | + cancel(id) { | |
| 1572 | + const index2 = id - this.startId; | |
| 1573 | + if (index2 < 0 || index2 >= this.callbacks.length) { | |
| 1574 | + return; | |
| 1575 | + } | |
| 1576 | + if (this.callbacks[index2] === null) { | |
| 1577 | + return; | |
| 1578 | + } | |
| 1579 | + this.callbacks[index2] = null; | |
| 1580 | + this.callbacksCount -= 1; | |
| 1581 | + } | |
| 1582 | +}; | |
| 1583 | +var scheduler = new Scheduler(); | |
| 1584 | +var AnimationFrame = class _AnimationFrame { | |
| 1585 | + static create() { | |
| 1586 | + return new _AnimationFrame(); | |
| 1587 | + } | |
| 1588 | + static request(fn) { | |
| 1589 | + return scheduler.request(fn); | |
| 1590 | + } | |
| 1591 | + static cancel(id) { | |
| 1592 | + return scheduler.cancel(id); | |
| 1593 | + } | |
| 1594 | + currentId = EMPTY; | |
| 1595 | + /** | |
| 1596 | + * Executes `fn` after `delay`, clearing any previously scheduled call. | |
| 1597 | + */ | |
| 1598 | + request(fn) { | |
| 1599 | + this.cancel(); | |
| 1600 | + this.currentId = scheduler.request(() => { | |
| 1601 | + this.currentId = EMPTY; | |
| 1602 | + fn(); | |
| 1603 | + }); | |
| 1604 | + } | |
| 1605 | + cancel = () => { | |
| 1606 | + if (this.currentId !== EMPTY) { | |
| 1607 | + scheduler.cancel(this.currentId); | |
| 1608 | + this.currentId = EMPTY; | |
| 1609 | + } | |
| 1610 | + }; | |
| 1611 | + disposeEffect = () => { | |
| 1612 | + return this.cancel; | |
| 1613 | + }; | |
| 1614 | +}; | |
| 1615 | +function useAnimationFrame() { | |
| 1616 | + const timeout = useRefWithInit(AnimationFrame.create).current; | |
| 1617 | + useOnMount(timeout.disposeEffect); | |
| 1618 | + return timeout; | |
| 1619 | +} | |
| 1620 | + | |
| 1621 | +// node_modules/@base-ui/react/internals/useTransitionStatus.mjs | |
| 1622 | +function useTransitionStatus(open2, enableIdleState = false, deferEndingState = false, animateInitialOpen = false) { | |
| 1623 | + const [transitionStatus, setTransitionStatus] = React10.useState(open2 && enableIdleState ? "idle" : void 0); | |
| 1624 | + const [mounted, setMounted] = React10.useState(open2 && !animateInitialOpen); | |
| 1625 | + if (open2 && !mounted) { | |
| 1626 | + setMounted(true); | |
| 1627 | + setTransitionStatus("starting"); | |
| 1628 | + } | |
| 1629 | + if (!open2 && mounted && transitionStatus !== "ending" && !deferEndingState) { | |
| 1630 | + setTransitionStatus("ending"); | |
| 1631 | + } | |
| 1632 | + if (!open2 && !mounted && transitionStatus === "ending") { | |
| 1633 | + setTransitionStatus(void 0); | |
| 1634 | + } | |
| 1635 | + useIsoLayoutEffect(() => { | |
| 1636 | + if (!open2 && mounted && transitionStatus !== "ending" && deferEndingState) { | |
| 1637 | + const frame = AnimationFrame.request(() => { | |
| 1638 | + setTransitionStatus("ending"); | |
| 1639 | + }); | |
| 1640 | + return () => { | |
| 1641 | + AnimationFrame.cancel(frame); | |
| 123 | 1642 | }; |
| 124 | 1643 | } |
| 1644 | + return void 0; | |
| 1645 | + }, [open2, mounted, transitionStatus, deferEndingState]); | |
| 1646 | + useIsoLayoutEffect(() => { | |
| 1647 | + if (!open2 || enableIdleState) { | |
| 1648 | + return void 0; | |
| 1649 | + } | |
| 1650 | + const frame = AnimationFrame.request(() => { | |
| 1651 | + setTransitionStatus(void 0); | |
| 1652 | + }); | |
| 1653 | + return () => { | |
| 1654 | + AnimationFrame.cancel(frame); | |
| 1655 | + }; | |
| 1656 | + }, [enableIdleState, open2]); | |
| 1657 | + useIsoLayoutEffect(() => { | |
| 1658 | + if (!open2 || !enableIdleState) { | |
| 1659 | + return void 0; | |
| 1660 | + } | |
| 1661 | + if (open2 && mounted && transitionStatus !== "idle") { | |
| 1662 | + setTransitionStatus("starting"); | |
| 1663 | + } | |
| 1664 | + const frame = AnimationFrame.request(() => { | |
| 1665 | + setTransitionStatus("idle"); | |
| 1666 | + }); | |
| 1667 | + return () => { | |
| 1668 | + AnimationFrame.cancel(frame); | |
| 1669 | + }; | |
| 1670 | + }, [enableIdleState, open2, mounted, transitionStatus]); | |
| 1671 | + return { | |
| 1672 | + mounted, | |
| 1673 | + setMounted, | |
| 1674 | + transitionStatus | |
| 1675 | + }; | |
| 1676 | +} | |
| 1677 | + | |
| 1678 | +// node_modules/@base-ui/react/internals/TransitionStatusDataAttributes.mjs | |
| 1679 | +var startingStyle = "data-starting-style"; | |
| 1680 | +var endingStyle = "data-ending-style"; | |
| 1681 | + | |
| 1682 | +// node_modules/@base-ui/react/internals/stateAttributesMapping.mjs | |
| 1683 | +var STARTING_HOOK = { | |
| 1684 | + [startingStyle]: "" | |
| 1685 | +}; | |
| 1686 | +var ENDING_HOOK = { | |
| 1687 | + [endingStyle]: "" | |
| 1688 | +}; | |
| 1689 | +var transitionStatusMapping = { | |
| 1690 | + transitionStatus(value) { | |
| 1691 | + if (value === "starting") { | |
| 1692 | + return STARTING_HOOK; | |
| 1693 | + } | |
| 1694 | + if (value === "ending") { | |
| 1695 | + return ENDING_HOOK; | |
| 1696 | + } | |
| 1697 | + return null; | |
| 125 | 1698 | } |
| 126 | - if (activeViewOverrides.layout) { | |
| 127 | - result = { | |
| 128 | - ...result, | |
| 129 | - layout: { | |
| 130 | - ...result.layout, | |
| 131 | - ...activeViewOverrides.layout | |
| 1699 | +}; | |
| 1700 | + | |
| 1701 | +// node_modules/@base-ui/react/internals/use-button/useButton.mjs | |
| 1702 | +var React13 = __toESM(require_react(), 1); | |
| 1703 | + | |
| 1704 | +// node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs | |
| 1705 | +function hasWindow() { | |
| 1706 | + return typeof window !== "undefined"; | |
| 1707 | +} | |
| 1708 | +function getNodeName(node) { | |
| 1709 | + if (isNode(node)) { | |
| 1710 | + return (node.nodeName || "").toLowerCase(); | |
| 1711 | + } | |
| 1712 | + return "#document"; | |
| 1713 | +} | |
| 1714 | +function getWindow(node) { | |
| 1715 | + var _node$ownerDocument; | |
| 1716 | + return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; | |
| 1717 | +} | |
| 1718 | +function getDocumentElement(node) { | |
| 1719 | + var _ref; | |
| 1720 | + return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; | |
| 1721 | +} | |
| 1722 | +function isNode(value) { | |
| 1723 | + if (!hasWindow()) { | |
| 1724 | + return false; | |
| 1725 | + } | |
| 1726 | + return value instanceof Node || value instanceof getWindow(value).Node; | |
| 1727 | +} | |
| 1728 | +function isElement(value) { | |
| 1729 | + if (!hasWindow()) { | |
| 1730 | + return false; | |
| 1731 | + } | |
| 1732 | + return value instanceof Element || value instanceof getWindow(value).Element; | |
| 1733 | +} | |
| 1734 | +function isHTMLElement(value) { | |
| 1735 | + if (!hasWindow()) { | |
| 1736 | + return false; | |
| 1737 | + } | |
| 1738 | + return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; | |
| 1739 | +} | |
| 1740 | +function isShadowRoot(value) { | |
| 1741 | + if (!hasWindow() || typeof ShadowRoot === "undefined") { | |
| 1742 | + return false; | |
| 1743 | + } | |
| 1744 | + return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; | |
| 1745 | +} | |
| 1746 | +function isOverflowElement(element) { | |
| 1747 | + const { | |
| 1748 | + overflow, | |
| 1749 | + overflowX, | |
| 1750 | + overflowY, | |
| 1751 | + display | |
| 1752 | + } = getComputedStyle2(element); | |
| 1753 | + return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents"; | |
| 1754 | +} | |
| 1755 | +function isTableElement(element) { | |
| 1756 | + return /^(table|td|th)$/.test(getNodeName(element)); | |
| 1757 | +} | |
| 1758 | +function isTopLayer(element) { | |
| 1759 | + try { | |
| 1760 | + if (element.matches(":popover-open")) { | |
| 1761 | + return true; | |
| 1762 | + } | |
| 1763 | + } catch (_e) { | |
| 1764 | + } | |
| 1765 | + try { | |
| 1766 | + return element.matches(":modal"); | |
| 1767 | + } catch (_e) { | |
| 1768 | + return false; | |
| 1769 | + } | |
| 1770 | +} | |
| 1771 | +var willChangeRe = /transform|translate|scale|rotate|perspective|filter/; | |
| 1772 | +var containRe = /paint|layout|strict|content/; | |
| 1773 | +var isNotNone = (value) => !!value && value !== "none"; | |
| 1774 | +var isWebKitValue; | |
| 1775 | +function isContainingBlock(elementOrCss) { | |
| 1776 | + const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss; | |
| 1777 | + 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 || ""); | |
| 1778 | +} | |
| 1779 | +function getContainingBlock(element) { | |
| 1780 | + let currentNode = getParentNode(element); | |
| 1781 | + while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { | |
| 1782 | + if (isContainingBlock(currentNode)) { | |
| 1783 | + return currentNode; | |
| 1784 | + } else if (isTopLayer(currentNode)) { | |
| 1785 | + return null; | |
| 1786 | + } | |
| 1787 | + currentNode = getParentNode(currentNode); | |
| 1788 | + } | |
| 1789 | + return null; | |
| 1790 | +} | |
| 1791 | +function isWebKit() { | |
| 1792 | + if (isWebKitValue == null) { | |
| 1793 | + isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"); | |
| 1794 | + } | |
| 1795 | + return isWebKitValue; | |
| 1796 | +} | |
| 1797 | +function isLastTraversableNode(node) { | |
| 1798 | + return /^(html|body|#document)$/.test(getNodeName(node)); | |
| 1799 | +} | |
| 1800 | +function getComputedStyle2(element) { | |
| 1801 | + return getWindow(element).getComputedStyle(element); | |
| 1802 | +} | |
| 1803 | +function getNodeScroll(element) { | |
| 1804 | + if (isElement(element)) { | |
| 1805 | + return { | |
| 1806 | + scrollLeft: element.scrollLeft, | |
| 1807 | + scrollTop: element.scrollTop | |
| 1808 | + }; | |
| 1809 | + } | |
| 1810 | + return { | |
| 1811 | + scrollLeft: element.scrollX, | |
| 1812 | + scrollTop: element.scrollY | |
| 1813 | + }; | |
| 1814 | +} | |
| 1815 | +function getParentNode(node) { | |
| 1816 | + if (getNodeName(node) === "html") { | |
| 1817 | + return node; | |
| 1818 | + } | |
| 1819 | + const result = ( | |
| 1820 | + // Step into the shadow DOM of the parent of a slotted node. | |
| 1821 | + node.assignedSlot || // DOM Element detected. | |
| 1822 | + node.parentNode || // ShadowRoot detected. | |
| 1823 | + isShadowRoot(node) && node.host || // Fallback. | |
| 1824 | + getDocumentElement(node) | |
| 1825 | + ); | |
| 1826 | + return isShadowRoot(result) ? result.host : result; | |
| 1827 | +} | |
| 1828 | +function getNearestOverflowAncestor(node) { | |
| 1829 | + const parentNode = getParentNode(node); | |
| 1830 | + if (isLastTraversableNode(parentNode)) { | |
| 1831 | + return (node.ownerDocument || node).body; | |
| 1832 | + } | |
| 1833 | + if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { | |
| 1834 | + return parentNode; | |
| 1835 | + } | |
| 1836 | + return getNearestOverflowAncestor(parentNode); | |
| 1837 | +} | |
| 1838 | +function getOverflowAncestors(node, list, traverseIframes) { | |
| 1839 | + var _node$ownerDocument2; | |
| 1840 | + if (list === void 0) { | |
| 1841 | + list = []; | |
| 1842 | + } | |
| 1843 | + if (traverseIframes === void 0) { | |
| 1844 | + traverseIframes = true; | |
| 1845 | + } | |
| 1846 | + const scrollableAncestor = getNearestOverflowAncestor(node); | |
| 1847 | + const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); | |
| 1848 | + const win = getWindow(scrollableAncestor); | |
| 1849 | + if (isBody) { | |
| 1850 | + const frameElement = getFrameElement(win); | |
| 1851 | + return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); | |
| 1852 | + } else { | |
| 1853 | + return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); | |
| 1854 | + } | |
| 1855 | +} | |
| 1856 | +function getFrameElement(win) { | |
| 1857 | + return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; | |
| 1858 | +} | |
| 1859 | + | |
| 1860 | +// node_modules/@base-ui/react/internals/composite/root/CompositeRootContext.mjs | |
| 1861 | +var React11 = __toESM(require_react(), 1); | |
| 1862 | +var CompositeRootContext = /* @__PURE__ */ React11.createContext(void 0); | |
| 1863 | +if (true) CompositeRootContext.displayName = "CompositeRootContext"; | |
| 1864 | +function useCompositeRootContext(optional = false) { | |
| 1865 | + const context = React11.useContext(CompositeRootContext); | |
| 1866 | + if (context === void 0 && !optional) { | |
| 1867 | + throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : formatErrorMessage_default(16)); | |
| 1868 | + } | |
| 1869 | + return context; | |
| 1870 | +} | |
| 1871 | + | |
| 1872 | +// node_modules/@base-ui/react/utils/useFocusableWhenDisabled.mjs | |
| 1873 | +var React12 = __toESM(require_react(), 1); | |
| 1874 | +function useFocusableWhenDisabled(parameters) { | |
| 1875 | + const { | |
| 1876 | + focusableWhenDisabled, | |
| 1877 | + disabled: disabled2, | |
| 1878 | + composite = false, | |
| 1879 | + tabIndex: tabIndexProp = 0, | |
| 1880 | + isNativeButton | |
| 1881 | + } = parameters; | |
| 1882 | + const isFocusableComposite = composite && focusableWhenDisabled !== false; | |
| 1883 | + const isNonFocusableComposite = composite && focusableWhenDisabled === false; | |
| 1884 | + const props = React12.useMemo(() => { | |
| 1885 | + const additionalProps = { | |
| 1886 | + // allow Tabbing away from focusableWhenDisabled elements | |
| 1887 | + onKeyDown(event) { | |
| 1888 | + if (disabled2 && focusableWhenDisabled && event.key !== "Tab") { | |
| 1889 | + event.preventDefault(); | |
| 1890 | + } | |
| 132 | 1891 | } |
| 133 | 1892 | }; |
| 1893 | + if (!composite) { | |
| 1894 | + additionalProps.tabIndex = tabIndexProp; | |
| 1895 | + if (!isNativeButton && disabled2) { | |
| 1896 | + additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1; | |
| 1897 | + } | |
| 1898 | + } | |
| 1899 | + if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) { | |
| 1900 | + additionalProps["aria-disabled"] = disabled2; | |
| 1901 | + } | |
| 1902 | + if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) { | |
| 1903 | + additionalProps.disabled = disabled2; | |
| 1904 | + } | |
| 1905 | + return additionalProps; | |
| 1906 | + }, [composite, disabled2, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]); | |
| 1907 | + return { | |
| 1908 | + props | |
| 1909 | + }; | |
| 1910 | +} | |
| 1911 | + | |
| 1912 | +// node_modules/@base-ui/utils/owner.mjs | |
| 1913 | +function ownerDocument(node) { | |
| 1914 | + return node?.ownerDocument || document; | |
| 1915 | +} | |
| 1916 | + | |
| 1917 | +// node_modules/@base-ui/react/utils/dispatchClickWithModifiers.mjs | |
| 1918 | +function dispatchClickWithModifiers(target, sourceEvent, { | |
| 1919 | + detail = 0 | |
| 1920 | +} = {}) { | |
| 1921 | + target.dispatchEvent(new (getWindow(target)).PointerEvent("click", { | |
| 1922 | + bubbles: true, | |
| 1923 | + cancelable: true, | |
| 1924 | + composed: true, | |
| 1925 | + detail, | |
| 1926 | + shiftKey: sourceEvent.shiftKey, | |
| 1927 | + ctrlKey: sourceEvent.ctrlKey, | |
| 1928 | + altKey: sourceEvent.altKey, | |
| 1929 | + metaKey: sourceEvent.metaKey | |
| 1930 | + })); | |
| 1931 | +} | |
| 1932 | + | |
| 1933 | +// node_modules/@base-ui/react/internals/use-button/useButton.mjs | |
| 1934 | +function useButton(parameters = {}) { | |
| 1935 | + const { | |
| 1936 | + disabled: disabled2 = false, | |
| 1937 | + focusableWhenDisabled, | |
| 1938 | + tabIndex = 0, | |
| 1939 | + native: isNativeButton = true, | |
| 1940 | + composite: compositeProp | |
| 1941 | + } = parameters; | |
| 1942 | + const elementRef = React13.useRef(null); | |
| 1943 | + const compositeRootContext = useCompositeRootContext(true); | |
| 1944 | + const isCompositeItem = compositeProp ?? compositeRootContext !== void 0; | |
| 1945 | + const { | |
| 1946 | + props: focusableWhenDisabledProps | |
| 1947 | + } = useFocusableWhenDisabled({ | |
| 1948 | + focusableWhenDisabled, | |
| 1949 | + disabled: disabled2, | |
| 1950 | + composite: isCompositeItem, | |
| 1951 | + tabIndex, | |
| 1952 | + isNativeButton | |
| 1953 | + }); | |
| 1954 | + if (true) { | |
| 1955 | + React13.useEffect(() => { | |
| 1956 | + if (!elementRef.current) { | |
| 1957 | + return; | |
| 1958 | + } | |
| 1959 | + const isButtonTag = isButtonElement(elementRef.current); | |
| 1960 | + if (isNativeButton) { | |
| 1961 | + if (!isButtonTag) { | |
| 1962 | + const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; | |
| 1963 | + const message2 = "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`."; | |
| 1964 | + error(`${message2}${ownerStackMessage}`); | |
| 1965 | + } | |
| 1966 | + } else if (isButtonTag) { | |
| 1967 | + const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; | |
| 1968 | + const message2 = "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`."; | |
| 1969 | + error(`${message2}${ownerStackMessage}`); | |
| 1970 | + } | |
| 1971 | + }, [isNativeButton]); | |
| 134 | 1972 | } |
| 135 | - if (activeViewOverrides.groupBy) { | |
| 136 | - result = { | |
| 137 | - ...result, | |
| 138 | - groupBy: activeViewOverrides.groupBy | |
| 1973 | + const updateDisabled = React13.useCallback(() => { | |
| 1974 | + const element = elementRef.current; | |
| 1975 | + if (!isButtonElement(element)) { | |
| 1976 | + return; | |
| 1977 | + } | |
| 1978 | + if (isCompositeItem && disabled2 && focusableWhenDisabledProps.disabled === void 0 && element.disabled) { | |
| 1979 | + element.disabled = false; | |
| 1980 | + } | |
| 1981 | + }, [disabled2, focusableWhenDisabledProps.disabled, isCompositeItem]); | |
| 1982 | + useIsoLayoutEffect(updateDisabled, [updateDisabled]); | |
| 1983 | + const getButtonProps = React13.useCallback((externalProps = {}) => { | |
| 1984 | + const { | |
| 1985 | + onClick: externalOnClick, | |
| 1986 | + onMouseDown: externalOnMouseDown, | |
| 1987 | + onKeyUp: externalOnKeyUp, | |
| 1988 | + onKeyDown: externalOnKeyDown, | |
| 1989 | + onPointerDown: externalOnPointerDown, | |
| 1990 | + ...otherExternalProps | |
| 1991 | + } = externalProps; | |
| 1992 | + return mergeProps({ | |
| 1993 | + onClick(event) { | |
| 1994 | + if (disabled2) { | |
| 1995 | + event.preventDefault(); | |
| 1996 | + return; | |
| 1997 | + } | |
| 1998 | + externalOnClick?.(event); | |
| 1999 | + }, | |
| 2000 | + onMouseDown(event) { | |
| 2001 | + if (!disabled2) { | |
| 2002 | + externalOnMouseDown?.(event); | |
| 2003 | + } | |
| 2004 | + }, | |
| 2005 | + onKeyDown(event) { | |
| 2006 | + if (disabled2) { | |
| 2007 | + return; | |
| 2008 | + } | |
| 2009 | + makeEventPreventable(event); | |
| 2010 | + externalOnKeyDown?.(event); | |
| 2011 | + if (event.baseUIHandlerPrevented) { | |
| 2012 | + return; | |
| 2013 | + } | |
| 2014 | + const isCurrentTarget = event.target === event.currentTarget; | |
| 2015 | + const currentTarget = event.currentTarget; | |
| 2016 | + const isButton = isButtonElement(currentTarget); | |
| 2017 | + const isLink = !isNativeButton && isValidLinkElement(currentTarget); | |
| 2018 | + const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink); | |
| 2019 | + const isEnterKey = event.key === "Enter"; | |
| 2020 | + const isSpaceKey = event.key === " "; | |
| 2021 | + const role = currentTarget.getAttribute("role"); | |
| 2022 | + const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell"; | |
| 2023 | + if (isCurrentTarget && isCompositeItem && isSpaceKey) { | |
| 2024 | + if (event.defaultPrevented && isTextNavigationRole) { | |
| 2025 | + return; | |
| 2026 | + } | |
| 2027 | + event.preventDefault(); | |
| 2028 | + if (!isNativeButton || isButton) { | |
| 2029 | + event.preventBaseUIHandler(); | |
| 2030 | + dispatchClickWithModifiers(currentTarget, event); | |
| 2031 | + } | |
| 2032 | + return; | |
| 2033 | + } | |
| 2034 | + if (!shouldClick || isNativeButton || !isSpaceKey && !isEnterKey) { | |
| 2035 | + if (isCurrentTarget && isLink && isSpaceKey) { | |
| 2036 | + event.preventDefault(); | |
| 2037 | + } | |
| 2038 | + return; | |
| 2039 | + } | |
| 2040 | + if (event.defaultPrevented) { | |
| 2041 | + return; | |
| 2042 | + } | |
| 2043 | + event.preventDefault(); | |
| 2044 | + if (isEnterKey) { | |
| 2045 | + event.preventBaseUIHandler(); | |
| 2046 | + dispatchClickWithModifiers(currentTarget, event); | |
| 2047 | + } | |
| 2048 | + }, | |
| 2049 | + onKeyUp(event) { | |
| 2050 | + if (disabled2) { | |
| 2051 | + return; | |
| 2052 | + } | |
| 2053 | + makeEventPreventable(event); | |
| 2054 | + externalOnKeyUp?.(event); | |
| 2055 | + if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") { | |
| 2056 | + event.preventDefault(); | |
| 2057 | + return; | |
| 2058 | + } | |
| 2059 | + if (event.baseUIHandlerPrevented) { | |
| 2060 | + return; | |
| 2061 | + } | |
| 2062 | + if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && !event.defaultPrevented && event.key === " ") { | |
| 2063 | + event.preventBaseUIHandler(); | |
| 2064 | + dispatchClickWithModifiers(event.currentTarget, event); | |
| 2065 | + } | |
| 2066 | + }, | |
| 2067 | + onPointerDown(event) { | |
| 2068 | + if (disabled2) { | |
| 2069 | + event.preventDefault(); | |
| 2070 | + return; | |
| 2071 | + } | |
| 2072 | + externalOnPointerDown?.(event); | |
| 2073 | + } | |
| 2074 | + }, isNativeButton ? { | |
| 2075 | + type: "button" | |
| 2076 | + } : { | |
| 2077 | + role: "button" | |
| 2078 | + }, focusableWhenDisabledProps, otherExternalProps); | |
| 2079 | + }, [disabled2, focusableWhenDisabledProps, isCompositeItem, isNativeButton]); | |
| 2080 | + const buttonRef = useStableCallback((element) => { | |
| 2081 | + elementRef.current = element; | |
| 2082 | + updateDisabled(); | |
| 2083 | + }); | |
| 2084 | + return { | |
| 2085 | + getButtonProps, | |
| 2086 | + buttonRef | |
| 2087 | + }; | |
| 2088 | +} | |
| 2089 | +function isButtonElement(elem) { | |
| 2090 | + return isHTMLElement(elem) && elem.tagName === "BUTTON"; | |
| 2091 | +} | |
| 2092 | +function isValidLinkElement(elem) { | |
| 2093 | + return isHTMLElement(elem) && elem.tagName === "A" && Boolean(elem.href); | |
| 2094 | +} | |
| 2095 | + | |
| 2096 | +// node_modules/@base-ui/utils/addEventListener.mjs | |
| 2097 | +function addEventListener(target, type, listener, options) { | |
| 2098 | + target.addEventListener(type, listener, options); | |
| 2099 | + return () => { | |
| 2100 | + target.removeEventListener(type, listener, options); | |
| 2101 | + }; | |
| 2102 | +} | |
| 2103 | + | |
| 2104 | +// node_modules/@base-ui/utils/useValueAsRef.mjs | |
| 2105 | +function useValueAsRef(value) { | |
| 2106 | + const latest = useRefWithInit(createLatestRef, value).current; | |
| 2107 | + latest.next = value; | |
| 2108 | + useIsoLayoutEffect(latest.effect); | |
| 2109 | + return latest; | |
| 2110 | +} | |
| 2111 | +function createLatestRef(value) { | |
| 2112 | + const latest = { | |
| 2113 | + current: value, | |
| 2114 | + next: value, | |
| 2115 | + effect: () => { | |
| 2116 | + latest.current = latest.next; | |
| 2117 | + } | |
| 2118 | + }; | |
| 2119 | + return latest; | |
| 2120 | +} | |
| 2121 | + | |
| 2122 | +// node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs | |
| 2123 | +var React14 = __toESM(require_react(), 1); | |
| 2124 | + | |
| 2125 | +// node_modules/@base-ui/react/internals/useAnimationsFinished.mjs | |
| 2126 | +var ReactDOM = __toESM(require_react_dom(), 1); | |
| 2127 | + | |
| 2128 | +// node_modules/@base-ui/react/utils/resolveRef.mjs | |
| 2129 | +function resolveRef(maybeRef) { | |
| 2130 | + if (maybeRef == null) { | |
| 2131 | + return maybeRef; | |
| 2132 | + } | |
| 2133 | + return "current" in maybeRef ? maybeRef.current : maybeRef; | |
| 2134 | +} | |
| 2135 | + | |
| 2136 | +// node_modules/@base-ui/react/internals/useAnimationsFinished.mjs | |
| 2137 | +var pendingCallbacks = null; | |
| 2138 | +function flushBeforePaint(fn) { | |
| 2139 | + if (!pendingCallbacks) { | |
| 2140 | + const callbacks = []; | |
| 2141 | + pendingCallbacks = callbacks; | |
| 2142 | + queueMicrotask(() => { | |
| 2143 | + pendingCallbacks = null; | |
| 2144 | + ReactDOM.flushSync(() => { | |
| 2145 | + for (const callback of callbacks) { | |
| 2146 | + callback(); | |
| 2147 | + } | |
| 2148 | + }); | |
| 2149 | + }); | |
| 2150 | + } | |
| 2151 | + pendingCallbacks.push(fn); | |
| 2152 | +} | |
| 2153 | +function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, batch = false) { | |
| 2154 | + const frame = useAnimationFrame(); | |
| 2155 | + return useStableCallback((fnToExecute, signal = null) => { | |
| 2156 | + frame.cancel(); | |
| 2157 | + const element = resolveRef(elementOrRef); | |
| 2158 | + if (element == null) { | |
| 2159 | + return; | |
| 2160 | + } | |
| 2161 | + const resolvedElement = element; | |
| 2162 | + const done = () => { | |
| 2163 | + if (!batch) { | |
| 2164 | + ReactDOM.flushSync(fnToExecute); | |
| 2165 | + return; | |
| 2166 | + } | |
| 2167 | + flushBeforePaint(() => { | |
| 2168 | + if (!signal?.aborted) { | |
| 2169 | + fnToExecute(); | |
| 2170 | + } | |
| 2171 | + }); | |
| 139 | 2172 | }; |
| 2173 | + if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) { | |
| 2174 | + fnToExecute(); | |
| 2175 | + return; | |
| 2176 | + } | |
| 2177 | + function exec() { | |
| 2178 | + Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => { | |
| 2179 | + if (!signal?.aborted) { | |
| 2180 | + done(); | |
| 2181 | + } | |
| 2182 | + }, () => { | |
| 2183 | + if (signal?.aborted) { | |
| 2184 | + return; | |
| 2185 | + } | |
| 2186 | + const currentAnimations = resolvedElement.getAnimations(); | |
| 2187 | + if (currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) { | |
| 2188 | + exec(); | |
| 2189 | + return; | |
| 2190 | + } | |
| 2191 | + done(); | |
| 2192 | + }); | |
| 2193 | + } | |
| 2194 | + if (waitForStartingStyleRemoved) { | |
| 2195 | + const startingStyleAttribute = startingStyle; | |
| 2196 | + if (!resolvedElement.hasAttribute(startingStyleAttribute)) { | |
| 2197 | + frame.request(exec); | |
| 2198 | + return; | |
| 2199 | + } | |
| 2200 | + const attributeObserver = new MutationObserver(() => { | |
| 2201 | + if (!resolvedElement.hasAttribute(startingStyleAttribute)) { | |
| 2202 | + attributeObserver.disconnect(); | |
| 2203 | + exec(); | |
| 2204 | + } | |
| 2205 | + }); | |
| 2206 | + attributeObserver.observe(resolvedElement, { | |
| 2207 | + attributes: true, | |
| 2208 | + attributeFilter: [startingStyleAttribute] | |
| 2209 | + }); | |
| 2210 | + signal?.addEventListener("abort", () => attributeObserver.disconnect(), { | |
| 2211 | + once: true | |
| 2212 | + }); | |
| 2213 | + return; | |
| 2214 | + } | |
| 2215 | + frame.request(exec); | |
| 2216 | + }); | |
| 2217 | +} | |
| 2218 | + | |
| 2219 | +// node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs | |
| 2220 | +function useOpenChangeComplete(parameters) { | |
| 2221 | + const { | |
| 2222 | + enabled = true, | |
| 2223 | + open: open2, | |
| 2224 | + ref, | |
| 2225 | + batch = false, | |
| 2226 | + onComplete: onCompleteParam | |
| 2227 | + } = parameters; | |
| 2228 | + const onComplete = useStableCallback(onCompleteParam); | |
| 2229 | + const runOnceAnimationsFinish = useAnimationsFinished(ref, open2, batch); | |
| 2230 | + React14.useEffect(() => { | |
| 2231 | + if (!enabled) { | |
| 2232 | + return void 0; | |
| 2233 | + } | |
| 2234 | + const abortController = new AbortController(); | |
| 2235 | + runOnceAnimationsFinish(onComplete, abortController.signal); | |
| 2236 | + return () => { | |
| 2237 | + abortController.abort(); | |
| 2238 | + }; | |
| 2239 | + }, [enabled, open2, onComplete, runOnceAnimationsFinish]); | |
| 2240 | +} | |
| 2241 | + | |
| 2242 | +// node_modules/@base-ui/utils/platform/parts.mjs | |
| 2243 | +var parts_exports = {}; | |
| 2244 | +__export(parts_exports, { | |
| 2245 | + engine: () => engine_exports, | |
| 2246 | + env: () => env_exports, | |
| 2247 | + mediaQuery: () => media_query_exports, | |
| 2248 | + os: () => os_exports, | |
| 2249 | + screenReader: () => screen_reader_exports | |
| 2250 | +}); | |
| 2251 | + | |
| 2252 | +// node_modules/@base-ui/utils/platform/os.mjs | |
| 2253 | +var os_exports = {}; | |
| 2254 | +__export(os_exports, { | |
| 2255 | + android: () => android, | |
| 2256 | + apple: () => apple, | |
| 2257 | + ios: () => ios, | |
| 2258 | + linux: () => linux, | |
| 2259 | + mac: () => mac, | |
| 2260 | + windows: () => windows | |
| 2261 | +}); | |
| 2262 | + | |
| 2263 | +// node_modules/@base-ui/utils/platform/shared.mjs | |
| 2264 | +function readRawData() { | |
| 2265 | + if (typeof navigator === "undefined") { | |
| 2266 | + return { | |
| 2267 | + userAgent: "", | |
| 2268 | + platform: "", | |
| 2269 | + maxTouchPoints: 0 | |
| 2270 | + }; | |
| 140 | 2271 | } |
| 2272 | + if (true) { | |
| 2273 | + const uaData = navigator.userAgentData; | |
| 2274 | + if (uaData && Array.isArray(uaData.brands)) { | |
| 2275 | + return { | |
| 2276 | + userAgent: uaData.brands.map(({ | |
| 2277 | + brand, | |
| 2278 | + version: version2 | |
| 2279 | + }) => `${brand}/${version2}`).join(" "), | |
| 2280 | + platform: uaData.platform ?? navigator.platform ?? "", | |
| 2281 | + maxTouchPoints: navigator.maxTouchPoints ?? 0 | |
| 2282 | + }; | |
| 2283 | + } | |
| 2284 | + } | |
| 2285 | + return { | |
| 2286 | + userAgent: navigator.userAgent, | |
| 2287 | + platform: navigator.platform ?? "", | |
| 2288 | + maxTouchPoints: navigator.maxTouchPoints ?? 0 | |
| 2289 | + }; | |
| 2290 | +} | |
| 2291 | +var { | |
| 2292 | + userAgent, | |
| 2293 | + platform, | |
| 2294 | + maxTouchPoints | |
| 2295 | +} = readRawData(); | |
| 2296 | +var lowerUserAgent = userAgent.toLowerCase(); | |
| 2297 | +var lowerPlatform = platform.toLowerCase(); | |
| 2298 | + | |
| 2299 | +// node_modules/@base-ui/utils/platform/os.mjs | |
| 2300 | +var ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === "macintel" && maxTouchPoints > 1; | |
| 2301 | +var ANDROID_STRING = "android"; | |
| 2302 | +var android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING); | |
| 2303 | +var mac = !ios && lowerPlatform.startsWith("mac"); | |
| 2304 | +var windows = lowerPlatform.startsWith("win"); | |
| 2305 | +var linux = !android && /^(linux|chrome os)/.test(lowerPlatform); | |
| 2306 | +var apple = mac || ios; | |
| 2307 | + | |
| 2308 | +// node_modules/@base-ui/utils/platform/engine.mjs | |
| 2309 | +var engine_exports = {}; | |
| 2310 | +__export(engine_exports, { | |
| 2311 | + blink: () => blink, | |
| 2312 | + gecko: () => gecko, | |
| 2313 | + webkit: () => webkit | |
| 2314 | +}); | |
| 2315 | +var webkit = typeof CSS !== "undefined" && !!CSS.supports?.("-webkit-backdrop-filter:none"); | |
| 2316 | +var gecko = !webkit && lowerUserAgent.includes("firefox"); | |
| 2317 | +var blink = !webkit && lowerUserAgent.includes("chrom"); | |
| 2318 | + | |
| 2319 | +// node_modules/@base-ui/utils/platform/screen-reader.mjs | |
| 2320 | +var screen_reader_exports = {}; | |
| 2321 | +__export(screen_reader_exports, { | |
| 2322 | + voiceOver: () => voiceOver | |
| 2323 | +}); | |
| 2324 | +var voiceOver = apple; | |
| 2325 | + | |
| 2326 | +// node_modules/@base-ui/utils/platform/env.mjs | |
| 2327 | +var env_exports = {}; | |
| 2328 | +__export(env_exports, { | |
| 2329 | + jsdom: () => jsdom | |
| 2330 | +}); | |
| 2331 | +var jsdom = /jsdom|happydom/.test(lowerUserAgent); | |
| 2332 | + | |
| 2333 | +// node_modules/@base-ui/utils/platform/media-query.mjs | |
| 2334 | +var media_query_exports = {}; | |
| 2335 | +__export(media_query_exports, { | |
| 2336 | + iOS: () => iOS | |
| 2337 | +}); | |
| 2338 | +var iOS = "@supports (-webkit-touch-callout: none)"; | |
| 2339 | + | |
| 2340 | +// node_modules/@base-ui/utils/useTimeout.mjs | |
| 2341 | +var EMPTY2 = 0; | |
| 2342 | +var Timeout = class _Timeout { | |
| 2343 | + static create() { | |
| 2344 | + return new _Timeout(); | |
| 2345 | + } | |
| 2346 | + currentId = EMPTY2; | |
| 2347 | + /** | |
| 2348 | + * Executes `fn` after `delay`, clearing any previously scheduled call. | |
| 2349 | + */ | |
| 2350 | + start(delay, fn) { | |
| 2351 | + this.clear(); | |
| 2352 | + this.currentId = setTimeout(() => { | |
| 2353 | + this.currentId = EMPTY2; | |
| 2354 | + fn(); | |
| 2355 | + }, delay); | |
| 2356 | + } | |
| 2357 | + isStarted() { | |
| 2358 | + return this.currentId !== EMPTY2; | |
| 2359 | + } | |
| 2360 | + clear = () => { | |
| 2361 | + if (this.currentId !== EMPTY2) { | |
| 2362 | + clearTimeout(this.currentId); | |
| 2363 | + this.currentId = EMPTY2; | |
| 2364 | + } | |
| 2365 | + }; | |
| 2366 | + disposeEffect = () => { | |
| 2367 | + return this.clear; | |
| 2368 | + }; | |
| 2369 | +}; | |
| 2370 | +function useTimeout() { | |
| 2371 | + const timeout = useRefWithInit(Timeout.create).current; | |
| 2372 | + useOnMount(timeout.disposeEffect); | |
| 2373 | + return timeout; | |
| 2374 | +} | |
| 2375 | + | |
| 2376 | +// node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs | |
| 2377 | +var React15 = __toESM(require_react(), 1); | |
| 2378 | + | |
| 2379 | +// node_modules/@base-ui/react/floating-ui-react/utils/event.mjs | |
| 2380 | +function isReactEvent(event) { | |
| 2381 | + return "nativeEvent" in event; | |
| 2382 | +} | |
| 2383 | +function isVirtualClick(event) { | |
| 2384 | + if (event.pointerType === "" && event.isTrusted) { | |
| 2385 | + return true; | |
| 2386 | + } | |
| 2387 | + if (parts_exports.os.android && event.pointerType) { | |
| 2388 | + return event.type === "click" && event.buttons === 1; | |
| 2389 | + } | |
| 2390 | + return event.detail === 0 && !event.pointerType; | |
| 2391 | +} | |
| 2392 | +function isMouseLikePointerType(pointerType, strict) { | |
| 2393 | + const values = ["mouse", "pen"]; | |
| 2394 | + if (!strict) { | |
| 2395 | + values.push("", void 0); | |
| 2396 | + } | |
| 2397 | + return values.includes(pointerType); | |
| 2398 | +} | |
| 2399 | +function isClickLikeEvent(event) { | |
| 2400 | + const type = event.type; | |
| 2401 | + return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup"; | |
| 2402 | +} | |
| 2403 | + | |
| 2404 | +// node_modules/@base-ui/utils/shadowDom.mjs | |
| 2405 | +function activeElement(doc) { | |
| 2406 | + let element = doc.activeElement; | |
| 2407 | + while (element?.shadowRoot?.activeElement != null) { | |
| 2408 | + element = element.shadowRoot.activeElement; | |
| 2409 | + } | |
| 2410 | + return element; | |
| 2411 | +} | |
| 2412 | +function contains(parent, child) { | |
| 2413 | + if (!parent || !child) { | |
| 2414 | + return false; | |
| 2415 | + } | |
| 2416 | + const rootNode = child.getRootNode?.(); | |
| 2417 | + if (parent.contains(child)) { | |
| 2418 | + return true; | |
| 2419 | + } | |
| 2420 | + if (rootNode && isShadowRoot(rootNode)) { | |
| 2421 | + let next = child; | |
| 2422 | + while (next) { | |
| 2423 | + if (parent === next) { | |
| 2424 | + return true; | |
| 2425 | + } | |
| 2426 | + next = next.parentNode || next.host; | |
| 2427 | + } | |
| 2428 | + } | |
| 2429 | + return false; | |
| 2430 | +} | |
| 2431 | +function getTarget(event) { | |
| 2432 | + if ("composedPath" in event) { | |
| 2433 | + return event.composedPath()[0] ?? event.target; | |
| 2434 | + } | |
| 2435 | + return event.target; | |
| 2436 | +} | |
| 2437 | + | |
| 2438 | +// node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs | |
| 2439 | +var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable"; | |
| 2440 | +var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; | |
| 2441 | + | |
| 2442 | +// node_modules/@base-ui/react/utils/CommonPopupDataAttributes.mjs | |
| 2443 | +var open = "data-open"; | |
| 2444 | +var closed = "data-closed"; | |
| 2445 | +var anchorHidden = "data-anchor-hidden"; | |
| 2446 | + | |
| 2447 | +// node_modules/@base-ui/react/utils/CommonTriggerDataAttributes.mjs | |
| 2448 | +var CommonTriggerDataAttributes_exports = {}; | |
| 2449 | +__export(CommonTriggerDataAttributes_exports, { | |
| 2450 | + popupOpen: () => popupOpen, | |
| 2451 | + pressed: () => pressed | |
| 2452 | +}); | |
| 2453 | +var popupOpen = "data-popup-open"; | |
| 2454 | +var pressed = "data-pressed"; | |
| 2455 | + | |
| 2456 | +// node_modules/@base-ui/react/utils/popupStateMapping.mjs | |
| 2457 | +var TRIGGER_HOOK = { | |
| 2458 | + [popupOpen]: "" | |
| 2459 | +}; | |
| 2460 | +var PRESSABLE_TRIGGER_HOOK = { | |
| 2461 | + [popupOpen]: "", | |
| 2462 | + [pressed]: "" | |
| 2463 | +}; | |
| 2464 | +var POPUP_OPEN_HOOK = { | |
| 2465 | + [open]: "" | |
| 2466 | +}; | |
| 2467 | +var POPUP_CLOSED_HOOK = { | |
| 2468 | + [closed]: "" | |
| 2469 | +}; | |
| 2470 | +var ANCHOR_HIDDEN_HOOK = { | |
| 2471 | + [anchorHidden]: "" | |
| 2472 | +}; | |
| 2473 | +var triggerOpenStateMapping = { | |
| 2474 | + open(value) { | |
| 2475 | + if (value) { | |
| 2476 | + return TRIGGER_HOOK; | |
| 2477 | + } | |
| 2478 | + return null; | |
| 2479 | + } | |
| 2480 | +}; | |
| 2481 | +var popupStateMapping = { | |
| 2482 | + open(value) { | |
| 2483 | + if (value) { | |
| 2484 | + return POPUP_OPEN_HOOK; | |
| 2485 | + } | |
| 2486 | + return POPUP_CLOSED_HOOK; | |
| 2487 | + }, | |
| 2488 | + anchorHidden(value) { | |
| 2489 | + if (value) { | |
| 2490 | + return ANCHOR_HIDDEN_HOOK; | |
| 2491 | + } | |
| 2492 | + return null; | |
| 2493 | + } | |
| 2494 | +}; | |
| 2495 | +var popupTransitionStateMapping = { | |
| 2496 | + ...popupStateMapping, | |
| 2497 | + ...transitionStatusMapping | |
| 2498 | +}; | |
| 2499 | + | |
| 2500 | +// node_modules/@base-ui/react/tooltip/trigger/TooltipTriggerDataAttributes.mjs | |
| 2501 | +var popupOpen2 = CommonTriggerDataAttributes_exports.popupOpen; | |
| 2502 | +var triggerDisabled = "data-trigger-disabled"; | |
| 2503 | + | |
| 2504 | +// node_modules/@base-ui/react/floating-ui-react/utils/element.mjs | |
| 2505 | +function isTargetInsideEnabledTrigger(target, triggerElements) { | |
| 2506 | + if (!isElement(target)) { | |
| 2507 | + return false; | |
| 2508 | + } | |
| 2509 | + const targetElement = target; | |
| 2510 | + if (triggerElements.hasElement(targetElement)) { | |
| 2511 | + return !targetElement.hasAttribute(triggerDisabled); | |
| 2512 | + } | |
| 2513 | + for (const [, trigger] of triggerElements.entries()) { | |
| 2514 | + if (contains(trigger, targetElement)) { | |
| 2515 | + return !trigger.hasAttribute(triggerDisabled); | |
| 2516 | + } | |
| 2517 | + } | |
| 2518 | + return false; | |
| 2519 | +} | |
| 2520 | +function isEventTargetWithin(event, node) { | |
| 2521 | + if (node == null) { | |
| 2522 | + return false; | |
| 2523 | + } | |
| 2524 | + if ("composedPath" in event) { | |
| 2525 | + return event.composedPath().includes(node); | |
| 2526 | + } | |
| 2527 | + const eventAgain = event; | |
| 2528 | + return eventAgain.target != null && node.contains(eventAgain.target); | |
| 2529 | +} | |
| 2530 | +function isRootElement(element) { | |
| 2531 | + return element.matches("html,body"); | |
| 2532 | +} | |
| 2533 | +function isTypeableElement(element) { | |
| 2534 | + return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR); | |
| 2535 | +} | |
| 2536 | +function isInteractiveElement(element) { | |
| 2537 | + return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${TYPEABLE_SELECTOR}`) != null; | |
| 2538 | +} | |
| 2539 | +function matchesFocusVisible(element) { | |
| 2540 | + if (!element || parts_exports.env.jsdom) { | |
| 2541 | + return true; | |
| 2542 | + } | |
| 2543 | + try { | |
| 2544 | + return element.matches(":focus-visible"); | |
| 2545 | + } catch (_e) { | |
| 2546 | + return true; | |
| 2547 | + } | |
| 2548 | +} | |
| 2549 | + | |
| 2550 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs | |
| 2551 | +function resolveValue(value, pointerType) { | |
| 2552 | + if (pointerType != null && !isMouseLikePointerType(pointerType)) { | |
| 2553 | + return 0; | |
| 2554 | + } | |
| 2555 | + if (typeof value === "function") { | |
| 2556 | + return value(); | |
| 2557 | + } | |
| 2558 | + return value; | |
| 2559 | +} | |
| 2560 | +function getDelay(value, prop, pointerType) { | |
| 2561 | + const result = resolveValue(value, pointerType); | |
| 2562 | + if (typeof result === "number") { | |
| 2563 | + return result; | |
| 2564 | + } | |
| 2565 | + return result?.[prop]; | |
| 2566 | +} | |
| 2567 | +function getRestMs(value) { | |
| 2568 | + if (typeof value === "function") { | |
| 2569 | + return value(); | |
| 2570 | + } | |
| 2571 | + return value; | |
| 2572 | +} | |
| 2573 | +function isClickLikeOpenEvent(openEventType, interactedInside) { | |
| 2574 | + return interactedInside || openEventType === "click" || openEventType === "mousedown"; | |
| 2575 | +} | |
| 2576 | +function isHoverOpenEvent(openEventType) { | |
| 2577 | + return openEventType?.includes("mouse") && openEventType !== "mousedown"; | |
| 2578 | +} | |
| 2579 | + | |
| 2580 | +// node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs | |
| 2581 | +var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); | |
| 2582 | +var FloatingDelayGroupContext = /* @__PURE__ */ React15.createContext({ | |
| 2583 | + hasProvider: false, | |
| 2584 | + timeoutMs: 0, | |
| 2585 | + delayRef: { | |
| 2586 | + current: 0 | |
| 2587 | + }, | |
| 2588 | + initialDelayRef: { | |
| 2589 | + current: 0 | |
| 2590 | + }, | |
| 2591 | + timeout: new Timeout(), | |
| 2592 | + currentIdRef: { | |
| 2593 | + current: null | |
| 2594 | + }, | |
| 2595 | + currentContextRef: { | |
| 2596 | + current: null | |
| 2597 | + } | |
| 2598 | +}); | |
| 2599 | +if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext"; | |
| 2600 | +function resetDelayRef(delayRef, initialDelayRef) { | |
| 2601 | + delayRef.current = initialDelayRef.current; | |
| 2602 | +} | |
| 2603 | +function FloatingDelayGroup(props) { | |
| 2604 | + const { | |
| 2605 | + children, | |
| 2606 | + delay, | |
| 2607 | + timeoutMs = 0 | |
| 2608 | + } = props; | |
| 2609 | + const delayRef = React15.useRef(delay); | |
| 2610 | + const initialDelayRef = React15.useRef(delay); | |
| 2611 | + const currentIdRef = React15.useRef(null); | |
| 2612 | + const currentContextRef = React15.useRef(null); | |
| 2613 | + const timeout = useTimeout(); | |
| 2614 | + useIsoLayoutEffect(() => { | |
| 2615 | + initialDelayRef.current = delay; | |
| 2616 | + if (!currentIdRef.current) { | |
| 2617 | + delayRef.current = delay; | |
| 2618 | + return; | |
| 2619 | + } | |
| 2620 | + delayRef.current = { | |
| 2621 | + open: getDelay(delayRef.current, "open"), | |
| 2622 | + close: getDelay(delay, "close") | |
| 2623 | + }; | |
| 2624 | + }, [delay, currentIdRef, delayRef, initialDelayRef]); | |
| 2625 | + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FloatingDelayGroupContext.Provider, { | |
| 2626 | + value: React15.useMemo(() => ({ | |
| 2627 | + hasProvider: true, | |
| 2628 | + delayRef, | |
| 2629 | + initialDelayRef, | |
| 2630 | + currentIdRef, | |
| 2631 | + timeoutMs, | |
| 2632 | + currentContextRef, | |
| 2633 | + timeout | |
| 2634 | + }), [timeoutMs, timeout]), | |
| 2635 | + children | |
| 2636 | + }); | |
| 2637 | +} | |
| 2638 | +function useDelayGroup(context, options = { | |
| 2639 | + open: false | |
| 2640 | +}) { | |
| 2641 | + const { | |
| 2642 | + open: open2 | |
| 2643 | + } = options; | |
| 2644 | + const store = "rootStore" in context ? context.rootStore : context; | |
| 2645 | + const floatingId = store.useState("floatingId"); | |
| 2646 | + const groupContext = React15.useContext(FloatingDelayGroupContext); | |
| 2647 | + const { | |
| 2648 | + currentIdRef, | |
| 2649 | + delayRef, | |
| 2650 | + timeoutMs, | |
| 2651 | + initialDelayRef, | |
| 2652 | + currentContextRef, | |
| 2653 | + hasProvider, | |
| 2654 | + timeout | |
| 2655 | + } = groupContext; | |
| 2656 | + const [isInstantPhase, setIsInstantPhase] = React15.useState(false); | |
| 2657 | + const openRef = React15.useRef(open2); | |
| 2658 | + useIsoLayoutEffect(() => { | |
| 2659 | + openRef.current = open2; | |
| 2660 | + }, [open2]); | |
| 2661 | + useIsoLayoutEffect(() => { | |
| 2662 | + function unset() { | |
| 2663 | + currentContextRef.current?.setIsInstantPhase(false); | |
| 2664 | + currentIdRef.current = null; | |
| 2665 | + currentContextRef.current = null; | |
| 2666 | + delayRef.current = initialDelayRef.current; | |
| 2667 | + timeout.clear(); | |
| 2668 | + } | |
| 2669 | + if (!currentIdRef.current) { | |
| 2670 | + return void 0; | |
| 2671 | + } | |
| 2672 | + if (!open2 && currentIdRef.current === floatingId) { | |
| 2673 | + setIsInstantPhase(false); | |
| 2674 | + if (timeoutMs) { | |
| 2675 | + const closingId = floatingId; | |
| 2676 | + timeout.start(timeoutMs, () => { | |
| 2677 | + if (store.select("open") || currentIdRef.current && currentIdRef.current !== closingId) { | |
| 2678 | + return; | |
| 2679 | + } | |
| 2680 | + unset(); | |
| 2681 | + }); | |
| 2682 | + return () => { | |
| 2683 | + if (openRef.current || currentIdRef.current !== closingId) { | |
| 2684 | + timeout.clear(); | |
| 2685 | + } | |
| 2686 | + }; | |
| 2687 | + } | |
| 2688 | + unset(); | |
| 2689 | + } | |
| 2690 | + return void 0; | |
| 2691 | + }, [open2, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store]); | |
| 2692 | + useIsoLayoutEffect(() => { | |
| 2693 | + if (!open2) { | |
| 2694 | + return; | |
| 2695 | + } | |
| 2696 | + const prevContext = currentContextRef.current; | |
| 2697 | + const prevId = currentIdRef.current; | |
| 2698 | + timeout.clear(); | |
| 2699 | + currentContextRef.current = { | |
| 2700 | + onOpenChange: store.setOpen, | |
| 2701 | + setIsInstantPhase | |
| 2702 | + }; | |
| 2703 | + currentIdRef.current = floatingId; | |
| 2704 | + delayRef.current = { | |
| 2705 | + open: 0, | |
| 2706 | + close: getDelay(initialDelayRef.current, "close") | |
| 2707 | + }; | |
| 2708 | + if (prevId !== null && prevId !== floatingId) { | |
| 2709 | + setIsInstantPhase(true); | |
| 2710 | + prevContext?.setIsInstantPhase(true); | |
| 2711 | + prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none)); | |
| 2712 | + } else { | |
| 2713 | + setIsInstantPhase(false); | |
| 2714 | + prevContext?.setIsInstantPhase(false); | |
| 2715 | + } | |
| 2716 | + }, [open2, floatingId, store, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]); | |
| 2717 | + useIsoLayoutEffect(() => { | |
| 2718 | + return () => { | |
| 2719 | + if (currentIdRef.current === floatingId) { | |
| 2720 | + currentContextRef.current = null; | |
| 2721 | + if (!openRef.current) { | |
| 2722 | + return; | |
| 2723 | + } | |
| 2724 | + currentIdRef.current = null; | |
| 2725 | + resetDelayRef(delayRef, initialDelayRef); | |
| 2726 | + timeout.clear(); | |
| 2727 | + } | |
| 2728 | + }; | |
| 2729 | + }, [currentContextRef, currentIdRef, delayRef, floatingId, initialDelayRef, timeout]); | |
| 2730 | + return React15.useMemo(() => ({ | |
| 2731 | + activeIdRef: currentIdRef, | |
| 2732 | + hasProvider, | |
| 2733 | + delayRef, | |
| 2734 | + isInstantPhase | |
| 2735 | + }), [currentIdRef, hasProvider, delayRef, isInstantPhase]); | |
| 2736 | +} | |
| 2737 | + | |
| 2738 | +// node_modules/@base-ui/utils/mergeCleanups.mjs | |
| 2739 | +function mergeCleanups(...cleanups) { | |
| 2740 | + return () => { | |
| 2741 | + for (let i = 0; i < cleanups.length; i += 1) { | |
| 2742 | + const cleanup = cleanups[i]; | |
| 2743 | + if (cleanup) { | |
| 2744 | + cleanup(); | |
| 2745 | + } | |
| 2746 | + } | |
| 2747 | + }; | |
| 2748 | +} | |
| 2749 | + | |
| 2750 | +// node_modules/@base-ui/react/utils/FocusGuard.mjs | |
| 2751 | +var React16 = __toESM(require_react(), 1); | |
| 2752 | + | |
| 2753 | +// node_modules/@base-ui/utils/visuallyHidden.mjs | |
| 2754 | +var visuallyHiddenBase = { | |
| 2755 | + clipPath: "inset(50%)", | |
| 2756 | + overflow: "hidden", | |
| 2757 | + whiteSpace: "nowrap", | |
| 2758 | + border: 0, | |
| 2759 | + padding: 0, | |
| 2760 | + width: 1, | |
| 2761 | + height: 1, | |
| 2762 | + margin: -1 | |
| 2763 | +}; | |
| 2764 | +var visuallyHidden = { | |
| 2765 | + ...visuallyHiddenBase, | |
| 2766 | + position: "fixed", | |
| 2767 | + top: 0, | |
| 2768 | + left: 0 | |
| 2769 | +}; | |
| 2770 | +var visuallyHiddenInput = { | |
| 2771 | + ...visuallyHiddenBase, | |
| 2772 | + position: "absolute" | |
| 2773 | +}; | |
| 2774 | + | |
| 2775 | +// node_modules/@base-ui/react/utils/FocusGuard.mjs | |
| 2776 | +var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); | |
| 2777 | +var FocusGuard = /* @__PURE__ */ React16.forwardRef(function FocusGuard2(props, ref) { | |
| 2778 | + const [role, setRole] = React16.useState(); | |
| 2779 | + useIsoLayoutEffect(() => { | |
| 2780 | + if (parts_exports.screenReader.voiceOver && parts_exports.engine.webkit) { | |
| 2781 | + setRole("button"); | |
| 2782 | + } | |
| 2783 | + }, []); | |
| 2784 | + const restProps = { | |
| 2785 | + tabIndex: 0, | |
| 2786 | + // Role is only for VoiceOver | |
| 2787 | + role | |
| 2788 | + }; | |
| 2789 | + return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { | |
| 2790 | + ...props, | |
| 2791 | + ref, | |
| 2792 | + style: visuallyHidden, | |
| 2793 | + "aria-hidden": role ? void 0 : true, | |
| 2794 | + ...restProps, | |
| 2795 | + "data-base-ui-focus-guard": "" | |
| 2796 | + }); | |
| 2797 | +}); | |
| 2798 | +if (true) FocusGuard.displayName = "FocusGuard"; | |
| 2799 | + | |
| 2800 | +// node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs | |
| 2801 | +var min = Math.min; | |
| 2802 | +var max = Math.max; | |
| 2803 | +var round = Math.round; | |
| 2804 | +var floor = Math.floor; | |
| 2805 | +var createCoords = (v2) => ({ | |
| 2806 | + x: v2, | |
| 2807 | + y: v2 | |
| 2808 | +}); | |
| 2809 | +var oppositeSideMap = { | |
| 2810 | + left: "right", | |
| 2811 | + right: "left", | |
| 2812 | + bottom: "top", | |
| 2813 | + top: "bottom" | |
| 2814 | +}; | |
| 2815 | +function clamp(start, value, end) { | |
| 2816 | + return max(start, min(value, end)); | |
| 2817 | +} | |
| 2818 | +function evaluate(value, param) { | |
| 2819 | + return typeof value === "function" ? value(param) : value; | |
| 2820 | +} | |
| 2821 | +function getSide(placement) { | |
| 2822 | + return placement.split("-")[0]; | |
| 2823 | +} | |
| 2824 | +function getAlignment(placement) { | |
| 2825 | + return placement.split("-")[1]; | |
| 2826 | +} | |
| 2827 | +function getOppositeAxis(axis) { | |
| 2828 | + return axis === "x" ? "y" : "x"; | |
| 2829 | +} | |
| 2830 | +function getAxisLength(axis) { | |
| 2831 | + return axis === "y" ? "height" : "width"; | |
| 2832 | +} | |
| 2833 | +function getSideAxis(placement) { | |
| 2834 | + const firstChar = placement[0]; | |
| 2835 | + return firstChar === "t" || firstChar === "b" ? "y" : "x"; | |
| 2836 | +} | |
| 2837 | +function getAlignmentAxis(placement) { | |
| 2838 | + return getOppositeAxis(getSideAxis(placement)); | |
| 2839 | +} | |
| 2840 | +function getAlignmentSides(placement, rects, rtl) { | |
| 2841 | + if (rtl === void 0) { | |
| 2842 | + rtl = false; | |
| 2843 | + } | |
| 2844 | + const alignment = getAlignment(placement); | |
| 2845 | + const alignmentAxis = getAlignmentAxis(placement); | |
| 2846 | + const length = getAxisLength(alignmentAxis); | |
| 2847 | + let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; | |
| 2848 | + if (rects.reference[length] > rects.floating[length]) { | |
| 2849 | + mainAlignmentSide = getOppositePlacement(mainAlignmentSide); | |
| 2850 | + } | |
| 2851 | + return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; | |
| 2852 | +} | |
| 2853 | +function getExpandedPlacements(placement) { | |
| 2854 | + const oppositePlacement = getOppositePlacement(placement); | |
| 2855 | + return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; | |
| 2856 | +} | |
| 2857 | +function getOppositeAlignmentPlacement(placement) { | |
| 2858 | + return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start"); | |
| 2859 | +} | |
| 2860 | +var lrPlacement = ["left", "right"]; | |
| 2861 | +var rlPlacement = ["right", "left"]; | |
| 2862 | +var tbPlacement = ["top", "bottom"]; | |
| 2863 | +var btPlacement = ["bottom", "top"]; | |
| 2864 | +function getSideList(side, isStart, rtl) { | |
| 2865 | + switch (side) { | |
| 2866 | + case "top": | |
| 2867 | + case "bottom": | |
| 2868 | + if (rtl) return isStart ? rlPlacement : lrPlacement; | |
| 2869 | + return isStart ? lrPlacement : rlPlacement; | |
| 2870 | + case "left": | |
| 2871 | + case "right": | |
| 2872 | + return isStart ? tbPlacement : btPlacement; | |
| 2873 | + default: | |
| 2874 | + return []; | |
| 2875 | + } | |
| 2876 | +} | |
| 2877 | +function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { | |
| 2878 | + const alignment = getAlignment(placement); | |
| 2879 | + let list = getSideList(getSide(placement), direction === "start", rtl); | |
| 2880 | + if (alignment) { | |
| 2881 | + list = list.map((side) => side + "-" + alignment); | |
| 2882 | + if (flipAlignment) { | |
| 2883 | + list = list.concat(list.map(getOppositeAlignmentPlacement)); | |
| 2884 | + } | |
| 2885 | + } | |
| 2886 | + return list; | |
| 2887 | +} | |
| 2888 | +function getOppositePlacement(placement) { | |
| 2889 | + const side = getSide(placement); | |
| 2890 | + return oppositeSideMap[side] + placement.slice(side.length); | |
| 2891 | +} | |
| 2892 | +function expandPaddingObject(padding) { | |
| 2893 | + var _padding$top, _padding$right, _padding$bottom, _padding$left; | |
| 2894 | + return { | |
| 2895 | + top: (_padding$top = padding.top) != null ? _padding$top : 0, | |
| 2896 | + right: (_padding$right = padding.right) != null ? _padding$right : 0, | |
| 2897 | + bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0, | |
| 2898 | + left: (_padding$left = padding.left) != null ? _padding$left : 0 | |
| 2899 | + }; | |
| 2900 | +} | |
| 2901 | +function getPaddingObject(padding) { | |
| 2902 | + return typeof padding !== "number" ? expandPaddingObject(padding) : { | |
| 2903 | + top: padding, | |
| 2904 | + right: padding, | |
| 2905 | + bottom: padding, | |
| 2906 | + left: padding | |
| 2907 | + }; | |
| 2908 | +} | |
| 2909 | +function rectToClientRect(rect) { | |
| 2910 | + const { | |
| 2911 | + x: x2, | |
| 2912 | + y: y2, | |
| 2913 | + width, | |
| 2914 | + height | |
| 2915 | + } = rect; | |
| 2916 | + return { | |
| 2917 | + width, | |
| 2918 | + height, | |
| 2919 | + top: y2, | |
| 2920 | + left: x2, | |
| 2921 | + right: x2 + width, | |
| 2922 | + bottom: y2 + height, | |
| 2923 | + x: x2, | |
| 2924 | + y: y2 | |
| 2925 | + }; | |
| 2926 | +} | |
| 2927 | + | |
| 2928 | +// node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs | |
| 2929 | +function isHiddenByStyles(styles) { | |
| 2930 | + return styles.visibility === "hidden" || styles.visibility === "collapse"; | |
| 2931 | +} | |
| 2932 | +function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) { | |
| 2933 | + if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) { | |
| 2934 | + return false; | |
| 2935 | + } | |
| 2936 | + if (typeof element.checkVisibility === "function") { | |
| 2937 | + return element.checkVisibility(); | |
| 2938 | + } | |
| 2939 | + return styles.display !== "none" && styles.display !== "contents"; | |
| 2940 | +} | |
| 2941 | + | |
| 2942 | +// node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs | |
| 2943 | +var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]'; | |
| 2944 | +function getParentElement(element) { | |
| 2945 | + const assignedSlot = element.assignedSlot; | |
| 2946 | + if (assignedSlot) { | |
| 2947 | + return assignedSlot; | |
| 2948 | + } | |
| 2949 | + if (element.parentElement) { | |
| 2950 | + return element.parentElement; | |
| 2951 | + } | |
| 2952 | + const rootNode = element.getRootNode(); | |
| 2953 | + return isShadowRoot(rootNode) ? rootNode.host : null; | |
| 2954 | +} | |
| 2955 | +function getDetailsSummary(details) { | |
| 2956 | + for (const child of Array.from(details.children)) { | |
| 2957 | + if (getNodeName(child) === "summary") { | |
| 2958 | + return child; | |
| 2959 | + } | |
| 2960 | + } | |
| 2961 | + return null; | |
| 2962 | +} | |
| 2963 | +function isWithinOpenDetailsSummary(element, details) { | |
| 2964 | + const summary = getDetailsSummary(details); | |
| 2965 | + return !!summary && (element === summary || contains(summary, element)); | |
| 2966 | +} | |
| 2967 | +function isFocusableCandidate(element) { | |
| 2968 | + const nodeName = element ? getNodeName(element) : ""; | |
| 2969 | + 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"); | |
| 2970 | +} | |
| 2971 | +function isFocusableElement(element) { | |
| 2972 | + if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) { | |
| 2973 | + return false; | |
| 2974 | + } | |
| 2975 | + for (let current = element; current; current = getParentElement(current)) { | |
| 2976 | + const isAncestor = current !== element; | |
| 2977 | + const isSlot = getNodeName(current) === "slot"; | |
| 2978 | + if (current.hasAttribute("inert")) { | |
| 2979 | + return false; | |
| 2980 | + } | |
| 2981 | + if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) { | |
| 2982 | + return false; | |
| 2983 | + } | |
| 2984 | + } | |
| 2985 | + return true; | |
| 2986 | +} | |
| 2987 | +function isVisibleInTabbableTree(element, isAncestor) { | |
| 2988 | + const styles = getComputedStyle2(element); | |
| 2989 | + if (!isAncestor) { | |
| 2990 | + return isElementVisible(element, styles); | |
| 2991 | + } | |
| 2992 | + return styles.display !== "none"; | |
| 2993 | +} | |
| 2994 | +function getTabIndex(element) { | |
| 2995 | + const tabIndex = element.tabIndex; | |
| 2996 | + if (tabIndex < 0) { | |
| 2997 | + const nodeName = getNodeName(element); | |
| 2998 | + if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) { | |
| 2999 | + return 0; | |
| 3000 | + } | |
| 3001 | + } | |
| 3002 | + return tabIndex; | |
| 3003 | +} | |
| 3004 | +function getNamedRadioInput(element) { | |
| 3005 | + if (getNodeName(element) !== "input") { | |
| 3006 | + return null; | |
| 3007 | + } | |
| 3008 | + const input = element; | |
| 3009 | + return input.type === "radio" && input.name !== "" ? input : null; | |
| 3010 | +} | |
| 3011 | +function isTabbableRadio(element, candidates) { | |
| 3012 | + const input = getNamedRadioInput(element); | |
| 3013 | + if (!input) { | |
| 3014 | + return true; | |
| 3015 | + } | |
| 3016 | + const checkedRadio = candidates.find((candidate) => { | |
| 3017 | + const radio = getNamedRadioInput(candidate); | |
| 3018 | + return radio?.name === input.name && radio.form === input.form && radio.checked; | |
| 3019 | + }); | |
| 3020 | + if (checkedRadio) { | |
| 3021 | + return checkedRadio === input; | |
| 3022 | + } | |
| 3023 | + return candidates.find((candidate) => { | |
| 3024 | + const radio = getNamedRadioInput(candidate); | |
| 3025 | + return radio?.name === input.name && radio.form === input.form; | |
| 3026 | + }) === input; | |
| 3027 | +} | |
| 3028 | +function getComposedChildren(container) { | |
| 3029 | + if (isHTMLElement(container) && getNodeName(container) === "slot") { | |
| 3030 | + const assignedElements = container.assignedElements({ | |
| 3031 | + flatten: true | |
| 3032 | + }); | |
| 3033 | + if (assignedElements.length > 0) { | |
| 3034 | + return assignedElements; | |
| 3035 | + } | |
| 3036 | + } | |
| 3037 | + if (isHTMLElement(container) && container.shadowRoot) { | |
| 3038 | + return Array.from(container.shadowRoot.children); | |
| 3039 | + } | |
| 3040 | + return Array.from(container.children); | |
| 3041 | +} | |
| 3042 | +function appendCandidates(container, list) { | |
| 3043 | + getComposedChildren(container).forEach((child) => { | |
| 3044 | + if (isFocusableCandidate(child)) { | |
| 3045 | + list.push(child); | |
| 3046 | + } | |
| 3047 | + appendCandidates(child, list); | |
| 3048 | + }); | |
| 3049 | +} | |
| 3050 | +function appendMatchingElements(container, selector, list) { | |
| 3051 | + getComposedChildren(container).forEach((child) => { | |
| 3052 | + if (isHTMLElement(child) && child.matches(selector)) { | |
| 3053 | + list.push(child); | |
| 3054 | + } | |
| 3055 | + appendMatchingElements(child, selector, list); | |
| 3056 | + }); | |
| 3057 | +} | |
| 3058 | +function focusable(container) { | |
| 3059 | + const candidates = []; | |
| 3060 | + appendCandidates(container, candidates); | |
| 3061 | + return candidates.filter(isFocusableElement); | |
| 3062 | +} | |
| 3063 | +function tabbable(container) { | |
| 3064 | + const candidates = focusable(container); | |
| 3065 | + return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates)); | |
| 3066 | +} | |
| 3067 | +function getTabbableIn(container, dir) { | |
| 3068 | + const list = tabbable(container); | |
| 3069 | + const len = list.length; | |
| 3070 | + if (len === 0) { | |
| 3071 | + return void 0; | |
| 3072 | + } | |
| 3073 | + const active = activeElement(ownerDocument(container)); | |
| 3074 | + const index2 = list.indexOf(active); | |
| 3075 | + const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir; | |
| 3076 | + return list[nextIndex]; | |
| 3077 | +} | |
| 3078 | +function getNextTabbable(referenceElement) { | |
| 3079 | + return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement; | |
| 3080 | +} | |
| 3081 | +function getPreviousTabbable(referenceElement) { | |
| 3082 | + return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement; | |
| 3083 | +} | |
| 3084 | +function isOutsideEvent(event, container) { | |
| 3085 | + const containerElement = container || event.currentTarget; | |
| 3086 | + const relatedTarget = event.relatedTarget; | |
| 3087 | + return !relatedTarget || !contains(containerElement, relatedTarget); | |
| 3088 | +} | |
| 3089 | +function disableFocusInside(container) { | |
| 3090 | + const tabbableElements = tabbable(container); | |
| 3091 | + tabbableElements.forEach((element) => { | |
| 3092 | + element.dataset.tabindex = element.getAttribute("tabindex") || ""; | |
| 3093 | + element.setAttribute("tabindex", "-1"); | |
| 3094 | + }); | |
| 3095 | +} | |
| 3096 | +function enableFocusInside(container) { | |
| 3097 | + const elements = []; | |
| 3098 | + appendMatchingElements(container, "[data-tabindex]", elements); | |
| 3099 | + elements.forEach((element) => { | |
| 3100 | + const tabindex = element.dataset.tabindex; | |
| 3101 | + delete element.dataset.tabindex; | |
| 3102 | + if (tabindex) { | |
| 3103 | + element.setAttribute("tabindex", tabindex); | |
| 3104 | + } else { | |
| 3105 | + element.removeAttribute("tabindex"); | |
| 3106 | + } | |
| 3107 | + }); | |
| 3108 | +} | |
| 3109 | + | |
| 3110 | +// node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs | |
| 3111 | +function getNodeChildren(nodes, id, onlyOpenChildren = true) { | |
| 3112 | + const directChildren = nodes.filter((node) => node.parentId === id); | |
| 3113 | + return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]); | |
| 3114 | +} | |
| 3115 | + | |
| 3116 | +// node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs | |
| 3117 | +function createAttribute(name) { | |
| 3118 | + return `data-base-ui-${name}`; | |
| 3119 | +} | |
| 3120 | + | |
| 3121 | +// node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs | |
| 3122 | +var React17 = __toESM(require_react(), 1); | |
| 3123 | +var ReactDOM2 = __toESM(require_react_dom(), 1); | |
| 3124 | + | |
| 3125 | +// node_modules/@base-ui/react/internals/constants.mjs | |
| 3126 | +var DISABLED_TRANSITIONS_STYLE = { | |
| 3127 | + style: { | |
| 3128 | + transition: "none" | |
| 3129 | + } | |
| 3130 | +}; | |
| 3131 | +var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore"; | |
| 3132 | +var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore"; | |
| 3133 | +var BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`; | |
| 3134 | +var LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`; | |
| 3135 | +var POPUP_COLLISION_AVOIDANCE = { | |
| 3136 | + fallbackAxisSide: "end" | |
| 3137 | +}; | |
| 3138 | +var ownerVisuallyHidden = { | |
| 3139 | + clipPath: "inset(50%)", | |
| 3140 | + position: "fixed", | |
| 3141 | + top: 0, | |
| 3142 | + left: 0 | |
| 3143 | +}; | |
| 3144 | + | |
| 3145 | +// node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs | |
| 3146 | +var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); | |
| 3147 | +var PortalContext = /* @__PURE__ */ React17.createContext(null); | |
| 3148 | +if (true) PortalContext.displayName = "PortalContext"; | |
| 3149 | +var usePortalContext = () => React17.useContext(PortalContext); | |
| 3150 | +var attr = createAttribute("portal"); | |
| 3151 | +function useFloatingPortalNode(props = {}) { | |
| 3152 | + const { | |
| 3153 | + ref, | |
| 3154 | + container: containerProp, | |
| 3155 | + componentProps = EMPTY_OBJECT, | |
| 3156 | + elementProps | |
| 3157 | + } = props; | |
| 3158 | + const uniqueId = useId(); | |
| 3159 | + const portalContext = usePortalContext(); | |
| 3160 | + const parentPortalNode = portalContext?.portalNode; | |
| 3161 | + const [containerElement, setContainerElement] = React17.useState(null); | |
| 3162 | + const [portalNode, setPortalNode] = React17.useState(null); | |
| 3163 | + const setPortalNodeRef = useStableCallback((node) => { | |
| 3164 | + if (node !== null) { | |
| 3165 | + setPortalNode(node); | |
| 3166 | + } | |
| 3167 | + }); | |
| 3168 | + const containerRef = React17.useRef(null); | |
| 3169 | + useIsoLayoutEffect(() => { | |
| 3170 | + if (containerProp === null) { | |
| 3171 | + if (containerRef.current) { | |
| 3172 | + containerRef.current = null; | |
| 3173 | + setPortalNode(null); | |
| 3174 | + setContainerElement(null); | |
| 3175 | + } | |
| 3176 | + return; | |
| 3177 | + } | |
| 3178 | + const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body; | |
| 3179 | + if (resolvedContainer == null) { | |
| 3180 | + if (containerRef.current) { | |
| 3181 | + containerRef.current = null; | |
| 3182 | + setPortalNode(null); | |
| 3183 | + setContainerElement(null); | |
| 3184 | + } | |
| 3185 | + return; | |
| 3186 | + } | |
| 3187 | + if (containerRef.current !== resolvedContainer) { | |
| 3188 | + containerRef.current = resolvedContainer; | |
| 3189 | + setPortalNode(null); | |
| 3190 | + setContainerElement(resolvedContainer); | |
| 3191 | + } | |
| 3192 | + }, [containerProp, parentPortalNode]); | |
| 3193 | + const portalElement = useRenderElement("div", componentProps, { | |
| 3194 | + ref: [ref, setPortalNodeRef], | |
| 3195 | + props: [{ | |
| 3196 | + id: uniqueId, | |
| 3197 | + [attr]: "" | |
| 3198 | + }, elementProps] | |
| 3199 | + }); | |
| 3200 | + const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null; | |
| 3201 | + return { | |
| 3202 | + node: portalNode, | |
| 3203 | + // `id` and `render` props can override or remove the generated ID. Use the exact | |
| 3204 | + // rendered value so `aria-owns` never points at an ID absent from the DOM. | |
| 3205 | + nodeId: /* @__PURE__ */ React17.isValidElement(portalElement) ? portalElement.props.id : void 0, | |
| 3206 | + subtree: portalSubtree | |
| 3207 | + }; | |
| 3208 | +} | |
| 3209 | +var FloatingPortal = /* @__PURE__ */ React17.forwardRef(function FloatingPortal2(componentProps, forwardedRef) { | |
| 3210 | + const { | |
| 3211 | + render: render4, | |
| 3212 | + className, | |
| 3213 | + style, | |
| 3214 | + children, | |
| 3215 | + container, | |
| 3216 | + portalOwnerRole, | |
| 3217 | + ...elementProps | |
| 3218 | + } = componentProps; | |
| 3219 | + const { | |
| 3220 | + node: portalNode, | |
| 3221 | + nodeId: portalNodeId, | |
| 3222 | + subtree: portalSubtree | |
| 3223 | + } = useFloatingPortalNode({ | |
| 3224 | + container, | |
| 3225 | + ref: forwardedRef, | |
| 3226 | + componentProps, | |
| 3227 | + elementProps | |
| 3228 | + }); | |
| 3229 | + const beforeOutsideRef = React17.useRef(null); | |
| 3230 | + const afterOutsideRef = React17.useRef(null); | |
| 3231 | + const beforeInsideRef = React17.useRef(null); | |
| 3232 | + const afterInsideRef = React17.useRef(null); | |
| 3233 | + const [focusManagerState, setFocusManagerState] = React17.useState(null); | |
| 3234 | + const focusInsideDisabledRef = React17.useRef(false); | |
| 3235 | + const modal = focusManagerState?.modal; | |
| 3236 | + const open2 = focusManagerState?.open; | |
| 3237 | + const shouldRenderGuards = !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode; | |
| 3238 | + React17.useEffect(() => { | |
| 3239 | + if (!portalNode || modal) { | |
| 3240 | + return void 0; | |
| 3241 | + } | |
| 3242 | + function onFocus(event) { | |
| 3243 | + if (portalNode && event.relatedTarget && isOutsideEvent(event)) { | |
| 3244 | + if (event.type === "focusin") { | |
| 3245 | + if (focusInsideDisabledRef.current) { | |
| 3246 | + enableFocusInside(portalNode); | |
| 3247 | + focusInsideDisabledRef.current = false; | |
| 3248 | + } | |
| 3249 | + } else { | |
| 3250 | + disableFocusInside(portalNode); | |
| 3251 | + focusInsideDisabledRef.current = true; | |
| 3252 | + } | |
| 3253 | + } | |
| 3254 | + } | |
| 3255 | + return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true)); | |
| 3256 | + }, [portalNode, modal]); | |
| 3257 | + useIsoLayoutEffect(() => { | |
| 3258 | + if (!portalNode || open2 !== true || !focusInsideDisabledRef.current) { | |
| 3259 | + return; | |
| 3260 | + } | |
| 3261 | + enableFocusInside(portalNode); | |
| 3262 | + focusInsideDisabledRef.current = false; | |
| 3263 | + }, [open2, portalNode]); | |
| 3264 | + const portalContextValue = React17.useMemo(() => ({ | |
| 3265 | + beforeOutsideRef, | |
| 3266 | + afterOutsideRef, | |
| 3267 | + beforeInsideRef, | |
| 3268 | + afterInsideRef, | |
| 3269 | + portalNode, | |
| 3270 | + setFocusManagerState | |
| 3271 | + }), [portalNode]); | |
| 3272 | + return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(React17.Fragment, { | |
| 3273 | + children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(PortalContext.Provider, { | |
| 3274 | + value: portalContextValue, | |
| 3275 | + children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { | |
| 3276 | + "data-type": "outside", | |
| 3277 | + ref: beforeOutsideRef, | |
| 3278 | + onFocus: (event) => { | |
| 3279 | + if (isOutsideEvent(event, portalNode)) { | |
| 3280 | + beforeInsideRef.current?.focus(); | |
| 3281 | + } else { | |
| 3282 | + const domReference = focusManagerState ? focusManagerState.domReference : null; | |
| 3283 | + const prevTabbable = getPreviousTabbable(domReference); | |
| 3284 | + prevTabbable?.focus(); | |
| 3285 | + } | |
| 3286 | + } | |
| 3287 | + }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { | |
| 3288 | + role: portalOwnerRole, | |
| 3289 | + "aria-owns": portalNodeId, | |
| 3290 | + style: ownerVisuallyHidden | |
| 3291 | + }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { | |
| 3292 | + "data-type": "outside", | |
| 3293 | + ref: afterOutsideRef, | |
| 3294 | + onFocus: (event) => { | |
| 3295 | + if (isOutsideEvent(event, portalNode)) { | |
| 3296 | + afterInsideRef.current?.focus(); | |
| 3297 | + } else { | |
| 3298 | + const domReference = focusManagerState ? focusManagerState.domReference : null; | |
| 3299 | + const nextTabbable = getNextTabbable(domReference); | |
| 3300 | + nextTabbable?.focus(); | |
| 3301 | + if (focusManagerState?.closeOnFocusOut) { | |
| 3302 | + focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent)); | |
| 3303 | + } | |
| 3304 | + } | |
| 3305 | + } | |
| 3306 | + })] | |
| 3307 | + })] | |
| 3308 | + }); | |
| 3309 | +}); | |
| 3310 | +if (true) FloatingPortal.displayName = "FloatingPortal"; | |
| 3311 | + | |
| 3312 | +// node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs | |
| 3313 | +var React18 = __toESM(require_react(), 1); | |
| 3314 | + | |
| 3315 | +// node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs | |
| 3316 | +function createEventEmitter() { | |
| 3317 | + const map = /* @__PURE__ */ new Map(); | |
| 3318 | + return { | |
| 3319 | + emit(event, data) { | |
| 3320 | + map.get(event)?.forEach((listener) => listener(data)); | |
| 3321 | + }, | |
| 3322 | + on(event, listener) { | |
| 3323 | + if (!map.has(event)) { | |
| 3324 | + map.set(event, /* @__PURE__ */ new Set()); | |
| 3325 | + } | |
| 3326 | + map.get(event).add(listener); | |
| 3327 | + }, | |
| 3328 | + off(event, listener) { | |
| 3329 | + map.get(event)?.delete(listener); | |
| 3330 | + } | |
| 3331 | + }; | |
| 3332 | +} | |
| 3333 | + | |
| 3334 | +// node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs | |
| 3335 | +var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); | |
| 3336 | +var FloatingNodeContext = /* @__PURE__ */ React18.createContext(null); | |
| 3337 | +if (true) FloatingNodeContext.displayName = "FloatingNodeContext"; | |
| 3338 | +var FloatingTreeContext = /* @__PURE__ */ React18.createContext(null); | |
| 3339 | +if (true) FloatingTreeContext.displayName = "FloatingTreeContext"; | |
| 3340 | +var useFloatingParentNodeId = () => React18.useContext(FloatingNodeContext)?.id || null; | |
| 3341 | +var useFloatingTree = (externalTree) => { | |
| 3342 | + const contextTree = React18.useContext(FloatingTreeContext); | |
| 3343 | + return externalTree ?? contextTree; | |
| 3344 | +}; | |
| 3345 | + | |
| 3346 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useClientPoint.mjs | |
| 3347 | +var React19 = __toESM(require_react(), 1); | |
| 3348 | +function createVirtualElement(domElement, data) { | |
| 3349 | + let offsetX = null; | |
| 3350 | + let offsetY = null; | |
| 3351 | + let isAutoUpdateEvent = false; | |
| 3352 | + return { | |
| 3353 | + contextElement: domElement || void 0, | |
| 3354 | + getBoundingClientRect() { | |
| 3355 | + const domRect = domElement?.getBoundingClientRect() || { | |
| 3356 | + width: 0, | |
| 3357 | + height: 0, | |
| 3358 | + x: 0, | |
| 3359 | + y: 0 | |
| 3360 | + }; | |
| 3361 | + const isXAxis = data.axis === "x" || data.axis === "both"; | |
| 3362 | + const isYAxis = data.axis === "y" || data.axis === "both"; | |
| 3363 | + const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch"; | |
| 3364 | + let width = domRect.width; | |
| 3365 | + let height = domRect.height; | |
| 3366 | + let x2 = domRect.x; | |
| 3367 | + let y2 = domRect.y; | |
| 3368 | + if (offsetX == null && data.x && isXAxis) { | |
| 3369 | + offsetX = domRect.x - data.x; | |
| 3370 | + } | |
| 3371 | + if (offsetY == null && data.y && isYAxis) { | |
| 3372 | + offsetY = domRect.y - data.y; | |
| 3373 | + } | |
| 3374 | + x2 -= offsetX || 0; | |
| 3375 | + y2 -= offsetY || 0; | |
| 3376 | + width = 0; | |
| 3377 | + height = 0; | |
| 3378 | + if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) { | |
| 3379 | + width = data.axis === "y" ? domRect.width : 0; | |
| 3380 | + height = data.axis === "x" ? domRect.height : 0; | |
| 3381 | + x2 = isXAxis && data.x != null ? data.x : x2; | |
| 3382 | + y2 = isYAxis && data.y != null ? data.y : y2; | |
| 3383 | + } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) { | |
| 3384 | + height = data.axis === "x" ? domRect.height : height; | |
| 3385 | + width = data.axis === "y" ? domRect.width : width; | |
| 3386 | + } | |
| 3387 | + isAutoUpdateEvent = true; | |
| 3388 | + return { | |
| 3389 | + width, | |
| 3390 | + height, | |
| 3391 | + x: x2, | |
| 3392 | + y: y2, | |
| 3393 | + top: y2, | |
| 3394 | + right: x2 + width, | |
| 3395 | + bottom: y2 + height, | |
| 3396 | + left: x2 | |
| 3397 | + }; | |
| 3398 | + } | |
| 3399 | + }; | |
| 3400 | +} | |
| 3401 | +function isMouseBasedEvent(event) { | |
| 3402 | + return event != null && event.clientX != null; | |
| 3403 | +} | |
| 3404 | +function useClientPoint(context, props = {}) { | |
| 3405 | + const { | |
| 3406 | + enabled = true, | |
| 3407 | + axis = "both" | |
| 3408 | + } = props; | |
| 3409 | + const store = "rootStore" in context ? context.rootStore : context; | |
| 3410 | + const open2 = store.useState("open"); | |
| 3411 | + const floating = store.useState("floatingElement"); | |
| 3412 | + const domReference = store.useState("domReferenceElement"); | |
| 3413 | + const dataRef = store.context.dataRef; | |
| 3414 | + const initialRef = React19.useRef(false); | |
| 3415 | + const cleanupListenerRef = React19.useRef(null); | |
| 3416 | + const [pointerType, setPointerType] = React19.useState(); | |
| 3417 | + const [reactive, setReactive] = React19.useState([]); | |
| 3418 | + const resetReference = useStableCallback((reference2) => { | |
| 3419 | + store.set("positionReference", reference2); | |
| 3420 | + }); | |
| 3421 | + const setReference = useStableCallback((newX, newY, referenceElement) => { | |
| 3422 | + if (initialRef.current) { | |
| 3423 | + return; | |
| 3424 | + } | |
| 3425 | + if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) { | |
| 3426 | + return; | |
| 3427 | + } | |
| 3428 | + store.set("positionReference", createVirtualElement(referenceElement ?? domReference, { | |
| 3429 | + x: newX, | |
| 3430 | + y: newY, | |
| 3431 | + axis, | |
| 3432 | + dataRef, | |
| 3433 | + pointerType | |
| 3434 | + })); | |
| 3435 | + }); | |
| 3436 | + const handleReferenceEnterOrMove = useStableCallback((event) => { | |
| 3437 | + if (!open2) { | |
| 3438 | + setReference(event.clientX, event.clientY, event.currentTarget); | |
| 3439 | + } else if (!cleanupListenerRef.current) { | |
| 3440 | + setReference(event.clientX, event.clientY, event.currentTarget); | |
| 3441 | + setReactive([]); | |
| 3442 | + } | |
| 3443 | + }); | |
| 3444 | + const openCheck = isMouseLikePointerType(pointerType) ? floating : open2; | |
| 3445 | + React19.useEffect(() => { | |
| 3446 | + if (!enabled) { | |
| 3447 | + resetReference(domReference); | |
| 3448 | + return void 0; | |
| 3449 | + } | |
| 3450 | + if (!openCheck) { | |
| 3451 | + return void 0; | |
| 3452 | + } | |
| 3453 | + function cleanupListener() { | |
| 3454 | + cleanupListenerRef.current?.(); | |
| 3455 | + cleanupListenerRef.current = null; | |
| 3456 | + } | |
| 3457 | + const win = getWindow(floating); | |
| 3458 | + function handleMouseMove(event) { | |
| 3459 | + const target = getTarget(event); | |
| 3460 | + if (!contains(floating, target)) { | |
| 3461 | + setReference(event.clientX, event.clientY); | |
| 3462 | + } else { | |
| 3463 | + cleanupListener(); | |
| 3464 | + } | |
| 3465 | + } | |
| 3466 | + if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) { | |
| 3467 | + cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove); | |
| 3468 | + } else { | |
| 3469 | + resetReference(domReference); | |
| 3470 | + } | |
| 3471 | + return cleanupListener; | |
| 3472 | + }, [openCheck, enabled, floating, dataRef, domReference, store, setReference, resetReference, reactive]); | |
| 3473 | + React19.useEffect(() => () => { | |
| 3474 | + store.set("positionReference", null); | |
| 3475 | + }, [store]); | |
| 3476 | + React19.useEffect(() => { | |
| 3477 | + if (enabled && !floating) { | |
| 3478 | + initialRef.current = false; | |
| 3479 | + } | |
| 3480 | + }, [enabled, floating]); | |
| 3481 | + React19.useEffect(() => { | |
| 3482 | + if (!enabled && open2) { | |
| 3483 | + initialRef.current = true; | |
| 3484 | + } | |
| 3485 | + }, [enabled, open2]); | |
| 3486 | + const reference = React19.useMemo(() => { | |
| 3487 | + function setPointerTypeRef(event) { | |
| 3488 | + setPointerType(event.pointerType); | |
| 3489 | + } | |
| 3490 | + return { | |
| 3491 | + onPointerDown: setPointerTypeRef, | |
| 3492 | + onPointerEnter: setPointerTypeRef, | |
| 3493 | + onMouseMove: handleReferenceEnterOrMove, | |
| 3494 | + onMouseEnter: handleReferenceEnterOrMove | |
| 3495 | + }; | |
| 3496 | + }, [handleReferenceEnterOrMove]); | |
| 3497 | + return React19.useMemo(() => enabled ? { | |
| 3498 | + reference, | |
| 3499 | + trigger: reference | |
| 3500 | + } : {}, [enabled, reference]); | |
| 3501 | +} | |
| 3502 | + | |
| 3503 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs | |
| 3504 | +var React20 = __toESM(require_react(), 1); | |
| 3505 | +function alwaysFalse() { | |
| 3506 | + return false; | |
| 3507 | +} | |
| 3508 | +function normalizeProp(normalizable) { | |
| 3509 | + return { | |
| 3510 | + escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false, | |
| 3511 | + outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true | |
| 3512 | + }; | |
| 3513 | +} | |
| 3514 | +function useDismiss(context, props = {}) { | |
| 3515 | + const { | |
| 3516 | + enabled = true, | |
| 3517 | + escapeKey: escapeKey2 = true, | |
| 3518 | + outsidePress: outsidePressProp = true, | |
| 3519 | + outsidePressEvent = "sloppy", | |
| 3520 | + referencePress = alwaysFalse, | |
| 3521 | + bubbles, | |
| 3522 | + externalTree | |
| 3523 | + } = props; | |
| 3524 | + const store = "rootStore" in context ? context.rootStore : context; | |
| 3525 | + const open2 = store.useState("open"); | |
| 3526 | + const floatingElement = store.useState("floatingElement"); | |
| 3527 | + const { | |
| 3528 | + dataRef, | |
| 3529 | + events | |
| 3530 | + } = store.context; | |
| 3531 | + const tree = useFloatingTree(externalTree); | |
| 3532 | + const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false); | |
| 3533 | + const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp; | |
| 3534 | + const outsidePressEnabled = outsidePress2 !== false; | |
| 3535 | + const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent); | |
| 3536 | + const { | |
| 3537 | + escapeKey: escapeKeyBubbles, | |
| 3538 | + outsidePress: outsidePressBubbles | |
| 3539 | + } = normalizeProp(bubbles); | |
| 3540 | + const pressStartedInsideRef = React20.useRef(false); | |
| 3541 | + const pressStartPreventedRef = React20.useRef(false); | |
| 3542 | + const suppressNextOutsideClickRef = React20.useRef(false); | |
| 3543 | + const sawPressWhileOpenRef = React20.useRef(false); | |
| 3544 | + const isComposingRef = React20.useRef(false); | |
| 3545 | + const currentPointerTypeRef = React20.useRef(""); | |
| 3546 | + const touchStateRef = React20.useRef(null); | |
| 3547 | + const cancelDismissOnEndTimeout = useTimeout(); | |
| 3548 | + const clearInsideReactTreeTimeout = useTimeout(); | |
| 3549 | + const clearInsideReactTree = useStableCallback(() => { | |
| 3550 | + clearInsideReactTreeTimeout.clear(); | |
| 3551 | + dataRef.current.insideReactTree = false; | |
| 3552 | + }); | |
| 3553 | + const hasBlockingChild = useStableCallback((bubbleKey) => { | |
| 3554 | + const nodeId = dataRef.current.floatingContext?.nodeId; | |
| 3555 | + const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : []; | |
| 3556 | + return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]); | |
| 3557 | + }); | |
| 3558 | + const isEventWithinOwnElements = useStableCallback((event) => { | |
| 3559 | + return isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement")); | |
| 3560 | + }); | |
| 3561 | + const closeOnReferencePress = useStableCallback((event) => { | |
| 3562 | + if (!referencePress()) { | |
| 3563 | + return; | |
| 3564 | + } | |
| 3565 | + store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent)); | |
| 3566 | + }); | |
| 3567 | + const closeOnEscapeKeyDown = useStableCallback((event) => { | |
| 3568 | + if (!open2 || !enabled || !escapeKey2 || event.key !== "Escape") { | |
| 3569 | + return; | |
| 3570 | + } | |
| 3571 | + if (isComposingRef.current) { | |
| 3572 | + return; | |
| 3573 | + } | |
| 3574 | + if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) { | |
| 3575 | + return; | |
| 3576 | + } | |
| 3577 | + const native = isReactEvent(event) ? event.nativeEvent : event; | |
| 3578 | + const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native); | |
| 3579 | + store.setOpen(false, eventDetails); | |
| 3580 | + if (!eventDetails.isCanceled) { | |
| 3581 | + event.preventDefault(); | |
| 3582 | + } | |
| 3583 | + if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) { | |
| 3584 | + event.stopPropagation(); | |
| 3585 | + } | |
| 3586 | + }); | |
| 3587 | + const markInsideReactTree = useStableCallback(() => { | |
| 3588 | + dataRef.current.insideReactTree = true; | |
| 3589 | + clearInsideReactTreeTimeout.start(0, clearInsideReactTree); | |
| 3590 | + }); | |
| 3591 | + const markPressStartedInsideReactTree = useStableCallback((event) => { | |
| 3592 | + if (!open2 || !enabled || event.button !== 0) { | |
| 3593 | + return; | |
| 3594 | + } | |
| 3595 | + const target = getTarget(event.nativeEvent); | |
| 3596 | + if (!contains(store.select("floatingElement"), target)) { | |
| 3597 | + return; | |
| 3598 | + } | |
| 3599 | + if (!pressStartedInsideRef.current) { | |
| 3600 | + pressStartedInsideRef.current = true; | |
| 3601 | + pressStartPreventedRef.current = false; | |
| 3602 | + } | |
| 3603 | + }); | |
| 3604 | + const markInsidePressStartPrevented = useStableCallback((event) => { | |
| 3605 | + if (!open2 || !enabled) { | |
| 3606 | + return; | |
| 3607 | + } | |
| 3608 | + if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) { | |
| 3609 | + return; | |
| 3610 | + } | |
| 3611 | + if (pressStartedInsideRef.current) { | |
| 3612 | + pressStartPreventedRef.current = true; | |
| 3613 | + } | |
| 3614 | + }); | |
| 3615 | + React20.useEffect(() => { | |
| 3616 | + function handleOpenChange(details) { | |
| 3617 | + if (!details.open) { | |
| 3618 | + sawPressWhileOpenRef.current = false; | |
| 3619 | + } | |
| 3620 | + } | |
| 3621 | + events.on("openchange", handleOpenChange); | |
| 3622 | + return () => { | |
| 3623 | + events.off("openchange", handleOpenChange); | |
| 3624 | + }; | |
| 3625 | + }, [events]); | |
| 3626 | + React20.useEffect(() => { | |
| 3627 | + if (!open2 || !enabled) { | |
| 3628 | + if (!open2) { | |
| 3629 | + sawPressWhileOpenRef.current = false; | |
| 3630 | + } | |
| 3631 | + return clearInsideReactTree; | |
| 3632 | + } | |
| 3633 | + dataRef.current.__escapeKeyBubbles = escapeKeyBubbles; | |
| 3634 | + dataRef.current.__outsidePressBubbles = outsidePressBubbles; | |
| 3635 | + const compositionTimeout = new Timeout(); | |
| 3636 | + const preventedPressSuppressionTimeout = new Timeout(); | |
| 3637 | + const doc = ownerDocument(floatingElement); | |
| 3638 | + function handleCompositionStart() { | |
| 3639 | + compositionTimeout.clear(); | |
| 3640 | + isComposingRef.current = true; | |
| 3641 | + } | |
| 3642 | + function handleCompositionEnd() { | |
| 3643 | + compositionTimeout.start( | |
| 3644 | + // 0ms or 1ms don't work in Safari. 5ms appears to consistently work. | |
| 3645 | + // Only apply to WebKit for the test to remain 0ms. | |
| 3646 | + parts_exports.engine.webkit ? 5 : 0, | |
| 3647 | + () => { | |
| 3648 | + isComposingRef.current = false; | |
| 3649 | + } | |
| 3650 | + ); | |
| 3651 | + } | |
| 3652 | + function suppressImmediateOutsideClickAfterPreventedStart() { | |
| 3653 | + suppressNextOutsideClickRef.current = true; | |
| 3654 | + preventedPressSuppressionTimeout.start(0, () => { | |
| 3655 | + suppressNextOutsideClickRef.current = false; | |
| 3656 | + }); | |
| 3657 | + } | |
| 3658 | + function resetPressStartState() { | |
| 3659 | + pressStartedInsideRef.current = false; | |
| 3660 | + pressStartPreventedRef.current = false; | |
| 3661 | + } | |
| 3662 | + function getOutsidePressEvent() { | |
| 3663 | + const type = currentPointerTypeRef.current; | |
| 3664 | + const computedType = type === "pen" || !type ? "mouse" : type; | |
| 3665 | + const outsidePressEventValue = getOutsidePressEventProp(); | |
| 3666 | + const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue; | |
| 3667 | + if (typeof resolved === "string") { | |
| 3668 | + return resolved; | |
| 3669 | + } | |
| 3670 | + return resolved[computedType]; | |
| 3671 | + } | |
| 3672 | + function shouldIgnoreEvent(event) { | |
| 3673 | + const computedOutsidePressEvent = getOutsidePressEvent(); | |
| 3674 | + return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click"; | |
| 3675 | + } | |
| 3676 | + function isEventWithinFloatingTree(event) { | |
| 3677 | + const nodeId = dataRef.current.floatingContext?.nodeId; | |
| 3678 | + const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating)); | |
| 3679 | + return isEventWithinOwnElements(event) || targetIsInsideChildren; | |
| 3680 | + } | |
| 3681 | + function closeOnPressOutside(event) { | |
| 3682 | + if (shouldIgnoreEvent(event)) { | |
| 3683 | + if (event.type !== "click" && !isEventWithinOwnElements(event)) { | |
| 3684 | + preventedPressSuppressionTimeout.clear(); | |
| 3685 | + suppressNextOutsideClickRef.current = false; | |
| 3686 | + } | |
| 3687 | + clearInsideReactTree(); | |
| 3688 | + return; | |
| 3689 | + } | |
| 3690 | + if (dataRef.current.insideReactTree) { | |
| 3691 | + clearInsideReactTree(); | |
| 3692 | + return; | |
| 3693 | + } | |
| 3694 | + const target = getTarget(event); | |
| 3695 | + const inertSelector = `[${createAttribute("inert")}]`; | |
| 3696 | + const targetRoot = isElement(target) ? target.getRootNode() : null; | |
| 3697 | + const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store.select("floatingElement"))).querySelectorAll(inertSelector)); | |
| 3698 | + const triggers = store.context.triggerElements; | |
| 3699 | + if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) { | |
| 3700 | + return; | |
| 3701 | + } | |
| 3702 | + let targetRootAncestor = isElement(target) ? target : null; | |
| 3703 | + while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) { | |
| 3704 | + const nextParent = getParentNode(targetRootAncestor); | |
| 3705 | + if (isLastTraversableNode(nextParent) || !isElement(nextParent)) { | |
| 3706 | + break; | |
| 3707 | + } | |
| 3708 | + targetRootAncestor = nextParent; | |
| 3709 | + } | |
| 3710 | + if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay). | |
| 3711 | + !contains(target, store.select("floatingElement")) && // If the target root element contains none of the markers, then the | |
| 3712 | + // element was injected after the floating element rendered. | |
| 3713 | + markers.every((marker) => !contains(targetRootAncestor, marker))) { | |
| 3714 | + return; | |
| 3715 | + } | |
| 3716 | + if (isHTMLElement(target) && !("touches" in event)) { | |
| 3717 | + const lastTraversableNode = isLastTraversableNode(target); | |
| 3718 | + const style = getComputedStyle2(target); | |
| 3719 | + const scrollRe = /auto|scroll/; | |
| 3720 | + const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX); | |
| 3721 | + const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY); | |
| 3722 | + const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth; | |
| 3723 | + const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight; | |
| 3724 | + const isRTL6 = style.direction === "rtl"; | |
| 3725 | + const pressedVerticalScrollbar = canScrollY && (isRTL6 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth); | |
| 3726 | + const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight; | |
| 3727 | + if (pressedVerticalScrollbar || pressedHorizontalScrollbar) { | |
| 3728 | + return; | |
| 3729 | + } | |
| 3730 | + } | |
| 3731 | + if (isEventWithinFloatingTree(event)) { | |
| 3732 | + return; | |
| 3733 | + } | |
| 3734 | + if (getOutsidePressEvent() === "intentional") { | |
| 3735 | + if (event.detail !== 0 && !isVirtualClick(event) && !sawPressWhileOpenRef.current) { | |
| 3736 | + return; | |
| 3737 | + } | |
| 3738 | + if (suppressNextOutsideClickRef.current) { | |
| 3739 | + preventedPressSuppressionTimeout.clear(); | |
| 3740 | + suppressNextOutsideClickRef.current = false; | |
| 3741 | + return; | |
| 3742 | + } | |
| 3743 | + } | |
| 3744 | + if (typeof outsidePress2 === "function" && !outsidePress2(event)) { | |
| 3745 | + return; | |
| 3746 | + } | |
| 3747 | + if (hasBlockingChild("__outsidePressBubbles")) { | |
| 3748 | + return; | |
| 3749 | + } | |
| 3750 | + store.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event)); | |
| 3751 | + clearInsideReactTree(); | |
| 3752 | + } | |
| 3753 | + function handlePointerDown(event) { | |
| 3754 | + if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store.select("open") || !enabled || isEventWithinOwnElements(event)) { | |
| 3755 | + return; | |
| 3756 | + } | |
| 3757 | + closeOnPressOutside(event); | |
| 3758 | + } | |
| 3759 | + function handleTouchStart(event) { | |
| 3760 | + if (getOutsidePressEvent() !== "sloppy" || !store.select("open") || !enabled || isEventWithinOwnElements(event)) { | |
| 3761 | + return; | |
| 3762 | + } | |
| 3763 | + const touch = event.touches[0]; | |
| 3764 | + if (touch) { | |
| 3765 | + touchStateRef.current = { | |
| 3766 | + startTime: Date.now(), | |
| 3767 | + startX: touch.clientX, | |
| 3768 | + startY: touch.clientY, | |
| 3769 | + dismissOnTouchEnd: false, | |
| 3770 | + dismissOnMouseDown: true | |
| 3771 | + }; | |
| 3772 | + cancelDismissOnEndTimeout.start(1e3, () => { | |
| 3773 | + if (touchStateRef.current) { | |
| 3774 | + touchStateRef.current.dismissOnTouchEnd = false; | |
| 3775 | + touchStateRef.current.dismissOnMouseDown = false; | |
| 3776 | + } | |
| 3777 | + }); | |
| 3778 | + } | |
| 3779 | + } | |
| 3780 | + function addTargetEventListenerOnce(event, listener) { | |
| 3781 | + const target = getTarget(event); | |
| 3782 | + if (!target) { | |
| 3783 | + return; | |
| 3784 | + } | |
| 3785 | + const unsubscribe2 = addEventListener(target, event.type, () => { | |
| 3786 | + listener(event); | |
| 3787 | + unsubscribe2(); | |
| 3788 | + }); | |
| 3789 | + } | |
| 3790 | + function handleTouchStartCapture(event) { | |
| 3791 | + currentPointerTypeRef.current = "touch"; | |
| 3792 | + addTargetEventListenerOnce(event, handleTouchStart); | |
| 3793 | + } | |
| 3794 | + function closeOnPressOutsideCapture(event) { | |
| 3795 | + cancelDismissOnEndTimeout.clear(); | |
| 3796 | + if (event.type === "pointerdown") { | |
| 3797 | + if (event.button === 0) { | |
| 3798 | + sawPressWhileOpenRef.current = true; | |
| 3799 | + } | |
| 3800 | + currentPointerTypeRef.current = event.pointerType; | |
| 3801 | + } | |
| 3802 | + if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) { | |
| 3803 | + return; | |
| 3804 | + } | |
| 3805 | + addTargetEventListenerOnce(event, (targetEvent) => { | |
| 3806 | + if (targetEvent.type === "pointerdown") { | |
| 3807 | + handlePointerDown(targetEvent); | |
| 3808 | + } else { | |
| 3809 | + closeOnPressOutside(targetEvent); | |
| 3810 | + } | |
| 3811 | + }); | |
| 3812 | + } | |
| 3813 | + function handlePressEndCapture(event) { | |
| 3814 | + if (event.type === "pointercancel") { | |
| 3815 | + sawPressWhileOpenRef.current = false; | |
| 3816 | + } | |
| 3817 | + if (!pressStartedInsideRef.current) { | |
| 3818 | + return; | |
| 3819 | + } | |
| 3820 | + const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current; | |
| 3821 | + resetPressStartState(); | |
| 3822 | + if (getOutsidePressEvent() !== "intentional") { | |
| 3823 | + return; | |
| 3824 | + } | |
| 3825 | + if (event.type === "pointercancel") { | |
| 3826 | + if (pressStartedInsideDefaultPrevented) { | |
| 3827 | + suppressImmediateOutsideClickAfterPreventedStart(); | |
| 3828 | + } | |
| 3829 | + return; | |
| 3830 | + } | |
| 3831 | + if (isEventWithinFloatingTree(event)) { | |
| 3832 | + return; | |
| 3833 | + } | |
| 3834 | + if (pressStartedInsideDefaultPrevented) { | |
| 3835 | + suppressImmediateOutsideClickAfterPreventedStart(); | |
| 3836 | + return; | |
| 3837 | + } | |
| 3838 | + if (typeof outsidePress2 === "function" && !outsidePress2(event)) { | |
| 3839 | + return; | |
| 3840 | + } | |
| 3841 | + preventedPressSuppressionTimeout.clear(); | |
| 3842 | + suppressNextOutsideClickRef.current = true; | |
| 3843 | + clearInsideReactTree(); | |
| 3844 | + } | |
| 3845 | + function handleTouchMove(event) { | |
| 3846 | + if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { | |
| 3847 | + return; | |
| 3848 | + } | |
| 3849 | + const touch = event.touches[0]; | |
| 3850 | + if (!touch) { | |
| 3851 | + return; | |
| 3852 | + } | |
| 3853 | + const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX); | |
| 3854 | + const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY); | |
| 3855 | + const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); | |
| 3856 | + if (distance > 5) { | |
| 3857 | + touchStateRef.current.dismissOnTouchEnd = true; | |
| 3858 | + } | |
| 3859 | + if (distance > 10) { | |
| 3860 | + closeOnPressOutside(event); | |
| 3861 | + cancelDismissOnEndTimeout.clear(); | |
| 3862 | + touchStateRef.current = null; | |
| 3863 | + } | |
| 3864 | + } | |
| 3865 | + function handleTouchMoveCapture(event) { | |
| 3866 | + addTargetEventListenerOnce(event, handleTouchMove); | |
| 3867 | + } | |
| 3868 | + function handleTouchEnd(event) { | |
| 3869 | + if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { | |
| 3870 | + return; | |
| 3871 | + } | |
| 3872 | + if (touchStateRef.current.dismissOnTouchEnd) { | |
| 3873 | + closeOnPressOutside(event); | |
| 3874 | + } | |
| 3875 | + cancelDismissOnEndTimeout.clear(); | |
| 3876 | + touchStateRef.current = null; | |
| 3877 | + } | |
| 3878 | + function handleTouchEndCapture(event) { | |
| 3879 | + addTargetEventListenerOnce(event, handleTouchEnd); | |
| 3880 | + } | |
| 3881 | + 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, { | |
| 3882 | + capture: true, | |
| 3883 | + passive: true | |
| 3884 | + }), addEventListener(doc, "touchmove", handleTouchMoveCapture, { | |
| 3885 | + capture: true, | |
| 3886 | + passive: true | |
| 3887 | + }), addEventListener(doc, "touchend", handleTouchEndCapture, { | |
| 3888 | + capture: true, | |
| 3889 | + passive: true | |
| 3890 | + }))); | |
| 3891 | + return () => { | |
| 3892 | + unsubscribe(); | |
| 3893 | + compositionTimeout.clear(); | |
| 3894 | + preventedPressSuppressionTimeout.clear(); | |
| 3895 | + resetPressStartState(); | |
| 3896 | + suppressNextOutsideClickRef.current = false; | |
| 3897 | + clearInsideReactTree(); | |
| 3898 | + }; | |
| 3899 | + }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open2, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store, cancelDismissOnEndTimeout]); | |
| 3900 | + const reference = React20.useMemo(() => ({ | |
| 3901 | + onKeyDown: closeOnEscapeKeyDown, | |
| 3902 | + onPointerDown: closeOnReferencePress, | |
| 3903 | + onClick: closeOnReferencePress | |
| 3904 | + }), [closeOnEscapeKeyDown, closeOnReferencePress]); | |
| 3905 | + const floating = React20.useMemo(() => ({ | |
| 3906 | + onKeyDown: closeOnEscapeKeyDown, | |
| 3907 | + // `onMouseDown` may be blocked if `event.preventDefault()` is called in | |
| 3908 | + // `onPointerDown`, such as with <NumberField.ScrubArea>. | |
| 3909 | + // See https://github.com/mui/base-ui/pull/3379 | |
| 3910 | + onPointerDown: markInsidePressStartPrevented, | |
| 3911 | + onMouseDown: markInsidePressStartPrevented, | |
| 3912 | + onClickCapture: markInsideReactTree, | |
| 3913 | + onMouseDownCapture(event) { | |
| 3914 | + markInsideReactTree(); | |
| 3915 | + markPressStartedInsideReactTree(event); | |
| 3916 | + }, | |
| 3917 | + onPointerDownCapture(event) { | |
| 3918 | + markInsideReactTree(); | |
| 3919 | + markPressStartedInsideReactTree(event); | |
| 3920 | + }, | |
| 3921 | + onMouseUpCapture: markInsideReactTree, | |
| 3922 | + onTouchEndCapture: markInsideReactTree, | |
| 3923 | + onTouchMoveCapture: markInsideReactTree | |
| 3924 | + }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]); | |
| 3925 | + return React20.useMemo(() => enabled ? { | |
| 3926 | + reference, | |
| 3927 | + floating, | |
| 3928 | + trigger: reference | |
| 3929 | + } : {}, [enabled, reference, floating]); | |
| 3930 | +} | |
| 3931 | + | |
| 3932 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs | |
| 3933 | +var React28 = __toESM(require_react(), 1); | |
| 3934 | + | |
| 3935 | +// node_modules/@floating-ui/core/dist/floating-ui.core.mjs | |
| 3936 | +function computeCoordsFromPlacement(_ref, placement, rtl) { | |
| 3937 | + let { | |
| 3938 | + reference, | |
| 3939 | + floating | |
| 3940 | + } = _ref; | |
| 3941 | + const sideAxis = getSideAxis(placement); | |
| 3942 | + const alignmentAxis = getAlignmentAxis(placement); | |
| 3943 | + const alignLength = getAxisLength(alignmentAxis); | |
| 3944 | + const side = getSide(placement); | |
| 3945 | + const isVertical = sideAxis === "y"; | |
| 3946 | + const commonX = reference.x + reference.width / 2 - floating.width / 2; | |
| 3947 | + const commonY = reference.y + reference.height / 2 - floating.height / 2; | |
| 3948 | + const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; | |
| 3949 | + let coords; | |
| 3950 | + switch (side) { | |
| 3951 | + case "top": | |
| 3952 | + coords = { | |
| 3953 | + x: commonX, | |
| 3954 | + y: reference.y - floating.height | |
| 3955 | + }; | |
| 3956 | + break; | |
| 3957 | + case "bottom": | |
| 3958 | + coords = { | |
| 3959 | + x: commonX, | |
| 3960 | + y: reference.y + reference.height | |
| 3961 | + }; | |
| 3962 | + break; | |
| 3963 | + case "right": | |
| 3964 | + coords = { | |
| 3965 | + x: reference.x + reference.width, | |
| 3966 | + y: commonY | |
| 3967 | + }; | |
| 3968 | + break; | |
| 3969 | + case "left": | |
| 3970 | + coords = { | |
| 3971 | + x: reference.x - floating.width, | |
| 3972 | + y: commonY | |
| 3973 | + }; | |
| 3974 | + break; | |
| 3975 | + default: | |
| 3976 | + coords = { | |
| 3977 | + x: reference.x, | |
| 3978 | + y: reference.y | |
| 3979 | + }; | |
| 3980 | + } | |
| 3981 | + const alignment = getAlignment(placement); | |
| 3982 | + if (alignment) { | |
| 3983 | + coords[alignmentAxis] += commonAlign * (alignment === "end" ? 1 : -1) * (rtl && isVertical ? -1 : 1); | |
| 3984 | + } | |
| 3985 | + return coords; | |
| 3986 | +} | |
| 3987 | +async function detectOverflow(state, options) { | |
| 3988 | + var _await$platform$isEle; | |
| 3989 | + if (options === void 0) { | |
| 3990 | + options = {}; | |
| 3991 | + } | |
| 3992 | + const { | |
| 3993 | + x: x2, | |
| 3994 | + y: y2, | |
| 3995 | + platform: platform3, | |
| 3996 | + rects, | |
| 3997 | + elements, | |
| 3998 | + strategy | |
| 3999 | + } = state; | |
| 4000 | + const { | |
| 4001 | + boundary = "clippingAncestors", | |
| 4002 | + rootBoundary = "viewport", | |
| 4003 | + elementContext = "floating", | |
| 4004 | + altBoundary = false, | |
| 4005 | + padding = 0 | |
| 4006 | + } = evaluate(options, state); | |
| 4007 | + const paddingObject = getPaddingObject(padding); | |
| 4008 | + const altContext = elementContext === "floating" ? "reference" : "floating"; | |
| 4009 | + const element = elements[altBoundary ? altContext : elementContext]; | |
| 4010 | + const clippingClientRect = rectToClientRect(await platform3.getClippingRect({ | |
| 4011 | + 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)), | |
| 4012 | + boundary, | |
| 4013 | + rootBoundary, | |
| 4014 | + strategy | |
| 4015 | + })); | |
| 4016 | + const rect = elementContext === "floating" ? { | |
| 4017 | + x: x2, | |
| 4018 | + y: y2, | |
| 4019 | + width: rects.floating.width, | |
| 4020 | + height: rects.floating.height | |
| 4021 | + } : rects.reference; | |
| 4022 | + const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating)); | |
| 4023 | + const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) && await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || { | |
| 4024 | + x: 1, | |
| 4025 | + y: 1 | |
| 4026 | + }; | |
| 4027 | + const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({ | |
| 4028 | + elements, | |
| 4029 | + rect, | |
| 4030 | + offsetParent, | |
| 4031 | + strategy | |
| 4032 | + }) : rect); | |
| 4033 | + return { | |
| 4034 | + top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, | |
| 4035 | + bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, | |
| 4036 | + left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, | |
| 4037 | + right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x | |
| 4038 | + }; | |
| 4039 | +} | |
| 4040 | +var MAX_RESET_COUNT = 50; | |
| 4041 | +var computePosition = async (reference, floating, config) => { | |
| 4042 | + const { | |
| 4043 | + placement = "bottom", | |
| 4044 | + strategy = "absolute", | |
| 4045 | + middleware = [], | |
| 4046 | + platform: platform3 | |
| 4047 | + } = config; | |
| 4048 | + const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : { | |
| 4049 | + ...platform3, | |
| 4050 | + detectOverflow | |
| 4051 | + }; | |
| 4052 | + const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating)); | |
| 4053 | + let rects = await platform3.getElementRects({ | |
| 4054 | + reference, | |
| 4055 | + floating, | |
| 4056 | + strategy | |
| 4057 | + }); | |
| 4058 | + let { | |
| 4059 | + x: x2, | |
| 4060 | + y: y2 | |
| 4061 | + } = computeCoordsFromPlacement(rects, placement, rtl); | |
| 4062 | + let statefulPlacement = placement; | |
| 4063 | + let resetCount = 0; | |
| 4064 | + const middlewareData = {}; | |
| 4065 | + for (let i = 0; i < middleware.length; i++) { | |
| 4066 | + const currentMiddleware = middleware[i]; | |
| 4067 | + if (!currentMiddleware) { | |
| 4068 | + continue; | |
| 4069 | + } | |
| 4070 | + const { | |
| 4071 | + name, | |
| 4072 | + fn | |
| 4073 | + } = currentMiddleware; | |
| 4074 | + const { | |
| 4075 | + x: nextX, | |
| 4076 | + y: nextY, | |
| 4077 | + data, | |
| 4078 | + reset | |
| 4079 | + } = await fn({ | |
| 4080 | + x: x2, | |
| 4081 | + y: y2, | |
| 4082 | + initialPlacement: placement, | |
| 4083 | + placement: statefulPlacement, | |
| 4084 | + strategy, | |
| 4085 | + middlewareData, | |
| 4086 | + rects, | |
| 4087 | + platform: platformWithDetectOverflow, | |
| 4088 | + elements: { | |
| 4089 | + reference, | |
| 4090 | + floating | |
| 4091 | + } | |
| 4092 | + }); | |
| 4093 | + x2 = nextX != null ? nextX : x2; | |
| 4094 | + y2 = nextY != null ? nextY : y2; | |
| 4095 | + middlewareData[name] = { | |
| 4096 | + ...middlewareData[name], | |
| 4097 | + ...data | |
| 4098 | + }; | |
| 4099 | + if (reset && resetCount < MAX_RESET_COUNT) { | |
| 4100 | + resetCount++; | |
| 4101 | + if (typeof reset === "object") { | |
| 4102 | + if (reset.placement) { | |
| 4103 | + statefulPlacement = reset.placement; | |
| 4104 | + } | |
| 4105 | + if (reset.rects) { | |
| 4106 | + rects = reset.rects === true ? await platform3.getElementRects({ | |
| 4107 | + reference, | |
| 4108 | + floating, | |
| 4109 | + strategy | |
| 4110 | + }) : reset.rects; | |
| 4111 | + } | |
| 4112 | + ({ | |
| 4113 | + x: x2, | |
| 4114 | + y: y2 | |
| 4115 | + } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); | |
| 4116 | + } | |
| 4117 | + i = -1; | |
| 4118 | + } | |
| 4119 | + } | |
| 4120 | + return { | |
| 4121 | + x: x2, | |
| 4122 | + y: y2, | |
| 4123 | + placement: statefulPlacement, | |
| 4124 | + strategy, | |
| 4125 | + middlewareData | |
| 4126 | + }; | |
| 4127 | +}; | |
| 4128 | +var flip = function(options) { | |
| 4129 | + if (options === void 0) { | |
| 4130 | + options = {}; | |
| 4131 | + } | |
| 4132 | + return { | |
| 4133 | + name: "flip", | |
| 4134 | + options, | |
| 4135 | + async fn(state) { | |
| 4136 | + var _middlewareData$arrow, _middlewareData$flip; | |
| 4137 | + const { | |
| 4138 | + placement, | |
| 4139 | + middlewareData, | |
| 4140 | + rects, | |
| 4141 | + initialPlacement, | |
| 4142 | + platform: platform3, | |
| 4143 | + elements | |
| 4144 | + } = state; | |
| 4145 | + const { | |
| 4146 | + mainAxis: checkMainAxis = true, | |
| 4147 | + crossAxis: checkCrossAxis = true, | |
| 4148 | + fallbackPlacements: specifiedFallbackPlacements, | |
| 4149 | + fallbackStrategy = "bestFit", | |
| 4150 | + fallbackAxisSideDirection = "none", | |
| 4151 | + flipAlignment = true, | |
| 4152 | + ...detectOverflowOptions | |
| 4153 | + } = evaluate(options, state); | |
| 4154 | + if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { | |
| 4155 | + return {}; | |
| 4156 | + } | |
| 4157 | + const side = getSide(placement); | |
| 4158 | + const initialSideAxis = getSideAxis(initialPlacement); | |
| 4159 | + const isBasePlacement = getSide(initialPlacement) === initialPlacement; | |
| 4160 | + const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); | |
| 4161 | + const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); | |
| 4162 | + const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none"; | |
| 4163 | + if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { | |
| 4164 | + fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); | |
| 4165 | + } | |
| 4166 | + const placements2 = [initialPlacement, ...fallbackPlacements]; | |
| 4167 | + const overflow = await platform3.detectOverflow(state, detectOverflowOptions); | |
| 4168 | + const overflows = []; | |
| 4169 | + let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; | |
| 4170 | + if (checkMainAxis) { | |
| 4171 | + overflows.push(overflow[side]); | |
| 4172 | + } | |
| 4173 | + if (checkCrossAxis) { | |
| 4174 | + const sides2 = getAlignmentSides(placement, rects, rtl); | |
| 4175 | + overflows.push(overflow[sides2[0]], overflow[sides2[1]]); | |
| 4176 | + } | |
| 4177 | + overflowsData = [...overflowsData, { | |
| 4178 | + placement, | |
| 4179 | + overflows | |
| 4180 | + }]; | |
| 4181 | + if (!overflows.every((side2) => side2 <= 0)) { | |
| 4182 | + var _middlewareData$flip2, _overflowsData$filter; | |
| 4183 | + const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; | |
| 4184 | + const nextPlacement = placements2[nextIndex]; | |
| 4185 | + if (nextPlacement) { | |
| 4186 | + const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false; | |
| 4187 | + if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis | |
| 4188 | + // overflows the main axis. | |
| 4189 | + overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) { | |
| 4190 | + return { | |
| 4191 | + data: { | |
| 4192 | + index: nextIndex, | |
| 4193 | + overflows: overflowsData | |
| 4194 | + }, | |
| 4195 | + reset: { | |
| 4196 | + placement: nextPlacement | |
| 4197 | + } | |
| 4198 | + }; | |
| 4199 | + } | |
| 4200 | + } | |
| 4201 | + 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; | |
| 4202 | + if (!resetPlacement) { | |
| 4203 | + switch (fallbackStrategy) { | |
| 4204 | + case "bestFit": { | |
| 4205 | + var _overflowsData$filter2; | |
| 4206 | + const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => { | |
| 4207 | + if (hasFallbackAxisSideDirection) { | |
| 4208 | + const currentSideAxis = getSideAxis(d.placement); | |
| 4209 | + return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal | |
| 4210 | + // reading directions favoring greater width. | |
| 4211 | + currentSideAxis === "y"; | |
| 4212 | + } | |
| 4213 | + return true; | |
| 4214 | + }).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]; | |
| 4215 | + if (placement2) { | |
| 4216 | + resetPlacement = placement2; | |
| 4217 | + } | |
| 4218 | + break; | |
| 4219 | + } | |
| 4220 | + case "initialPlacement": | |
| 4221 | + resetPlacement = initialPlacement; | |
| 4222 | + break; | |
| 4223 | + } | |
| 4224 | + } | |
| 4225 | + if (placement !== resetPlacement) { | |
| 4226 | + return { | |
| 4227 | + reset: { | |
| 4228 | + placement: resetPlacement | |
| 4229 | + } | |
| 4230 | + }; | |
| 4231 | + } | |
| 4232 | + } | |
| 4233 | + return {}; | |
| 4234 | + } | |
| 4235 | + }; | |
| 4236 | +}; | |
| 4237 | +var originSides = /* @__PURE__ */ new Set(["left", "top"]); | |
| 4238 | +async function convertValueToCoords(state, options) { | |
| 4239 | + const { | |
| 4240 | + placement, | |
| 4241 | + platform: platform3, | |
| 4242 | + elements | |
| 4243 | + } = state; | |
| 4244 | + const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); | |
| 4245 | + const side = getSide(placement); | |
| 4246 | + const alignment = getAlignment(placement); | |
| 4247 | + const isVertical = getSideAxis(placement) === "y"; | |
| 4248 | + const mainAxisMulti = originSides.has(side) ? -1 : 1; | |
| 4249 | + const crossAxisMulti = rtl && isVertical ? -1 : 1; | |
| 4250 | + const rawValue = evaluate(options, state); | |
| 4251 | + let { | |
| 4252 | + mainAxis, | |
| 4253 | + crossAxis, | |
| 4254 | + alignmentAxis | |
| 4255 | + } = typeof rawValue === "number" ? { | |
| 4256 | + mainAxis: rawValue, | |
| 4257 | + crossAxis: 0, | |
| 4258 | + alignmentAxis: null | |
| 4259 | + } : { | |
| 4260 | + mainAxis: rawValue.mainAxis || 0, | |
| 4261 | + crossAxis: rawValue.crossAxis || 0, | |
| 4262 | + alignmentAxis: rawValue.alignmentAxis | |
| 4263 | + }; | |
| 4264 | + if (alignment && typeof alignmentAxis === "number") { | |
| 4265 | + crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; | |
| 4266 | + } | |
| 4267 | + return isVertical ? { | |
| 4268 | + x: crossAxis * crossAxisMulti, | |
| 4269 | + y: mainAxis * mainAxisMulti | |
| 4270 | + } : { | |
| 4271 | + x: mainAxis * mainAxisMulti, | |
| 4272 | + y: crossAxis * crossAxisMulti | |
| 4273 | + }; | |
| 4274 | +} | |
| 4275 | +var offset = function(options) { | |
| 4276 | + if (options === void 0) { | |
| 4277 | + options = 0; | |
| 4278 | + } | |
| 4279 | + return { | |
| 4280 | + name: "offset", | |
| 4281 | + options, | |
| 4282 | + async fn(state) { | |
| 4283 | + var _middlewareData$offse, _middlewareData$arrow; | |
| 4284 | + const { | |
| 4285 | + x: x2, | |
| 4286 | + y: y2, | |
| 4287 | + placement, | |
| 4288 | + middlewareData | |
| 4289 | + } = state; | |
| 4290 | + const diffCoords = await convertValueToCoords(state, options); | |
| 4291 | + if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { | |
| 4292 | + return {}; | |
| 4293 | + } | |
| 4294 | + return { | |
| 4295 | + x: x2 + diffCoords.x, | |
| 4296 | + y: y2 + diffCoords.y, | |
| 4297 | + data: { | |
| 4298 | + ...diffCoords, | |
| 4299 | + placement | |
| 4300 | + } | |
| 4301 | + }; | |
| 4302 | + } | |
| 4303 | + }; | |
| 4304 | +}; | |
| 4305 | +var shift = function(options) { | |
| 4306 | + if (options === void 0) { | |
| 4307 | + options = {}; | |
| 4308 | + } | |
| 4309 | + return { | |
| 4310 | + name: "shift", | |
| 4311 | + options, | |
| 4312 | + async fn(state) { | |
| 4313 | + const { | |
| 4314 | + x: x2, | |
| 4315 | + y: y2, | |
| 4316 | + placement, | |
| 4317 | + platform: platform3 | |
| 4318 | + } = state; | |
| 4319 | + const { | |
| 4320 | + mainAxis: checkMainAxis = true, | |
| 4321 | + crossAxis: checkCrossAxis = false, | |
| 4322 | + limiter = { | |
| 4323 | + fn: (_ref) => { | |
| 4324 | + let { | |
| 4325 | + x: x3, | |
| 4326 | + y: y3 | |
| 4327 | + } = _ref; | |
| 4328 | + return { | |
| 4329 | + x: x3, | |
| 4330 | + y: y3 | |
| 4331 | + }; | |
| 4332 | + } | |
| 4333 | + }, | |
| 4334 | + ...detectOverflowOptions | |
| 4335 | + } = evaluate(options, state); | |
| 4336 | + const coords = { | |
| 4337 | + x: x2, | |
| 4338 | + y: y2 | |
| 4339 | + }; | |
| 4340 | + const overflow = await platform3.detectOverflow(state, detectOverflowOptions); | |
| 4341 | + const crossAxis = getSideAxis(placement); | |
| 4342 | + const mainAxis = getOppositeAxis(crossAxis); | |
| 4343 | + let mainAxisCoord = coords[mainAxis]; | |
| 4344 | + let crossAxisCoord = coords[crossAxis]; | |
| 4345 | + const clampCoord = (axis, coord) => clamp(coord + overflow[axis === "y" ? "top" : "left"], coord, coord - overflow[axis === "y" ? "bottom" : "right"]); | |
| 4346 | + if (checkMainAxis) { | |
| 4347 | + mainAxisCoord = clampCoord(mainAxis, mainAxisCoord); | |
| 4348 | + } | |
| 4349 | + if (checkCrossAxis) { | |
| 4350 | + crossAxisCoord = clampCoord(crossAxis, crossAxisCoord); | |
| 4351 | + } | |
| 4352 | + const limitedCoords = limiter.fn({ | |
| 4353 | + ...state, | |
| 4354 | + [mainAxis]: mainAxisCoord, | |
| 4355 | + [crossAxis]: crossAxisCoord | |
| 4356 | + }); | |
| 4357 | + return { | |
| 4358 | + ...limitedCoords, | |
| 4359 | + data: { | |
| 4360 | + x: limitedCoords.x - x2, | |
| 4361 | + y: limitedCoords.y - y2, | |
| 4362 | + enabled: { | |
| 4363 | + [mainAxis]: checkMainAxis, | |
| 4364 | + [crossAxis]: checkCrossAxis | |
| 4365 | + } | |
| 4366 | + } | |
| 4367 | + }; | |
| 4368 | + } | |
| 4369 | + }; | |
| 4370 | +}; | |
| 4371 | +var limitShift = function(options) { | |
| 4372 | + if (options === void 0) { | |
| 4373 | + options = {}; | |
| 4374 | + } | |
| 4375 | + return { | |
| 4376 | + options, | |
| 4377 | + fn(state) { | |
| 4378 | + var _rawOffset$mainAxis, _rawOffset$crossAxis; | |
| 4379 | + const { | |
| 4380 | + x: x2, | |
| 4381 | + y: y2, | |
| 4382 | + placement, | |
| 4383 | + rects, | |
| 4384 | + middlewareData | |
| 4385 | + } = state; | |
| 4386 | + const { | |
| 4387 | + offset: offset4 = 0, | |
| 4388 | + mainAxis: checkMainAxis = true, | |
| 4389 | + crossAxis: checkCrossAxis = true | |
| 4390 | + } = evaluate(options, state); | |
| 4391 | + const coords = { | |
| 4392 | + x: x2, | |
| 4393 | + y: y2 | |
| 4394 | + }; | |
| 4395 | + const crossAxis = getSideAxis(placement); | |
| 4396 | + const mainAxis = getOppositeAxis(crossAxis); | |
| 4397 | + let mainAxisCoord = coords[mainAxis]; | |
| 4398 | + let crossAxisCoord = coords[crossAxis]; | |
| 4399 | + const rawOffset = evaluate(offset4, state); | |
| 4400 | + const computedOffset = typeof rawOffset === "number" ? { | |
| 4401 | + mainAxis: rawOffset, | |
| 4402 | + crossAxis: 0 | |
| 4403 | + } : { | |
| 4404 | + mainAxis: (_rawOffset$mainAxis = rawOffset.mainAxis) != null ? _rawOffset$mainAxis : 0, | |
| 4405 | + crossAxis: (_rawOffset$crossAxis = rawOffset.crossAxis) != null ? _rawOffset$crossAxis : 0 | |
| 4406 | + }; | |
| 4407 | + if (checkMainAxis) { | |
| 4408 | + const len = mainAxis === "y" ? "height" : "width"; | |
| 4409 | + const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; | |
| 4410 | + const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; | |
| 4411 | + if (mainAxisCoord < limitMin) { | |
| 4412 | + mainAxisCoord = limitMin; | |
| 4413 | + } else if (mainAxisCoord > limitMax) { | |
| 4414 | + mainAxisCoord = limitMax; | |
| 4415 | + } | |
| 4416 | + } | |
| 4417 | + if (checkCrossAxis) { | |
| 4418 | + var _middlewareData$offse, _middlewareData$offse2; | |
| 4419 | + const len = mainAxis === "y" ? "width" : "height"; | |
| 4420 | + const isOriginSide = originSides.has(getSide(placement)); | |
| 4421 | + 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); | |
| 4422 | + 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); | |
| 4423 | + if (crossAxisCoord < limitMin) { | |
| 4424 | + crossAxisCoord = limitMin; | |
| 4425 | + } else if (crossAxisCoord > limitMax) { | |
| 4426 | + crossAxisCoord = limitMax; | |
| 4427 | + } | |
| 4428 | + } | |
| 4429 | + return { | |
| 4430 | + [mainAxis]: mainAxisCoord, | |
| 4431 | + [crossAxis]: crossAxisCoord | |
| 4432 | + }; | |
| 4433 | + } | |
| 4434 | + }; | |
| 4435 | +}; | |
| 4436 | +var size = function(options) { | |
| 4437 | + if (options === void 0) { | |
| 4438 | + options = {}; | |
| 4439 | + } | |
| 4440 | + return { | |
| 4441 | + name: "size", | |
| 4442 | + options, | |
| 4443 | + async fn(state) { | |
| 4444 | + const { | |
| 4445 | + placement, | |
| 4446 | + rects, | |
| 4447 | + platform: platform3, | |
| 4448 | + elements | |
| 4449 | + } = state; | |
| 4450 | + const { | |
| 4451 | + apply = () => { | |
| 4452 | + }, | |
| 4453 | + ...detectOverflowOptions | |
| 4454 | + } = evaluate(options, state); | |
| 4455 | + const overflow = await platform3.detectOverflow(state, detectOverflowOptions); | |
| 4456 | + const side = getSide(placement); | |
| 4457 | + const alignment = getAlignment(placement); | |
| 4458 | + const isYAxis = getSideAxis(placement) === "y"; | |
| 4459 | + const { | |
| 4460 | + width, | |
| 4461 | + height | |
| 4462 | + } = rects.floating; | |
| 4463 | + let heightSide; | |
| 4464 | + let widthSide; | |
| 4465 | + if (side === "top" || side === "bottom") { | |
| 4466 | + heightSide = side; | |
| 4467 | + widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right"; | |
| 4468 | + } else { | |
| 4469 | + widthSide = side; | |
| 4470 | + heightSide = alignment === "end" ? "top" : "bottom"; | |
| 4471 | + } | |
| 4472 | + const maximumClippingHeight = height - overflow.top - overflow.bottom; | |
| 4473 | + const maximumClippingWidth = width - overflow.left - overflow.right; | |
| 4474 | + const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight); | |
| 4475 | + const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth); | |
| 4476 | + const shiftData = state.middlewareData.shift; | |
| 4477 | + const noShift = !shiftData; | |
| 4478 | + let availableHeight2 = overflowAvailableHeight; | |
| 4479 | + let availableWidth2 = overflowAvailableWidth; | |
| 4480 | + if (shiftData != null && shiftData.enabled.x) { | |
| 4481 | + availableWidth2 = maximumClippingWidth; | |
| 4482 | + } | |
| 4483 | + if (shiftData != null && shiftData.enabled.y) { | |
| 4484 | + availableHeight2 = maximumClippingHeight; | |
| 4485 | + } | |
| 4486 | + if (noShift && !alignment) { | |
| 4487 | + if (isYAxis) { | |
| 4488 | + availableWidth2 = width - 2 * max(overflow.left, overflow.right); | |
| 4489 | + } else { | |
| 4490 | + availableHeight2 = height - 2 * max(overflow.top, overflow.bottom); | |
| 4491 | + } | |
| 4492 | + } | |
| 4493 | + await apply({ | |
| 4494 | + ...state, | |
| 4495 | + availableWidth: availableWidth2, | |
| 4496 | + availableHeight: availableHeight2 | |
| 4497 | + }); | |
| 4498 | + const nextDimensions = await platform3.getDimensions(elements.floating); | |
| 4499 | + if (width !== nextDimensions.width || height !== nextDimensions.height) { | |
| 4500 | + return { | |
| 4501 | + reset: { | |
| 4502 | + rects: true | |
| 4503 | + } | |
| 4504 | + }; | |
| 4505 | + } | |
| 4506 | + return {}; | |
| 4507 | + } | |
| 4508 | + }; | |
| 4509 | +}; | |
| 4510 | + | |
| 4511 | +// node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs | |
| 4512 | +function getCssDimensions(element) { | |
| 4513 | + const css = getComputedStyle2(element); | |
| 4514 | + let width = parseFloat(css.width) || 0; | |
| 4515 | + let height = parseFloat(css.height) || 0; | |
| 4516 | + const hasOffset = isHTMLElement(element); | |
| 4517 | + const offsetWidth = hasOffset ? element.offsetWidth : width; | |
| 4518 | + const offsetHeight = hasOffset ? element.offsetHeight : height; | |
| 4519 | + const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; | |
| 4520 | + if (shouldFallback) { | |
| 4521 | + width = offsetWidth; | |
| 4522 | + height = offsetHeight; | |
| 4523 | + } | |
| 4524 | + return { | |
| 4525 | + width, | |
| 4526 | + height, | |
| 4527 | + $: shouldFallback | |
| 4528 | + }; | |
| 4529 | +} | |
| 4530 | +function unwrapElement(element) { | |
| 4531 | + return !isElement(element) ? element.contextElement : element; | |
| 4532 | +} | |
| 4533 | +function getScale(element) { | |
| 4534 | + const domElement = unwrapElement(element); | |
| 4535 | + if (!isHTMLElement(domElement)) { | |
| 4536 | + return createCoords(1); | |
| 4537 | + } | |
| 4538 | + const rect = domElement.getBoundingClientRect(); | |
| 4539 | + const { | |
| 4540 | + width, | |
| 4541 | + height, | |
| 4542 | + $: $2 | |
| 4543 | + } = getCssDimensions(domElement); | |
| 4544 | + let x2 = ($2 ? round(rect.width) : rect.width) / width; | |
| 4545 | + let y2 = ($2 ? round(rect.height) : rect.height) / height; | |
| 4546 | + if (!x2 || !Number.isFinite(x2)) { | |
| 4547 | + x2 = 1; | |
| 4548 | + } | |
| 4549 | + if (!y2 || !Number.isFinite(y2)) { | |
| 4550 | + y2 = 1; | |
| 4551 | + } | |
| 4552 | + return { | |
| 4553 | + x: x2, | |
| 4554 | + y: y2 | |
| 4555 | + }; | |
| 4556 | +} | |
| 4557 | +var noOffsets = /* @__PURE__ */ createCoords(0); | |
| 4558 | +function getVisualOffsets(element) { | |
| 4559 | + const win = getWindow(element); | |
| 4560 | + if (!isWebKit() || !win.visualViewport) { | |
| 4561 | + return noOffsets; | |
| 4562 | + } | |
| 4563 | + return { | |
| 4564 | + x: win.visualViewport.offsetLeft, | |
| 4565 | + y: win.visualViewport.offsetTop | |
| 4566 | + }; | |
| 4567 | +} | |
| 4568 | +function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { | |
| 4569 | + if (isFixed === void 0) { | |
| 4570 | + isFixed = false; | |
| 4571 | + } | |
| 4572 | + return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element); | |
| 4573 | +} | |
| 4574 | +function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { | |
| 4575 | + if (includeScale === void 0) { | |
| 4576 | + includeScale = false; | |
| 4577 | + } | |
| 4578 | + if (isFixedStrategy === void 0) { | |
| 4579 | + isFixedStrategy = false; | |
| 4580 | + } | |
| 4581 | + const clientRect = element.getBoundingClientRect(); | |
| 4582 | + const domElement = unwrapElement(element); | |
| 4583 | + let scale = createCoords(1); | |
| 4584 | + if (includeScale) { | |
| 4585 | + if (offsetParent) { | |
| 4586 | + if (isElement(offsetParent)) { | |
| 4587 | + scale = getScale(offsetParent); | |
| 4588 | + } | |
| 4589 | + } else { | |
| 4590 | + scale = getScale(element); | |
| 4591 | + } | |
| 4592 | + } | |
| 4593 | + const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); | |
| 4594 | + let x2 = (clientRect.left + visualOffsets.x) / scale.x; | |
| 4595 | + let y2 = (clientRect.top + visualOffsets.y) / scale.y; | |
| 4596 | + let width = clientRect.width / scale.x; | |
| 4597 | + let height = clientRect.height / scale.y; | |
| 4598 | + if (domElement && offsetParent) { | |
| 4599 | + const win = getWindow(domElement); | |
| 4600 | + const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; | |
| 4601 | + let currentWin = win; | |
| 4602 | + let currentIFrame = getFrameElement(currentWin); | |
| 4603 | + while (currentIFrame && offsetWin !== currentWin) { | |
| 4604 | + const iframeScale = getScale(currentIFrame); | |
| 4605 | + const iframeRect = currentIFrame.getBoundingClientRect(); | |
| 4606 | + const css = getComputedStyle2(currentIFrame); | |
| 4607 | + const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; | |
| 4608 | + const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; | |
| 4609 | + x2 *= iframeScale.x; | |
| 4610 | + y2 *= iframeScale.y; | |
| 4611 | + width *= iframeScale.x; | |
| 4612 | + height *= iframeScale.y; | |
| 4613 | + x2 += left; | |
| 4614 | + y2 += top; | |
| 4615 | + currentWin = getWindow(currentIFrame); | |
| 4616 | + currentIFrame = getFrameElement(currentWin); | |
| 4617 | + } | |
| 4618 | + } | |
| 4619 | + return rectToClientRect({ | |
| 4620 | + width, | |
| 4621 | + height, | |
| 4622 | + x: x2, | |
| 4623 | + y: y2 | |
| 4624 | + }); | |
| 4625 | +} | |
| 4626 | +function getWindowScrollBarX(element, rect) { | |
| 4627 | + const leftScroll = getNodeScroll(element).scrollLeft; | |
| 4628 | + if (!rect) { | |
| 4629 | + return getBoundingClientRect(getDocumentElement(element)).left + leftScroll; | |
| 4630 | + } | |
| 4631 | + return rect.left + leftScroll; | |
| 4632 | +} | |
| 4633 | +function getHTMLOffset(documentElement, scroll) { | |
| 4634 | + const htmlRect = documentElement.getBoundingClientRect(); | |
| 4635 | + const x2 = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect); | |
| 4636 | + const y2 = htmlRect.top + scroll.scrollTop; | |
| 4637 | + return { | |
| 4638 | + x: x2, | |
| 4639 | + y: y2 | |
| 4640 | + }; | |
| 4641 | +} | |
| 4642 | +function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { | |
| 4643 | + let { | |
| 4644 | + elements, | |
| 4645 | + rect, | |
| 4646 | + offsetParent, | |
| 4647 | + strategy | |
| 4648 | + } = _ref; | |
| 4649 | + const isFixed = strategy === "fixed"; | |
| 4650 | + const documentElement = getDocumentElement(offsetParent); | |
| 4651 | + const topLayer = elements ? isTopLayer(elements.floating) : false; | |
| 4652 | + if (offsetParent === documentElement || topLayer && isFixed) { | |
| 4653 | + return rect; | |
| 4654 | + } | |
| 4655 | + let scroll = { | |
| 4656 | + scrollLeft: 0, | |
| 4657 | + scrollTop: 0 | |
| 4658 | + }; | |
| 4659 | + let scale = createCoords(1); | |
| 4660 | + const offsets = createCoords(0); | |
| 4661 | + const isOffsetParentAnElement = isHTMLElement(offsetParent); | |
| 4662 | + if (isOffsetParentAnElement || !isFixed) { | |
| 4663 | + if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { | |
| 4664 | + scroll = getNodeScroll(offsetParent); | |
| 4665 | + } | |
| 4666 | + if (isOffsetParentAnElement) { | |
| 4667 | + const offsetRect = getBoundingClientRect(offsetParent); | |
| 4668 | + scale = getScale(offsetParent); | |
| 4669 | + offsets.x = offsetRect.x + offsetParent.clientLeft; | |
| 4670 | + offsets.y = offsetRect.y + offsetParent.clientTop; | |
| 4671 | + } | |
| 4672 | + } | |
| 4673 | + const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); | |
| 4674 | + return { | |
| 4675 | + width: rect.width * scale.x, | |
| 4676 | + height: rect.height * scale.y, | |
| 4677 | + x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, | |
| 4678 | + y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y | |
| 4679 | + }; | |
| 4680 | +} | |
| 4681 | +function getClientRects(element) { | |
| 4682 | + return element.getClientRects ? Array.from(element.getClientRects()) : []; | |
| 4683 | +} | |
| 4684 | +function getDocumentRect(html) { | |
| 4685 | + const scroll = getNodeScroll(html); | |
| 4686 | + const body = html.ownerDocument.body; | |
| 4687 | + const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); | |
| 4688 | + const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); | |
| 4689 | + let x2 = -scroll.scrollLeft + getWindowScrollBarX(html); | |
| 4690 | + const y2 = -scroll.scrollTop; | |
| 4691 | + if (getComputedStyle2(body).direction === "rtl") { | |
| 4692 | + x2 += max(html.clientWidth, body.clientWidth) - width; | |
| 4693 | + } | |
| 4694 | + return { | |
| 4695 | + width, | |
| 4696 | + height, | |
| 4697 | + x: x2, | |
| 4698 | + y: y2 | |
| 4699 | + }; | |
| 4700 | +} | |
| 4701 | +var SCROLLBAR_MAX = 25; | |
| 4702 | +function getViewportRect(element, strategy, rootBoundary) { | |
| 4703 | + if (rootBoundary === void 0) { | |
| 4704 | + rootBoundary = "viewport"; | |
| 4705 | + } | |
| 4706 | + const isLayoutViewport = rootBoundary === "layoutViewport"; | |
| 4707 | + const win = getWindow(element); | |
| 4708 | + const html = getDocumentElement(element); | |
| 4709 | + const visualViewport = win.visualViewport; | |
| 4710 | + let width = html.clientWidth; | |
| 4711 | + let height = html.clientHeight; | |
| 4712 | + let x2 = 0; | |
| 4713 | + let y2 = 0; | |
| 4714 | + if (visualViewport) { | |
| 4715 | + const layoutRelativeClientCoords = !isWebKit() || strategy === "fixed"; | |
| 4716 | + if (isLayoutViewport) { | |
| 4717 | + if (!layoutRelativeClientCoords) { | |
| 4718 | + x2 = -visualViewport.offsetLeft; | |
| 4719 | + y2 = -visualViewport.offsetTop; | |
| 4720 | + } | |
| 4721 | + } else { | |
| 4722 | + width = visualViewport.width; | |
| 4723 | + height = visualViewport.height; | |
| 4724 | + if (layoutRelativeClientCoords) { | |
| 4725 | + x2 = visualViewport.offsetLeft; | |
| 4726 | + y2 = visualViewport.offsetTop; | |
| 4727 | + } | |
| 4728 | + } | |
| 4729 | + } | |
| 4730 | + const windowScrollbarX = getWindowScrollBarX(html); | |
| 4731 | + if (windowScrollbarX <= 0) { | |
| 4732 | + const doc = html.ownerDocument; | |
| 4733 | + const body = doc.body; | |
| 4734 | + const bodyStyles = getComputedStyle(body); | |
| 4735 | + const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0; | |
| 4736 | + const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline); | |
| 4737 | + const gutter = getComputedStyle(html).scrollbarGutter === "stable both-edges" ? reservedWidth / 2 : reservedWidth; | |
| 4738 | + if (gutter <= SCROLLBAR_MAX) { | |
| 4739 | + width -= gutter; | |
| 4740 | + } | |
| 4741 | + } | |
| 4742 | + return { | |
| 4743 | + width, | |
| 4744 | + height, | |
| 4745 | + x: x2, | |
| 4746 | + y: y2 | |
| 4747 | + }; | |
| 4748 | +} | |
| 4749 | +function getInnerBoundingClientRect(element, strategy) { | |
| 4750 | + const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); | |
| 4751 | + const top = clientRect.top + element.clientTop; | |
| 4752 | + const left = clientRect.left + element.clientLeft; | |
| 4753 | + const scale = getScale(element); | |
| 4754 | + const width = element.clientWidth * scale.x; | |
| 4755 | + const height = element.clientHeight * scale.y; | |
| 4756 | + const x2 = left * scale.x; | |
| 4757 | + const y2 = top * scale.y; | |
| 4758 | + return { | |
| 4759 | + width, | |
| 4760 | + height, | |
| 4761 | + x: x2, | |
| 4762 | + y: y2 | |
| 4763 | + }; | |
| 4764 | +} | |
| 4765 | +function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { | |
| 4766 | + let rect; | |
| 4767 | + if (clippingAncestor === "viewport" || clippingAncestor === "layoutViewport") { | |
| 4768 | + rect = getViewportRect(element, strategy, clippingAncestor); | |
| 4769 | + } else if (clippingAncestor === "document") { | |
| 4770 | + rect = getDocumentRect(getDocumentElement(element)); | |
| 4771 | + } else if (isElement(clippingAncestor)) { | |
| 4772 | + rect = getInnerBoundingClientRect(clippingAncestor, strategy); | |
| 4773 | + } else { | |
| 4774 | + const visualOffsets = getVisualOffsets(element); | |
| 4775 | + rect = { | |
| 4776 | + x: clippingAncestor.x - visualOffsets.x, | |
| 4777 | + y: clippingAncestor.y - visualOffsets.y, | |
| 4778 | + width: clippingAncestor.width, | |
| 4779 | + height: clippingAncestor.height | |
| 4780 | + }; | |
| 4781 | + } | |
| 4782 | + return rectToClientRect(rect); | |
| 4783 | +} | |
| 4784 | +function getClippingElementAncestors(element, cache) { | |
| 4785 | + const cachedResult = cache.get(element); | |
| 4786 | + if (cachedResult) { | |
| 4787 | + return cachedResult; | |
| 4788 | + } | |
| 4789 | + let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); | |
| 4790 | + let lastKeptComputedStyle = null; | |
| 4791 | + const elementIsFixed = getComputedStyle2(element).position === "fixed"; | |
| 4792 | + let currentNode = elementIsFixed ? getParentNode(element) : element; | |
| 4793 | + while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { | |
| 4794 | + const computedStyle = getComputedStyle2(currentNode); | |
| 4795 | + const currentNodeIsContaining = isContainingBlock(currentNode); | |
| 4796 | + const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? "fixed" : ""; | |
| 4797 | + const shouldDropCurrentNode = !currentNodeIsContaining && (lastPosition === "fixed" || lastPosition === "absolute" && computedStyle.position === "static"); | |
| 4798 | + if (shouldDropCurrentNode) { | |
| 4799 | + result = result.filter((ancestor) => ancestor !== currentNode); | |
| 4800 | + } else { | |
| 4801 | + lastKeptComputedStyle = computedStyle; | |
| 4802 | + } | |
| 4803 | + currentNode = getParentNode(currentNode); | |
| 4804 | + } | |
| 4805 | + cache.set(element, result); | |
| 141 | 4806 | return result; |
| 142 | 4807 | } |
| 4808 | +function getClippingRect(_ref) { | |
| 4809 | + let { | |
| 4810 | + element, | |
| 4811 | + boundary, | |
| 4812 | + rootBoundary, | |
| 4813 | + strategy | |
| 4814 | + } = _ref; | |
| 4815 | + const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary); | |
| 4816 | + const clippingAncestors = [...elementClippingAncestors, rootBoundary]; | |
| 4817 | + const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy); | |
| 4818 | + let top = firstRect.top; | |
| 4819 | + let right = firstRect.right; | |
| 4820 | + let bottom = firstRect.bottom; | |
| 4821 | + let left = firstRect.left; | |
| 4822 | + for (let i = 1; i < clippingAncestors.length; i++) { | |
| 4823 | + const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy); | |
| 4824 | + top = max(rect.top, top); | |
| 4825 | + right = min(rect.right, right); | |
| 4826 | + bottom = min(rect.bottom, bottom); | |
| 4827 | + left = max(rect.left, left); | |
| 4828 | + } | |
| 4829 | + return { | |
| 4830 | + width: right - left, | |
| 4831 | + height: bottom - top, | |
| 4832 | + x: left, | |
| 4833 | + y: top | |
| 4834 | + }; | |
| 4835 | +} | |
| 4836 | +function getDimensions(element) { | |
| 4837 | + const { | |
| 4838 | + width, | |
| 4839 | + height | |
| 4840 | + } = getCssDimensions(element); | |
| 4841 | + return { | |
| 4842 | + width, | |
| 4843 | + height | |
| 4844 | + }; | |
| 4845 | +} | |
| 4846 | +function getRectRelativeToOffsetParent(element, offsetParent, strategy) { | |
| 4847 | + const isOffsetParentAnElement = isHTMLElement(offsetParent); | |
| 4848 | + const documentElement = getDocumentElement(offsetParent); | |
| 4849 | + const isFixed = strategy === "fixed"; | |
| 4850 | + const rect = getBoundingClientRect(element, true, isFixed, offsetParent); | |
| 4851 | + let scroll = { | |
| 4852 | + scrollLeft: 0, | |
| 4853 | + scrollTop: 0 | |
| 4854 | + }; | |
| 4855 | + const offsets = createCoords(0); | |
| 4856 | + if (isOffsetParentAnElement || !isFixed) { | |
| 4857 | + if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { | |
| 4858 | + scroll = getNodeScroll(offsetParent); | |
| 4859 | + } | |
| 4860 | + if (isOffsetParentAnElement) { | |
| 4861 | + const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); | |
| 4862 | + offsets.x = offsetRect.x + offsetParent.clientLeft; | |
| 4863 | + offsets.y = offsetRect.y + offsetParent.clientTop; | |
| 4864 | + } | |
| 4865 | + } | |
| 4866 | + if (!isOffsetParentAnElement && documentElement) { | |
| 4867 | + offsets.x = getWindowScrollBarX(documentElement); | |
| 4868 | + } | |
| 4869 | + const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); | |
| 4870 | + const x2 = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x; | |
| 4871 | + const y2 = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y; | |
| 4872 | + return { | |
| 4873 | + x: x2, | |
| 4874 | + y: y2, | |
| 4875 | + width: rect.width, | |
| 4876 | + height: rect.height | |
| 4877 | + }; | |
| 4878 | +} | |
| 4879 | +function isStaticPositioned(element) { | |
| 4880 | + return getComputedStyle2(element).position === "static"; | |
| 4881 | +} | |
| 4882 | +function getTrueOffsetParent(element, polyfill) { | |
| 4883 | + if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") { | |
| 4884 | + return null; | |
| 4885 | + } | |
| 4886 | + if (polyfill) { | |
| 4887 | + return polyfill(element); | |
| 4888 | + } | |
| 4889 | + let rawOffsetParent = element.offsetParent; | |
| 4890 | + if (getDocumentElement(element) === rawOffsetParent) { | |
| 4891 | + rawOffsetParent = rawOffsetParent.ownerDocument.body; | |
| 4892 | + } | |
| 4893 | + return rawOffsetParent; | |
| 4894 | +} | |
| 4895 | +function getOffsetParent(element, polyfill) { | |
| 4896 | + const win = getWindow(element); | |
| 4897 | + if (isTopLayer(element)) { | |
| 4898 | + return win; | |
| 4899 | + } | |
| 4900 | + if (!isHTMLElement(element)) { | |
| 4901 | + let svgOffsetParent = getParentNode(element); | |
| 4902 | + while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { | |
| 4903 | + if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { | |
| 4904 | + return svgOffsetParent; | |
| 4905 | + } | |
| 4906 | + svgOffsetParent = getParentNode(svgOffsetParent); | |
| 4907 | + } | |
| 4908 | + return win; | |
| 4909 | + } | |
| 4910 | + let offsetParent = getTrueOffsetParent(element, polyfill); | |
| 4911 | + while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) { | |
| 4912 | + offsetParent = getTrueOffsetParent(offsetParent, polyfill); | |
| 4913 | + } | |
| 4914 | + if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) { | |
| 4915 | + return win; | |
| 4916 | + } | |
| 4917 | + return offsetParent || getContainingBlock(element) || win; | |
| 4918 | +} | |
| 4919 | +var getElementRects = async function(data) { | |
| 4920 | + const getOffsetParentFn = this.getOffsetParent || getOffsetParent; | |
| 4921 | + const getDimensionsFn = this.getDimensions; | |
| 4922 | + const floatingDimensions = await getDimensionsFn(data.floating); | |
| 4923 | + return { | |
| 4924 | + reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), | |
| 4925 | + floating: { | |
| 4926 | + x: 0, | |
| 4927 | + y: 0, | |
| 4928 | + width: floatingDimensions.width, | |
| 4929 | + height: floatingDimensions.height | |
| 4930 | + } | |
| 4931 | + }; | |
| 4932 | +}; | |
| 4933 | +function isRTL(element) { | |
| 4934 | + return getComputedStyle2(element).direction === "rtl"; | |
| 4935 | +} | |
| 4936 | +var platform2 = { | |
| 4937 | + convertOffsetParentRelativeRectToViewportRelativeRect, | |
| 4938 | + getDocumentElement, | |
| 4939 | + getClippingRect, | |
| 4940 | + getOffsetParent, | |
| 4941 | + getElementRects, | |
| 4942 | + getClientRects, | |
| 4943 | + getDimensions, | |
| 4944 | + getScale, | |
| 4945 | + isElement, | |
| 4946 | + isRTL | |
| 4947 | +}; | |
| 4948 | +function rectsAreEqual(a, b) { | |
| 4949 | + return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; | |
| 4950 | +} | |
| 4951 | +function observeMove(element, onMove, ancestorResize) { | |
| 4952 | + let io = null; | |
| 4953 | + let timeoutId; | |
| 4954 | + const root = getDocumentElement(element); | |
| 4955 | + function cleanup() { | |
| 4956 | + var _io; | |
| 4957 | + clearTimeout(timeoutId); | |
| 4958 | + (_io = io) == null || _io.disconnect(); | |
| 4959 | + io = null; | |
| 4960 | + } | |
| 4961 | + function refresh(skip, threshold) { | |
| 4962 | + if (skip === void 0) { | |
| 4963 | + skip = false; | |
| 4964 | + } | |
| 4965 | + if (threshold === void 0) { | |
| 4966 | + threshold = 1; | |
| 4967 | + } | |
| 4968 | + cleanup(); | |
| 4969 | + const elementRectForRootMargin = element.getBoundingClientRect(); | |
| 4970 | + const { | |
| 4971 | + left, | |
| 4972 | + top, | |
| 4973 | + width, | |
| 4974 | + height | |
| 4975 | + } = elementRectForRootMargin; | |
| 4976 | + if (!skip) { | |
| 4977 | + onMove(); | |
| 4978 | + } | |
| 4979 | + if (!width || !height) { | |
| 4980 | + return; | |
| 4981 | + } | |
| 4982 | + const insetTop = floor(top); | |
| 4983 | + const insetRight = floor(root.clientWidth - (left + width)); | |
| 4984 | + const insetBottom = floor(root.clientHeight - (top + height)); | |
| 4985 | + const insetLeft = floor(left); | |
| 4986 | + const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; | |
| 4987 | + const options = { | |
| 4988 | + rootMargin, | |
| 4989 | + threshold: max(0, min(1, threshold)) || 1 | |
| 4990 | + }; | |
| 4991 | + let isFirstUpdate = true; | |
| 4992 | + function handleObserve(entries) { | |
| 4993 | + const ratio = entries[0].intersectionRatio; | |
| 4994 | + if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) { | |
| 4995 | + return refresh(); | |
| 4996 | + } | |
| 4997 | + if (ratio !== threshold) { | |
| 4998 | + if (!isFirstUpdate) { | |
| 4999 | + return refresh(); | |
| 5000 | + } | |
| 5001 | + if (!ratio) { | |
| 5002 | + timeoutId = setTimeout(() => { | |
| 5003 | + refresh(false, 1e-7); | |
| 5004 | + }, 1e3); | |
| 5005 | + } else { | |
| 5006 | + refresh(false, ratio); | |
| 5007 | + } | |
| 5008 | + } | |
| 5009 | + isFirstUpdate = false; | |
| 5010 | + } | |
| 5011 | + try { | |
| 5012 | + io = new IntersectionObserver(handleObserve, { | |
| 5013 | + ...options, | |
| 5014 | + // Handle <iframe>s | |
| 5015 | + root: root.ownerDocument | |
| 5016 | + }); | |
| 5017 | + } catch (_e) { | |
| 5018 | + io = new IntersectionObserver(handleObserve, options); | |
| 5019 | + } | |
| 5020 | + io.observe(element); | |
| 5021 | + } | |
| 5022 | + const win = getWindow(element); | |
| 5023 | + const handleResize = () => refresh(ancestorResize); | |
| 5024 | + win.addEventListener("resize", handleResize); | |
| 5025 | + refresh(true); | |
| 5026 | + return () => { | |
| 5027 | + win.removeEventListener("resize", handleResize); | |
| 5028 | + cleanup(); | |
| 5029 | + }; | |
| 5030 | +} | |
| 5031 | +function autoUpdate(reference, floating, update2, options) { | |
| 5032 | + if (options === void 0) { | |
| 5033 | + options = {}; | |
| 5034 | + } | |
| 5035 | + const { | |
| 5036 | + ancestorScroll = true, | |
| 5037 | + ancestorResize = true, | |
| 5038 | + elementResize = typeof ResizeObserver === "function", | |
| 5039 | + layoutShift = typeof IntersectionObserver === "function", | |
| 5040 | + animationFrame = false | |
| 5041 | + } = options; | |
| 5042 | + const referenceEl = unwrapElement(reference); | |
| 5043 | + const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : []; | |
| 5044 | + ancestors.forEach((ancestor) => { | |
| 5045 | + ancestorScroll && ancestor.addEventListener("scroll", update2); | |
| 5046 | + ancestorResize && ancestor.addEventListener("resize", update2); | |
| 5047 | + }); | |
| 5048 | + const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2, ancestorResize) : null; | |
| 5049 | + let reobserveFrame = -1; | |
| 5050 | + let resizeObserver = null; | |
| 5051 | + if (elementResize) { | |
| 5052 | + resizeObserver = new ResizeObserver((_ref) => { | |
| 5053 | + let [firstEntry] = _ref; | |
| 5054 | + if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) { | |
| 5055 | + resizeObserver.unobserve(floating); | |
| 5056 | + cancelAnimationFrame(reobserveFrame); | |
| 5057 | + reobserveFrame = requestAnimationFrame(() => { | |
| 5058 | + var _resizeObserver; | |
| 5059 | + (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); | |
| 5060 | + }); | |
| 5061 | + } | |
| 5062 | + update2(); | |
| 5063 | + }); | |
| 5064 | + if (referenceEl && !animationFrame) { | |
| 5065 | + resizeObserver.observe(referenceEl); | |
| 5066 | + } | |
| 5067 | + if (floating) { | |
| 5068 | + resizeObserver.observe(floating); | |
| 5069 | + } | |
| 5070 | + } | |
| 5071 | + let frameId; | |
| 5072 | + let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; | |
| 5073 | + if (animationFrame) { | |
| 5074 | + frameLoop(); | |
| 5075 | + } | |
| 5076 | + function frameLoop() { | |
| 5077 | + const nextRefRect = getBoundingClientRect(reference); | |
| 5078 | + if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) { | |
| 5079 | + update2(); | |
| 5080 | + } | |
| 5081 | + prevRefRect = nextRefRect; | |
| 5082 | + frameId = requestAnimationFrame(frameLoop); | |
| 5083 | + } | |
| 5084 | + update2(); | |
| 5085 | + return () => { | |
| 5086 | + var _resizeObserver2; | |
| 5087 | + ancestors.forEach((ancestor) => { | |
| 5088 | + ancestorScroll && ancestor.removeEventListener("scroll", update2); | |
| 5089 | + ancestorResize && ancestor.removeEventListener("resize", update2); | |
| 5090 | + }); | |
| 5091 | + cleanupIo == null || cleanupIo(); | |
| 5092 | + (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); | |
| 5093 | + resizeObserver = null; | |
| 5094 | + if (animationFrame) { | |
| 5095 | + cancelAnimationFrame(frameId); | |
| 5096 | + } | |
| 5097 | + }; | |
| 5098 | +} | |
| 5099 | +var offset2 = offset; | |
| 5100 | +var shift2 = shift; | |
| 5101 | +var flip2 = flip; | |
| 5102 | +var size2 = size; | |
| 5103 | +var limitShift2 = limitShift; | |
| 5104 | +var computePosition2 = (reference, floating, options) => { | |
| 5105 | + const cache = /* @__PURE__ */ new Map(); | |
| 5106 | + const mergedOptions = options != null ? options : {}; | |
| 5107 | + const platformWithCache = { | |
| 5108 | + ...platform2, | |
| 5109 | + ...mergedOptions.platform, | |
| 5110 | + _c: cache | |
| 5111 | + }; | |
| 5112 | + return computePosition(reference, floating, { | |
| 5113 | + ...mergedOptions, | |
| 5114 | + platform: platformWithCache | |
| 5115 | + }); | |
| 5116 | +}; | |
| 143 | 5117 | |
| 144 | -// packages/views/build-module/load-view.mjs | |
| 145 | -var import_data2 = __toESM(require_data(), 1); | |
| 146 | -var import_preferences2 = __toESM(require_preferences(), 1); | |
| 147 | -async function loadView(config) { | |
| 148 | - const { kind, name, slug, defaultView, activeViewOverrides, queryParams } = config; | |
| 149 | - const preferenceKey = generatePreferenceKey(kind, name, slug); | |
| 150 | - const persistedView = (0, import_data2.select)(import_preferences2.store).get( | |
| 151 | - "core/views", | |
| 152 | - preferenceKey | |
| 5118 | +// node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs | |
| 5119 | +var React21 = __toESM(require_react(), 1); | |
| 5120 | +var import_react2 = __toESM(require_react(), 1); | |
| 5121 | +var ReactDOM3 = __toESM(require_react_dom(), 1); | |
| 5122 | +var isClient = typeof document !== "undefined"; | |
| 5123 | +var noop2 = function noop3() { | |
| 5124 | +}; | |
| 5125 | +var index = isClient ? import_react2.useLayoutEffect : noop2; | |
| 5126 | +function deepEqual(a, b) { | |
| 5127 | + if (a === b) { | |
| 5128 | + return true; | |
| 5129 | + } | |
| 5130 | + if (typeof a !== typeof b) { | |
| 5131 | + return false; | |
| 5132 | + } | |
| 5133 | + if (typeof a === "function" && a.toString() === b.toString()) { | |
| 5134 | + return true; | |
| 5135 | + } | |
| 5136 | + let length; | |
| 5137 | + let i; | |
| 5138 | + let keys; | |
| 5139 | + if (a && b && typeof a === "object") { | |
| 5140 | + if (Array.isArray(a)) { | |
| 5141 | + length = a.length; | |
| 5142 | + if (length !== b.length) return false; | |
| 5143 | + for (i = length; i-- !== 0; ) { | |
| 5144 | + if (!deepEqual(a[i], b[i])) { | |
| 5145 | + return false; | |
| 5146 | + } | |
| 5147 | + } | |
| 5148 | + return true; | |
| 5149 | + } | |
| 5150 | + keys = Object.keys(a); | |
| 5151 | + length = keys.length; | |
| 5152 | + if (length !== Object.keys(b).length) { | |
| 5153 | + return false; | |
| 5154 | + } | |
| 5155 | + for (i = length; i-- !== 0; ) { | |
| 5156 | + if (!{}.hasOwnProperty.call(b, keys[i])) { | |
| 5157 | + return false; | |
| 5158 | + } | |
| 5159 | + } | |
| 5160 | + for (i = length; i-- !== 0; ) { | |
| 5161 | + const key = keys[i]; | |
| 5162 | + if (key === "_owner" && a.$$typeof) { | |
| 5163 | + continue; | |
| 5164 | + } | |
| 5165 | + if (!deepEqual(a[key], b[key])) { | |
| 5166 | + return false; | |
| 5167 | + } | |
| 5168 | + } | |
| 5169 | + return true; | |
| 5170 | + } | |
| 5171 | + return a !== a && b !== b; | |
| 5172 | +} | |
| 5173 | +function getDPR(element) { | |
| 5174 | + if (typeof window === "undefined") { | |
| 5175 | + return 1; | |
| 5176 | + } | |
| 5177 | + const win = element.ownerDocument.defaultView || window; | |
| 5178 | + return win.devicePixelRatio || 1; | |
| 5179 | +} | |
| 5180 | +function roundByDPR(element, value) { | |
| 5181 | + const dpr = getDPR(element); | |
| 5182 | + return Math.round(value * dpr) / dpr; | |
| 5183 | +} | |
| 5184 | +function useLatestRef(value) { | |
| 5185 | + const ref = React21.useRef(value); | |
| 5186 | + index(() => { | |
| 5187 | + ref.current = value; | |
| 5188 | + }); | |
| 5189 | + return ref; | |
| 5190 | +} | |
| 5191 | +function useFloating(options) { | |
| 5192 | + if (options === void 0) { | |
| 5193 | + options = {}; | |
| 5194 | + } | |
| 5195 | + const { | |
| 5196 | + placement = "bottom", | |
| 5197 | + strategy = "absolute", | |
| 5198 | + middleware = [], | |
| 5199 | + platform: platform3, | |
| 5200 | + elements: { | |
| 5201 | + reference: externalReference, | |
| 5202 | + floating: externalFloating | |
| 5203 | + } = {}, | |
| 5204 | + transform = true, | |
| 5205 | + whileElementsMounted, | |
| 5206 | + open: open2 | |
| 5207 | + } = options; | |
| 5208 | + const [data, setData] = React21.useState({ | |
| 5209 | + x: 0, | |
| 5210 | + y: 0, | |
| 5211 | + strategy, | |
| 5212 | + placement, | |
| 5213 | + middlewareData: {}, | |
| 5214 | + isPositioned: false | |
| 5215 | + }); | |
| 5216 | + const [latestMiddleware, setLatestMiddleware] = React21.useState(middleware); | |
| 5217 | + if (!deepEqual(latestMiddleware, middleware)) { | |
| 5218 | + setLatestMiddleware(middleware); | |
| 5219 | + } | |
| 5220 | + const [_reference, _setReference] = React21.useState(null); | |
| 5221 | + const [_floating, _setFloating] = React21.useState(null); | |
| 5222 | + const setReference = React21.useCallback((node) => { | |
| 5223 | + if (node !== referenceRef.current) { | |
| 5224 | + referenceRef.current = node; | |
| 5225 | + _setReference(node); | |
| 5226 | + } | |
| 5227 | + }, []); | |
| 5228 | + const setFloating = React21.useCallback((node) => { | |
| 5229 | + if (node !== floatingRef.current) { | |
| 5230 | + floatingRef.current = node; | |
| 5231 | + _setFloating(node); | |
| 5232 | + } | |
| 5233 | + }, []); | |
| 5234 | + const referenceEl = externalReference || _reference; | |
| 5235 | + const floatingEl = externalFloating || _floating; | |
| 5236 | + const referenceRef = React21.useRef(null); | |
| 5237 | + const floatingRef = React21.useRef(null); | |
| 5238 | + const dataRef = React21.useRef(data); | |
| 5239 | + const hasWhileElementsMounted = whileElementsMounted != null; | |
| 5240 | + const whileElementsMountedRef = useLatestRef(whileElementsMounted); | |
| 5241 | + const platformRef = useLatestRef(platform3); | |
| 5242 | + const openRef = useLatestRef(open2); | |
| 5243 | + const update2 = React21.useCallback(() => { | |
| 5244 | + if (!referenceRef.current || !floatingRef.current) { | |
| 5245 | + return; | |
| 5246 | + } | |
| 5247 | + const config = { | |
| 5248 | + placement, | |
| 5249 | + strategy, | |
| 5250 | + middleware: latestMiddleware | |
| 5251 | + }; | |
| 5252 | + if (platformRef.current) { | |
| 5253 | + config.platform = platformRef.current; | |
| 5254 | + } | |
| 5255 | + computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => { | |
| 5256 | + const fullData = { | |
| 5257 | + ...data2, | |
| 5258 | + // The floating element's position may be recomputed while it's closed | |
| 5259 | + // but still mounted (such as when transitioning out). To ensure | |
| 5260 | + // `isPositioned` will be `false` initially on the next open, avoid | |
| 5261 | + // setting it to `true` when `open === false` (must be specified). | |
| 5262 | + isPositioned: openRef.current !== false | |
| 5263 | + }; | |
| 5264 | + if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { | |
| 5265 | + dataRef.current = fullData; | |
| 5266 | + ReactDOM3.flushSync(() => { | |
| 5267 | + setData(fullData); | |
| 5268 | + }); | |
| 5269 | + } | |
| 5270 | + }); | |
| 5271 | + }, [latestMiddleware, placement, strategy, platformRef, openRef]); | |
| 5272 | + index(() => { | |
| 5273 | + if (open2 === false && dataRef.current.isPositioned) { | |
| 5274 | + dataRef.current.isPositioned = false; | |
| 5275 | + setData((data2) => ({ | |
| 5276 | + ...data2, | |
| 5277 | + isPositioned: false | |
| 5278 | + })); | |
| 5279 | + } | |
| 5280 | + }, [open2]); | |
| 5281 | + const isMountedRef = React21.useRef(false); | |
| 5282 | + index(() => { | |
| 5283 | + isMountedRef.current = true; | |
| 5284 | + return () => { | |
| 5285 | + isMountedRef.current = false; | |
| 5286 | + }; | |
| 5287 | + }, []); | |
| 5288 | + index(() => { | |
| 5289 | + if (referenceEl) referenceRef.current = referenceEl; | |
| 5290 | + if (floatingEl) floatingRef.current = floatingEl; | |
| 5291 | + if (referenceEl && floatingEl) { | |
| 5292 | + if (whileElementsMountedRef.current) { | |
| 5293 | + return whileElementsMountedRef.current(referenceEl, floatingEl, update2); | |
| 5294 | + } | |
| 5295 | + update2(); | |
| 5296 | + } | |
| 5297 | + }, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]); | |
| 5298 | + const refs = React21.useMemo(() => ({ | |
| 5299 | + reference: referenceRef, | |
| 5300 | + floating: floatingRef, | |
| 5301 | + setReference, | |
| 5302 | + setFloating | |
| 5303 | + }), [setReference, setFloating]); | |
| 5304 | + const elements = React21.useMemo(() => ({ | |
| 5305 | + reference: referenceEl, | |
| 5306 | + floating: floatingEl | |
| 5307 | + }), [referenceEl, floatingEl]); | |
| 5308 | + const floatingStyles = React21.useMemo(() => { | |
| 5309 | + const initialStyles = { | |
| 5310 | + position: strategy, | |
| 5311 | + left: 0, | |
| 5312 | + top: 0 | |
| 5313 | + }; | |
| 5314 | + if (!elements.floating) { | |
| 5315 | + return initialStyles; | |
| 5316 | + } | |
| 5317 | + const x2 = roundByDPR(elements.floating, data.x); | |
| 5318 | + const y2 = roundByDPR(elements.floating, data.y); | |
| 5319 | + if (transform) { | |
| 5320 | + return { | |
| 5321 | + ...initialStyles, | |
| 5322 | + transform: "translate(" + x2 + "px, " + y2 + "px)", | |
| 5323 | + ...getDPR(elements.floating) >= 1.5 && { | |
| 5324 | + willChange: "transform" | |
| 5325 | + } | |
| 5326 | + }; | |
| 5327 | + } | |
| 5328 | + return { | |
| 5329 | + position: strategy, | |
| 5330 | + left: x2, | |
| 5331 | + top: y2 | |
| 5332 | + }; | |
| 5333 | + }, [strategy, transform, elements.floating, data.x, data.y]); | |
| 5334 | + return React21.useMemo(() => ({ | |
| 5335 | + ...data, | |
| 5336 | + update: update2, | |
| 5337 | + refs, | |
| 5338 | + elements, | |
| 5339 | + floatingStyles | |
| 5340 | + }), [data, update2, refs, elements, floatingStyles]); | |
| 5341 | +} | |
| 5342 | +var offset3 = (options, deps) => { | |
| 5343 | + const result = offset2(options); | |
| 5344 | + return { | |
| 5345 | + name: result.name, | |
| 5346 | + fn: result.fn, | |
| 5347 | + options: [options, deps] | |
| 5348 | + }; | |
| 5349 | +}; | |
| 5350 | +var shift3 = (options, deps) => { | |
| 5351 | + const result = shift2(options); | |
| 5352 | + return { | |
| 5353 | + name: result.name, | |
| 5354 | + fn: result.fn, | |
| 5355 | + options: [options, deps] | |
| 5356 | + }; | |
| 5357 | +}; | |
| 5358 | +var limitShift3 = (options, deps) => { | |
| 5359 | + const result = limitShift2(options); | |
| 5360 | + return { | |
| 5361 | + fn: result.fn, | |
| 5362 | + options: [options, deps] | |
| 5363 | + }; | |
| 5364 | +}; | |
| 5365 | +var flip3 = (options, deps) => { | |
| 5366 | + const result = flip2(options); | |
| 5367 | + return { | |
| 5368 | + name: result.name, | |
| 5369 | + fn: result.fn, | |
| 5370 | + options: [options, deps] | |
| 5371 | + }; | |
| 5372 | +}; | |
| 5373 | +var size3 = (options, deps) => { | |
| 5374 | + const result = size2(options); | |
| 5375 | + return { | |
| 5376 | + name: result.name, | |
| 5377 | + fn: result.fn, | |
| 5378 | + options: [options, deps] | |
| 5379 | + }; | |
| 5380 | +}; | |
| 5381 | + | |
| 5382 | +// node_modules/@base-ui/react/utils/popups/popupHandle.mjs | |
| 5383 | +var BasePopupHandle = class { | |
| 5384 | + /** | |
| 5385 | + * Stores of every root currently using this handle, in attach order. A handle is meant to be used | |
| 5386 | + * by a single mounted root, but roots can transiently overlap (e.g. during an animated route | |
| 5387 | + * transition), so this stack lets `attachStore`'s cleanup restore the previous root instead of | |
| 5388 | + * leaving a still-mounted root uncontrollable when a newer overlapping root detaches first. | |
| 5389 | + */ | |
| 5390 | + attachedStores = []; | |
| 5391 | + /** | |
| 5392 | + * Store of the root that currently controls the handle: the most recently attached one still | |
| 5393 | + * mounted, or `null` when no root is attached. Imperative methods are no-ops while this is `null`. | |
| 5394 | + */ | |
| 5395 | + attachedStoreValue = null; | |
| 5396 | + /** | |
| 5397 | + * Listeners notified when `attachedStore` changes, so detached triggers can follow the store pointer. | |
| 5398 | + */ | |
| 5399 | + storeListeners = /* @__PURE__ */ new Set(); | |
| 5400 | + /** | |
| 5401 | + * Creates a handle backed by the store used while no root is attached. | |
| 5402 | + * | |
| 5403 | + * @param fallbackStore Inert, closed store handed to detached triggers while no root is attached, | |
| 5404 | + * so they can render and register without a mounted root. Triggers register into whichever store | |
| 5405 | + * `store` currently resolves to, so while detached they live in this store's trigger map and | |
| 5406 | + * migrate themselves to the root's store (and back) as it attaches/detaches. | |
| 5407 | + * @param componentName Component name used to prefix dev warnings, e.g. `'Menu'` produces | |
| 5408 | + * `MenuHandle.open()` in warning text. | |
| 5409 | + * @param throwOnMissingTrigger Whether `open(triggerId)` throws when no trigger with that id is | |
| 5410 | + * registered. Anchored popups (Menu, Popover, Tooltip, PreviewCard) need a trigger to anchor to, | |
| 5411 | + * so they throw; Dialog is not anchored and instead opens unassociated with a dev warning. | |
| 5412 | + */ | |
| 5413 | + constructor(fallbackStore, componentName, throwOnMissingTrigger = true) { | |
| 5414 | + this.fallbackStore = fallbackStore; | |
| 5415 | + this.componentName = componentName; | |
| 5416 | + this.throwOnMissingTrigger = throwOnMissingTrigger; | |
| 5417 | + } | |
| 5418 | + get attachedStore() { | |
| 5419 | + return this.attachedStoreValue; | |
| 5420 | + } | |
| 5421 | + /** | |
| 5422 | + * Store that detached triggers read from: the attached root's store, or an inert fallback store | |
| 5423 | + * used while no root is attached. | |
| 5424 | + * @internal | |
| 5425 | + */ | |
| 5426 | + get store() { | |
| 5427 | + return this.attachedStoreValue ?? this.fallbackStore; | |
| 5428 | + } | |
| 5429 | + /** | |
| 5430 | + * Stable fallback store used for server rendering and hydration. Root stores cannot be recorded on | |
| 5431 | + * the handle during render because a handle can be shared by concurrent server-rendered requests. | |
| 5432 | + * @internal | |
| 5433 | + */ | |
| 5434 | + get serverStore() { | |
| 5435 | + return this.fallbackStore; | |
| 5436 | + } | |
| 5437 | + /** | |
| 5438 | + * Subscribes to changes of the attached store pointer so detached triggers re-render and re-bind | |
| 5439 | + * when a root attaches or detaches. Returns a function that removes the listener. | |
| 5440 | + * @internal | |
| 5441 | + */ | |
| 5442 | + subscribeStore(listener) { | |
| 5443 | + this.storeListeners.add(listener); | |
| 5444 | + return () => { | |
| 5445 | + this.storeListeners.delete(listener); | |
| 5446 | + }; | |
| 5447 | + } | |
| 5448 | + /** | |
| 5449 | + * Points the handle at a root's store and notifies subscribers so detached triggers re-render and | |
| 5450 | + * re-register into it (their registration effect migrates them when the store pointer changes). | |
| 5451 | + * Returns a cleanup function that detaches the store again. | |
| 5452 | + * @internal | |
| 5453 | + */ | |
| 5454 | + attachStore(newStore) { | |
| 5455 | + this.attachedStores.push(newStore); | |
| 5456 | + this.setActiveStore(newStore); | |
| 5457 | + if (true) { | |
| 5458 | + if (this.attachedStores.length > 1) { | |
| 5459 | + const dev = this; | |
| 5460 | + (dev.overlapWarningFrame ??= AnimationFrame.create()).request(() => { | |
| 5461 | + if (this.attachedStores.length > 1) { | |
| 5462 | + 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."); | |
| 5463 | + } | |
| 5464 | + }); | |
| 5465 | + } | |
| 5466 | + } | |
| 5467 | + return () => { | |
| 5468 | + const index2 = this.attachedStores.lastIndexOf(newStore); | |
| 5469 | + if (index2 !== -1) { | |
| 5470 | + this.attachedStores.splice(index2, 1); | |
| 5471 | + } | |
| 5472 | + this.setActiveStore(this.attachedStores[this.attachedStores.length - 1] ?? null); | |
| 5473 | + }; | |
| 5474 | + } | |
| 5475 | + /** | |
| 5476 | + * Sets the store that currently controls the handle and notifies subscribers when it changes, so | |
| 5477 | + * detached triggers re-render and migrate their registration to the new store. | |
| 5478 | + */ | |
| 5479 | + setActiveStore(store) { | |
| 5480 | + if (this.attachedStoreValue !== store) { | |
| 5481 | + this.attachedStoreValue = store; | |
| 5482 | + this.storeListeners.forEach((listener) => { | |
| 5483 | + listener(); | |
| 5484 | + }); | |
| 5485 | + } | |
| 5486 | + } | |
| 5487 | + /** | |
| 5488 | + * Opens the attached root's store and associates it with the trigger with the given id, or a | |
| 5489 | + * no-op (with a dev warning) while no root is attached. Shared by every concrete handle's public | |
| 5490 | + * `open()` method, which only narrows the parameter type. | |
| 5491 | + * | |
| 5492 | + * When a trigger id is given but no matching trigger is registered, anchored popups throw (see | |
| 5493 | + * `throwOnMissingTrigger`); Dialog opens unassociated with a dev warning instead. | |
| 5494 | + * | |
| 5495 | + * This method should only be called in an event handler or an effect (not during rendering). | |
| 5496 | + * | |
| 5497 | + * @param triggerId ID of the trigger to associate with the popup, or `null`/`undefined` to open | |
| 5498 | + * without associating any trigger. | |
| 5499 | + */ | |
| 5500 | + openByTrigger(triggerId) { | |
| 5501 | + const attachedStore = this.attachedStore; | |
| 5502 | + if (attachedStore === null) { | |
| 5503 | + if (true) { | |
| 5504 | + 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.`); | |
| 5505 | + } | |
| 5506 | + return; | |
| 5507 | + } | |
| 5508 | + let triggerElement; | |
| 5509 | + if (triggerId) { | |
| 5510 | + for (let i = this.attachedStores.length - 1; i >= 0 && !triggerElement; i -= 1) { | |
| 5511 | + triggerElement = this.attachedStores[i].context.triggerElements.getById(triggerId); | |
| 5512 | + } | |
| 5513 | + triggerElement ??= this.fallbackStore.context.triggerElements.getById(triggerId); | |
| 5514 | + } | |
| 5515 | + if (triggerId && !triggerElement) { | |
| 5516 | + if (this.throwOnMissingTrigger) { | |
| 5517 | + 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)); | |
| 5518 | + } | |
| 5519 | + if (true) { | |
| 5520 | + 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.`); | |
| 5521 | + } | |
| 5522 | + } | |
| 5523 | + attachedStore.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement)); | |
| 5524 | + } | |
| 5525 | + /** | |
| 5526 | + * Closes the popup by setting the attached root's store to closed, or a no-op (with a dev warning) | |
| 5527 | + * while no root is attached. Shared by every concrete handle's public `close()` method. | |
| 5528 | + * | |
| 5529 | + * This method should only be called in an event handler or an effect (not during rendering). | |
| 5530 | + */ | |
| 5531 | + closePopup() { | |
| 5532 | + const attachedStore = this.attachedStore; | |
| 5533 | + if (attachedStore === null) { | |
| 5534 | + if (true) { | |
| 5535 | + console.warn(`Base UI: ${this.componentName}Handle.close() was called while no root using this handle is mounted. The call was ignored.`); | |
| 5536 | + } | |
| 5537 | + return; | |
| 5538 | + } | |
| 5539 | + attachedStore.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)); | |
| 5540 | + } | |
| 5541 | +}; | |
| 5542 | + | |
| 5543 | +// node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs | |
| 5544 | +var React26 = __toESM(require_react(), 1); | |
| 5545 | +var ReactDOM4 = __toESM(require_react_dom(), 1); | |
| 5546 | + | |
| 5547 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs | |
| 5548 | +var React25 = __toESM(require_react(), 1); | |
| 5549 | + | |
| 5550 | +// node_modules/@base-ui/utils/store/useStore.mjs | |
| 5551 | +var React23 = __toESM(require_react(), 1); | |
| 5552 | +var import_shim = __toESM(require_shim(), 1); | |
| 5553 | +var import_with_selector = __toESM(require_with_selector(), 1); | |
| 5554 | + | |
| 5555 | +// node_modules/@base-ui/utils/fastHooks.mjs | |
| 5556 | +var React22 = __toESM(require_react(), 1); | |
| 5557 | +var hooks = []; | |
| 5558 | +var currentInstance = void 0; | |
| 5559 | +function getInstance() { | |
| 5560 | + return currentInstance; | |
| 5561 | +} | |
| 5562 | +function register(hook) { | |
| 5563 | + hooks.push(hook); | |
| 5564 | +} | |
| 5565 | +function fastComponent(fn) { | |
| 5566 | + const FastComponent = (props, forwardedRef) => { | |
| 5567 | + const instance = useRefWithInit(createInstance).current; | |
| 5568 | + let result; | |
| 5569 | + try { | |
| 5570 | + currentInstance = instance; | |
| 5571 | + for (const hook of hooks) { | |
| 5572 | + hook.before(instance); | |
| 5573 | + } | |
| 5574 | + result = fn(props, forwardedRef); | |
| 5575 | + for (const hook of hooks) { | |
| 5576 | + hook.after(instance); | |
| 5577 | + } | |
| 5578 | + instance.didInitialize = true; | |
| 5579 | + } finally { | |
| 5580 | + currentInstance = void 0; | |
| 5581 | + } | |
| 5582 | + return result; | |
| 5583 | + }; | |
| 5584 | + FastComponent.displayName = fn.displayName || fn.name; | |
| 5585 | + return FastComponent; | |
| 5586 | +} | |
| 5587 | +function fastComponentRef(fn) { | |
| 5588 | + return /* @__PURE__ */ React22.forwardRef(fastComponent(fn)); | |
| 5589 | +} | |
| 5590 | +function createInstance() { | |
| 5591 | + return { | |
| 5592 | + didInitialize: false | |
| 5593 | + }; | |
| 5594 | +} | |
| 5595 | + | |
| 5596 | +// node_modules/@base-ui/utils/store/useStore.mjs | |
| 5597 | +var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19); | |
| 5598 | +var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy; | |
| 5599 | +function useStore(store, selector, a1, a2, a3) { | |
| 5600 | + return useStoreImplementation(store, selector, a1, a2, a3); | |
| 5601 | +} | |
| 5602 | +function useStoreR19(store, selector, a1, a2, a3) { | |
| 5603 | + const getSelection = React23.useCallback(() => selector(store.getSnapshot(), a1, a2, a3), [store, selector, a1, a2, a3]); | |
| 5604 | + return (0, import_shim.useSyncExternalStore)(store.subscribe, getSelection, getSelection); | |
| 5605 | +} | |
| 5606 | +register({ | |
| 5607 | + before(instance) { | |
| 5608 | + instance.syncIndex = 0; | |
| 5609 | + if (!instance.didInitialize) { | |
| 5610 | + instance.syncTick = 1; | |
| 5611 | + instance.syncHooks = []; | |
| 5612 | + instance.didChangeStore = true; | |
| 5613 | + instance.getSnapshot = () => { | |
| 5614 | + let didChange2 = false; | |
| 5615 | + for (let i = 0; i < instance.syncHooks.length; i += 1) { | |
| 5616 | + const hook = instance.syncHooks[i]; | |
| 5617 | + const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3); | |
| 5618 | + if (!Object.is(hook.value, value)) { | |
| 5619 | + didChange2 = true; | |
| 5620 | + hook.value = value; | |
| 5621 | + } | |
| 5622 | + } | |
| 5623 | + if (didChange2) { | |
| 5624 | + instance.syncTick += 1; | |
| 5625 | + } | |
| 5626 | + return instance.syncTick; | |
| 5627 | + }; | |
| 5628 | + } | |
| 5629 | + }, | |
| 5630 | + after(instance) { | |
| 5631 | + if (instance.syncHooks.length > 0) { | |
| 5632 | + if (instance.didChangeStore) { | |
| 5633 | + instance.didChangeStore = false; | |
| 5634 | + instance.subscribe = (onStoreChange) => { | |
| 5635 | + const stores = /* @__PURE__ */ new Set(); | |
| 5636 | + for (const hook of instance.syncHooks) { | |
| 5637 | + stores.add(hook.store); | |
| 5638 | + } | |
| 5639 | + const unsubscribes = []; | |
| 5640 | + for (const store of stores) { | |
| 5641 | + unsubscribes.push(store.subscribe(onStoreChange)); | |
| 5642 | + } | |
| 5643 | + return () => { | |
| 5644 | + for (const unsubscribe of unsubscribes) { | |
| 5645 | + unsubscribe(); | |
| 5646 | + } | |
| 5647 | + }; | |
| 5648 | + }; | |
| 5649 | + } | |
| 5650 | + (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot); | |
| 5651 | + } | |
| 5652 | + } | |
| 5653 | +}); | |
| 5654 | +function useStoreFast(store, selector, a1, a2, a3) { | |
| 5655 | + const instance = getInstance(); | |
| 5656 | + if (!instance) { | |
| 5657 | + return useStoreR19(store, selector, a1, a2, a3); | |
| 5658 | + } | |
| 5659 | + const index2 = instance.syncIndex; | |
| 5660 | + instance.syncIndex += 1; | |
| 5661 | + let hook; | |
| 5662 | + if (!instance.didInitialize) { | |
| 5663 | + hook = { | |
| 5664 | + store, | |
| 5665 | + selector, | |
| 5666 | + a1, | |
| 5667 | + a2, | |
| 5668 | + a3, | |
| 5669 | + value: selector(store.getSnapshot(), a1, a2, a3) | |
| 5670 | + }; | |
| 5671 | + instance.syncHooks.push(hook); | |
| 5672 | + } else { | |
| 5673 | + hook = instance.syncHooks[index2]; | |
| 5674 | + if (hook.store !== store || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) { | |
| 5675 | + if (hook.store !== store) { | |
| 5676 | + instance.didChangeStore = true; | |
| 5677 | + } | |
| 5678 | + hook.store = store; | |
| 5679 | + hook.selector = selector; | |
| 5680 | + hook.a1 = a1; | |
| 5681 | + hook.a2 = a2; | |
| 5682 | + hook.a3 = a3; | |
| 5683 | + hook.value = selector(store.getSnapshot(), a1, a2, a3); | |
| 5684 | + } | |
| 5685 | + } | |
| 5686 | + return hook.value; | |
| 5687 | +} | |
| 5688 | +function useStoreLegacy(store, selector, a1, a2, a3) { | |
| 5689 | + return (0, import_with_selector.useSyncExternalStoreWithSelector)(store.subscribe, store.getSnapshot, store.getSnapshot, (state) => selector(state, a1, a2, a3)); | |
| 5690 | +} | |
| 5691 | + | |
| 5692 | +// node_modules/@base-ui/utils/store/Store.mjs | |
| 5693 | +var Store = class { | |
| 5694 | + /** | |
| 5695 | + * Creates a store with the given initial state, constructing the class it is called on. | |
| 5696 | + * Calling it on a generic base class (e.g. `ReactStore.create(...)`) constructs that | |
| 5697 | + * class but degrades the inferred instance type to `Store`; use `new` there instead. | |
| 5698 | + */ | |
| 5699 | + static create(state) { | |
| 5700 | + return new this(state); | |
| 5701 | + } | |
| 5702 | + /** | |
| 5703 | + * The current state of the store. | |
| 5704 | + * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}. | |
| 5705 | + * 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). | |
| 5706 | + * The values can be used directly (to avoid subscribing to the store) in effects or event handlers. | |
| 5707 | + * | |
| 5708 | + * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification. | |
| 5709 | + */ | |
| 5710 | + // Internal state to handle recursive `setState()` calls | |
| 5711 | + constructor(state) { | |
| 5712 | + this.state = state; | |
| 5713 | + this.listeners = /* @__PURE__ */ new Set(); | |
| 5714 | + this.updateTick = 0; | |
| 5715 | + } | |
| 5716 | + /** | |
| 5717 | + * Registers a listener that will be called whenever the store's state changes. | |
| 5718 | + * | |
| 5719 | + * @param fn The listener function to be called on state changes. | |
| 5720 | + * @returns A function to unsubscribe the listener. | |
| 5721 | + */ | |
| 5722 | + subscribe = (fn) => { | |
| 5723 | + this.listeners.add(fn); | |
| 5724 | + return () => { | |
| 5725 | + this.listeners.delete(fn); | |
| 5726 | + }; | |
| 5727 | + }; | |
| 5728 | + /** | |
| 5729 | + * Returns the current state of the store. | |
| 5730 | + */ | |
| 5731 | + getSnapshot = () => { | |
| 5732 | + return this.state; | |
| 5733 | + }; | |
| 5734 | + /** | |
| 5735 | + * Updates the entire store's state and notifies all registered listeners. | |
| 5736 | + * | |
| 5737 | + * @param newState The new state to set for the store. | |
| 5738 | + */ | |
| 5739 | + setState(newState) { | |
| 5740 | + if (this.state === newState) { | |
| 5741 | + return; | |
| 5742 | + } | |
| 5743 | + this.state = newState; | |
| 5744 | + this.updateTick += 1; | |
| 5745 | + const currentTick = this.updateTick; | |
| 5746 | + for (const listener of this.listeners) { | |
| 5747 | + if (currentTick !== this.updateTick) { | |
| 5748 | + return; | |
| 5749 | + } | |
| 5750 | + listener(newState); | |
| 5751 | + } | |
| 5752 | + } | |
| 5753 | + /** | |
| 5754 | + * Merges the provided changes into the current state and notifies listeners if there are changes. | |
| 5755 | + * Each value must match its state key. Pass an exact known subset rather than a broad | |
| 5756 | + * `Partial<State>`, which may contain `undefined` for required state fields. | |
| 5757 | + * | |
| 5758 | + * @param changes An object containing the changes to apply to the current state. | |
| 5759 | + */ | |
| 5760 | + update(changes) { | |
| 5761 | + for (const key in changes) { | |
| 5762 | + if (!Object.is(this.state[key], changes[key])) { | |
| 5763 | + this.setState({ | |
| 5764 | + ...this.state, | |
| 5765 | + ...changes | |
| 5766 | + }); | |
| 5767 | + return; | |
| 5768 | + } | |
| 5769 | + } | |
| 5770 | + } | |
| 5771 | + /** | |
| 5772 | + * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed. | |
| 5773 | + * | |
| 5774 | + * @param key The key in the store's state to update. | |
| 5775 | + * @param value The new value to set for the specified key. | |
| 5776 | + */ | |
| 5777 | + set(key, value) { | |
| 5778 | + if (!Object.is(this.state[key], value)) { | |
| 5779 | + this.setState({ | |
| 5780 | + ...this.state, | |
| 5781 | + [key]: value | |
| 5782 | + }); | |
| 5783 | + } | |
| 5784 | + } | |
| 5785 | + /** | |
| 5786 | + * Gives the state a new reference and updates all registered listeners. | |
| 5787 | + */ | |
| 5788 | + notifyAll() { | |
| 5789 | + const newState = { | |
| 5790 | + ...this.state | |
| 5791 | + }; | |
| 5792 | + this.setState(newState); | |
| 5793 | + } | |
| 5794 | + use(selector, a1, a2, a3) { | |
| 5795 | + return useStore(this, selector, a1, a2, a3); | |
| 5796 | + } | |
| 5797 | +}; | |
| 5798 | + | |
| 5799 | +// node_modules/@base-ui/utils/store/ReactStore.mjs | |
| 5800 | +var React24 = __toESM(require_react(), 1); | |
| 5801 | +var ReactStore = class extends Store { | |
| 5802 | + /** | |
| 5803 | + * Creates a new ReactStore instance. | |
| 5804 | + * | |
| 5805 | + * @param state Initial state of the store. | |
| 5806 | + * @param context Non-reactive context values. | |
| 5807 | + * @param selectors Optional selectors for use with `useState`. | |
| 5808 | + */ | |
| 5809 | + constructor(state, context = {}, selectors3) { | |
| 5810 | + super(state); | |
| 5811 | + this.context = context; | |
| 5812 | + this.selectors = selectors3; | |
| 5813 | + } | |
| 5814 | + /** | |
| 5815 | + * Non-reactive values such as refs, callbacks, etc. | |
| 5816 | + */ | |
| 5817 | + /** | |
| 5818 | + * Synchronizes a single external value into the store. | |
| 5819 | + * | |
| 5820 | + * Note that the while the value in `state` is updated immediately, the value returned | |
| 5821 | + * by `useState` is updated before the next render (similarly to React's `useState`). | |
| 5822 | + */ | |
| 5823 | + useSyncedValue(key, value) { | |
| 5824 | + React24.useDebugValue(key); | |
| 5825 | + const store = this; | |
| 5826 | + useIsoLayoutEffect(() => { | |
| 5827 | + if (store.state[key] !== value) { | |
| 5828 | + store.set(key, value); | |
| 5829 | + } | |
| 5830 | + }, [store, key, value]); | |
| 5831 | + } | |
| 5832 | + /** | |
| 5833 | + * Synchronizes a single external value into the store and | |
| 5834 | + * cleans it up (sets to `undefined`) on unmount. | |
| 5835 | + * | |
| 5836 | + * Note that the while the value in `state` is updated immediately, the value returned | |
| 5837 | + * by `useState` is updated before the next render (similarly to React's `useState`). | |
| 5838 | + */ | |
| 5839 | + useSyncedValueWithCleanup(key, value) { | |
| 5840 | + const store = this; | |
| 5841 | + useIsoLayoutEffect(() => { | |
| 5842 | + if (store.state[key] !== value) { | |
| 5843 | + store.set(key, value); | |
| 5844 | + } | |
| 5845 | + return () => { | |
| 5846 | + store.set(key, void 0); | |
| 5847 | + }; | |
| 5848 | + }, [store, key, value]); | |
| 5849 | + } | |
| 5850 | + /** | |
| 5851 | + * Synchronizes multiple external values into the store. | |
| 5852 | + * Each value must match its state key. Pass an exact known subset rather than a broad | |
| 5853 | + * `Partial<State>`, which may contain `undefined` for required state fields. | |
| 5854 | + * | |
| 5855 | + * Note that the while the values in `state` are updated immediately, the values returned | |
| 5856 | + * by `useState` are updated before the next render (similarly to React's `useState`). | |
| 5857 | + * | |
| 5858 | + * @param statePart An exact subset of state fields to synchronize. Unknown keys are not accepted. | |
| 5859 | + */ | |
| 5860 | + useSyncedValues(statePart) { | |
| 5861 | + const store = this; | |
| 5862 | + if (true) { | |
| 5863 | + React24.useDebugValue(statePart, (p2) => Object.keys(p2)); | |
| 5864 | + const keys = React24.useRef(Object.keys(statePart)).current; | |
| 5865 | + const nextKeys = Object.keys(statePart); | |
| 5866 | + if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) { | |
| 5867 | + console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable."); | |
| 5868 | + } | |
| 5869 | + } | |
| 5870 | + const dependencies = Object.values(statePart); | |
| 5871 | + useIsoLayoutEffect(() => { | |
| 5872 | + store.update(statePart); | |
| 5873 | + }, [store, ...dependencies]); | |
| 5874 | + } | |
| 5875 | + /** | |
| 5876 | + * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled` | |
| 5877 | + * is non-undefined, the store's state at `key` is updated to match `controlled`. | |
| 5878 | + */ | |
| 5879 | + useControlledProp(key, controlled) { | |
| 5880 | + React24.useDebugValue(key); | |
| 5881 | + const store = this; | |
| 5882 | + const isControlled = controlled !== void 0; | |
| 5883 | + useIsoLayoutEffect(() => { | |
| 5884 | + if (isControlled && !Object.is(store.state[key], controlled)) { | |
| 5885 | + store.setState({ | |
| 5886 | + ...store.state, | |
| 5887 | + [key]: controlled | |
| 5888 | + }); | |
| 5889 | + } | |
| 5890 | + }, [store, key, controlled, isControlled]); | |
| 5891 | + if (true) { | |
| 5892 | + const cache = this.controlledValues ??= /* @__PURE__ */ new Map(); | |
| 5893 | + if (!cache.has(key)) { | |
| 5894 | + cache.set(key, isControlled); | |
| 5895 | + } | |
| 5896 | + const previouslyControlled = cache.get(key); | |
| 5897 | + if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) { | |
| 5898 | + 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).`); | |
| 5899 | + } | |
| 5900 | + } | |
| 5901 | + } | |
| 5902 | + /** Gets the current value from the store using a selector with the provided key. | |
| 5903 | + * | |
| 5904 | + * @param key Key of the selector to use. | |
| 5905 | + */ | |
| 5906 | + select(key, a1, a2, a3) { | |
| 5907 | + const selector = this.selectors[key]; | |
| 5908 | + return selector(this.state, a1, a2, a3); | |
| 5909 | + } | |
| 5910 | + /** | |
| 5911 | + * Returns a value from the store's state using a selector function. | |
| 5912 | + * Used to subscribe to specific parts of the state. | |
| 5913 | + * This methods causes a rerender whenever the selected state changes. | |
| 5914 | + * | |
| 5915 | + * @param key Key of the selector to use. | |
| 5916 | + */ | |
| 5917 | + useState(key, a1, a2, a3) { | |
| 5918 | + React24.useDebugValue(key); | |
| 5919 | + return useStore(this, this.selectors[key], a1, a2, a3); | |
| 5920 | + } | |
| 5921 | + /** | |
| 5922 | + * Wraps a function with `useStableCallback` to ensure it has a stable reference | |
| 5923 | + * and assigns it to the context. | |
| 5924 | + * | |
| 5925 | + * @param key Key of the event callback. Must be a function in the context. | |
| 5926 | + * @param fn Function to assign. | |
| 5927 | + */ | |
| 5928 | + useContextCallback(key, fn) { | |
| 5929 | + React24.useDebugValue(key); | |
| 5930 | + const stableFunction = useStableCallback(fn ?? NOOP); | |
| 5931 | + this.context[key] = stableFunction; | |
| 5932 | + } | |
| 5933 | + /** | |
| 5934 | + * Returns a stable setter function for a specific key in the store's state. | |
| 5935 | + * It's commonly used to pass as a ref callback to React elements. | |
| 5936 | + * | |
| 5937 | + * @param key Key of the state to set. | |
| 5938 | + */ | |
| 5939 | + useStateSetter(key) { | |
| 5940 | + const ref = React24.useRef(void 0); | |
| 5941 | + if (ref.current === void 0) { | |
| 5942 | + ref.current = (value) => { | |
| 5943 | + this.set(key, value); | |
| 5944 | + }; | |
| 5945 | + } | |
| 5946 | + return ref.current; | |
| 5947 | + } | |
| 5948 | + /** | |
| 5949 | + * Observes changes derived from the store's selectors and calls the listener when the selected value changes. | |
| 5950 | + * | |
| 5951 | + * @param key Key of the selector to observe. | |
| 5952 | + * @param listener Listener function called when the selector result changes. | |
| 5953 | + */ | |
| 5954 | + observe(selector, listener) { | |
| 5955 | + let selectFn; | |
| 5956 | + if (typeof selector === "function") { | |
| 5957 | + selectFn = selector; | |
| 5958 | + } else { | |
| 5959 | + selectFn = this.selectors[selector]; | |
| 5960 | + } | |
| 5961 | + let prevValue = selectFn(this.state); | |
| 5962 | + listener(prevValue, prevValue, this); | |
| 5963 | + return this.subscribe((nextState) => { | |
| 5964 | + const nextValue = selectFn(nextState); | |
| 5965 | + if (!Object.is(prevValue, nextValue)) { | |
| 5966 | + const oldValue = prevValue; | |
| 5967 | + prevValue = nextValue; | |
| 5968 | + listener(nextValue, oldValue, this); | |
| 5969 | + } | |
| 5970 | + }); | |
| 5971 | + } | |
| 5972 | +}; | |
| 5973 | + | |
| 5974 | +// node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs | |
| 5975 | +var selectors = { | |
| 5976 | + open: (state) => state.open, | |
| 5977 | + transitionStatus: (state) => state.transitionStatus, | |
| 5978 | + domReferenceElement: (state) => state.domReferenceElement, | |
| 5979 | + referenceElement: (state) => state.positionReference ?? state.referenceElement, | |
| 5980 | + floatingElement: (state) => state.floatingElement, | |
| 5981 | + floatingId: (state) => state.floatingId | |
| 5982 | +}; | |
| 5983 | +var FloatingRootStore = class extends ReactStore { | |
| 5984 | + constructor(options) { | |
| 5985 | + const { | |
| 5986 | + syncOnly, | |
| 5987 | + nested, | |
| 5988 | + onOpenChange, | |
| 5989 | + triggerElements, | |
| 5990 | + ...initialState | |
| 5991 | + } = options; | |
| 5992 | + super({ | |
| 5993 | + ...initialState, | |
| 5994 | + positionReference: initialState.referenceElement, | |
| 5995 | + domReferenceElement: initialState.referenceElement | |
| 5996 | + }, { | |
| 5997 | + onOpenChange, | |
| 5998 | + dataRef: { | |
| 5999 | + current: {} | |
| 6000 | + }, | |
| 6001 | + events: createEventEmitter(), | |
| 6002 | + nested, | |
| 6003 | + triggerElements | |
| 6004 | + }, selectors); | |
| 6005 | + this.syncOnly = syncOnly; | |
| 6006 | + } | |
| 6007 | + /** | |
| 6008 | + * Syncs the event used by hover logic to distinguish hover-open from click-like interaction. | |
| 6009 | + */ | |
| 6010 | + syncOpenEvent = (newOpen, event) => { | |
| 6011 | + if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing | |
| 6012 | + // click events to upgrade a hover-open. | |
| 6013 | + event != null && isClickLikeEvent(event)) { | |
| 6014 | + this.context.dataRef.current.openEvent = newOpen ? event : void 0; | |
| 6015 | + } | |
| 6016 | + }; | |
| 6017 | + /** | |
| 6018 | + * Runs the root-owned side effects for an open state change. | |
| 6019 | + */ | |
| 6020 | + dispatchOpenChange = (newOpen, eventDetails) => { | |
| 6021 | + this.syncOpenEvent(newOpen, eventDetails.event); | |
| 6022 | + const details = { | |
| 6023 | + open: newOpen, | |
| 6024 | + reason: eventDetails.reason, | |
| 6025 | + nativeEvent: eventDetails.event, | |
| 6026 | + nested: this.context.nested, | |
| 6027 | + triggerElement: eventDetails.trigger | |
| 6028 | + }; | |
| 6029 | + this.context.events.emit("openchange", details); | |
| 6030 | + }; | |
| 6031 | + /** | |
| 6032 | + * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments. | |
| 6033 | + * | |
| 6034 | + * @param newOpen The new open state. | |
| 6035 | + * @param eventDetails Details about the event that triggered the open state change. | |
| 6036 | + */ | |
| 6037 | + setOpen = (newOpen, eventDetails) => { | |
| 6038 | + if (this.syncOnly) { | |
| 6039 | + this.context.onOpenChange?.(newOpen, eventDetails); | |
| 6040 | + return; | |
| 6041 | + } | |
| 6042 | + this.dispatchOpenChange(newOpen, eventDetails); | |
| 6043 | + this.context.onOpenChange?.(newOpen, eventDetails); | |
| 6044 | + }; | |
| 6045 | +}; | |
| 6046 | + | |
| 6047 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs | |
| 6048 | +function useSyncedFloatingRootContext(options) { | |
| 6049 | + const { | |
| 6050 | + popupStore, | |
| 6051 | + treatPopupAsFloatingElement = false, | |
| 6052 | + floatingRootContext: floatingRootContextProp, | |
| 6053 | + floatingId, | |
| 6054 | + nested, | |
| 6055 | + onOpenChange | |
| 6056 | + } = options; | |
| 6057 | + const open2 = popupStore.useState("open"); | |
| 6058 | + const referenceElement = popupStore.useState("activeTriggerElement"); | |
| 6059 | + const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement"); | |
| 6060 | + const triggerElements = popupStore.context.triggerElements; | |
| 6061 | + const handleOpenChange = onOpenChange; | |
| 6062 | + const internalStoreRef = React25.useRef(null); | |
| 6063 | + if (floatingRootContextProp === void 0 && internalStoreRef.current === null) { | |
| 6064 | + internalStoreRef.current = new FloatingRootStore({ | |
| 6065 | + open: open2, | |
| 6066 | + transitionStatus: void 0, | |
| 6067 | + referenceElement, | |
| 6068 | + floatingElement, | |
| 6069 | + triggerElements, | |
| 6070 | + onOpenChange: handleOpenChange, | |
| 6071 | + floatingId, | |
| 6072 | + syncOnly: true, | |
| 6073 | + nested | |
| 6074 | + }); | |
| 6075 | + } | |
| 6076 | + const store = floatingRootContextProp ?? internalStoreRef.current; | |
| 6077 | + popupStore.useSyncedValue("floatingId", floatingId); | |
| 6078 | + useIsoLayoutEffect(() => { | |
| 6079 | + const valuesToSync = { | |
| 6080 | + open: open2, | |
| 6081 | + floatingId, | |
| 6082 | + referenceElement, | |
| 6083 | + floatingElement | |
| 6084 | + }; | |
| 6085 | + if (isElement(referenceElement)) { | |
| 6086 | + valuesToSync.domReferenceElement = referenceElement; | |
| 6087 | + } | |
| 6088 | + if (store.state.positionReference === store.state.referenceElement) { | |
| 6089 | + valuesToSync.positionReference = referenceElement; | |
| 6090 | + } | |
| 6091 | + store.update(valuesToSync); | |
| 6092 | + }, [open2, floatingId, referenceElement, floatingElement, store]); | |
| 6093 | + store.context.onOpenChange = handleOpenChange; | |
| 6094 | + store.context.nested = nested; | |
| 6095 | + return store; | |
| 6096 | +} | |
| 6097 | + | |
| 6098 | +// node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs | |
| 6099 | +var FOCUSABLE_POPUP_PROPS = { | |
| 6100 | + tabIndex: -1, | |
| 6101 | + [FOCUSABLE_ATTRIBUTE]: "" | |
| 6102 | +}; | |
| 6103 | +function usePopupRootStore(createStore, treatPopupAsFloatingElement = false) { | |
| 6104 | + const floatingId = useId(); | |
| 6105 | + const nested = useFloatingParentNodeId() != null; | |
| 6106 | + const store = useRefWithInit(() => createStore(floatingId, nested)).current; | |
| 6107 | + useSyncedFloatingRootContext({ | |
| 6108 | + popupStore: store, | |
| 6109 | + treatPopupAsFloatingElement, | |
| 6110 | + floatingRootContext: store.state.floatingRootContext, | |
| 6111 | + floatingId, | |
| 6112 | + nested, | |
| 6113 | + onOpenChange: store.setOpen | |
| 6114 | + }); | |
| 6115 | + return store; | |
| 6116 | +} | |
| 6117 | +function PopupHandleAttachment({ | |
| 6118 | + handle, | |
| 6119 | + store | |
| 6120 | +}) { | |
| 6121 | + useIsoLayoutEffect(() => { | |
| 6122 | + return handle.attachStore(store); | |
| 6123 | + }, [handle, store]); | |
| 6124 | + return null; | |
| 6125 | +} | |
| 6126 | +function syncTriggerCount(store) { | |
| 6127 | + const triggerCount = store.context.triggerElements.size; | |
| 6128 | + if (store.select("open") && store.state.triggerCount !== triggerCount) { | |
| 6129 | + store.set("triggerCount", triggerCount); | |
| 6130 | + } | |
| 6131 | +} | |
| 6132 | +function useTriggerRegistration(id, store) { | |
| 6133 | + const registrationRef = React26.useRef(null); | |
| 6134 | + return useStableCallback((element) => { | |
| 6135 | + const registration = registrationRef.current; | |
| 6136 | + if (registration !== null) { | |
| 6137 | + if (registration.element === element && registration.store === store && registration.id === id) { | |
| 6138 | + return; | |
| 6139 | + } | |
| 6140 | + registrationRef.current = null; | |
| 6141 | + const registeredStore = registration.store; | |
| 6142 | + if (registeredStore.context.triggerElements.getById(registration.id) === registration.element) { | |
| 6143 | + registeredStore.context.triggerElements.delete(registration.id); | |
| 6144 | + syncTriggerCount(registeredStore); | |
| 6145 | + } | |
| 6146 | + } | |
| 6147 | + if (element !== null && id !== void 0) { | |
| 6148 | + registrationRef.current = { | |
| 6149 | + store, | |
| 6150 | + id, | |
| 6151 | + element | |
| 6152 | + }; | |
| 6153 | + store.context.triggerElements.add(id, element); | |
| 6154 | + syncTriggerCount(store); | |
| 6155 | + } | |
| 6156 | + }); | |
| 6157 | +} | |
| 6158 | +function createPopupOpenState(state, open2, trigger, preventUnmountOnClose = false) { | |
| 6159 | + let preventUnmountingOnClose = state.preventUnmountingOnClose; | |
| 6160 | + if (open2) { | |
| 6161 | + preventUnmountingOnClose = false; | |
| 6162 | + } else if (preventUnmountOnClose) { | |
| 6163 | + preventUnmountingOnClose = true; | |
| 6164 | + } | |
| 6165 | + const triggerId = trigger?.id ?? null; | |
| 6166 | + let activeTriggerId = state.activeTriggerId; | |
| 6167 | + let activeTriggerElement = state.activeTriggerElement; | |
| 6168 | + if (triggerId || open2) { | |
| 6169 | + activeTriggerId = triggerId; | |
| 6170 | + activeTriggerElement = trigger ?? null; | |
| 6171 | + } | |
| 6172 | + return { | |
| 6173 | + open: open2, | |
| 6174 | + preventUnmountingOnClose, | |
| 6175 | + activeTriggerId, | |
| 6176 | + activeTriggerElement | |
| 6177 | + }; | |
| 6178 | +} | |
| 6179 | +function attachPreventUnmountOnClose(eventDetails) { | |
| 6180 | + let preventUnmountOnClose = false; | |
| 6181 | + eventDetails.preventUnmountOnClose = () => { | |
| 6182 | + preventUnmountOnClose = true; | |
| 6183 | + }; | |
| 6184 | + return () => preventUnmountOnClose; | |
| 6185 | +} | |
| 6186 | +function applyPopupOpenChange(store, nextOpen, eventDetails, options = {}) { | |
| 6187 | + const reason = eventDetails.reason; | |
| 6188 | + const isHover = reason === reason_parts_exports.triggerHover; | |
| 6189 | + const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus; | |
| 6190 | + const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey); | |
| 6191 | + const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails); | |
| 6192 | + store.context.onOpenChange?.(nextOpen, eventDetails); | |
| 6193 | + if (eventDetails.isCanceled) { | |
| 6194 | + return; | |
| 6195 | + } | |
| 6196 | + options.onBeforeDispatch?.(); | |
| 6197 | + store.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails); | |
| 6198 | + const changeState = () => { | |
| 6199 | + const popupOpenState = createPopupOpenState(store.state, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose()); | |
| 6200 | + const updatedState = { | |
| 6201 | + ...options.extraState, | |
| 6202 | + ...popupOpenState | |
| 6203 | + }; | |
| 6204 | + if (isFocusOpen) { | |
| 6205 | + updatedState.instantType = "focus"; | |
| 6206 | + } else if (isDismissClose) { | |
| 6207 | + updatedState.instantType = "dismiss"; | |
| 6208 | + } else if (isHover) { | |
| 6209 | + updatedState.instantType = void 0; | |
| 6210 | + } | |
| 6211 | + store.update(updatedState); | |
| 6212 | + }; | |
| 6213 | + if (isHover) { | |
| 6214 | + ReactDOM4.flushSync(changeState); | |
| 6215 | + } else { | |
| 6216 | + changeState(); | |
| 6217 | + } | |
| 6218 | +} | |
| 6219 | +function useTriggerDataForwarding(triggerId, triggerElementRef, store, stateUpdates) { | |
| 6220 | + const isMountedByThisTrigger = store.useState("isMountedByTrigger", triggerId); | |
| 6221 | + const baseRegisterTrigger = useTriggerRegistration(triggerId, store); | |
| 6222 | + const applyTriggerData = useStableCallback((element) => { | |
| 6223 | + const open2 = store.select("open"); | |
| 6224 | + const activeTriggerId = store.select("activeTriggerId"); | |
| 6225 | + if (activeTriggerId === triggerId) { | |
| 6226 | + const changes = { | |
| 6227 | + activeTriggerElement: element, | |
| 6228 | + ...open2 ? stateUpdates : null | |
| 6229 | + }; | |
| 6230 | + store.update(changes); | |
| 6231 | + return; | |
| 6232 | + } | |
| 6233 | + if (activeTriggerId == null && open2) { | |
| 6234 | + const changes = { | |
| 6235 | + activeTriggerId: triggerId ?? null, | |
| 6236 | + activeTriggerElement: element, | |
| 6237 | + ...stateUpdates | |
| 6238 | + }; | |
| 6239 | + store.update(changes); | |
| 6240 | + } | |
| 6241 | + }); | |
| 6242 | + const registerTrigger = useStableCallback((element) => { | |
| 6243 | + baseRegisterTrigger(element); | |
| 6244 | + if (element) { | |
| 6245 | + applyTriggerData(element); | |
| 6246 | + } | |
| 6247 | + }); | |
| 6248 | + useIsoLayoutEffect(() => { | |
| 6249 | + registerTrigger(triggerElementRef.current); | |
| 6250 | + return () => registerTrigger(null); | |
| 6251 | + }, [registerTrigger, triggerElementRef, store, triggerId]); | |
| 6252 | + useIsoLayoutEffect(() => { | |
| 6253 | + if (isMountedByThisTrigger) { | |
| 6254 | + const changes = { | |
| 6255 | + activeTriggerElement: triggerElementRef.current, | |
| 6256 | + ...stateUpdates | |
| 6257 | + }; | |
| 6258 | + store.update(changes); | |
| 6259 | + } | |
| 6260 | + }, [isMountedByThisTrigger, store, triggerElementRef, ...Object.values(stateUpdates)]); | |
| 6261 | + return { | |
| 6262 | + registerTrigger, | |
| 6263 | + isMountedByThisTrigger | |
| 6264 | + }; | |
| 6265 | +} | |
| 6266 | +function useImplicitActiveTrigger(store, options = {}) { | |
| 6267 | + const { | |
| 6268 | + closeOnActiveTriggerUnmount = false | |
| 6269 | + } = options; | |
| 6270 | + const resolvedActiveTriggerIdRef = React26.useRef(null); | |
| 6271 | + const open2 = store.useState("open"); | |
| 6272 | + const reactiveTriggerCount = store.useState("triggerCount"); | |
| 6273 | + const activeTriggerId = store.useState("activeTriggerId"); | |
| 6274 | + const reactiveActiveTriggerElement = store.useState("activeTriggerElement"); | |
| 6275 | + useIsoLayoutEffect(() => { | |
| 6276 | + if (!open2) { | |
| 6277 | + resolvedActiveTriggerIdRef.current = null; | |
| 6278 | + if (store.state.triggerCount !== 0) { | |
| 6279 | + store.set("triggerCount", 0); | |
| 6280 | + } | |
| 6281 | + return; | |
| 6282 | + } | |
| 6283 | + const triggerCount = store.context.triggerElements.size; | |
| 6284 | + const stateUpdates = {}; | |
| 6285 | + if (store.state.triggerCount !== triggerCount) { | |
| 6286 | + stateUpdates.triggerCount = triggerCount; | |
| 6287 | + } | |
| 6288 | + const currentActiveTriggerId = store.select("activeTriggerId"); | |
| 6289 | + let lostActiveTriggerId = null; | |
| 6290 | + if (currentActiveTriggerId) { | |
| 6291 | + const activeTriggerElement = store.context.triggerElements.getById(currentActiveTriggerId); | |
| 6292 | + if (!activeTriggerElement) { | |
| 6293 | + for (const [triggerId, triggerElement] of store.context.triggerElements.entries()) { | |
| 6294 | + if (triggerElement === store.state.activeTriggerElement) { | |
| 6295 | + stateUpdates.activeTriggerId = triggerId; | |
| 6296 | + stateUpdates.activeTriggerElement = triggerElement; | |
| 6297 | + resolvedActiveTriggerIdRef.current = triggerId; | |
| 6298 | + break; | |
| 6299 | + } | |
| 6300 | + } | |
| 6301 | + if (stateUpdates.activeTriggerId === void 0) { | |
| 6302 | + if (resolvedActiveTriggerIdRef.current === currentActiveTriggerId) { | |
| 6303 | + lostActiveTriggerId = currentActiveTriggerId; | |
| 6304 | + } else { | |
| 6305 | + resolvedActiveTriggerIdRef.current = null; | |
| 6306 | + } | |
| 6307 | + } | |
| 6308 | + } else { | |
| 6309 | + resolvedActiveTriggerIdRef.current = currentActiveTriggerId; | |
| 6310 | + if (activeTriggerElement !== store.state.activeTriggerElement) { | |
| 6311 | + stateUpdates.activeTriggerElement = activeTriggerElement; | |
| 6312 | + } | |
| 6313 | + } | |
| 6314 | + } else { | |
| 6315 | + resolvedActiveTriggerIdRef.current = null; | |
| 6316 | + } | |
| 6317 | + if (!lostActiveTriggerId && !currentActiveTriggerId && triggerCount === 1) { | |
| 6318 | + const iteratorResult = store.context.triggerElements.entries().next(); | |
| 6319 | + if (!iteratorResult.done) { | |
| 6320 | + const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value; | |
| 6321 | + stateUpdates.activeTriggerId = implicitTriggerId; | |
| 6322 | + stateUpdates.activeTriggerElement = implicitTriggerElement; | |
| 6323 | + resolvedActiveTriggerIdRef.current = implicitTriggerId; | |
| 6324 | + } | |
| 6325 | + } | |
| 6326 | + if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0 || stateUpdates.activeTriggerElement !== void 0) { | |
| 6327 | + store.update(stateUpdates); | |
| 6328 | + } | |
| 6329 | + if (lostActiveTriggerId) { | |
| 6330 | + if (closeOnActiveTriggerUnmount) { | |
| 6331 | + queueMicrotask(() => { | |
| 6332 | + if (store.select("open") && store.select("activeTriggerId") === lostActiveTriggerId && !store.context.triggerElements.getById(lostActiveTriggerId)) { | |
| 6333 | + const eventDetails = createChangeEventDetails(reason_parts_exports.none); | |
| 6334 | + store.setOpen(false, eventDetails); | |
| 6335 | + if (!eventDetails.isCanceled) { | |
| 6336 | + store.update({ | |
| 6337 | + activeTriggerId: null, | |
| 6338 | + activeTriggerElement: null | |
| 6339 | + }); | |
| 6340 | + } | |
| 6341 | + } | |
| 6342 | + }); | |
| 6343 | + } | |
| 6344 | + } | |
| 6345 | + }, [open2, store, reactiveTriggerCount, activeTriggerId, reactiveActiveTriggerElement, closeOnActiveTriggerUnmount]); | |
| 6346 | +} | |
| 6347 | +function useOpenStateTransitions(open2, store, onUnmount, animateInitialOpen) { | |
| 6348 | + const { | |
| 6349 | + mounted, | |
| 6350 | + setMounted, | |
| 6351 | + transitionStatus | |
| 6352 | + } = useTransitionStatus(open2, false, false, animateInitialOpen); | |
| 6353 | + const preventUnmountingOnClose = store.useState("preventUnmountingOnClose"); | |
| 6354 | + const syncedPreventUnmountingOnClose = open2 ? false : preventUnmountingOnClose; | |
| 6355 | + store.useSyncedValues({ | |
| 6356 | + mounted, | |
| 6357 | + transitionStatus, | |
| 6358 | + preventUnmountingOnClose: syncedPreventUnmountingOnClose | |
| 6359 | + }); | |
| 6360 | + const forceUnmount = useStableCallback(() => { | |
| 6361 | + setMounted(false); | |
| 6362 | + store.update({ | |
| 6363 | + activeTriggerId: null, | |
| 6364 | + activeTriggerElement: null, | |
| 6365 | + mounted: false, | |
| 6366 | + preventUnmountingOnClose: false | |
| 6367 | + }); | |
| 6368 | + onUnmount?.(); | |
| 6369 | + store.context.onOpenChangeComplete?.(false); | |
| 6370 | + }); | |
| 6371 | + useOpenChangeComplete({ | |
| 6372 | + enabled: mounted && !open2 && !syncedPreventUnmountingOnClose, | |
| 6373 | + open: open2, | |
| 6374 | + ref: store.context.popupRef, | |
| 6375 | + onComplete() { | |
| 6376 | + if (!open2) { | |
| 6377 | + forceUnmount(); | |
| 6378 | + } | |
| 6379 | + } | |
| 6380 | + }); | |
| 6381 | + return { | |
| 6382 | + forceUnmount, | |
| 6383 | + transitionStatus | |
| 6384 | + }; | |
| 6385 | +} | |
| 6386 | +function usePopupInteractionProps(store, statePart) { | |
| 6387 | + store.useSyncedValues(statePart); | |
| 6388 | + useIsoLayoutEffect(() => () => { | |
| 6389 | + store.update({ | |
| 6390 | + activeTriggerProps: EMPTY_OBJECT, | |
| 6391 | + inactiveTriggerProps: EMPTY_OBJECT, | |
| 6392 | + popupProps: EMPTY_OBJECT | |
| 6393 | + }); | |
| 6394 | + }, [store]); | |
| 6395 | +} | |
| 6396 | + | |
| 6397 | +// node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs | |
| 6398 | +var devElementIdsByMap; | |
| 6399 | +function getDevElementIds(map) { | |
| 6400 | + devElementIdsByMap ??= /* @__PURE__ */ new WeakMap(); | |
| 6401 | + let elementIds = devElementIdsByMap.get(map); | |
| 6402 | + if (!elementIds) { | |
| 6403 | + elementIds = /* @__PURE__ */ new WeakMap(); | |
| 6404 | + devElementIdsByMap.set(map, elementIds); | |
| 6405 | + } | |
| 6406 | + return elementIds; | |
| 6407 | +} | |
| 6408 | +var PopupTriggerMap = class { | |
| 6409 | + constructor() { | |
| 6410 | + this.idMap = /* @__PURE__ */ new Map(); | |
| 6411 | + } | |
| 6412 | + /** | |
| 6413 | + * Adds a trigger element with the given ID. | |
| 6414 | + * | |
| 6415 | + * Note: The provided element is assumed to not be registered under multiple IDs. | |
| 6416 | + */ | |
| 6417 | + add(id, element) { | |
| 6418 | + if (true) { | |
| 6419 | + const elementIds = getDevElementIds(this); | |
| 6420 | + const existingId = elementIds.get(element); | |
| 6421 | + if (existingId !== void 0 && existingId !== id) { | |
| 6422 | + throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap."); | |
| 6423 | + } | |
| 6424 | + const previousElement = this.idMap.get(id); | |
| 6425 | + if (previousElement !== void 0 && previousElement !== element) { | |
| 6426 | + elementIds.delete(previousElement); | |
| 6427 | + } | |
| 6428 | + elementIds.set(element, id); | |
| 6429 | + } | |
| 6430 | + this.idMap.set(id, element); | |
| 6431 | + } | |
| 6432 | + /** | |
| 6433 | + * Removes the trigger element with the given ID. | |
| 6434 | + */ | |
| 6435 | + delete(id) { | |
| 6436 | + if (true) { | |
| 6437 | + const element = this.idMap.get(id); | |
| 6438 | + if (element !== void 0) { | |
| 6439 | + devElementIdsByMap?.get(this)?.delete(element); | |
| 6440 | + } | |
| 6441 | + } | |
| 6442 | + this.idMap.delete(id); | |
| 6443 | + } | |
| 6444 | + /** | |
| 6445 | + * Whether the given element is registered as a trigger. | |
| 6446 | + */ | |
| 6447 | + hasElement(element) { | |
| 6448 | + for (const registered of this.idMap.values()) { | |
| 6449 | + if (registered === element) { | |
| 6450 | + return true; | |
| 6451 | + } | |
| 6452 | + } | |
| 6453 | + return false; | |
| 6454 | + } | |
| 6455 | + /** | |
| 6456 | + * Whether there is a registered trigger element matching the given predicate. | |
| 6457 | + */ | |
| 6458 | + hasMatchingElement(predicate) { | |
| 6459 | + for (const element of this.idMap.values()) { | |
| 6460 | + if (predicate(element)) { | |
| 6461 | + return true; | |
| 6462 | + } | |
| 6463 | + } | |
| 6464 | + return false; | |
| 6465 | + } | |
| 6466 | + /** | |
| 6467 | + * Returns the trigger element associated with the given ID, or undefined if no such element exists. | |
| 6468 | + */ | |
| 6469 | + getById(id) { | |
| 6470 | + return this.idMap.get(id); | |
| 6471 | + } | |
| 6472 | + /** | |
| 6473 | + * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element]. | |
| 6474 | + */ | |
| 6475 | + entries() { | |
| 6476 | + return this.idMap.entries(); | |
| 6477 | + } | |
| 6478 | + /** | |
| 6479 | + * Returns an iterable of all registered trigger elements. | |
| 6480 | + */ | |
| 6481 | + elements() { | |
| 6482 | + return this.idMap.values(); | |
| 6483 | + } | |
| 6484 | + /** | |
| 6485 | + * Returns the number of registered trigger elements. | |
| 6486 | + */ | |
| 6487 | + get size() { | |
| 6488 | + return this.idMap.size; | |
| 6489 | + } | |
| 6490 | +}; | |
| 6491 | + | |
| 6492 | +// node_modules/@base-ui/react/utils/popups/store.mjs | |
| 6493 | +function createInitialPopupStoreState(triggerElements, floatingId, nested = false) { | |
| 6494 | + return { | |
| 6495 | + open: false, | |
| 6496 | + openProp: void 0, | |
| 6497 | + mounted: false, | |
| 6498 | + transitionStatus: void 0, | |
| 6499 | + floatingRootContext: new FloatingRootStore({ | |
| 6500 | + open: false, | |
| 6501 | + transitionStatus: void 0, | |
| 6502 | + floatingElement: null, | |
| 6503 | + referenceElement: null, | |
| 6504 | + triggerElements, | |
| 6505 | + floatingId, | |
| 6506 | + syncOnly: true, | |
| 6507 | + nested, | |
| 6508 | + onOpenChange: void 0 | |
| 6509 | + }), | |
| 6510 | + floatingId, | |
| 6511 | + triggerCount: 0, | |
| 6512 | + preventUnmountingOnClose: false, | |
| 6513 | + payload: void 0, | |
| 6514 | + activeTriggerId: null, | |
| 6515 | + activeTriggerElement: null, | |
| 6516 | + triggerIdProp: void 0, | |
| 6517 | + popupElement: null, | |
| 6518 | + positionerElement: null, | |
| 6519 | + activeTriggerProps: EMPTY_OBJECT, | |
| 6520 | + inactiveTriggerProps: EMPTY_OBJECT, | |
| 6521 | + popupProps: EMPTY_OBJECT | |
| 6522 | + }; | |
| 6523 | +} | |
| 6524 | +var activeTriggerIdSelector = (state) => state.triggerIdProp ?? state.activeTriggerId; | |
| 6525 | +var openSelector = (state) => state.openProp ?? state.open; | |
| 6526 | +var popupIdSelector = (state) => { | |
| 6527 | + const popupId = state.popupElement?.id ?? state.floatingId; | |
| 6528 | + return popupId || void 0; | |
| 6529 | +}; | |
| 6530 | +function triggerOwnsOpenPopup(state, triggerId) { | |
| 6531 | + return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId; | |
| 6532 | +} | |
| 6533 | +function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) { | |
| 6534 | + if (triggerOwnsOpenPopup(state, triggerId)) { | |
| 6535 | + return true; | |
| 6536 | + } | |
| 6537 | + return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1; | |
| 6538 | +} | |
| 6539 | +var popupStoreSelectors = { | |
| 6540 | + open: openSelector, | |
| 6541 | + mounted: (state) => state.mounted, | |
| 6542 | + transitionStatus: (state) => state.transitionStatus, | |
| 6543 | + floatingRootContext: (state) => state.floatingRootContext, | |
| 6544 | + triggerCount: (state) => state.triggerCount, | |
| 6545 | + preventUnmountingOnClose: (state) => state.preventUnmountingOnClose, | |
| 6546 | + payload: (state) => state.payload, | |
| 6547 | + activeTriggerId: activeTriggerIdSelector, | |
| 6548 | + activeTriggerElement: (state) => state.mounted ? state.activeTriggerElement : null, | |
| 6549 | + popupId: popupIdSelector, | |
| 6550 | + /** | |
| 6551 | + * Whether the trigger with the given ID was used to open the popup. | |
| 6552 | + */ | |
| 6553 | + isTriggerActive: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId, | |
| 6554 | + /** | |
| 6555 | + * Whether the popup is open and was activated by a trigger with the given ID. | |
| 6556 | + */ | |
| 6557 | + isOpenedByTrigger: (state, triggerId) => triggerOwnsOpenPopup(state, triggerId), | |
| 6558 | + /** | |
| 6559 | + * Whether the popup is mounted and was activated by a trigger with the given ID. | |
| 6560 | + */ | |
| 6561 | + isMountedByTrigger: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted, | |
| 6562 | + triggerProps: (state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps, | |
| 6563 | + /** | |
| 6564 | + * Popup id for the trigger that currently owns the open popup. | |
| 6565 | + */ | |
| 6566 | + triggerPopupId: (state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0, | |
| 6567 | + popupProps: (state) => state.popupProps, | |
| 6568 | + popupElement: (state) => state.popupElement, | |
| 6569 | + positionerElement: (state) => state.positionerElement | |
| 6570 | +}; | |
| 6571 | + | |
| 6572 | +// node_modules/@base-ui/react/utils/popups/usePopupHandleStore.mjs | |
| 6573 | +var React27 = __toESM(require_react(), 1); | |
| 6574 | +var import_shim2 = __toESM(require_shim(), 1); | |
| 6575 | +function usePopupHandleStore(handle) { | |
| 6576 | + const subscribe = React27.useCallback((listener) => { | |
| 6577 | + if (handle === void 0) { | |
| 6578 | + return NOOP; | |
| 6579 | + } | |
| 6580 | + return handle.subscribeStore(listener); | |
| 6581 | + }, [handle]); | |
| 6582 | + const getSnapshot = React27.useCallback(() => { | |
| 6583 | + return handle === void 0 ? void 0 : handle.store; | |
| 6584 | + }, [handle]); | |
| 6585 | + return (0, import_shim2.useSyncExternalStore)(subscribe, getSnapshot, () => handle?.serverStore); | |
| 6586 | +} | |
| 6587 | + | |
| 6588 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs | |
| 6589 | +function useBaseUIFloating(options) { | |
| 6590 | + return useFloatingWithStore(options, options.rootContext); | |
| 6591 | +} | |
| 6592 | +function useFloatingWithStore(options, store) { | |
| 6593 | + const { | |
| 6594 | + nodeId, | |
| 6595 | + externalTree | |
| 6596 | + } = options; | |
| 6597 | + const referenceElement = store.useState("referenceElement"); | |
| 6598 | + const floatingElement = store.useState("floatingElement"); | |
| 6599 | + const domReferenceElement = store.useState("domReferenceElement"); | |
| 6600 | + const open2 = store.useState("open"); | |
| 6601 | + const floatingId = store.useState("floatingId"); | |
| 6602 | + const [positionReference, setPositionReferenceRaw] = React28.useState(null); | |
| 6603 | + const [localDomReference, setLocalDomReference] = React28.useState(void 0); | |
| 6604 | + const [localFloatingElement, setLocalFloatingElement] = React28.useState(void 0); | |
| 6605 | + const domReferenceRef = React28.useRef(null); | |
| 6606 | + const tree = useFloatingTree(externalTree); | |
| 6607 | + const storeElements = React28.useMemo(() => ({ | |
| 6608 | + reference: referenceElement, | |
| 6609 | + floating: floatingElement, | |
| 6610 | + domReference: domReferenceElement | |
| 6611 | + }), [referenceElement, floatingElement, domReferenceElement]); | |
| 6612 | + const position = useFloating({ | |
| 6613 | + ...options, | |
| 6614 | + elements: { | |
| 6615 | + ...storeElements, | |
| 6616 | + ...positionReference && { | |
| 6617 | + reference: positionReference | |
| 6618 | + } | |
| 6619 | + } | |
| 6620 | + }); | |
| 6621 | + const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null; | |
| 6622 | + const syncedFloatingElement = localFloatingElement === void 0 ? store.state.floatingElement : localFloatingElement; | |
| 6623 | + store.useSyncedValue("referenceElement", localDomReference ?? null); | |
| 6624 | + store.useSyncedValue("domReferenceElement", localDomReference === void 0 ? domReferenceElement : localDomReferenceElement); | |
| 6625 | + store.useSyncedValue("floatingElement", syncedFloatingElement); | |
| 6626 | + const setPositionReference = React28.useCallback((node) => { | |
| 6627 | + const computedPositionReference = isElement(node) ? { | |
| 6628 | + getBoundingClientRect: () => node.getBoundingClientRect(), | |
| 6629 | + getClientRects: () => node.getClientRects(), | |
| 6630 | + contextElement: node | |
| 6631 | + } : node; | |
| 6632 | + setPositionReferenceRaw(computedPositionReference); | |
| 6633 | + position.refs.setReference(computedPositionReference); | |
| 6634 | + }, [position.refs]); | |
| 6635 | + const setReference = React28.useCallback((node) => { | |
| 6636 | + if (isElement(node) || node === null) { | |
| 6637 | + domReferenceRef.current = node; | |
| 6638 | + setLocalDomReference(node); | |
| 6639 | + } | |
| 6640 | + if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to | |
| 6641 | + // `null` to support `positionReference` + an unstable `reference` | |
| 6642 | + // callback ref. | |
| 6643 | + node !== null && !isElement(node)) { | |
| 6644 | + position.refs.setReference(node); | |
| 6645 | + } | |
| 6646 | + }, [position.refs, setLocalDomReference]); | |
| 6647 | + const setFloating = React28.useCallback((node) => { | |
| 6648 | + setLocalFloatingElement(node); | |
| 6649 | + position.refs.setFloating(node); | |
| 6650 | + }, [position.refs]); | |
| 6651 | + const refs = React28.useMemo(() => ({ | |
| 6652 | + ...position.refs, | |
| 6653 | + setReference, | |
| 6654 | + setFloating, | |
| 6655 | + setPositionReference, | |
| 6656 | + domReference: domReferenceRef | |
| 6657 | + }), [position.refs, setReference, setFloating, setPositionReference]); | |
| 6658 | + const elements = React28.useMemo(() => ({ | |
| 6659 | + ...position.elements, | |
| 6660 | + domReference: domReferenceElement | |
| 6661 | + }), [position.elements, domReferenceElement]); | |
| 6662 | + const context = React28.useMemo(() => ({ | |
| 6663 | + ...position, | |
| 6664 | + dataRef: store.context.dataRef, | |
| 6665 | + open: open2, | |
| 6666 | + onOpenChange: store.setOpen, | |
| 6667 | + events: store.context.events, | |
| 6668 | + floatingId, | |
| 6669 | + refs, | |
| 6670 | + elements, | |
| 6671 | + nodeId, | |
| 6672 | + rootStore: store | |
| 6673 | + }), [position, refs, elements, nodeId, store, open2, floatingId]); | |
| 6674 | + useIsoLayoutEffect(() => { | |
| 6675 | + if (domReferenceElement) { | |
| 6676 | + domReferenceRef.current = domReferenceElement; | |
| 6677 | + } | |
| 6678 | + }, [domReferenceElement]); | |
| 6679 | + useIsoLayoutEffect(() => { | |
| 6680 | + store.context.dataRef.current.floatingContext = context; | |
| 6681 | + const node = tree?.nodesRef.current.find((n) => n.id === nodeId); | |
| 6682 | + if (node) { | |
| 6683 | + node.context = context; | |
| 6684 | + } | |
| 6685 | + }); | |
| 6686 | + return React28.useMemo(() => ({ | |
| 6687 | + ...position, | |
| 6688 | + context, | |
| 6689 | + refs, | |
| 6690 | + elements, | |
| 6691 | + rootStore: store | |
| 6692 | + }), [position, refs, elements, context, store]); | |
| 6693 | +} | |
| 6694 | + | |
| 6695 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs | |
| 6696 | +var React29 = __toESM(require_react(), 1); | |
| 6697 | +var isMacSafari = parts_exports.os.mac && parts_exports.engine.webkit; | |
| 6698 | +function useFocus(context, props = {}) { | |
| 6699 | + const { | |
| 6700 | + enabled = true, | |
| 6701 | + delay | |
| 6702 | + } = props; | |
| 6703 | + const store = "rootStore" in context ? context.rootStore : context; | |
| 6704 | + const { | |
| 6705 | + events, | |
| 6706 | + dataRef | |
| 6707 | + } = store.context; | |
| 6708 | + const blockFocusRef = React29.useRef(false); | |
| 6709 | + const blockedReferenceRef = React29.useRef(null); | |
| 6710 | + const keyboardModalityRef = React29.useRef(true); | |
| 6711 | + const timeout = useTimeout(); | |
| 6712 | + React29.useEffect(() => { | |
| 6713 | + const domReference = store.select("domReferenceElement"); | |
| 6714 | + if (!enabled) { | |
| 6715 | + return void 0; | |
| 6716 | + } | |
| 6717 | + const win = getWindow(domReference); | |
| 6718 | + function onBlur() { | |
| 6719 | + const currentDomReference = store.select("domReferenceElement"); | |
| 6720 | + if (!store.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) { | |
| 6721 | + blockFocusRef.current = true; | |
| 6722 | + blockedReferenceRef.current = currentDomReference; | |
| 6723 | + } | |
| 6724 | + } | |
| 6725 | + function onKeyDown() { | |
| 6726 | + keyboardModalityRef.current = true; | |
| 6727 | + } | |
| 6728 | + function onPointerDown() { | |
| 6729 | + keyboardModalityRef.current = false; | |
| 6730 | + } | |
| 6731 | + return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true)); | |
| 6732 | + }, [store, enabled]); | |
| 6733 | + React29.useEffect(() => { | |
| 6734 | + if (!enabled) { | |
| 6735 | + return void 0; | |
| 6736 | + } | |
| 6737 | + function onOpenChangeLocal(details) { | |
| 6738 | + if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) { | |
| 6739 | + const referenceElement = store.select("domReferenceElement"); | |
| 6740 | + if (isElement(referenceElement)) { | |
| 6741 | + blockedReferenceRef.current = referenceElement; | |
| 6742 | + blockFocusRef.current = true; | |
| 6743 | + } | |
| 6744 | + } | |
| 6745 | + } | |
| 6746 | + events.on("openchange", onOpenChangeLocal); | |
| 6747 | + return () => { | |
| 6748 | + events.off("openchange", onOpenChangeLocal); | |
| 6749 | + }; | |
| 6750 | + }, [events, enabled, store]); | |
| 6751 | + const reference = React29.useMemo(() => { | |
| 6752 | + function resetBlockedFocus() { | |
| 6753 | + blockFocusRef.current = false; | |
| 6754 | + blockedReferenceRef.current = null; | |
| 6755 | + } | |
| 6756 | + return { | |
| 6757 | + onMouseLeave() { | |
| 6758 | + resetBlockedFocus(); | |
| 6759 | + }, | |
| 6760 | + onFocus(event) { | |
| 6761 | + const focusTarget = event.currentTarget; | |
| 6762 | + if (blockFocusRef.current) { | |
| 6763 | + if (blockedReferenceRef.current === focusTarget) { | |
| 6764 | + return; | |
| 6765 | + } | |
| 6766 | + resetBlockedFocus(); | |
| 6767 | + } | |
| 6768 | + const target = getTarget(event.nativeEvent); | |
| 6769 | + if (isElement(target)) { | |
| 6770 | + if (isMacSafari && !event.relatedTarget) { | |
| 6771 | + if (!keyboardModalityRef.current && !isTypeableElement(target)) { | |
| 6772 | + return; | |
| 6773 | + } | |
| 6774 | + } else if (!matchesFocusVisible(target)) { | |
| 6775 | + return; | |
| 6776 | + } | |
| 6777 | + } | |
| 6778 | + const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements); | |
| 6779 | + const { | |
| 6780 | + nativeEvent, | |
| 6781 | + currentTarget | |
| 6782 | + } = event; | |
| 6783 | + const delayValue = typeof delay === "function" ? delay() : delay; | |
| 6784 | + if (store.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) { | |
| 6785 | + store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); | |
| 6786 | + return; | |
| 6787 | + } | |
| 6788 | + timeout.start(delayValue, () => { | |
| 6789 | + if (blockFocusRef.current) { | |
| 6790 | + return; | |
| 6791 | + } | |
| 6792 | + store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); | |
| 6793 | + }); | |
| 6794 | + }, | |
| 6795 | + onBlur(event) { | |
| 6796 | + resetBlockedFocus(); | |
| 6797 | + const relatedTarget = event.relatedTarget; | |
| 6798 | + const nativeEvent = event.nativeEvent; | |
| 6799 | + const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside"; | |
| 6800 | + timeout.start(0, () => { | |
| 6801 | + const domReference = store.select("domReferenceElement"); | |
| 6802 | + const activeEl = activeElement(ownerDocument(domReference)); | |
| 6803 | + if (!relatedTarget && activeEl === domReference) { | |
| 6804 | + return; | |
| 6805 | + } | |
| 6806 | + if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) { | |
| 6807 | + return; | |
| 6808 | + } | |
| 6809 | + const nextFocusedElement = relatedTarget ?? activeEl; | |
| 6810 | + if (isTargetInsideEnabledTrigger(nextFocusedElement, store.context.triggerElements)) { | |
| 6811 | + return; | |
| 6812 | + } | |
| 6813 | + store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent)); | |
| 6814 | + }); | |
| 6815 | + } | |
| 6816 | + }; | |
| 6817 | + }, [dataRef, delay, store, timeout]); | |
| 6818 | + return React29.useMemo(() => enabled ? { | |
| 6819 | + reference, | |
| 6820 | + trigger: reference | |
| 6821 | + } : {}, [enabled, reference]); | |
| 6822 | +} | |
| 6823 | + | |
| 6824 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs | |
| 6825 | +var React30 = __toESM(require_react(), 1); | |
| 6826 | + | |
| 6827 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs | |
| 6828 | +var HoverInteraction = class _HoverInteraction { | |
| 6829 | + constructor() { | |
| 6830 | + this.pointerType = void 0; | |
| 6831 | + this.interactedInside = false; | |
| 6832 | + this.handler = void 0; | |
| 6833 | + this.blockMouseMove = true; | |
| 6834 | + this.performedPointerEventsMutation = false; | |
| 6835 | + this.pointerEventsScopeElement = null; | |
| 6836 | + this.pointerEventsReferenceElement = null; | |
| 6837 | + this.pointerEventsFloatingElement = null; | |
| 6838 | + this.restTimeoutPending = false; | |
| 6839 | + this.openChangeTimeout = new Timeout(); | |
| 6840 | + this.restTimeout = new Timeout(); | |
| 6841 | + this.handleCloseOptions = void 0; | |
| 6842 | + } | |
| 6843 | + static create() { | |
| 6844 | + return new _HoverInteraction(); | |
| 6845 | + } | |
| 6846 | + dispose = () => { | |
| 6847 | + this.openChangeTimeout.clear(); | |
| 6848 | + this.restTimeout.clear(); | |
| 6849 | + }; | |
| 6850 | + disposeEffect = () => { | |
| 6851 | + return this.dispose; | |
| 6852 | + }; | |
| 6853 | +}; | |
| 6854 | +var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap(); | |
| 6855 | +function clearSafePolygonPointerEventsMutation(instance) { | |
| 6856 | + if (!instance.performedPointerEventsMutation) { | |
| 6857 | + return; | |
| 6858 | + } | |
| 6859 | + const scopeElement = instance.pointerEventsScopeElement; | |
| 6860 | + if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) { | |
| 6861 | + instance.pointerEventsScopeElement?.style.removeProperty("pointer-events"); | |
| 6862 | + instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events"); | |
| 6863 | + instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events"); | |
| 6864 | + pointerEventsMutationOwnerByScopeElement.delete(scopeElement); | |
| 6865 | + } | |
| 6866 | + instance.performedPointerEventsMutation = false; | |
| 6867 | + instance.pointerEventsScopeElement = null; | |
| 6868 | + instance.pointerEventsReferenceElement = null; | |
| 6869 | + instance.pointerEventsFloatingElement = null; | |
| 6870 | +} | |
| 6871 | +function applySafePolygonPointerEventsMutation(instance, options) { | |
| 6872 | + const { | |
| 6873 | + scopeElement, | |
| 6874 | + referenceElement, | |
| 6875 | + floatingElement | |
| 6876 | + } = options; | |
| 6877 | + const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement); | |
| 6878 | + if (existingOwner && existingOwner !== instance) { | |
| 6879 | + clearSafePolygonPointerEventsMutation(existingOwner); | |
| 6880 | + } | |
| 6881 | + clearSafePolygonPointerEventsMutation(instance); | |
| 6882 | + instance.performedPointerEventsMutation = true; | |
| 6883 | + instance.pointerEventsScopeElement = scopeElement; | |
| 6884 | + instance.pointerEventsReferenceElement = referenceElement; | |
| 6885 | + instance.pointerEventsFloatingElement = floatingElement; | |
| 6886 | + pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance); | |
| 6887 | + scopeElement.style.pointerEvents = "none"; | |
| 6888 | + referenceElement.style.pointerEvents = "auto"; | |
| 6889 | + floatingElement.style.pointerEvents = "auto"; | |
| 6890 | +} | |
| 6891 | +function useHoverInteractionSharedState(store) { | |
| 6892 | + const data = store.context.dataRef.current; | |
| 6893 | + const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current; | |
| 6894 | + if (!data.hoverInteractionState) { | |
| 6895 | + data.hoverInteractionState = instance; | |
| 6896 | + } | |
| 6897 | + useOnMount(data.hoverInteractionState.disposeEffect); | |
| 6898 | + return data.hoverInteractionState; | |
| 6899 | +} | |
| 6900 | + | |
| 6901 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs | |
| 6902 | +function useHoverFloatingInteraction(context, parameters = {}) { | |
| 6903 | + const { | |
| 6904 | + enabled = true, | |
| 6905 | + closeDelay: closeDelayProp = 0, | |
| 6906 | + nodeId: nodeIdProp | |
| 6907 | + } = parameters; | |
| 6908 | + const store = "rootStore" in context ? context.rootStore : context; | |
| 6909 | + const open2 = store.useState("open"); | |
| 6910 | + const floatingElement = store.useState("floatingElement"); | |
| 6911 | + const domReferenceElement = store.useState("domReferenceElement"); | |
| 6912 | + const { | |
| 6913 | + dataRef | |
| 6914 | + } = store.context; | |
| 6915 | + const tree = useFloatingTree(); | |
| 6916 | + const parentId = useFloatingParentNodeId(); | |
| 6917 | + const instance = useHoverInteractionSharedState(store); | |
| 6918 | + const childClosedTimeout = useTimeout(); | |
| 6919 | + const isClickLikeOpenEvent2 = useStableCallback(() => { | |
| 6920 | + return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); | |
| 6921 | + }); | |
| 6922 | + const isHoverOpen = useStableCallback(() => { | |
| 6923 | + return isHoverOpenEvent(dataRef.current.openEvent?.type); | |
| 6924 | + }); | |
| 6925 | + const clearPointerEvents = useStableCallback(() => { | |
| 6926 | + clearSafePolygonPointerEventsMutation(instance); | |
| 6927 | + }); | |
| 6928 | + useIsoLayoutEffect(() => { | |
| 6929 | + if (!open2) { | |
| 6930 | + instance.pointerType = void 0; | |
| 6931 | + instance.restTimeoutPending = false; | |
| 6932 | + instance.interactedInside = false; | |
| 6933 | + clearPointerEvents(); | |
| 6934 | + } | |
| 6935 | + }, [open2, instance, clearPointerEvents]); | |
| 6936 | + React30.useEffect(() => { | |
| 6937 | + return clearPointerEvents; | |
| 6938 | + }, [clearPointerEvents]); | |
| 6939 | + useIsoLayoutEffect(() => { | |
| 6940 | + if (!enabled) { | |
| 6941 | + return void 0; | |
| 6942 | + } | |
| 6943 | + if (open2 && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) { | |
| 6944 | + const ref = domReferenceElement; | |
| 6945 | + const floatingEl = floatingElement; | |
| 6946 | + const doc = ownerDocument(floatingElement); | |
| 6947 | + const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating; | |
| 6948 | + if (parentFloating) { | |
| 6949 | + parentFloating.style.pointerEvents = ""; | |
| 6950 | + } | |
| 6951 | + const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null; | |
| 6952 | + const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null; | |
| 6953 | + const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest("[data-rootownerid]") ?? doc.body; | |
| 6954 | + applySafePolygonPointerEventsMutation(instance, { | |
| 6955 | + scopeElement, | |
| 6956 | + referenceElement: ref, | |
| 6957 | + floatingElement: floatingEl | |
| 6958 | + }); | |
| 6959 | + return () => { | |
| 6960 | + clearPointerEvents(); | |
| 6961 | + }; | |
| 6962 | + } | |
| 6963 | + return void 0; | |
| 6964 | + }, [enabled, open2, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]); | |
| 6965 | + React30.useEffect(() => { | |
| 6966 | + if (!enabled) { | |
| 6967 | + return void 0; | |
| 6968 | + } | |
| 6969 | + function hasParentChildren() { | |
| 6970 | + return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0); | |
| 6971 | + } | |
| 6972 | + function closeWithDelay(event) { | |
| 6973 | + const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType); | |
| 6974 | + const close = () => { | |
| 6975 | + store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); | |
| 6976 | + tree?.events.emit("floating.closed", event); | |
| 6977 | + }; | |
| 6978 | + if (closeDelay) { | |
| 6979 | + instance.openChangeTimeout.start(closeDelay, close); | |
| 6980 | + } else { | |
| 6981 | + instance.openChangeTimeout.clear(); | |
| 6982 | + close(); | |
| 6983 | + } | |
| 6984 | + } | |
| 6985 | + function handleInteractInside(event) { | |
| 6986 | + const target = getTarget(event); | |
| 6987 | + if (!isInteractiveElement(target)) { | |
| 6988 | + instance.interactedInside = false; | |
| 6989 | + return; | |
| 6990 | + } | |
| 6991 | + instance.interactedInside = target?.closest("[aria-haspopup]") != null; | |
| 6992 | + } | |
| 6993 | + function onFloatingMouseEnter() { | |
| 6994 | + instance.openChangeTimeout.clear(); | |
| 6995 | + childClosedTimeout.clear(); | |
| 6996 | + tree?.events.off("floating.closed", onNodeClosed); | |
| 6997 | + clearPointerEvents(); | |
| 6998 | + } | |
| 6999 | + function onFloatingMouseLeave(event) { | |
| 7000 | + if (hasParentChildren() && tree) { | |
| 7001 | + tree.events.on("floating.closed", onNodeClosed); | |
| 7002 | + return; | |
| 7003 | + } | |
| 7004 | + if (isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) { | |
| 7005 | + return; | |
| 7006 | + } | |
| 7007 | + const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp; | |
| 7008 | + const relatedTarget = event.relatedTarget; | |
| 7009 | + const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget)); | |
| 7010 | + if (isMovingIntoDescendantFloating) { | |
| 7011 | + return; | |
| 7012 | + } | |
| 7013 | + if (instance.handler) { | |
| 7014 | + instance.handler(event); | |
| 7015 | + return; | |
| 7016 | + } | |
| 7017 | + clearPointerEvents(); | |
| 7018 | + if (isHoverOpen() && !isClickLikeOpenEvent2()) { | |
| 7019 | + closeWithDelay(event); | |
| 7020 | + } | |
| 7021 | + } | |
| 7022 | + function onNodeClosed(event) { | |
| 7023 | + if (!tree || !parentId || hasParentChildren()) { | |
| 7024 | + return; | |
| 7025 | + } | |
| 7026 | + childClosedTimeout.start(0, () => { | |
| 7027 | + tree.events.off("floating.closed", onNodeClosed); | |
| 7028 | + store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); | |
| 7029 | + tree.events.emit("floating.closed", event); | |
| 7030 | + }); | |
| 7031 | + } | |
| 7032 | + const floating = floatingElement; | |
| 7033 | + return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => { | |
| 7034 | + tree?.events.off("floating.closed", onNodeClosed); | |
| 7035 | + }); | |
| 7036 | + }, [enabled, floatingElement, store, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]); | |
| 7037 | +} | |
| 7038 | + | |
| 7039 | +// node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs | |
| 7040 | +var React31 = __toESM(require_react(), 1); | |
| 7041 | +var ReactDOM5 = __toESM(require_react_dom(), 1); | |
| 7042 | +var EMPTY_REF = { | |
| 7043 | + current: null | |
| 7044 | +}; | |
| 7045 | +function useHoverReferenceInteraction(context, props = {}) { | |
| 7046 | + const { | |
| 7047 | + enabled = true, | |
| 7048 | + delay = 0, | |
| 7049 | + handleClose = null, | |
| 7050 | + mouseOnly = false, | |
| 7051 | + restMs = 0, | |
| 7052 | + move = true, | |
| 7053 | + triggerElementRef = EMPTY_REF, | |
| 7054 | + externalTree, | |
| 7055 | + isActiveTrigger = true, | |
| 7056 | + getHandleCloseContext, | |
| 7057 | + isClosing, | |
| 7058 | + shouldOpen: shouldOpenProp, | |
| 7059 | + guardStaleOpen = false | |
| 7060 | + } = props; | |
| 7061 | + const store = "rootStore" in context ? context.rootStore : context; | |
| 7062 | + const { | |
| 7063 | + dataRef, | |
| 7064 | + events | |
| 7065 | + } = store.context; | |
| 7066 | + const tree = useFloatingTree(externalTree); | |
| 7067 | + const instance = useHoverInteractionSharedState(store); | |
| 7068 | + const isHoverCloseActiveRef = React31.useRef(false); | |
| 7069 | + const handleCloseRef = useValueAsRef(handleClose); | |
| 7070 | + const delayRef = useValueAsRef(delay); | |
| 7071 | + const restMsRef = useValueAsRef(restMs); | |
| 7072 | + const enabledRef = useValueAsRef(enabled); | |
| 7073 | + const shouldOpenRef = useValueAsRef(shouldOpenProp); | |
| 7074 | + const isClosingRef = useValueAsRef(isClosing); | |
| 7075 | + const isClickLikeOpenEvent2 = useStableCallback(() => { | |
| 7076 | + return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); | |
| 7077 | + }); | |
| 7078 | + const checkShouldOpen = useStableCallback(() => { | |
| 7079 | + return shouldOpenRef.current?.() !== false; | |
| 7080 | + }); | |
| 7081 | + const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => { | |
| 7082 | + const allTriggers = store.context.triggerElements; | |
| 7083 | + if (allTriggers.hasElement(currentTarget)) { | |
| 7084 | + return !currentDomReference || !contains(currentDomReference, currentTarget); | |
| 7085 | + } | |
| 7086 | + if (!isElement(target)) { | |
| 7087 | + return false; | |
| 7088 | + } | |
| 7089 | + const targetElement = target; | |
| 7090 | + return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement)); | |
| 7091 | + }); | |
| 7092 | + const cleanupMouseMoveHandler = useStableCallback(() => { | |
| 7093 | + if (!instance.handler) { | |
| 7094 | + return; | |
| 7095 | + } | |
| 7096 | + const doc = ownerDocument(store.select("domReferenceElement")); | |
| 7097 | + doc.removeEventListener("mousemove", instance.handler); | |
| 7098 | + instance.handler = void 0; | |
| 7099 | + }); | |
| 7100 | + const clearPointerEvents = useStableCallback(() => { | |
| 7101 | + clearSafePolygonPointerEventsMutation(instance); | |
| 7102 | + }); | |
| 7103 | + if (isActiveTrigger) { | |
| 7104 | + instance.handleCloseOptions = handleClose?.__options; | |
| 7105 | + } | |
| 7106 | + React31.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]); | |
| 7107 | + React31.useEffect(() => { | |
| 7108 | + if (!enabled) { | |
| 7109 | + return void 0; | |
| 7110 | + } | |
| 7111 | + function onOpenChangeLocal(details) { | |
| 7112 | + if (!details.open) { | |
| 7113 | + isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover; | |
| 7114 | + cleanupMouseMoveHandler(); | |
| 7115 | + instance.openChangeTimeout.clear(); | |
| 7116 | + instance.restTimeout.clear(); | |
| 7117 | + instance.blockMouseMove = true; | |
| 7118 | + instance.restTimeoutPending = false; | |
| 7119 | + } else { | |
| 7120 | + isHoverCloseActiveRef.current = false; | |
| 7121 | + } | |
| 7122 | + } | |
| 7123 | + events.on("openchange", onOpenChangeLocal); | |
| 7124 | + return () => { | |
| 7125 | + events.off("openchange", onOpenChangeLocal); | |
| 7126 | + }; | |
| 7127 | + }, [enabled, events, instance, cleanupMouseMoveHandler]); | |
| 7128 | + React31.useEffect(() => { | |
| 7129 | + if (!enabled) { | |
| 7130 | + return void 0; | |
| 7131 | + } | |
| 7132 | + function closeWithDelay(event, runElseBranch = true) { | |
| 7133 | + const closeDelay = getDelay(delayRef.current, "close", instance.pointerType); | |
| 7134 | + if (closeDelay) { | |
| 7135 | + instance.openChangeTimeout.start(closeDelay, () => { | |
| 7136 | + store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); | |
| 7137 | + tree?.events.emit("floating.closed", event); | |
| 7138 | + }); | |
| 7139 | + } else if (runElseBranch) { | |
| 7140 | + instance.openChangeTimeout.clear(); | |
| 7141 | + store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); | |
| 7142 | + tree?.events.emit("floating.closed", event); | |
| 7143 | + } | |
| 7144 | + } | |
| 7145 | + const trigger = triggerElementRef.current ?? (isActiveTrigger ? store.select("domReferenceElement") : null); | |
| 7146 | + if (!isElement(trigger)) { | |
| 7147 | + return void 0; | |
| 7148 | + } | |
| 7149 | + function onMouseEnter(event) { | |
| 7150 | + instance.openChangeTimeout.clear(); | |
| 7151 | + instance.blockMouseMove = false; | |
| 7152 | + if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { | |
| 7153 | + return; | |
| 7154 | + } | |
| 7155 | + const restMsValue = getRestMs(restMsRef.current); | |
| 7156 | + const openDelay = getDelay(delayRef.current, "open", instance.pointerType); | |
| 7157 | + const eventTarget = getTarget(event); | |
| 7158 | + const currentTarget = event.currentTarget ?? null; | |
| 7159 | + const currentDomReference = store.select("domReferenceElement"); | |
| 7160 | + let triggerNode = currentTarget; | |
| 7161 | + if (isElement(eventTarget) && !store.context.triggerElements.hasElement(eventTarget)) { | |
| 7162 | + for (const triggerElement of store.context.triggerElements.elements()) { | |
| 7163 | + if (contains(triggerElement, eventTarget)) { | |
| 7164 | + triggerNode = triggerElement; | |
| 7165 | + break; | |
| 7166 | + } | |
| 7167 | + } | |
| 7168 | + } | |
| 7169 | + if (isElement(currentTarget) && isElement(currentDomReference) && !store.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) { | |
| 7170 | + triggerNode = currentDomReference; | |
| 7171 | + } | |
| 7172 | + const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget); | |
| 7173 | + const isOpen = store.select("open"); | |
| 7174 | + const isInClosingTransition = isClosingRef.current?.() ?? store.select("transitionStatus") === "ending"; | |
| 7175 | + const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current; | |
| 7176 | + const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition; | |
| 7177 | + const isRestOnlyDelay = restMsValue > 0 && !openDelay; | |
| 7178 | + const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition; | |
| 7179 | + const shouldOpen = !isOpen || isOverInactive; | |
| 7180 | + if (shouldOpenImmediately) { | |
| 7181 | + if (checkShouldOpen()) { | |
| 7182 | + store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); | |
| 7183 | + } | |
| 7184 | + return; | |
| 7185 | + } | |
| 7186 | + if (isRestOnlyDelay) { | |
| 7187 | + return; | |
| 7188 | + } | |
| 7189 | + if (openDelay) { | |
| 7190 | + instance.openChangeTimeout.start(openDelay, () => { | |
| 7191 | + if (shouldOpen && checkShouldOpen()) { | |
| 7192 | + store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); | |
| 7193 | + } | |
| 7194 | + }); | |
| 7195 | + } else if (shouldOpen) { | |
| 7196 | + if (checkShouldOpen()) { | |
| 7197 | + store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); | |
| 7198 | + } | |
| 7199 | + } | |
| 7200 | + } | |
| 7201 | + function onMouseLeave(event) { | |
| 7202 | + if (isClickLikeOpenEvent2()) { | |
| 7203 | + clearPointerEvents(); | |
| 7204 | + return; | |
| 7205 | + } | |
| 7206 | + cleanupMouseMoveHandler(); | |
| 7207 | + const domReferenceElement = store.select("domReferenceElement"); | |
| 7208 | + const doc = ownerDocument(domReferenceElement); | |
| 7209 | + instance.restTimeout.clear(); | |
| 7210 | + instance.restTimeoutPending = false; | |
| 7211 | + const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.(); | |
| 7212 | + if (isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) { | |
| 7213 | + return; | |
| 7214 | + } | |
| 7215 | + if (handleCloseRef.current && handleCloseContextBase) { | |
| 7216 | + if (!store.select("open")) { | |
| 7217 | + instance.openChangeTimeout.clear(); | |
| 7218 | + } | |
| 7219 | + const currentTrigger = triggerElementRef.current; | |
| 7220 | + instance.handler = handleCloseRef.current({ | |
| 7221 | + ...handleCloseContextBase, | |
| 7222 | + tree, | |
| 7223 | + x: event.clientX, | |
| 7224 | + y: event.clientY, | |
| 7225 | + onClose() { | |
| 7226 | + clearPointerEvents(); | |
| 7227 | + cleanupMouseMoveHandler(); | |
| 7228 | + if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store.select("domReferenceElement")) { | |
| 7229 | + closeWithDelay(event, true); | |
| 7230 | + } | |
| 7231 | + } | |
| 7232 | + }); | |
| 7233 | + doc.addEventListener("mousemove", instance.handler); | |
| 7234 | + instance.handler(event); | |
| 7235 | + return; | |
| 7236 | + } | |
| 7237 | + const shouldClose = instance.pointerType === "touch" ? !contains(store.select("floatingElement"), event.relatedTarget) : true; | |
| 7238 | + if (shouldClose) { | |
| 7239 | + closeWithDelay(event); | |
| 7240 | + } | |
| 7241 | + } | |
| 7242 | + function onMouseOut(event) { | |
| 7243 | + if (contains(trigger, event.relatedTarget)) { | |
| 7244 | + return; | |
| 7245 | + } | |
| 7246 | + instance.openChangeTimeout.clear(); | |
| 7247 | + instance.restTimeout.clear(); | |
| 7248 | + instance.restTimeoutPending = false; | |
| 7249 | + } | |
| 7250 | + const staleOpenGuard = guardStaleOpen ? addEventListener(trigger, "mouseout", onMouseOut) : void 0; | |
| 7251 | + if (move) { | |
| 7252 | + return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, { | |
| 7253 | + once: true | |
| 7254 | + }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard); | |
| 7255 | + } | |
| 7256 | + return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard); | |
| 7257 | + }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen, guardStaleOpen]); | |
| 7258 | + return React31.useMemo(() => { | |
| 7259 | + if (!enabled) { | |
| 7260 | + return void 0; | |
| 7261 | + } | |
| 7262 | + function setPointerRef(event) { | |
| 7263 | + instance.pointerType = event.pointerType; | |
| 7264 | + } | |
| 7265 | + return { | |
| 7266 | + onPointerDown: setPointerRef, | |
| 7267 | + onPointerEnter: setPointerRef, | |
| 7268 | + onMouseMove(event) { | |
| 7269 | + const { | |
| 7270 | + nativeEvent | |
| 7271 | + } = event; | |
| 7272 | + const trigger = event.currentTarget; | |
| 7273 | + const currentDomReference = store.select("domReferenceElement"); | |
| 7274 | + const currentOpen = store.select("open"); | |
| 7275 | + const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target); | |
| 7276 | + if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { | |
| 7277 | + return; | |
| 7278 | + } | |
| 7279 | + if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) { | |
| 7280 | + const floatingElement = store.select("floatingElement"); | |
| 7281 | + if (floatingElement) { | |
| 7282 | + const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body; | |
| 7283 | + applySafePolygonPointerEventsMutation(instance, { | |
| 7284 | + scopeElement, | |
| 7285 | + referenceElement: trigger, | |
| 7286 | + floatingElement | |
| 7287 | + }); | |
| 7288 | + } | |
| 7289 | + } | |
| 7290 | + const restMsValue = getRestMs(restMsRef.current); | |
| 7291 | + if (currentOpen && !isOverInactive || restMsValue === 0) { | |
| 7292 | + return; | |
| 7293 | + } | |
| 7294 | + if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) { | |
| 7295 | + return; | |
| 7296 | + } | |
| 7297 | + instance.restTimeout.clear(); | |
| 7298 | + function handleMouseMove() { | |
| 7299 | + instance.restTimeoutPending = false; | |
| 7300 | + if (isClickLikeOpenEvent2()) { | |
| 7301 | + return; | |
| 7302 | + } | |
| 7303 | + const latestOpen = store.select("open"); | |
| 7304 | + if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) { | |
| 7305 | + store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger)); | |
| 7306 | + } | |
| 7307 | + } | |
| 7308 | + if (instance.pointerType === "touch") { | |
| 7309 | + ReactDOM5.flushSync(() => { | |
| 7310 | + handleMouseMove(); | |
| 7311 | + }); | |
| 7312 | + } else if (isOverInactive && currentOpen) { | |
| 7313 | + handleMouseMove(); | |
| 7314 | + } else { | |
| 7315 | + instance.restTimeoutPending = true; | |
| 7316 | + instance.restTimeout.start(restMsValue, handleMouseMove); | |
| 7317 | + } | |
| 7318 | + } | |
| 7319 | + }; | |
| 7320 | + }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store, restMsRef, checkShouldOpen]); | |
| 7321 | +} | |
| 7322 | + | |
| 7323 | +// node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs | |
| 7324 | +var CURSOR_SPEED_THRESHOLD = 0.1; | |
| 7325 | +var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD; | |
| 7326 | +var POLYGON_BUFFER = 0.5; | |
| 7327 | +function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) { | |
| 7328 | + return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi; | |
| 7329 | +} | |
| 7330 | +function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) { | |
| 7331 | + let isInsideValue = false; | |
| 7332 | + if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) { | |
| 7333 | + isInsideValue = !isInsideValue; | |
| 7334 | + } | |
| 7335 | + if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) { | |
| 7336 | + isInsideValue = !isInsideValue; | |
| 7337 | + } | |
| 7338 | + if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) { | |
| 7339 | + isInsideValue = !isInsideValue; | |
| 7340 | + } | |
| 7341 | + if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) { | |
| 7342 | + isInsideValue = !isInsideValue; | |
| 7343 | + } | |
| 7344 | + return isInsideValue; | |
| 7345 | +} | |
| 7346 | +function isInsideRect(pointX, pointY, rect) { | |
| 7347 | + return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height; | |
| 7348 | +} | |
| 7349 | +function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) { | |
| 7350 | + const minX = Math.min(x1, x2); | |
| 7351 | + const maxX = Math.max(x1, x2); | |
| 7352 | + const minY = Math.min(y1, y2); | |
| 7353 | + const maxY = Math.max(y1, y2); | |
| 7354 | + return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY; | |
| 7355 | +} | |
| 7356 | +function safePolygon(options = {}) { | |
| 7357 | + const { | |
| 7358 | + blockPointerEvents = false | |
| 7359 | + } = options; | |
| 7360 | + const timeout = new Timeout(); | |
| 7361 | + const fn = ({ | |
| 7362 | + x: x2, | |
| 7363 | + y: y2, | |
| 7364 | + placement, | |
| 7365 | + elements, | |
| 7366 | + onClose, | |
| 7367 | + nodeId, | |
| 7368 | + tree | |
| 7369 | + }) => { | |
| 7370 | + const side = placement?.split("-")[0]; | |
| 7371 | + let hasLanded = false; | |
| 7372 | + let lastX = null; | |
| 7373 | + let lastY = null; | |
| 7374 | + let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0; | |
| 7375 | + function isCursorMovingSlowly(nextX, nextY) { | |
| 7376 | + const currentTime = performance.now(); | |
| 7377 | + const elapsedTime = currentTime - lastCursorTime; | |
| 7378 | + if (lastX === null || lastY === null || elapsedTime === 0) { | |
| 7379 | + lastX = nextX; | |
| 7380 | + lastY = nextY; | |
| 7381 | + lastCursorTime = currentTime; | |
| 7382 | + return false; | |
| 7383 | + } | |
| 7384 | + const deltaX = nextX - lastX; | |
| 7385 | + const deltaY = nextY - lastY; | |
| 7386 | + const distanceSquared = deltaX * deltaX + deltaY * deltaY; | |
| 7387 | + const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED; | |
| 7388 | + lastX = nextX; | |
| 7389 | + lastY = nextY; | |
| 7390 | + lastCursorTime = currentTime; | |
| 7391 | + return distanceSquared < thresholdSquared; | |
| 7392 | + } | |
| 7393 | + function close() { | |
| 7394 | + timeout.clear(); | |
| 7395 | + onClose(); | |
| 7396 | + } | |
| 7397 | + return function onMouseMove(event) { | |
| 7398 | + timeout.clear(); | |
| 7399 | + const domReference = elements.domReference; | |
| 7400 | + const floating = elements.floating; | |
| 7401 | + if (!domReference || !floating || side == null || x2 == null || y2 == null) { | |
| 7402 | + return void 0; | |
| 7403 | + } | |
| 7404 | + const { | |
| 7405 | + clientX, | |
| 7406 | + clientY | |
| 7407 | + } = event; | |
| 7408 | + const target = getTarget(event); | |
| 7409 | + const isLeave = event.type === "mouseleave"; | |
| 7410 | + const isOverFloatingEl = contains(floating, target); | |
| 7411 | + const isOverReferenceEl = contains(domReference, target); | |
| 7412 | + if (isOverFloatingEl) { | |
| 7413 | + hasLanded = true; | |
| 7414 | + if (!isLeave) { | |
| 7415 | + return void 0; | |
| 7416 | + } | |
| 7417 | + } | |
| 7418 | + if (isOverReferenceEl) { | |
| 7419 | + hasLanded = false; | |
| 7420 | + if (!isLeave) { | |
| 7421 | + hasLanded = true; | |
| 7422 | + return void 0; | |
| 7423 | + } | |
| 7424 | + } | |
| 7425 | + if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) { | |
| 7426 | + return void 0; | |
| 7427 | + } | |
| 7428 | + function hasOpenChildNode() { | |
| 7429 | + return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0); | |
| 7430 | + } | |
| 7431 | + function closeIfNoOpenChild() { | |
| 7432 | + if (!hasOpenChildNode()) { | |
| 7433 | + close(); | |
| 7434 | + } | |
| 7435 | + } | |
| 7436 | + if (hasOpenChildNode()) { | |
| 7437 | + return void 0; | |
| 7438 | + } | |
| 7439 | + const refRect = domReference.getBoundingClientRect(); | |
| 7440 | + const rect = floating.getBoundingClientRect(); | |
| 7441 | + const cursorLeaveFromRight = x2 > rect.right - rect.width / 2; | |
| 7442 | + const cursorLeaveFromBottom = y2 > rect.bottom - rect.height / 2; | |
| 7443 | + const isFloatingWider = rect.width > refRect.width; | |
| 7444 | + const isFloatingTaller = rect.height > refRect.height; | |
| 7445 | + const left = (isFloatingWider ? refRect : rect).left; | |
| 7446 | + const right = (isFloatingWider ? refRect : rect).right; | |
| 7447 | + const top = (isFloatingTaller ? refRect : rect).top; | |
| 7448 | + const bottom = (isFloatingTaller ? refRect : rect).bottom; | |
| 7449 | + if (side === "top" && y2 >= refRect.bottom - 1 || side === "bottom" && y2 <= refRect.top + 1 || side === "left" && x2 >= refRect.right - 1 || side === "right" && x2 <= refRect.left + 1) { | |
| 7450 | + closeIfNoOpenChild(); | |
| 7451 | + return void 0; | |
| 7452 | + } | |
| 7453 | + let isInsideTroughRect = false; | |
| 7454 | + switch (side) { | |
| 7455 | + case "top": | |
| 7456 | + isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1); | |
| 7457 | + break; | |
| 7458 | + case "bottom": | |
| 7459 | + isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1); | |
| 7460 | + break; | |
| 7461 | + case "left": | |
| 7462 | + isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top); | |
| 7463 | + break; | |
| 7464 | + case "right": | |
| 7465 | + isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top); | |
| 7466 | + break; | |
| 7467 | + default: | |
| 7468 | + } | |
| 7469 | + if (isInsideTroughRect) { | |
| 7470 | + return void 0; | |
| 7471 | + } | |
| 7472 | + if (hasLanded && !isInsideRect(clientX, clientY, refRect)) { | |
| 7473 | + closeIfNoOpenChild(); | |
| 7474 | + return void 0; | |
| 7475 | + } | |
| 7476 | + if (!isLeave && isCursorMovingSlowly(clientX, clientY)) { | |
| 7477 | + closeIfNoOpenChild(); | |
| 7478 | + return void 0; | |
| 7479 | + } | |
| 7480 | + let isInsidePolygon = false; | |
| 7481 | + switch (side) { | |
| 7482 | + case "top": { | |
| 7483 | + const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; | |
| 7484 | + const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; | |
| 7485 | + const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; | |
| 7486 | + const cursorPointY = y2 + POLYGON_BUFFER + 1; | |
| 7487 | + const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top; | |
| 7488 | + const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER; | |
| 7489 | + isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); | |
| 7490 | + break; | |
| 7491 | + } | |
| 7492 | + case "bottom": { | |
| 7493 | + const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; | |
| 7494 | + const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; | |
| 7495 | + const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; | |
| 7496 | + const cursorPointY = y2 - POLYGON_BUFFER; | |
| 7497 | + const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom; | |
| 7498 | + const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER; | |
| 7499 | + isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); | |
| 7500 | + break; | |
| 7501 | + } | |
| 7502 | + case "left": { | |
| 7503 | + const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; | |
| 7504 | + const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; | |
| 7505 | + const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; | |
| 7506 | + const cursorPointX = x2 + POLYGON_BUFFER + 1; | |
| 7507 | + const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left; | |
| 7508 | + const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER; | |
| 7509 | + isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY); | |
| 7510 | + break; | |
| 7511 | + } | |
| 7512 | + case "right": { | |
| 7513 | + const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; | |
| 7514 | + const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; | |
| 7515 | + const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; | |
| 7516 | + const cursorPointX = x2 - POLYGON_BUFFER; | |
| 7517 | + const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right; | |
| 7518 | + const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER; | |
| 7519 | + isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom); | |
| 7520 | + break; | |
| 7521 | + } | |
| 7522 | + default: | |
| 7523 | + } | |
| 7524 | + if (!isInsidePolygon) { | |
| 7525 | + closeIfNoOpenChild(); | |
| 7526 | + } else if (!hasLanded) { | |
| 7527 | + timeout.start(40, closeIfNoOpenChild); | |
| 7528 | + } | |
| 7529 | + return void 0; | |
| 7530 | + }; | |
| 7531 | + }; | |
| 7532 | + fn.__options = { | |
| 7533 | + ...options, | |
| 7534 | + blockPointerEvents | |
| 7535 | + }; | |
| 7536 | + return fn; | |
| 7537 | +} | |
| 7538 | + | |
| 7539 | +// node_modules/@base-ui/react/utils/NullStore.mjs | |
| 7540 | +var NullStore = class extends ReactStore { | |
| 7541 | + // `update`/`set`/`notifyAll` funnel through `setState` in the base `Store`, so overriding | |
| 7542 | + // `setState` alone would neutralize them today. They are overridden explicitly so the store stays | |
| 7543 | + // inert even if a future base-class change stops routing a mutator through `setState`. | |
| 7544 | + setState(_newState) { | |
| 7545 | + } | |
| 7546 | + update(_changes) { | |
| 7547 | + } | |
| 7548 | + set(_key, _value) { | |
| 7549 | + } | |
| 7550 | + notifyAll() { | |
| 7551 | + } | |
| 7552 | +}; | |
| 7553 | + | |
| 7554 | +// node_modules/@base-ui/utils/inertValue.mjs | |
| 7555 | +function inertValue(value) { | |
| 7556 | + if (isReactVersionAtLeast(19)) { | |
| 7557 | + return value; | |
| 7558 | + } | |
| 7559 | + return value ? "true" : void 0; | |
| 7560 | +} | |
| 7561 | + | |
| 7562 | +// node_modules/@base-ui/react/internals/useValueChanged.mjs | |
| 7563 | +var React32 = __toESM(require_react(), 1); | |
| 7564 | +function useValueChanged(value, onChange) { | |
| 7565 | + const valueRef = React32.useRef(value); | |
| 7566 | + const onChangeCallback = useStableCallback(onChange); | |
| 7567 | + useIsoLayoutEffect(() => { | |
| 7568 | + if (valueRef.current !== value) { | |
| 7569 | + onChangeCallback(valueRef.current); | |
| 7570 | + } | |
| 7571 | + valueRef.current = value; | |
| 7572 | + }, [value, onChangeCallback]); | |
| 7573 | +} | |
| 7574 | + | |
| 7575 | +// node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs | |
| 7576 | +var React33 = __toESM(require_react(), 1); | |
| 7577 | + | |
| 7578 | +// node_modules/@base-ui/react/field/control/FieldControlDataAttributes.mjs | |
| 7579 | +var valid = "data-valid"; | |
| 7580 | +var invalid = "data-invalid"; | |
| 7581 | + | |
| 7582 | +// node_modules/@base-ui/react/internals/field-constants/constants.mjs | |
| 7583 | +var DEFAULT_VALIDITY_STATE = { | |
| 7584 | + badInput: false, | |
| 7585 | + customError: false, | |
| 7586 | + patternMismatch: false, | |
| 7587 | + rangeOverflow: false, | |
| 7588 | + rangeUnderflow: false, | |
| 7589 | + stepMismatch: false, | |
| 7590 | + tooLong: false, | |
| 7591 | + tooShort: false, | |
| 7592 | + typeMismatch: false, | |
| 7593 | + valid: null, | |
| 7594 | + valueMissing: false | |
| 7595 | +}; | |
| 7596 | +var DEFAULT_FIELD_STATE_ATTRIBUTES = { | |
| 7597 | + valid: null, | |
| 7598 | + touched: false, | |
| 7599 | + dirty: false, | |
| 7600 | + filled: false, | |
| 7601 | + focused: false | |
| 7602 | +}; | |
| 7603 | +var DEFAULT_FIELD_ROOT_STATE = { | |
| 7604 | + disabled: false, | |
| 7605 | + ...DEFAULT_FIELD_STATE_ATTRIBUTES | |
| 7606 | +}; | |
| 7607 | +var fieldValidityMapping = { | |
| 7608 | + valid(value) { | |
| 7609 | + if (value === null) { | |
| 7610 | + return null; | |
| 7611 | + } | |
| 7612 | + if (value) { | |
| 7613 | + return { | |
| 7614 | + [valid]: "" | |
| 7615 | + }; | |
| 7616 | + } | |
| 7617 | + return { | |
| 7618 | + [invalid]: "" | |
| 7619 | + }; | |
| 7620 | + } | |
| 7621 | +}; | |
| 7622 | + | |
| 7623 | +// node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs | |
| 7624 | +var DEFAULT_FIELD_ROOT_CONTEXT = { | |
| 7625 | + invalid: void 0, | |
| 7626 | + name: void 0, | |
| 7627 | + validityData: { | |
| 7628 | + state: DEFAULT_VALIDITY_STATE, | |
| 7629 | + errors: [], | |
| 7630 | + error: "", | |
| 7631 | + value: "", | |
| 7632 | + initialValue: null | |
| 7633 | + }, | |
| 7634 | + setValidityData: NOOP, | |
| 7635 | + disabled: void 0, | |
| 7636 | + setTouched: NOOP, | |
| 7637 | + setDirty: NOOP, | |
| 7638 | + setFilled: NOOP, | |
| 7639 | + setFocused: NOOP, | |
| 7640 | + validationMode: "onSubmit", | |
| 7641 | + shouldValidateOnChange: () => false, | |
| 7642 | + state: DEFAULT_FIELD_ROOT_STATE, | |
| 7643 | + registerFieldControl: NOOP, | |
| 7644 | + validation: { | |
| 7645 | + getValidationProps: (_disabled, props = EMPTY_OBJECT) => props, | |
| 7646 | + inputRef: { | |
| 7647 | + current: null | |
| 7648 | + }, | |
| 7649 | + registeredInputs: /* @__PURE__ */ new Map(), | |
| 7650 | + registerInput: NOOP, | |
| 7651 | + getInputControl: () => null, | |
| 7652 | + commit: async () => { | |
| 7653 | + }, | |
| 7654 | + change: NOOP | |
| 7655 | + } | |
| 7656 | +}; | |
| 7657 | +var FieldRootContext = /* @__PURE__ */ React33.createContext(DEFAULT_FIELD_ROOT_CONTEXT); | |
| 7658 | +if (true) FieldRootContext.displayName = "FieldRootContext"; | |
| 7659 | +function useFieldRootContext(optional = true) { | |
| 7660 | + const context = React33.useContext(FieldRootContext); | |
| 7661 | + if (context.setValidityData === NOOP && !optional) { | |
| 7662 | + throw new Error(true ? "Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>." : formatErrorMessage_default(28)); | |
| 7663 | + } | |
| 7664 | + return context; | |
| 7665 | +} | |
| 7666 | + | |
| 7667 | +// node_modules/@base-ui/react/internals/field-register-control/useRegisterFieldControl.mjs | |
| 7668 | +function useRegisterFieldControl(controlRef, id, value, getFormValueOverride, enabled = true, name) { | |
| 7669 | + const { | |
| 7670 | + registerFieldControl | |
| 7671 | + } = useFieldRootContext(); | |
| 7672 | + const sourceRef = useRefWithInit(() => /* @__PURE__ */ Symbol()); | |
| 7673 | + useIsoLayoutEffect(() => { | |
| 7674 | + const source = sourceRef.current; | |
| 7675 | + if (!enabled) { | |
| 7676 | + registerFieldControl(source, void 0); | |
| 7677 | + return; | |
| 7678 | + } | |
| 7679 | + const registration = { | |
| 7680 | + controlRef, | |
| 7681 | + getValue: getFormValueOverride, | |
| 7682 | + id, | |
| 7683 | + name, | |
| 7684 | + value | |
| 7685 | + }; | |
| 7686 | + registerFieldControl(source, registration); | |
| 7687 | + }, [controlRef, enabled, getFormValueOverride, id, name, registerFieldControl, sourceRef, value]); | |
| 7688 | + useIsoLayoutEffect(() => { | |
| 7689 | + const source = sourceRef.current; | |
| 7690 | + return () => { | |
| 7691 | + registerFieldControl(source, void 0); | |
| 7692 | + }; | |
| 7693 | + }, [registerFieldControl, sourceRef]); | |
| 7694 | +} | |
| 7695 | + | |
| 7696 | +// node_modules/@base-ui/react/internals/form-context/FormContext.mjs | |
| 7697 | +var React34 = __toESM(require_react(), 1); | |
| 7698 | +var FormContext = /* @__PURE__ */ React34.createContext({ | |
| 7699 | + elementRef: { | |
| 7700 | + current: null | |
| 7701 | + }, | |
| 7702 | + formRef: { | |
| 7703 | + current: { | |
| 7704 | + fields: /* @__PURE__ */ new Map() | |
| 7705 | + } | |
| 7706 | + }, | |
| 7707 | + errors: {}, | |
| 7708 | + clearErrors: NOOP, | |
| 7709 | + validationMode: "onSubmit", | |
| 7710 | + submitCountRef: { | |
| 7711 | + current: 0 | |
| 7712 | + } | |
| 7713 | +}); | |
| 7714 | +if (true) FormContext.displayName = "FormContext"; | |
| 7715 | +function useFormContext() { | |
| 7716 | + return React34.useContext(FormContext); | |
| 7717 | +} | |
| 7718 | + | |
| 7719 | +// node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs | |
| 7720 | +var React36 = __toESM(require_react(), 1); | |
| 7721 | + | |
| 7722 | +// node_modules/@base-ui/react/internals/labelable-provider/LabelableContext.mjs | |
| 7723 | +var React35 = __toESM(require_react(), 1); | |
| 7724 | +var LabelableContext = /* @__PURE__ */ React35.createContext({ | |
| 7725 | + controlId: void 0, | |
| 7726 | + registerControlId: NOOP, | |
| 7727 | + resetControlId: NOOP, | |
| 7728 | + labelId: void 0, | |
| 7729 | + setLabelId: NOOP, | |
| 7730 | + messageIds: [], | |
| 7731 | + setMessageIds: NOOP, | |
| 7732 | + getDescriptionProps: (externalProps) => externalProps | |
| 7733 | +}); | |
| 7734 | +if (true) LabelableContext.displayName = "LabelableContext"; | |
| 7735 | +function useLabelableContext() { | |
| 7736 | + return React35.useContext(LabelableContext); | |
| 7737 | +} | |
| 7738 | + | |
| 7739 | +// node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs | |
| 7740 | +function useLabelableId(params = {}) { | |
| 7741 | + const { | |
| 7742 | + id, | |
| 7743 | + enabled = true | |
| 7744 | + } = params; | |
| 7745 | + const { | |
| 7746 | + controlId, | |
| 7747 | + registerControlId, | |
| 7748 | + resetControlId | |
| 7749 | + } = useLabelableContext(); | |
| 7750 | + const defaultId = useBaseUiId(); | |
| 7751 | + const controlSourceRef = useRefWithInit(() => /* @__PURE__ */ Symbol()); | |
| 7752 | + const hasRegisteredRef = React36.useRef(false); | |
| 7753 | + const hadExplicitIdRef = React36.useRef(false); | |
| 7754 | + const unregisterControlId = useStableCallback(() => { | |
| 7755 | + if (!hasRegisteredRef.current || registerControlId === NOOP) { | |
| 7756 | + return; | |
| 7757 | + } | |
| 7758 | + hasRegisteredRef.current = false; | |
| 7759 | + registerControlId(controlSourceRef.current, void 0); | |
| 7760 | + }); | |
| 7761 | + useIsoLayoutEffect(() => { | |
| 7762 | + if (!enabled || registerControlId === NOOP) { | |
| 7763 | + unregisterControlId(); | |
| 7764 | + return void 0; | |
| 7765 | + } | |
| 7766 | + let nextId; | |
| 7767 | + if (id !== void 0) { | |
| 7768 | + hadExplicitIdRef.current = true; | |
| 7769 | + nextId = id; | |
| 7770 | + } else if (hadExplicitIdRef.current) { | |
| 7771 | + nextId = defaultId; | |
| 7772 | + } else { | |
| 7773 | + resetControlId(); | |
| 7774 | + return void 0; | |
| 7775 | + } | |
| 7776 | + if (nextId === void 0) { | |
| 7777 | + unregisterControlId(); | |
| 7778 | + return void 0; | |
| 7779 | + } | |
| 7780 | + hasRegisteredRef.current = true; | |
| 7781 | + registerControlId(controlSourceRef.current, nextId); | |
| 7782 | + return void 0; | |
| 7783 | + }, [id, enabled, registerControlId, resetControlId, defaultId, controlSourceRef, unregisterControlId]); | |
| 7784 | + useIsoLayoutEffect(() => { | |
| 7785 | + return unregisterControlId; | |
| 7786 | + }, [unregisterControlId]); | |
| 7787 | + return (enabled ? controlId : void 0) ?? id ?? defaultId; | |
| 7788 | +} | |
| 7789 | + | |
| 7790 | +// node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs | |
| 7791 | +var React37 = __toESM(require_react(), 1); | |
| 7792 | +var DirectionContext = /* @__PURE__ */ React37.createContext(void 0); | |
| 7793 | +if (true) DirectionContext.displayName = "DirectionContext"; | |
| 7794 | +function useDirection() { | |
| 7795 | + const context = React37.useContext(DirectionContext); | |
| 7796 | + return context?.direction ?? "ltr"; | |
| 7797 | +} | |
| 7798 | + | |
| 7799 | +// node_modules/@base-ui/react/internals/useAnchorPositioning.mjs | |
| 7800 | +var React38 = __toESM(require_react(), 1); | |
| 7801 | + | |
| 7802 | +// node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs | |
| 7803 | +var baseArrow = (options) => ({ | |
| 7804 | + name: "arrow", | |
| 7805 | + options, | |
| 7806 | + async fn(state) { | |
| 7807 | + const { | |
| 7808 | + x: x2, | |
| 7809 | + y: y2, | |
| 7810 | + placement, | |
| 7811 | + rects, | |
| 7812 | + platform: platform3, | |
| 7813 | + elements, | |
| 7814 | + middlewareData | |
| 7815 | + } = state; | |
| 7816 | + const { | |
| 7817 | + element, | |
| 7818 | + padding = 0, | |
| 7819 | + offsetParent = "real" | |
| 7820 | + } = evaluate(options, state) || {}; | |
| 7821 | + if (element == null) { | |
| 7822 | + return {}; | |
| 7823 | + } | |
| 7824 | + const paddingObject = getPaddingObject(padding); | |
| 7825 | + const coords = { | |
| 7826 | + x: x2, | |
| 7827 | + y: y2 | |
| 7828 | + }; | |
| 7829 | + const axis = getAlignmentAxis(placement); | |
| 7830 | + const length = getAxisLength(axis); | |
| 7831 | + const arrowDimensions = await platform3.getDimensions(element); | |
| 7832 | + const isYAxis = axis === "y"; | |
| 7833 | + const minProp = isYAxis ? "top" : "left"; | |
| 7834 | + const maxProp = isYAxis ? "bottom" : "right"; | |
| 7835 | + const clientProp = isYAxis ? "clientHeight" : "clientWidth"; | |
| 7836 | + const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; | |
| 7837 | + const startDiff = coords[axis] - rects.reference[axis]; | |
| 7838 | + const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating; | |
| 7839 | + let clientSize = elements.floating[clientProp] || rects.floating[length]; | |
| 7840 | + if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) { | |
| 7841 | + clientSize = elements.floating[clientProp] || rects.floating[length]; | |
| 7842 | + } | |
| 7843 | + const centerToReference = endDiff / 2 - startDiff / 2; | |
| 7844 | + const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; | |
| 7845 | + const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding); | |
| 7846 | + const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding); | |
| 7847 | + const min3 = minPadding; | |
| 7848 | + const max3 = clientSize - arrowDimensions[length] - maxPadding; | |
| 7849 | + const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; | |
| 7850 | + const offset4 = clamp(min3, center, max3); | |
| 7851 | + const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min3 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; | |
| 7852 | + const alignmentOffset = shouldAddOffset ? center < min3 ? center - min3 : center - max3 : 0; | |
| 7853 | + return { | |
| 7854 | + [axis]: coords[axis] + alignmentOffset, | |
| 7855 | + data: { | |
| 7856 | + [axis]: offset4, | |
| 7857 | + centerOffset: center - offset4 - alignmentOffset, | |
| 7858 | + ...shouldAddOffset && { | |
| 7859 | + alignmentOffset | |
| 7860 | + } | |
| 7861 | + }, | |
| 7862 | + reset: shouldAddOffset | |
| 7863 | + }; | |
| 7864 | + } | |
| 7865 | +}); | |
| 7866 | +var arrow4 = (options, deps) => { | |
| 7867 | + const { | |
| 7868 | + name, | |
| 7869 | + fn | |
| 7870 | + } = baseArrow(options); | |
| 7871 | + return { | |
| 7872 | + name, | |
| 7873 | + fn, | |
| 7874 | + options: [options, deps] | |
| 7875 | + }; | |
| 7876 | +}; | |
| 7877 | + | |
| 7878 | +// node_modules/@base-ui/react/utils/hideMiddleware.mjs | |
| 7879 | +var hide4 = { | |
| 7880 | + name: "hide", | |
| 7881 | + async fn(state) { | |
| 7882 | + const { | |
| 7883 | + width, | |
| 7884 | + height, | |
| 7885 | + x: x2, | |
| 7886 | + y: y2 | |
| 7887 | + } = state.rects.reference; | |
| 7888 | + const anchorHidden2 = width === 0 && height === 0 && x2 === 0 && y2 === 0; | |
| 7889 | + const overflow = await state.platform.detectOverflow(state, { | |
| 7890 | + elementContext: "reference" | |
| 7891 | + }); | |
| 7892 | + const referenceHidden = overflow.top - height >= 0 || overflow.right - width >= 0 || overflow.bottom - height >= 0 || overflow.left - width >= 0; | |
| 7893 | + return { | |
| 7894 | + data: { | |
| 7895 | + referenceHidden: referenceHidden || anchorHidden2 | |
| 7896 | + } | |
| 7897 | + }; | |
| 7898 | + } | |
| 7899 | +}; | |
| 7900 | + | |
| 7901 | +// node_modules/@base-ui/react/utils/adaptiveOriginConstants.mjs | |
| 7902 | +var DEFAULT_SIDES = { | |
| 7903 | + sideX: "left", | |
| 7904 | + sideY: "top" | |
| 7905 | +}; | |
| 7906 | + | |
| 7907 | +// node_modules/@base-ui/react/utils/CommonPositionerCssVars.mjs | |
| 7908 | +var availableWidth = "--available-width"; | |
| 7909 | +var availableHeight = "--available-height"; | |
| 7910 | +var anchorWidth = "--anchor-width"; | |
| 7911 | +var anchorHeight = "--anchor-height"; | |
| 7912 | +var transformOrigin = "--transform-origin"; | |
| 7913 | +var positionerWidth = "--positioner-width"; | |
| 7914 | +var positionerHeight = "--positioner-height"; | |
| 7915 | + | |
| 7916 | +// node_modules/@base-ui/react/internals/useAnchorPositioning.mjs | |
| 7917 | +var AVAILABLE_WIDTH_VAR = availableWidth; | |
| 7918 | +var AVAILABLE_HEIGHT_VAR = availableHeight; | |
| 7919 | +function getLogicalSide(sideParam, renderedSide, isRtl) { | |
| 7920 | + const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end"; | |
| 7921 | + const logicalRight = isRtl ? "inline-start" : "inline-end"; | |
| 7922 | + const logicalLeft = isRtl ? "inline-end" : "inline-start"; | |
| 7923 | + return { | |
| 7924 | + top: "top", | |
| 7925 | + right: isLogicalSideParam ? logicalRight : "right", | |
| 7926 | + bottom: "bottom", | |
| 7927 | + left: isLogicalSideParam ? logicalLeft : "left" | |
| 7928 | + }[renderedSide]; | |
| 7929 | +} | |
| 7930 | +function getOffsetData(state, sideParam, isRtl) { | |
| 7931 | + const { | |
| 7932 | + rects, | |
| 7933 | + placement | |
| 7934 | + } = state; | |
| 7935 | + const data = { | |
| 7936 | + side: getLogicalSide(sideParam, getSide(placement), isRtl), | |
| 7937 | + align: getAlignment(placement) || "center", | |
| 7938 | + anchor: { | |
| 7939 | + width: rects.reference.width, | |
| 7940 | + height: rects.reference.height | |
| 7941 | + }, | |
| 7942 | + positioner: { | |
| 7943 | + width: rects.floating.width, | |
| 7944 | + height: rects.floating.height | |
| 7945 | + } | |
| 7946 | + }; | |
| 7947 | + return data; | |
| 7948 | +} | |
| 7949 | +function useAnchorPositioning(params) { | |
| 7950 | + return useAnchorPositioningWithHook(params, useBaseUIFloating); | |
| 7951 | +} | |
| 7952 | +function useAnchorPositioningWithHook(params, useFloatingHook) { | |
| 7953 | + const { | |
| 7954 | + // Public parameters | |
| 7955 | + anchor, | |
| 7956 | + positionMethod = "absolute", | |
| 7957 | + side: sideParam = "bottom", | |
| 7958 | + sideOffset = 0, | |
| 7959 | + align = "center", | |
| 7960 | + alignOffset = 0, | |
| 7961 | + collisionBoundary, | |
| 7962 | + collisionPadding: collisionPaddingParam = 5, | |
| 7963 | + sticky = false, | |
| 7964 | + arrowPadding = 5, | |
| 7965 | + disableAnchorTracking = false, | |
| 7966 | + inline: inlineMiddleware, | |
| 7967 | + // Private parameters | |
| 7968 | + keepMounted = false, | |
| 7969 | + floatingRootContext, | |
| 7970 | + mounted, | |
| 7971 | + collisionAvoidance, | |
| 7972 | + shift: shift4, | |
| 7973 | + nodeId, | |
| 7974 | + adaptiveOrigin: adaptiveOrigin2, | |
| 7975 | + lazyFlip = false, | |
| 7976 | + externalTree | |
| 7977 | + } = params; | |
| 7978 | + const [mountSide, setMountSide] = React38.useState(null); | |
| 7979 | + if (!mounted && mountSide !== null) { | |
| 7980 | + setMountSide(null); | |
| 7981 | + } | |
| 7982 | + const collisionAvoidanceSide = collisionAvoidance.side || "flip"; | |
| 7983 | + const collisionAvoidanceAlign = collisionAvoidance.align || "flip"; | |
| 7984 | + const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end"; | |
| 7985 | + const shiftCrossAxis = shift4?.crossAxis ?? false; | |
| 7986 | + const shiftRootBoundary = shift4?.rootBoundary; | |
| 7987 | + const anchorFn = typeof anchor === "function" ? anchor : void 0; | |
| 7988 | + const anchorFnCallback = useStableCallback(anchorFn); | |
| 7989 | + const anchorDep = anchorFn ? anchorFnCallback : anchor; | |
| 7990 | + const anchorValueRef = useValueAsRef(anchor); | |
| 7991 | + const mountedRef = useValueAsRef(mounted); | |
| 7992 | + const direction = useDirection(); | |
| 7993 | + const isRtl = direction === "rtl"; | |
| 7994 | + const side = mountSide || { | |
| 7995 | + top: "top", | |
| 7996 | + right: "right", | |
| 7997 | + bottom: "bottom", | |
| 7998 | + left: "left", | |
| 7999 | + "inline-end": isRtl ? "left" : "right", | |
| 8000 | + "inline-start": isRtl ? "right" : "left" | |
| 8001 | + }[sideParam]; | |
| 8002 | + const placement = align === "center" ? side : `${side}-${align}`; | |
| 8003 | + let collisionPadding = collisionPaddingParam; | |
| 8004 | + if (typeof collisionPadding === "number") { | |
| 8005 | + collisionPadding = { | |
| 8006 | + top: collisionPadding, | |
| 8007 | + right: collisionPadding, | |
| 8008 | + bottom: collisionPadding, | |
| 8009 | + left: collisionPadding | |
| 8010 | + }; | |
| 8011 | + } else if (collisionPadding) { | |
| 8012 | + collisionPadding = { | |
| 8013 | + top: collisionPadding.top || 0, | |
| 8014 | + right: collisionPadding.right || 0, | |
| 8015 | + bottom: collisionPadding.bottom || 0, | |
| 8016 | + left: collisionPadding.left || 0 | |
| 8017 | + }; | |
| 8018 | + } | |
| 8019 | + const bias = 1; | |
| 8020 | + const biasTop = sideParam === "bottom" ? bias : 0; | |
| 8021 | + const biasBottom = sideParam === "top" ? bias : 0; | |
| 8022 | + const biasLeft = sideParam === "right" ? bias : 0; | |
| 8023 | + const biasRight = sideParam === "left" ? bias : 0; | |
| 8024 | + const commonCollisionProps = { | |
| 8025 | + boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary, | |
| 8026 | + padding: collisionPadding | |
| 8027 | + }; | |
| 8028 | + const arrowRef = React38.useRef(null); | |
| 8029 | + const sideOffsetRef = useValueAsRef(sideOffset); | |
| 8030 | + const alignOffsetRef = useValueAsRef(alignOffset); | |
| 8031 | + const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0; | |
| 8032 | + const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0; | |
| 8033 | + const middleware = []; | |
| 8034 | + if (inlineMiddleware) { | |
| 8035 | + middleware.push(inlineMiddleware); | |
| 8036 | + } | |
| 8037 | + middleware.push(offset3((state) => { | |
| 8038 | + const data = getOffsetData(state, sideParam, isRtl); | |
| 8039 | + const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current; | |
| 8040 | + const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current; | |
| 8041 | + return { | |
| 8042 | + mainAxis: sideAxis, | |
| 8043 | + crossAxis: alignAxis, | |
| 8044 | + alignmentAxis: alignAxis | |
| 8045 | + }; | |
| 8046 | + }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam])); | |
| 8047 | + const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift"; | |
| 8048 | + const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift"); | |
| 8049 | + const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({ | |
| 8050 | + ...commonCollisionProps, | |
| 8051 | + // Ensure the popup flips if it's been limited by its --available-height and it resizes. | |
| 8052 | + // Since the size() padding is smaller than the flip() padding, flip() will take precedence. | |
| 8053 | + padding: { | |
| 8054 | + top: collisionPadding.top + bias + biasTop, | |
| 8055 | + right: collisionPadding.right + bias + biasRight, | |
| 8056 | + bottom: collisionPadding.bottom + bias + biasBottom, | |
| 8057 | + left: collisionPadding.left + bias + biasLeft | |
| 8058 | + }, | |
| 8059 | + mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip", | |
| 8060 | + crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false, | |
| 8061 | + fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide | |
| 8062 | + }); | |
| 8063 | + const shiftMiddleware = shiftDisabled ? null : shift3({ | |
| 8064 | + ...commonCollisionProps, | |
| 8065 | + // Use the Layout Viewport to avoid shifting around when pinch-zooming. | |
| 8066 | + rootBoundary: shiftRootBoundary, | |
| 8067 | + mainAxis: collisionAvoidanceAlign !== "none", | |
| 8068 | + crossAxis: crossAxisShiftEnabled, | |
| 8069 | + limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => { | |
| 8070 | + if (!arrowRef.current) { | |
| 8071 | + return {}; | |
| 8072 | + } | |
| 8073 | + const { | |
| 8074 | + width, | |
| 8075 | + height | |
| 8076 | + } = arrowRef.current.getBoundingClientRect(); | |
| 8077 | + const sideAxis = getSideAxis(getSide(limitData.placement)); | |
| 8078 | + const arrowSize = sideAxis === "y" ? width : height; | |
| 8079 | + const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom; | |
| 8080 | + return { | |
| 8081 | + offset: arrowSize / 2 + offsetAmount / 2 | |
| 8082 | + }; | |
| 8083 | + }) | |
| 8084 | + }, [commonCollisionProps, sticky, shiftCrossAxis, shiftRootBoundary, collisionPadding, collisionAvoidanceAlign]); | |
| 8085 | + if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") { | |
| 8086 | + middleware.push(shiftMiddleware, flipMiddleware); | |
| 8087 | + } else { | |
| 8088 | + middleware.push(flipMiddleware, shiftMiddleware); | |
| 8089 | + } | |
| 8090 | + middleware.push(size3({ | |
| 8091 | + ...commonCollisionProps, | |
| 8092 | + apply({ | |
| 8093 | + elements: { | |
| 8094 | + floating | |
| 8095 | + }, | |
| 8096 | + availableWidth: availableWidth2, | |
| 8097 | + availableHeight: availableHeight2, | |
| 8098 | + rects | |
| 8099 | + }) { | |
| 8100 | + if (!mountedRef.current) { | |
| 8101 | + return; | |
| 8102 | + } | |
| 8103 | + const floatingStyle = floating.style; | |
| 8104 | + floatingStyle.setProperty(AVAILABLE_WIDTH_VAR, `${availableWidth2}px`); | |
| 8105 | + floatingStyle.setProperty(AVAILABLE_HEIGHT_VAR, `${availableHeight2}px`); | |
| 8106 | + const dpr = getWindow(floating).devicePixelRatio || 1; | |
| 8107 | + const { | |
| 8108 | + x: x3, | |
| 8109 | + y: y3, | |
| 8110 | + width, | |
| 8111 | + height | |
| 8112 | + } = rects.reference; | |
| 8113 | + const anchorWidth2 = (Math.round((x3 + width) * dpr) - Math.round(x3 * dpr)) / dpr; | |
| 8114 | + const anchorHeight2 = (Math.round((y3 + height) * dpr) - Math.round(y3 * dpr)) / dpr; | |
| 8115 | + floatingStyle.setProperty(anchorWidth, `${anchorWidth2}px`); | |
| 8116 | + floatingStyle.setProperty(anchorHeight, `${anchorHeight2}px`); | |
| 8117 | + } | |
| 8118 | + }), arrow4((state) => ({ | |
| 8119 | + // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set, | |
| 8120 | + // we'll create a fake element. | |
| 8121 | + element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"), | |
| 8122 | + // No padding for the fake arrow: it would displace aligned popups on narrow anchors. | |
| 8123 | + padding: arrowRef.current ? arrowPadding : 0, | |
| 8124 | + offsetParent: "floating" | |
| 8125 | + }), [arrowPadding]), { | |
| 8126 | + name: "transformOrigin", | |
| 8127 | + fn(state) { | |
| 8128 | + const { | |
| 8129 | + elements: { | |
| 8130 | + floating | |
| 8131 | + }, | |
| 8132 | + middlewareData: middlewareData2, | |
| 8133 | + placement: renderedPlacement2, | |
| 8134 | + platform: platform3, | |
| 8135 | + rects, | |
| 8136 | + y: y3 | |
| 8137 | + } = state; | |
| 8138 | + const renderedSide2 = getSide(renderedPlacement2); | |
| 8139 | + const renderedAlign2 = getAlignment(renderedPlacement2); | |
| 8140 | + const isVertical = getSideAxis(renderedSide2) === "y"; | |
| 8141 | + const arrowEl = arrowRef.current; | |
| 8142 | + const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset; | |
| 8143 | + let crossOrigin; | |
| 8144 | + if (!arrowEl && renderedAlign2 && Math.abs(isVertical ? middlewareData2.shift?.x || 0 : middlewareData2.shift?.y || 0) <= 1) { | |
| 8145 | + crossOrigin = renderedAlign2 === "start" === (isVertical && platform3.isRTL?.(floating) === true) ? "100%" : "0%"; | |
| 8146 | + } else { | |
| 8147 | + const arrowOffset = isVertical ? middlewareData2.arrow?.x || 0 : middlewareData2.arrow?.y || 0; | |
| 8148 | + const arrowSize = isVertical ? arrowEl?.clientWidth || 0 : arrowEl?.clientHeight || 0; | |
| 8149 | + crossOrigin = `${arrowOffset + arrowSize / 2}px`; | |
| 8150 | + } | |
| 8151 | + let sideOrigin = renderedSide2 === "top" || renderedSide2 === "left" ? `calc(100% + ${sideOffsetValue}px)` : `${-sideOffsetValue}px`; | |
| 8152 | + if (crossAxisShiftEnabled && isVertical && Math.abs(middlewareData2.shift?.y || 0) > sideOffsetValue) { | |
| 8153 | + sideOrigin = `${rects.reference.y + rects.reference.height / 2 - y3}px`; | |
| 8154 | + } | |
| 8155 | + floating.style.setProperty(transformOrigin, isVertical ? `${crossOrigin} ${sideOrigin}` : `${sideOrigin} ${crossOrigin}`); | |
| 8156 | + return {}; | |
| 8157 | + } | |
| 8158 | + }, hide4, adaptiveOrigin2); | |
| 8159 | + useIsoLayoutEffect(() => { | |
| 8160 | + if (!mounted && floatingRootContext) { | |
| 8161 | + floatingRootContext.update({ | |
| 8162 | + referenceElement: null, | |
| 8163 | + floatingElement: null, | |
| 8164 | + domReferenceElement: null, | |
| 8165 | + positionReference: null | |
| 8166 | + }); | |
| 8167 | + } | |
| 8168 | + }, [mounted, floatingRootContext]); | |
| 8169 | + const autoUpdateOptions = React38.useMemo(() => ({ | |
| 8170 | + ancestorScroll: !disableAnchorTracking, | |
| 8171 | + elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined", | |
| 8172 | + layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined" | |
| 8173 | + }), [disableAnchorTracking]); | |
| 8174 | + const { | |
| 8175 | + refs, | |
| 8176 | + elements, | |
| 8177 | + x: x2, | |
| 8178 | + y: y2, | |
| 8179 | + middlewareData, | |
| 8180 | + update: update2, | |
| 8181 | + placement: renderedPlacement, | |
| 8182 | + context, | |
| 8183 | + isPositioned, | |
| 8184 | + floatingStyles: originalFloatingStyles | |
| 8185 | + } = useFloatingHook({ | |
| 8186 | + rootContext: floatingRootContext, | |
| 8187 | + open: keepMounted ? mounted : void 0, | |
| 8188 | + placement, | |
| 8189 | + middleware, | |
| 8190 | + strategy: positionMethod, | |
| 8191 | + whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions), | |
| 8192 | + nodeId, | |
| 8193 | + externalTree | |
| 8194 | + }); | |
| 8195 | + const { | |
| 8196 | + sideX, | |
| 8197 | + sideY | |
| 8198 | + } = middlewareData.adaptiveOrigin || DEFAULT_SIDES; | |
| 8199 | + const resolvedPosition = isPositioned ? positionMethod : "fixed"; | |
| 8200 | + const floatingStyles = React38.useMemo(() => { | |
| 8201 | + let base; | |
| 8202 | + if (!isPositioned) { | |
| 8203 | + base = { | |
| 8204 | + position: resolvedPosition, | |
| 8205 | + top: 0, | |
| 8206 | + left: 0 | |
| 8207 | + }; | |
| 8208 | + } else if (adaptiveOrigin2) { | |
| 8209 | + base = { | |
| 8210 | + position: resolvedPosition, | |
| 8211 | + [sideX]: x2, | |
| 8212 | + [sideY]: y2 | |
| 8213 | + }; | |
| 8214 | + } else { | |
| 8215 | + base = { | |
| 8216 | + ...originalFloatingStyles, | |
| 8217 | + position: resolvedPosition | |
| 8218 | + }; | |
| 8219 | + } | |
| 8220 | + base[AVAILABLE_WIDTH_VAR] = "100vw"; | |
| 8221 | + base[AVAILABLE_HEIGHT_VAR] = "100vh"; | |
| 8222 | + if (!isPositioned) { | |
| 8223 | + base.opacity = 0; | |
| 8224 | + } | |
| 8225 | + return base; | |
| 8226 | + }, [adaptiveOrigin2, resolvedPosition, sideX, x2, sideY, y2, originalFloatingStyles, isPositioned]); | |
| 8227 | + const registeredPositionReferenceRef = React38.useRef(null); | |
| 8228 | + useIsoLayoutEffect(() => { | |
| 8229 | + if (!mounted) { | |
| 8230 | + return; | |
| 8231 | + } | |
| 8232 | + const anchorValue = anchorValueRef.current; | |
| 8233 | + const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue; | |
| 8234 | + const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null; | |
| 8235 | + const finalAnchor = unwrappedElement || null; | |
| 8236 | + if (finalAnchor !== registeredPositionReferenceRef.current) { | |
| 8237 | + refs.setPositionReference(finalAnchor); | |
| 8238 | + registeredPositionReferenceRef.current = finalAnchor; | |
| 8239 | + } | |
| 8240 | + }, [mounted, refs, anchorDep, anchorValueRef]); | |
| 8241 | + React38.useEffect(() => { | |
| 8242 | + if (!mounted) { | |
| 8243 | + return; | |
| 8244 | + } | |
| 8245 | + const anchorValue = anchorValueRef.current; | |
| 8246 | + if (typeof anchorValue === "function") { | |
| 8247 | + return; | |
| 8248 | + } | |
| 8249 | + if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) { | |
| 8250 | + refs.setPositionReference(anchorValue.current); | |
| 8251 | + registeredPositionReferenceRef.current = anchorValue.current; | |
| 8252 | + } | |
| 8253 | + }, [mounted, refs, anchorDep, anchorValueRef]); | |
| 8254 | + React38.useEffect(() => { | |
| 8255 | + if (keepMounted && mounted && elements.reference && elements.floating) { | |
| 8256 | + return autoUpdate(elements.reference, elements.floating, update2, autoUpdateOptions); | |
| 8257 | + } | |
| 8258 | + return void 0; | |
| 8259 | + }, [keepMounted, mounted, elements, update2, autoUpdateOptions]); | |
| 8260 | + const renderedSide = getSide(renderedPlacement); | |
| 8261 | + const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl); | |
| 8262 | + const renderedAlign = getAlignment(renderedPlacement) || "center"; | |
| 8263 | + const anchorHidden2 = Boolean(middlewareData.hide?.referenceHidden); | |
| 8264 | + useIsoLayoutEffect(() => { | |
| 8265 | + if (lazyFlip && mounted && isPositioned && renderedSide !== side) { | |
| 8266 | + setMountSide(renderedSide); | |
| 8267 | + } | |
| 8268 | + }, [lazyFlip, mounted, isPositioned, renderedSide, side]); | |
| 8269 | + const arrowStyles = React38.useMemo(() => ({ | |
| 8270 | + position: "absolute", | |
| 8271 | + top: middlewareData.arrow?.y, | |
| 8272 | + left: middlewareData.arrow?.x | |
| 8273 | + }), [middlewareData.arrow]); | |
| 8274 | + const arrowUncentered = middlewareData.arrow?.centerOffset !== 0; | |
| 8275 | + return React38.useMemo(() => ({ | |
| 8276 | + positionerStyles: floatingStyles, | |
| 8277 | + arrowStyles, | |
| 8278 | + arrowRef, | |
| 8279 | + arrowUncentered, | |
| 8280 | + side: logicalRenderedSide, | |
| 8281 | + align: renderedAlign, | |
| 8282 | + physicalSide: renderedSide, | |
| 8283 | + anchorHidden: anchorHidden2, | |
| 8284 | + refs, | |
| 8285 | + context, | |
| 8286 | + isPositioned, | |
| 8287 | + update: update2 | |
| 8288 | + }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden2, refs, context, isPositioned, update2]); | |
| 8289 | +} | |
| 8290 | +function isRef(param) { | |
| 8291 | + return param != null && "current" in param; | |
| 8292 | +} | |
| 8293 | + | |
| 8294 | +// node_modules/@base-ui/react/internals/getDisabledMountTransitionStyles.mjs | |
| 8295 | +function getDisabledMountTransitionStyles(transitionStatus) { | |
| 8296 | + return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT; | |
| 8297 | +} | |
| 8298 | + | |
| 8299 | +// node_modules/@base-ui/react/utils/usePositioner.mjs | |
| 8300 | +function usePositioner(componentProps, state, { | |
| 8301 | + styles, | |
| 8302 | + transitionStatus, | |
| 8303 | + props, | |
| 8304 | + refs, | |
| 8305 | + hidden, | |
| 8306 | + inert = false | |
| 8307 | +}) { | |
| 8308 | + const style = { | |
| 8309 | + ...styles | |
| 8310 | + }; | |
| 8311 | + if (inert) { | |
| 8312 | + style.pointerEvents = "none"; | |
| 8313 | + } | |
| 8314 | + return useRenderElement("div", componentProps, { | |
| 8315 | + state, | |
| 8316 | + ref: refs, | |
| 8317 | + props: [{ | |
| 8318 | + role: "presentation", | |
| 8319 | + hidden, | |
| 8320 | + style | |
| 8321 | + }, getDisabledMountTransitionStyles(transitionStatus), props], | |
| 8322 | + stateAttributesMapping: popupStateMapping | |
| 8323 | + }); | |
| 8324 | +} | |
| 8325 | + | |
| 8326 | +// node_modules/@base-ui/react/button/Button.mjs | |
| 8327 | +var React39 = __toESM(require_react(), 1); | |
| 8328 | +var Button = /* @__PURE__ */ React39.forwardRef(function Button2(componentProps, forwardedRef) { | |
| 8329 | + const { | |
| 8330 | + render: render4, | |
| 8331 | + className, | |
| 8332 | + disabled: disabled2 = false, | |
| 8333 | + focusableWhenDisabled = false, | |
| 8334 | + nativeButton = true, | |
| 8335 | + style, | |
| 8336 | + ...elementProps | |
| 8337 | + } = componentProps; | |
| 8338 | + const { | |
| 8339 | + getButtonProps, | |
| 8340 | + buttonRef | |
| 8341 | + } = useButton({ | |
| 8342 | + disabled: disabled2, | |
| 8343 | + focusableWhenDisabled, | |
| 8344 | + native: nativeButton | |
| 8345 | + }); | |
| 8346 | + const state = { | |
| 8347 | + disabled: disabled2 | |
| 8348 | + }; | |
| 8349 | + return useRenderElement("button", componentProps, { | |
| 8350 | + state, | |
| 8351 | + ref: [forwardedRef, buttonRef], | |
| 8352 | + props: [elementProps, getButtonProps] | |
| 8353 | + }); | |
| 8354 | +}); | |
| 8355 | +if (true) Button.displayName = "Button"; | |
| 8356 | + | |
| 8357 | +// node_modules/@base-ui/react/field/item/FieldItemContext.mjs | |
| 8358 | +var React40 = __toESM(require_react(), 1); | |
| 8359 | +var FieldItemContext = /* @__PURE__ */ React40.createContext({ | |
| 8360 | + disabled: false | |
| 8361 | +}); | |
| 8362 | +if (true) FieldItemContext.displayName = "FieldItemContext"; | |
| 8363 | +function useFieldItemContext() { | |
| 8364 | + const context = React40.useContext(FieldItemContext); | |
| 8365 | + return context; | |
| 8366 | +} | |
| 8367 | + | |
| 8368 | +// node_modules/@base-ui/react/field/root/useFieldValidation.mjs | |
| 8369 | +var React41 = __toESM(require_react(), 1); | |
| 8370 | + | |
| 8371 | +// node_modules/@base-ui/react/field/utils/getCombinedFieldValidityData.mjs | |
| 8372 | +function getCombinedFieldValidityData(validityData, invalid2) { | |
| 8373 | + return { | |
| 8374 | + ...validityData, | |
| 8375 | + state: { | |
| 8376 | + ...validityData.state, | |
| 8377 | + valid: !invalid2 && validityData.state.valid | |
| 8378 | + } | |
| 8379 | + }; | |
| 8380 | +} | |
| 8381 | + | |
| 8382 | +// node_modules/@base-ui/react/field/root/useFieldValidation.mjs | |
| 8383 | +var validityKeys = Object.keys(DEFAULT_VALIDITY_STATE); | |
| 8384 | +function isEligibleInput(input, formElement) { | |
| 8385 | + if (input.matches(":disabled")) { | |
| 8386 | + return false; | |
| 8387 | + } | |
| 8388 | + if (!formElement || input.form === formElement) { | |
| 8389 | + return true; | |
| 8390 | + } | |
| 8391 | + return input.form === null && !input.hasAttribute("form"); | |
| 8392 | +} | |
| 8393 | +function findRepresentativeInput(inputs, formElement) { | |
| 8394 | + let fallback = null; | |
| 8395 | + for (const input of inputs.keys()) { | |
| 8396 | + if (!isEligibleInput(input, formElement)) { | |
| 8397 | + continue; | |
| 8398 | + } | |
| 8399 | + if (!input.validity.valid) { | |
| 8400 | + return input; | |
| 8401 | + } | |
| 8402 | + fallback ??= input; | |
| 8403 | + } | |
| 8404 | + return fallback; | |
| 8405 | +} | |
| 8406 | +function makeState(customError) { | |
| 8407 | + return { | |
| 8408 | + ...DEFAULT_VALIDITY_STATE, | |
| 8409 | + valid: !customError, | |
| 8410 | + customError | |
| 8411 | + }; | |
| 8412 | +} | |
| 8413 | +function getNativeErrors(element) { | |
| 8414 | + return element && element.validationMessage ? [element.validationMessage] : []; | |
| 8415 | +} | |
| 8416 | +function useFieldValidation(params) { | |
| 8417 | + const { | |
| 8418 | + elementRef, | |
| 8419 | + formRef | |
| 8420 | + } = useFormContext(); | |
| 8421 | + const { | |
| 8422 | + setValidityData, | |
| 8423 | + validate, | |
| 8424 | + validityData, | |
| 8425 | + validationDebounceTime, | |
| 8426 | + invalid: invalid2, | |
| 8427 | + markedDirtyRef, | |
| 8428 | + state, | |
| 8429 | + shouldValidateOnChange, | |
| 8430 | + validationMode, | |
| 8431 | + registeredFieldIdRef | |
| 8432 | + } = params; | |
| 8433 | + const { | |
| 8434 | + controlId, | |
| 8435 | + getDescriptionProps | |
| 8436 | + } = useLabelableContext(); | |
| 8437 | + const timeout = useTimeout(); | |
| 8438 | + const inputRef = React41.useRef(null); | |
| 8439 | + const registeredInputs = useRefWithInit(() => /* @__PURE__ */ new Map()).current; | |
| 8440 | + const validationCommitIdRef = React41.useRef(0); | |
| 8441 | + const customValidityRef = React41.useRef(null); | |
| 8442 | + const registerInput = React41.useCallback((element, registration) => { | |
| 8443 | + registeredInputs.set(element, registration); | |
| 8444 | + return () => { | |
| 8445 | + registeredInputs.delete(element); | |
| 8446 | + }; | |
| 8447 | + }, [registeredInputs]); | |
| 8448 | + const getInputControl = useStableCallback(() => { | |
| 8449 | + const element = findRepresentativeInput(registeredInputs, elementRef.current); | |
| 8450 | + return element && registeredInputs.get(element)?.controlRef.current || null; | |
| 8451 | + }); | |
| 8452 | + const commit = useStableCallback(async (value, revalidate = false) => { | |
| 8453 | + validationCommitIdRef.current += 1; | |
| 8454 | + const validationCommitId = validationCommitIdRef.current; | |
| 8455 | + function updateRegisteredFieldValidity(nextValidityData, externalInvalid = invalid2) { | |
| 8456 | + const fieldId = registeredFieldIdRef.current ?? controlId; | |
| 8457 | + if (fieldId == null) { | |
| 8458 | + return; | |
| 8459 | + } | |
| 8460 | + const currentFieldData = formRef.current.fields.get(fieldId); | |
| 8461 | + if (!currentFieldData) { | |
| 8462 | + return; | |
| 8463 | + } | |
| 8464 | + const validityDataWithFormErrors = getCombinedFieldValidityData(nextValidityData, externalInvalid); | |
| 8465 | + formRef.current.fields.set(fieldId, { | |
| 8466 | + ...currentFieldData, | |
| 8467 | + validityData: validityDataWithFormErrors | |
| 8468 | + }); | |
| 8469 | + } | |
| 8470 | + function makeValidityData(validityState, errorMessages) { | |
| 8471 | + const errors = validityState.valid === false ? errorMessages : []; | |
| 8472 | + return { | |
| 8473 | + value, | |
| 8474 | + state: validityState, | |
| 8475 | + error: errors[0] ?? "", | |
| 8476 | + errors, | |
| 8477 | + initialValue: validityData.initialValue | |
| 8478 | + }; | |
| 8479 | + } | |
| 8480 | + function setCustomValidity(element2, message2) { | |
| 8481 | + const displaced = element2.validity.customError ? element2.validationMessage : ""; | |
| 8482 | + const ownedMessage = message2.replace(/\r\n?/g, "\n"); | |
| 8483 | + element2.setCustomValidity(ownedMessage); | |
| 8484 | + customValidityRef.current = [element2, ownedMessage, displaced]; | |
| 8485 | + } | |
| 8486 | + function clearCustomValidity() { | |
| 8487 | + const record = customValidityRef.current; | |
| 8488 | + customValidityRef.current = null; | |
| 8489 | + if (record && (!record[0].willValidate || record[0].validationMessage === record[1])) { | |
| 8490 | + record[0].setCustomValidity(record[2]); | |
| 8491 | + } | |
| 8492 | + } | |
| 8493 | + function publish(validityState, errorMessages, externalInvalid) { | |
| 8494 | + const nextValidityData = makeValidityData(validityState, errorMessages); | |
| 8495 | + updateRegisteredFieldValidity(nextValidityData, externalInvalid); | |
| 8496 | + setValidityData(nextValidityData); | |
| 8497 | + } | |
| 8498 | + function getState(el) { | |
| 8499 | + const computedState = validityKeys.reduce((acc, key) => { | |
| 8500 | + acc[key] = el.validity[key]; | |
| 8501 | + return acc; | |
| 8502 | + }, {}); | |
| 8503 | + let hasOnlyValueMissingError = false; | |
| 8504 | + for (const key of validityKeys) { | |
| 8505 | + if (key === "valid") { | |
| 8506 | + continue; | |
| 8507 | + } | |
| 8508 | + if (key === "valueMissing" && computedState[key]) { | |
| 8509 | + hasOnlyValueMissingError = true; | |
| 8510 | + } else if (computedState[key]) { | |
| 8511 | + return computedState; | |
| 8512 | + } | |
| 8513 | + } | |
| 8514 | + if (hasOnlyValueMissingError && !markedDirtyRef.current) { | |
| 8515 | + computedState.valid = true; | |
| 8516 | + computedState.valueMissing = false; | |
| 8517 | + } | |
| 8518 | + return computedState; | |
| 8519 | + } | |
| 8520 | + function resolveRepresentativeInput() { | |
| 8521 | + return registeredInputs.size > 0 ? findRepresentativeInput(registeredInputs, elementRef.current) : inputRef.current; | |
| 8522 | + } | |
| 8523 | + let element = resolveRepresentativeInput(); | |
| 8524 | + function refreshState() { | |
| 8525 | + element = resolveRepresentativeInput(); | |
| 8526 | + return element?.willValidate ? getState(element) : makeState(false); | |
| 8527 | + } | |
| 8528 | + if (revalidate) { | |
| 8529 | + if (state.valid !== false || !element) { | |
| 8530 | + return; | |
| 8531 | + } | |
| 8532 | + if (!element.validity.valueMissing) { | |
| 8533 | + clearCustomValidity(); | |
| 8534 | + const currentElement = resolveRepresentativeInput(); | |
| 8535 | + const foreign = currentElement?.validity.customError ? getNativeErrors(currentElement) : []; | |
| 8536 | + publish(makeState(foreign.length > 0), foreign, false); | |
| 8537 | + return; | |
| 8538 | + } | |
| 8539 | + for (const key of validityKeys) { | |
| 8540 | + if (key !== "valid" && key !== "valueMissing" && key !== "customError" && element.validity[key]) { | |
| 8541 | + return; | |
| 8542 | + } | |
| 8543 | + } | |
| 8544 | + } | |
| 8545 | + timeout.clear(); | |
| 8546 | + clearCustomValidity(); | |
| 8547 | + let nextState = refreshState(); | |
| 8548 | + let validationErrors = getNativeErrors(element); | |
| 8549 | + const isValidatingOnChange = shouldValidateOnChange(); | |
| 8550 | + if (validationErrors.length === 0 || isValidatingOnChange) { | |
| 8551 | + const formValues = Array.from(formRef.current.fields.values()).reduce((acc, field) => { | |
| 8552 | + if (field.name) { | |
| 8553 | + acc[field.name] = field.getValue(); | |
| 8554 | + } | |
| 8555 | + return acc; | |
| 8556 | + }, {}); | |
| 8557 | + const resultOrPromise = validate(value, formValues); | |
| 8558 | + let result; | |
| 8559 | + if (typeof resultOrPromise === "object" && resultOrPromise !== null && "then" in resultOrPromise) { | |
| 8560 | + if (nextState.valid === false) { | |
| 8561 | + publish(nextState, validationErrors); | |
| 8562 | + } else if (validationMode === "onSubmit" || !validityData.state.customError) { | |
| 8563 | + nextState.valid = null; | |
| 8564 | + publish(nextState, validationErrors); | |
| 8565 | + } | |
| 8566 | + result = await resultOrPromise; | |
| 8567 | + if (validationCommitId !== validationCommitIdRef.current) { | |
| 8568 | + return; | |
| 8569 | + } | |
| 8570 | + nextState = refreshState(); | |
| 8571 | + } else { | |
| 8572 | + result = resultOrPromise; | |
| 8573 | + } | |
| 8574 | + validationErrors = result ? [].concat(result).filter(Boolean) : []; | |
| 8575 | + if (validationErrors.length > 0) { | |
| 8576 | + nextState.valid = false; | |
| 8577 | + nextState.customError = true; | |
| 8578 | + if (element?.willValidate) { | |
| 8579 | + setCustomValidity(element, validationErrors.join("\n")); | |
| 8580 | + } | |
| 8581 | + } else { | |
| 8582 | + validationErrors = getNativeErrors(element); | |
| 8583 | + } | |
| 8584 | + } | |
| 8585 | + publish(nextState, validationErrors); | |
| 8586 | + }); | |
| 8587 | + const change = useStableCallback((value, cancelPending = false) => { | |
| 8588 | + timeout.clear(); | |
| 8589 | + validationCommitIdRef.current += 1; | |
| 8590 | + if (cancelPending) { | |
| 8591 | + return; | |
| 8592 | + } | |
| 8593 | + const validateOnChange = shouldValidateOnChange(); | |
| 8594 | + if (validateOnChange && value !== "" && validationDebounceTime) { | |
| 8595 | + timeout.start(validationDebounceTime, () => { | |
| 8596 | + commit(value); | |
| 8597 | + }); | |
| 8598 | + } else { | |
| 8599 | + commit(value, !validateOnChange); | |
| 8600 | + } | |
| 8601 | + }); | |
| 8602 | + const getValidationProps = React41.useCallback((disabled2, externalProps = {}) => mergeProps(getDescriptionProps(externalProps), state.valid === false && !state.disabled && !disabled2 ? { | |
| 8603 | + "aria-invalid": true | |
| 8604 | + } : EMPTY_OBJECT), [getDescriptionProps, state.disabled, state.valid]); | |
| 8605 | + return React41.useMemo(() => ({ | |
| 8606 | + getValidationProps, | |
| 8607 | + inputRef, | |
| 8608 | + registeredInputs, | |
| 8609 | + registerInput, | |
| 8610 | + getInputControl, | |
| 8611 | + commit, | |
| 8612 | + change | |
| 8613 | + }), [getValidationProps, registeredInputs, registerInput, getInputControl, commit, change]); | |
| 8614 | +} | |
| 8615 | + | |
| 8616 | +// node_modules/@base-ui/react/utils/useRegisteredLabelId.mjs | |
| 8617 | +function useRegisteredLabelId(idProp, setLabelId) { | |
| 8618 | + const id = useBaseUiId(idProp); | |
| 8619 | + useIsoLayoutEffect(() => { | |
| 8620 | + setLabelId(id); | |
| 8621 | + return () => { | |
| 8622 | + setLabelId((currentId) => currentId === id ? void 0 : currentId); | |
| 8623 | + }; | |
| 8624 | + }, [id, setLabelId]); | |
| 8625 | + return id; | |
| 8626 | +} | |
| 8627 | + | |
| 8628 | +// node_modules/@base-ui/react/internals/labelable-provider/useLabel.mjs | |
| 8629 | +function useLabel(params = {}) { | |
| 8630 | + const { | |
| 8631 | + id: idProp, | |
| 8632 | + fallbackControlId, | |
| 8633 | + native = false, | |
| 8634 | + setLabelId: setLabelIdProp, | |
| 8635 | + focusControl: focusControlProp | |
| 8636 | + } = params; | |
| 8637 | + const { | |
| 8638 | + controlId: contextControlId, | |
| 8639 | + setLabelId: setContextLabelId | |
| 8640 | + } = useLabelableContext(); | |
| 8641 | + const syncLabelId = useStableCallback((nextLabelId) => { | |
| 8642 | + setContextLabelId(nextLabelId); | |
| 8643 | + setLabelIdProp?.(nextLabelId); | |
| 8644 | + }); | |
| 8645 | + const id = useRegisteredLabelId(idProp, syncLabelId); | |
| 8646 | + const resolvedControlId = contextControlId ?? fallbackControlId; | |
| 8647 | + function focusControl(event) { | |
| 8648 | + if (focusControlProp) { | |
| 8649 | + focusControlProp(event, resolvedControlId); | |
| 8650 | + return; | |
| 8651 | + } | |
| 8652 | + if (!resolvedControlId) { | |
| 8653 | + return; | |
| 8654 | + } | |
| 8655 | + const controlElement = ownerDocument(event.currentTarget).getElementById(resolvedControlId); | |
| 8656 | + if (isHTMLElement(controlElement)) { | |
| 8657 | + focusElementWithVisible(controlElement); | |
| 8658 | + } | |
| 8659 | + } | |
| 8660 | + function handleInteraction(event) { | |
| 8661 | + const target = getTarget(event.nativeEvent); | |
| 8662 | + if (target?.closest("button,input,select,textarea")) { | |
| 8663 | + return; | |
| 8664 | + } | |
| 8665 | + if (!event.defaultPrevented && event.detail > 1) { | |
| 8666 | + event.preventDefault(); | |
| 8667 | + } | |
| 8668 | + if (native) { | |
| 8669 | + return; | |
| 8670 | + } | |
| 8671 | + focusControl(event); | |
| 8672 | + } | |
| 8673 | + return native ? { | |
| 8674 | + id, | |
| 8675 | + htmlFor: resolvedControlId, | |
| 8676 | + onMouseDown: handleInteraction | |
| 8677 | + } : { | |
| 8678 | + id, | |
| 8679 | + onClick: handleInteraction, | |
| 8680 | + onPointerDown(event) { | |
| 8681 | + event.preventDefault(); | |
| 8682 | + } | |
| 8683 | + }; | |
| 8684 | +} | |
| 8685 | +function focusElementWithVisible(element) { | |
| 8686 | + element.focus({ | |
| 8687 | + // Available from Chrome 144+ (January 2026). | |
| 8688 | + // Safari and Firefox already support it. | |
| 8689 | + focusVisible: true | |
| 8690 | + }); | |
| 8691 | +} | |
| 8692 | + | |
| 8693 | +// node_modules/@base-ui/react/utils/usePopupViewport.mjs | |
| 8694 | +var React45 = __toESM(require_react(), 1); | |
| 8695 | +var ReactDOM6 = __toESM(require_react_dom(), 1); | |
| 8696 | + | |
| 8697 | +// node_modules/@base-ui/utils/usePreviousValue.mjs | |
| 8698 | +var React42 = __toESM(require_react(), 1); | |
| 8699 | +function usePreviousValue(value) { | |
| 8700 | + const [state, setState] = React42.useState({ | |
| 8701 | + current: value, | |
| 8702 | + previous: null | |
| 8703 | + }); | |
| 8704 | + if (!Object.is(value, state.current)) { | |
| 8705 | + setState({ | |
| 8706 | + current: value, | |
| 8707 | + previous: state.current | |
| 8708 | + }); | |
| 8709 | + } | |
| 8710 | + return state.previous; | |
| 8711 | +} | |
| 8712 | + | |
| 8713 | +// node_modules/@base-ui/react/utils/usePopupAutoResize.mjs | |
| 8714 | +var React43 = __toESM(require_react(), 1); | |
| 8715 | + | |
| 8716 | +// node_modules/@base-ui/react/utils/getCssDimensions.mjs | |
| 8717 | +function getCssDimensions2(element) { | |
| 8718 | + const css = getComputedStyle2(element); | |
| 8719 | + let width = parseFloat(css.width) || 0; | |
| 8720 | + let height = parseFloat(css.height) || 0; | |
| 8721 | + const hasOffset = isHTMLElement(element); | |
| 8722 | + const offsetWidth = hasOffset ? element.offsetWidth : width; | |
| 8723 | + const offsetHeight = hasOffset ? element.offsetHeight : height; | |
| 8724 | + const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; | |
| 8725 | + if (shouldFallback) { | |
| 8726 | + width = offsetWidth; | |
| 8727 | + height = offsetHeight; | |
| 8728 | + } | |
| 8729 | + return { | |
| 8730 | + width, | |
| 8731 | + height | |
| 8732 | + }; | |
| 8733 | +} | |
| 8734 | + | |
| 8735 | +// node_modules/@base-ui/react/utils/CommonPopupCssVars.mjs | |
| 8736 | +var popupWidth = "--popup-width"; | |
| 8737 | +var popupHeight = "--popup-height"; | |
| 8738 | + | |
| 8739 | +// node_modules/@base-ui/react/utils/usePopupAutoResize.mjs | |
| 8740 | +function usePopupAutoResize(parameters) { | |
| 8741 | + const { | |
| 8742 | + popupElement, | |
| 8743 | + positionerElement, | |
| 8744 | + content, | |
| 8745 | + mounted, | |
| 8746 | + onMeasureLayout: onMeasureLayoutParam, | |
| 8747 | + onMeasureLayoutComplete: onMeasureLayoutCompleteParam, | |
| 8748 | + side, | |
| 8749 | + direction | |
| 8750 | + } = parameters; | |
| 8751 | + const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true); | |
| 8752 | + const animationFrame = useAnimationFrame(); | |
| 8753 | + const committedDimensionsRef = React43.useRef(null); | |
| 8754 | + const isInitialRenderRef = React43.useRef(true); | |
| 8755 | + const restoreAnchoringStylesRef = React43.useRef(NOOP); | |
| 8756 | + const onMeasureLayout = useStableCallback(onMeasureLayoutParam); | |
| 8757 | + const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam); | |
| 8758 | + const anchoringStyles = React43.useMemo(() => getPopupAnchoringStyles(side, direction), [side, direction]); | |
| 8759 | + useIsoLayoutEffect(() => { | |
| 8760 | + if (!mounted) { | |
| 8761 | + restoreAnchoringStylesRef.current = NOOP; | |
| 8762 | + isInitialRenderRef.current = true; | |
| 8763 | + committedDimensionsRef.current = null; | |
| 8764 | + return void 0; | |
| 8765 | + } | |
| 8766 | + if (!popupElement || !positionerElement) { | |
| 8767 | + return void 0; | |
| 8768 | + } | |
| 8769 | + restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles); | |
| 8770 | + setPopupCssSize(popupElement, "auto"); | |
| 8771 | + const restorePopupPosition = overrideElementStyle(popupElement, "position", "static"); | |
| 8772 | + const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none"); | |
| 8773 | + const restorePopupScale = overrideElementStyle(popupElement, "scale", "1"); | |
| 8774 | + const restorePositionerAvailableSize = applyElementStyles(positionerElement, { | |
| 8775 | + [availableWidth]: "max-content", | |
| 8776 | + [availableHeight]: "max-content" | |
| 8777 | + }); | |
| 8778 | + function restoreMeasurementOverrides() { | |
| 8779 | + restorePopupPosition(); | |
| 8780 | + restorePopupTransform(); | |
| 8781 | + restorePositionerAvailableSize(); | |
| 8782 | + } | |
| 8783 | + function restoreMeasurementOverridesIncludingScale() { | |
| 8784 | + restoreMeasurementOverrides(); | |
| 8785 | + restorePopupScale(); | |
| 8786 | + } | |
| 8787 | + onMeasureLayout?.(); | |
| 8788 | + if (isInitialRenderRef.current || committedDimensionsRef.current === null) { | |
| 8789 | + setPositionerCssSize(positionerElement, "max-content"); | |
| 8790 | + const dimensions = getCssDimensions2(popupElement); | |
| 8791 | + committedDimensionsRef.current = dimensions; | |
| 8792 | + setPositionerCssSize(positionerElement, dimensions); | |
| 8793 | + restoreMeasurementOverridesIncludingScale(); | |
| 8794 | + onMeasureLayoutComplete?.(null, dimensions); | |
| 8795 | + isInitialRenderRef.current = false; | |
| 8796 | + return () => { | |
| 8797 | + restoreAnchoringStylesRef.current(); | |
| 8798 | + restoreAnchoringStylesRef.current = NOOP; | |
| 8799 | + }; | |
| 8800 | + } | |
| 8801 | + setPositionerCssSize(positionerElement, "max-content"); | |
| 8802 | + const previousDimensions = committedDimensionsRef.current; | |
| 8803 | + const newDimensions = getCssDimensions2(popupElement); | |
| 8804 | + committedDimensionsRef.current = newDimensions; | |
| 8805 | + setPopupCssSize(popupElement, previousDimensions); | |
| 8806 | + restoreMeasurementOverridesIncludingScale(); | |
| 8807 | + onMeasureLayoutComplete?.(previousDimensions, newDimensions); | |
| 8808 | + setPositionerCssSize(positionerElement, newDimensions); | |
| 8809 | + const abortController = new AbortController(); | |
| 8810 | + animationFrame.request(() => { | |
| 8811 | + setPopupCssSize(popupElement, newDimensions); | |
| 8812 | + runOnceAnimationsFinish(() => { | |
| 8813 | + popupElement.style.setProperty(popupWidth, "auto"); | |
| 8814 | + popupElement.style.setProperty(popupHeight, "auto"); | |
| 8815 | + }, abortController.signal); | |
| 8816 | + }); | |
| 8817 | + return () => { | |
| 8818 | + abortController.abort(); | |
| 8819 | + animationFrame.cancel(); | |
| 8820 | + restoreAnchoringStylesRef.current(); | |
| 8821 | + restoreAnchoringStylesRef.current = NOOP; | |
| 8822 | + }; | |
| 8823 | + }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]); | |
| 8824 | +} | |
| 8825 | +function getPopupAnchoringStyles(side, direction) { | |
| 8826 | + const isPhysicalTop = side === "top"; | |
| 8827 | + const isPhysicalLeft = side === "left" || side === (direction === "rtl" ? "inline-end" : "inline-start"); | |
| 8828 | + if (!isPhysicalTop && !isPhysicalLeft) { | |
| 8829 | + return EMPTY_OBJECT; | |
| 8830 | + } | |
| 8831 | + return { | |
| 8832 | + position: "absolute", | |
| 8833 | + [isPhysicalTop ? "bottom" : "top"]: "0", | |
| 8834 | + [isPhysicalLeft ? "right" : "left"]: "0" | |
| 8835 | + }; | |
| 8836 | +} | |
| 8837 | +function overrideElementStyle(element, property, value) { | |
| 8838 | + const originalValue = element.style.getPropertyValue(property); | |
| 8839 | + element.style.setProperty(property, value); | |
| 8840 | + return () => { | |
| 8841 | + element.style.setProperty(property, originalValue); | |
| 8842 | + }; | |
| 8843 | +} | |
| 8844 | +function applyElementStyles(element, styles) { | |
| 8845 | + const restorers = []; | |
| 8846 | + for (const [key, value] of Object.entries(styles)) { | |
| 8847 | + restorers.push(overrideElementStyle(element, key, value)); | |
| 8848 | + } | |
| 8849 | + return restorers.length ? () => { | |
| 8850 | + restorers.forEach((restore) => restore()); | |
| 8851 | + } : NOOP; | |
| 8852 | +} | |
| 8853 | +function setPopupCssSize(popupElement, size4) { | |
| 8854 | + const width = size4 === "auto" ? "auto" : `${size4.width}px`; | |
| 8855 | + const height = size4 === "auto" ? "auto" : `${size4.height}px`; | |
| 8856 | + popupElement.style.setProperty(popupWidth, width); | |
| 8857 | + popupElement.style.setProperty(popupHeight, height); | |
| 8858 | +} | |
| 8859 | +function setPositionerCssSize(positionerElement, size4) { | |
| 8860 | + const width = size4 === "max-content" ? "max-content" : `${size4.width}px`; | |
| 8861 | + const height = size4 === "max-content" ? "max-content" : `${size4.height}px`; | |
| 8862 | + positionerElement.style.setProperty(positionerWidth, width); | |
| 8863 | + positionerElement.style.setProperty(positionerHeight, height); | |
| 8864 | +} | |
| 8865 | + | |
| 8866 | +// node_modules/@base-ui/react/direction-provider/DirectionProvider.mjs | |
| 8867 | +var React44 = __toESM(require_react(), 1); | |
| 8868 | +var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); | |
| 8869 | +var DirectionProvider = function DirectionProvider2(props) { | |
| 8870 | + const { | |
| 8871 | + direction = "ltr" | |
| 8872 | + } = props; | |
| 8873 | + const contextValue = React44.useMemo(() => ({ | |
| 8874 | + direction | |
| 8875 | + }), [direction]); | |
| 8876 | + return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DirectionContext.Provider, { | |
| 8877 | + value: contextValue, | |
| 8878 | + children: props.children | |
| 8879 | + }); | |
| 8880 | +}; | |
| 8881 | +if (true) DirectionProvider.displayName = "DirectionProvider"; | |
| 8882 | + | |
| 8883 | +// node_modules/@base-ui/react/utils/adaptiveOriginMiddleware.mjs | |
| 8884 | +var adaptiveOrigin = { | |
| 8885 | + name: "adaptiveOrigin", | |
| 8886 | + async fn(state) { | |
| 8887 | + const { | |
| 8888 | + x: rawX, | |
| 8889 | + y: rawY, | |
| 8890 | + rects: { | |
| 8891 | + floating: floatRect | |
| 8892 | + }, | |
| 8893 | + elements: { | |
| 8894 | + floating | |
| 8895 | + }, | |
| 8896 | + platform: platform3, | |
| 8897 | + strategy, | |
| 8898 | + placement | |
| 8899 | + } = state; | |
| 8900 | + const win = getWindow(floating); | |
| 8901 | + const styles = win.getComputedStyle(floating); | |
| 8902 | + const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== ""; | |
| 8903 | + if (!hasTransition) { | |
| 8904 | + return { | |
| 8905 | + x: rawX, | |
| 8906 | + y: rawY, | |
| 8907 | + data: DEFAULT_SIDES | |
| 8908 | + }; | |
| 8909 | + } | |
| 8910 | + const offsetParent = await platform3.getOffsetParent?.(floating); | |
| 8911 | + let offsetDimensions = { | |
| 8912 | + width: 0, | |
| 8913 | + height: 0 | |
| 8914 | + }; | |
| 8915 | + if (strategy === "fixed" && win?.visualViewport) { | |
| 8916 | + offsetDimensions = { | |
| 8917 | + width: win.visualViewport.width, | |
| 8918 | + height: win.visualViewport.height | |
| 8919 | + }; | |
| 8920 | + } else if (offsetParent === win) { | |
| 8921 | + const doc = ownerDocument(floating); | |
| 8922 | + offsetDimensions = { | |
| 8923 | + width: doc.documentElement.clientWidth, | |
| 8924 | + height: doc.documentElement.clientHeight | |
| 8925 | + }; | |
| 8926 | + } else if (await platform3.isElement?.(offsetParent)) { | |
| 8927 | + offsetDimensions = await platform3.getDimensions(offsetParent); | |
| 8928 | + } | |
| 8929 | + const currentSide = getSide(placement); | |
| 8930 | + let x2 = rawX; | |
| 8931 | + let y2 = rawY; | |
| 8932 | + if (currentSide === "left") { | |
| 8933 | + x2 = offsetDimensions.width - (rawX + floatRect.width); | |
| 8934 | + } | |
| 8935 | + if (currentSide === "top") { | |
| 8936 | + y2 = offsetDimensions.height - (rawY + floatRect.height); | |
| 8937 | + } | |
| 8938 | + const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX; | |
| 8939 | + const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY; | |
| 8940 | + return { | |
| 8941 | + x: x2, | |
| 8942 | + y: y2, | |
| 8943 | + data: { | |
| 8944 | + sideX, | |
| 8945 | + sideY | |
| 8946 | + } | |
| 8947 | + }; | |
| 8948 | + } | |
| 8949 | +}; | |
| 8950 | + | |
| 8951 | +// node_modules/@base-ui/react/utils/CommonViewportDataAttributes.mjs | |
| 8952 | +var activationDirection = "data-activation-direction"; | |
| 8953 | + | |
| 8954 | +// node_modules/@base-ui/react/utils/usePopupViewport.mjs | |
| 8955 | +var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); | |
| 8956 | +var popupViewportStateMapping = { | |
| 8957 | + activationDirection: (value) => value ? { | |
| 8958 | + [activationDirection]: value | |
| 8959 | + } : null | |
| 8960 | +}; | |
| 8961 | +function usePopupViewport(parameters) { | |
| 8962 | + const { | |
| 8963 | + store, | |
| 8964 | + side, | |
| 8965 | + children | |
| 8966 | + } = parameters; | |
| 8967 | + const direction = useDirection(); | |
| 8968 | + const activeTrigger = store.useState("activeTriggerElement"); | |
| 8969 | + const activeTriggerId = store.useState("activeTriggerId"); | |
| 8970 | + const open2 = store.useState("open"); | |
| 8971 | + const payload = store.useState("payload"); | |
| 8972 | + const mounted = store.useState("mounted"); | |
| 8973 | + const popupElement = store.useState("popupElement"); | |
| 8974 | + const positionerElement = store.useState("positionerElement"); | |
| 8975 | + const previousActiveTrigger = usePreviousValue(open2 ? activeTrigger : null); | |
| 8976 | + const currentContentKey = usePopupContentKey(activeTriggerId, payload); | |
| 8977 | + const capturedNodeRef = React45.useRef(null); | |
| 8978 | + const [previousContentNode, setPreviousContentNode] = React45.useState(null); | |
| 8979 | + const [newTriggerOffset, setNewTriggerOffset] = React45.useState(null); | |
| 8980 | + const currentContainerRef = React45.useRef(null); | |
| 8981 | + const previousContainerRef = React45.useRef(null); | |
| 8982 | + const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true); | |
| 8983 | + const cleanupFrame = useAnimationFrame(); | |
| 8984 | + const cleanupControllerRef = React45.useRef(null); | |
| 8985 | + const [previousContentDimensions, setPreviousContentDimensions] = React45.useState(null); | |
| 8986 | + const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React45.useState(false); | |
| 8987 | + useIsoLayoutEffect(() => { | |
| 8988 | + store.set("adaptiveOrigin", adaptiveOrigin); | |
| 8989 | + return () => { | |
| 8990 | + store.set("adaptiveOrigin", void 0); | |
| 8991 | + }; | |
| 8992 | + }, [store]); | |
| 8993 | + const handleMeasureLayout = useStableCallback(() => { | |
| 8994 | + currentContainerRef.current?.style.setProperty("animation", "none"); | |
| 8995 | + currentContainerRef.current?.style.setProperty("transition", "none"); | |
| 8996 | + previousContainerRef.current?.style.setProperty("display", "none"); | |
| 8997 | + }); | |
| 8998 | + const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => { | |
| 8999 | + currentContainerRef.current?.style.removeProperty("animation"); | |
| 9000 | + currentContainerRef.current?.style.removeProperty("transition"); | |
| 9001 | + previousContainerRef.current?.style.removeProperty("display"); | |
| 9002 | + if (previousDimensions) { | |
| 9003 | + setPreviousContentDimensions(previousDimensions); | |
| 9004 | + } | |
| 9005 | + }); | |
| 9006 | + const armViewportCleanup = useStableCallback(() => { | |
| 9007 | + cleanupControllerRef.current?.abort(); | |
| 9008 | + const controller = new AbortController(); | |
| 9009 | + cleanupControllerRef.current = controller; | |
| 9010 | + onAnimationsFinished(() => { | |
| 9011 | + setPreviousContentNode(null); | |
| 9012 | + setPreviousContentDimensions(null); | |
| 9013 | + capturedNodeRef.current = null; | |
| 9014 | + }, controller.signal); | |
| 9015 | + }); | |
| 9016 | + const lastHandledTriggerRef = React45.useRef(null); | |
| 9017 | + useIsoLayoutEffect(() => { | |
| 9018 | + if (!open2 || !mounted) { | |
| 9019 | + lastHandledTriggerRef.current = null; | |
| 9020 | + } | |
| 9021 | + }, [open2, mounted]); | |
| 9022 | + useIsoLayoutEffect(() => { | |
| 9023 | + if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) { | |
| 9024 | + setPreviousContentNode(capturedNodeRef.current); | |
| 9025 | + setShowStartingStyleAttribute(true); | |
| 9026 | + const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger); | |
| 9027 | + setNewTriggerOffset(offset4); | |
| 9028 | + lastHandledTriggerRef.current = activeTrigger; | |
| 9029 | + } | |
| 9030 | + }, [activeTrigger, previousActiveTrigger]); | |
| 9031 | + useIsoLayoutEffect(() => { | |
| 9032 | + if (previousContentNode == null) { | |
| 9033 | + return; | |
| 9034 | + } | |
| 9035 | + cleanupControllerRef.current?.abort(); | |
| 9036 | + setShowStartingStyleAttribute(true); | |
| 9037 | + cleanupFrame.request(() => { | |
| 9038 | + ReactDOM6.flushSync(() => { | |
| 9039 | + setShowStartingStyleAttribute(false); | |
| 9040 | + }); | |
| 9041 | + armViewportCleanup(); | |
| 9042 | + }); | |
| 9043 | + }, [currentContentKey, previousContentNode, armViewportCleanup, cleanupFrame]); | |
| 9044 | + useIsoLayoutEffect(() => { | |
| 9045 | + const source = currentContainerRef.current; | |
| 9046 | + if (!source) { | |
| 9047 | + return; | |
| 9048 | + } | |
| 9049 | + const wrapper = ownerDocument(source).createElement("div"); | |
| 9050 | + for (const child of Array.from(source.childNodes)) { | |
| 9051 | + wrapper.appendChild(child.cloneNode(true)); | |
| 9052 | + } | |
| 9053 | + capturedNodeRef.current = wrapper; | |
| 9054 | + }); | |
| 9055 | + const isTransitioning = previousContentNode != null; | |
| 9056 | + let childrenToRender; | |
| 9057 | + if (!isTransitioning) { | |
| 9058 | + childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { | |
| 9059 | + "data-current": true, | |
| 9060 | + ref: currentContainerRef, | |
| 9061 | + children | |
| 9062 | + }, currentContentKey); | |
| 9063 | + } else { | |
| 9064 | + childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(React45.Fragment, { | |
| 9065 | + children: [/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { | |
| 9066 | + "data-previous": true, | |
| 9067 | + inert: inertValue(true), | |
| 9068 | + ref: previousContainerRef, | |
| 9069 | + style: { | |
| 9070 | + ...previousContentDimensions ? { | |
| 9071 | + [popupWidth]: `${previousContentDimensions.width}px`, | |
| 9072 | + [popupHeight]: `${previousContentDimensions.height}px` | |
| 9073 | + } : null, | |
| 9074 | + position: "absolute" | |
| 9075 | + }, | |
| 9076 | + "data-ending-style": showStartingStyleAttribute ? void 0 : "" | |
| 9077 | + }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { | |
| 9078 | + "data-current": true, | |
| 9079 | + ref: currentContainerRef, | |
| 9080 | + "data-starting-style": showStartingStyleAttribute ? "" : void 0, | |
| 9081 | + children | |
| 9082 | + }, currentContentKey)] | |
| 9083 | + }); | |
| 9084 | + } | |
| 9085 | + useIsoLayoutEffect(() => { | |
| 9086 | + const container = previousContainerRef.current; | |
| 9087 | + if (!container || !previousContentNode) { | |
| 9088 | + return; | |
| 9089 | + } | |
| 9090 | + container.replaceChildren(...Array.from(previousContentNode.childNodes)); | |
| 9091 | + }, [previousContentNode]); | |
| 9092 | + usePopupAutoResize({ | |
| 9093 | + popupElement, | |
| 9094 | + positionerElement, | |
| 9095 | + mounted, | |
| 9096 | + content: payload, | |
| 9097 | + onMeasureLayout: handleMeasureLayout, | |
| 9098 | + onMeasureLayoutComplete: handleMeasureLayoutComplete, | |
| 9099 | + side, | |
| 9100 | + direction | |
| 9101 | + }); | |
| 9102 | + const state = { | |
| 9103 | + activationDirection: getActivationDirection(newTriggerOffset), | |
| 9104 | + transitioning: isTransitioning | |
| 9105 | + }; | |
| 9106 | + return { | |
| 9107 | + children: childrenToRender, | |
| 9108 | + state | |
| 9109 | + }; | |
| 9110 | +} | |
| 9111 | +function getActivationDirection(offset4) { | |
| 9112 | + if (!offset4) { | |
| 9113 | + return void 0; | |
| 9114 | + } | |
| 9115 | + return `${getValueWithTolerance(offset4.horizontal, 5, "right", "left")} ${getValueWithTolerance(offset4.vertical, 5, "down", "up")}`; | |
| 9116 | +} | |
| 9117 | +function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) { | |
| 9118 | + if (value > tolerance) { | |
| 9119 | + return positiveLabel; | |
| 9120 | + } | |
| 9121 | + if (value < -tolerance) { | |
| 9122 | + return negativeLabel; | |
| 9123 | + } | |
| 9124 | + return ""; | |
| 9125 | +} | |
| 9126 | +function calculateRelativePosition(from, to) { | |
| 9127 | + const fromRect = from.getBoundingClientRect(); | |
| 9128 | + const toRect = to.getBoundingClientRect(); | |
| 9129 | + const fromCenter = { | |
| 9130 | + x: fromRect.left + fromRect.width / 2, | |
| 9131 | + y: fromRect.top + fromRect.height / 2 | |
| 9132 | + }; | |
| 9133 | + const toCenter = { | |
| 9134 | + x: toRect.left + toRect.width / 2, | |
| 9135 | + y: toRect.top + toRect.height / 2 | |
| 9136 | + }; | |
| 9137 | + return { | |
| 9138 | + horizontal: toCenter.x - fromCenter.x, | |
| 9139 | + vertical: toCenter.y - fromCenter.y | |
| 9140 | + }; | |
| 9141 | +} | |
| 9142 | +function usePopupContentKey(activeTriggerId, payload) { | |
| 9143 | + const [contentKey, setContentKey] = React45.useState(0); | |
| 9144 | + const previousActiveTriggerIdRef = React45.useRef(activeTriggerId); | |
| 9145 | + const previousPayloadRef = React45.useRef(payload); | |
| 9146 | + const pendingPayloadUpdateRef = React45.useRef(false); | |
| 9147 | + useIsoLayoutEffect(() => { | |
| 9148 | + const previousActiveTriggerId = previousActiveTriggerIdRef.current; | |
| 9149 | + const previousPayload = previousPayloadRef.current; | |
| 9150 | + const triggerIdChanged = activeTriggerId !== previousActiveTriggerId; | |
| 9151 | + const payloadChanged = payload !== previousPayload; | |
| 9152 | + if (triggerIdChanged) { | |
| 9153 | + setContentKey((value) => value + 1); | |
| 9154 | + pendingPayloadUpdateRef.current = !payloadChanged; | |
| 9155 | + } else if (pendingPayloadUpdateRef.current && payloadChanged) { | |
| 9156 | + setContentKey((value) => value + 1); | |
| 9157 | + pendingPayloadUpdateRef.current = false; | |
| 9158 | + } | |
| 9159 | + previousActiveTriggerIdRef.current = activeTriggerId; | |
| 9160 | + previousPayloadRef.current = payload; | |
| 9161 | + }, [activeTriggerId, payload]); | |
| 9162 | + return `${activeTriggerId ?? "current"}-${contentKey}`; | |
| 9163 | +} | |
| 9164 | + | |
| 9165 | +// node_modules/@base-ui/react/field/index.parts.mjs | |
| 9166 | +var index_parts_exports = {}; | |
| 9167 | +__export(index_parts_exports, { | |
| 9168 | + Control: () => FieldControl, | |
| 9169 | + Description: () => FieldDescription, | |
| 9170 | + Error: () => FieldError, | |
| 9171 | + Item: () => FieldItem, | |
| 9172 | + Label: () => FieldLabel, | |
| 9173 | + Root: () => FieldRoot, | |
| 9174 | + Validity: () => FieldValidity | |
| 9175 | +}); | |
| 9176 | + | |
| 9177 | +// node_modules/@base-ui/react/field/root/FieldRoot.mjs | |
| 9178 | +var React49 = __toESM(require_react(), 1); | |
| 9179 | + | |
| 9180 | +// node_modules/@base-ui/react/fieldset/root/FieldsetRootContext.mjs | |
| 9181 | +var React46 = __toESM(require_react(), 1); | |
| 9182 | +var FieldsetRootContext = /* @__PURE__ */ React46.createContext(void 0); | |
| 9183 | +if (true) FieldsetRootContext.displayName = "FieldsetRootContext"; | |
| 9184 | +function useFieldsetRootContext(optional = false) { | |
| 9185 | + const context = React46.useContext(FieldsetRootContext); | |
| 9186 | + if (!context && !optional) { | |
| 9187 | + throw new Error(true ? "Base UI: FieldsetRootContext is missing. Fieldset parts must be placed within <Fieldset.Root>." : formatErrorMessage_default(86)); | |
| 9188 | + } | |
| 9189 | + return context; | |
| 9190 | +} | |
| 9191 | + | |
| 9192 | +// node_modules/@base-ui/react/internals/labelable-provider/LabelableProvider.mjs | |
| 9193 | +var React47 = __toESM(require_react(), 1); | |
| 9194 | +var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); | |
| 9195 | +var LabelableProvider = function LabelableProvider2(props) { | |
| 9196 | + const defaultId = useBaseUiId(); | |
| 9197 | + const [controlIdState, setControlIdState] = React47.useState(defaultId); | |
| 9198 | + const [labelId, setLabelId] = React47.useState(); | |
| 9199 | + const [messageIds, setMessageIds] = React47.useState([]); | |
| 9200 | + const controlId = controlIdState === void 0 ? defaultId : controlIdState; | |
| 9201 | + const registrationsRef = useRefWithInit(() => /* @__PURE__ */ new Map()); | |
| 9202 | + const { | |
| 9203 | + messageIds: parentMessageIds | |
| 9204 | + } = useLabelableContext(); | |
| 9205 | + const registerControlId = useStableCallback((source, nextId) => { | |
| 9206 | + const registrations = registrationsRef.current; | |
| 9207 | + if (nextId === void 0) { | |
| 9208 | + registrations.delete(source); | |
| 9209 | + } else { | |
| 9210 | + registrations.set(source, nextId); | |
| 9211 | + } | |
| 9212 | + setControlIdState((prev) => { | |
| 9213 | + if (registrations.size === 0) { | |
| 9214 | + return prev; | |
| 9215 | + } | |
| 9216 | + let nextControlId; | |
| 9217 | + for (const id of registrations.values()) { | |
| 9218 | + if (id === prev) { | |
| 9219 | + return prev; | |
| 9220 | + } | |
| 9221 | + if (nextControlId === void 0) { | |
| 9222 | + nextControlId = id; | |
| 9223 | + } | |
| 9224 | + } | |
| 9225 | + return nextControlId; | |
| 9226 | + }); | |
| 9227 | + }); | |
| 9228 | + const resetControlId = useStableCallback(() => { | |
| 9229 | + if (registrationsRef.current.size === 0) { | |
| 9230 | + setControlIdState(defaultId); | |
| 9231 | + } | |
| 9232 | + }); | |
| 9233 | + const getDescriptionProps = React47.useCallback((externalProps) => { | |
| 9234 | + const ids = externalProps["aria-describedby"] ? externalProps["aria-describedby"].split(" ") : []; | |
| 9235 | + ids.push(...parentMessageIds, ...messageIds); | |
| 9236 | + return { | |
| 9237 | + ...externalProps, | |
| 9238 | + "aria-describedby": Array.from(new Set(ids)).join(" ") || void 0 | |
| 9239 | + }; | |
| 9240 | + }, [parentMessageIds, messageIds]); | |
| 9241 | + const contextValue = React47.useMemo(() => ({ | |
| 9242 | + controlId, | |
| 9243 | + registerControlId, | |
| 9244 | + resetControlId, | |
| 9245 | + labelId, | |
| 9246 | + setLabelId, | |
| 9247 | + messageIds, | |
| 9248 | + setMessageIds, | |
| 9249 | + getDescriptionProps | |
| 9250 | + }), [controlId, registerControlId, resetControlId, labelId, setLabelId, messageIds, setMessageIds, getDescriptionProps]); | |
| 9251 | + return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(LabelableContext.Provider, { | |
| 9252 | + value: contextValue, | |
| 9253 | + children: props.children | |
| 9254 | + }); | |
| 9255 | +}; | |
| 9256 | +if (true) LabelableProvider.displayName = "LabelableProvider"; | |
| 9257 | + | |
| 9258 | +// node_modules/@base-ui/react/internals/field-register-control/useFieldControlRegistration.mjs | |
| 9259 | +var React48 = __toESM(require_react(), 1); | |
| 9260 | +function useFieldControlRegistration(params) { | |
| 9261 | + const { | |
| 9262 | + change, | |
| 9263 | + commit, | |
| 9264 | + invalid: invalid2, | |
| 9265 | + markedDirtyRef, | |
| 9266 | + name, | |
| 9267 | + setRegisteredFieldName, | |
| 9268 | + registeredFieldIdRef, | |
| 9269 | + setValidityData, | |
| 9270 | + validityData | |
| 9271 | + } = params; | |
| 9272 | + const { | |
| 9273 | + formRef | |
| 9274 | + } = useFormContext(); | |
| 9275 | + const activeFieldControlSourceRef = React48.useRef(null); | |
| 9276 | + const registrationRef = React48.useRef(null); | |
| 9277 | + const initialValueCapturedRef = React48.useRef(false); | |
| 9278 | + const getValueForForm = useStableCallback(() => { | |
| 9279 | + const registration = registrationRef.current; | |
| 9280 | + if (!registration) { | |
| 9281 | + return void 0; | |
| 9282 | + } | |
| 9283 | + if (registration.getValue) { | |
| 9284 | + return registration.getValue(); | |
| 9285 | + } | |
| 9286 | + return registration.value; | |
| 9287 | + }); | |
| 9288 | + function getRegistrationValue(registration) { | |
| 9289 | + return registration.value === void 0 ? getValueForForm() : registration.value; | |
| 9290 | + } | |
| 9291 | + const validate = useStableCallback(() => { | |
| 9292 | + const registration = registrationRef.current; | |
| 9293 | + markedDirtyRef.current = true; | |
| 9294 | + if (!registration) { | |
| 9295 | + commit(validityData.value); | |
| 9296 | + return; | |
| 9297 | + } | |
| 9298 | + commit(getRegistrationValue(registration)); | |
| 9299 | + }); | |
| 9300 | + function refreshRegistration() { | |
| 9301 | + const registration = registrationRef.current; | |
| 9302 | + if (!registration || !registration.id) { | |
| 9303 | + return; | |
| 9304 | + } | |
| 9305 | + formRef.current.fields.set(registration.id, { | |
| 9306 | + getValue: getValueForForm, | |
| 9307 | + name: name ?? registration.name, | |
| 9308 | + controlRef: registration.controlRef, | |
| 9309 | + validityData: getCombinedFieldValidityData(validityData, invalid2), | |
| 9310 | + validate | |
| 9311 | + }); | |
| 9312 | + } | |
| 9313 | + function deleteRegistration(id = registrationRef.current?.id) { | |
| 9314 | + if (id) { | |
| 9315 | + formRef.current.fields.delete(id); | |
| 9316 | + } | |
| 9317 | + } | |
| 9318 | + function captureInitialValue(registration) { | |
| 9319 | + if (initialValueCapturedRef.current) { | |
| 9320 | + return; | |
| 9321 | + } | |
| 9322 | + initialValueCapturedRef.current = true; | |
| 9323 | + const initialValue = getRegistrationValue(registration); | |
| 9324 | + setValidityData((prev) => prev.initialValue === initialValue ? prev : { | |
| 9325 | + ...prev, | |
| 9326 | + initialValue | |
| 9327 | + }); | |
| 9328 | + } | |
| 9329 | + useIsoLayoutEffect(() => { | |
| 9330 | + const registration = registrationRef.current; | |
| 9331 | + if (!registration || !registration.id) { | |
| 9332 | + return; | |
| 9333 | + } | |
| 9334 | + setRegisteredFieldName(name ? void 0 : registration.name); | |
| 9335 | + formRef.current.fields.set(registration.id, { | |
| 9336 | + getValue: getValueForForm, | |
| 9337 | + name: name ?? registration.name, | |
| 9338 | + controlRef: registration.controlRef, | |
| 9339 | + validityData: getCombinedFieldValidityData(validityData, invalid2), | |
| 9340 | + validate | |
| 9341 | + }); | |
| 9342 | + }, [formRef, getValueForForm, invalid2, name, setRegisteredFieldName, validate, validityData]); | |
| 9343 | + useIsoLayoutEffect(() => { | |
| 9344 | + const fields = formRef.current.fields; | |
| 9345 | + return () => { | |
| 9346 | + const id = registrationRef.current?.id; | |
| 9347 | + if (id) { | |
| 9348 | + fields.delete(id); | |
| 9349 | + } | |
| 9350 | + }; | |
| 9351 | + }, [formRef]); | |
| 9352 | + const register2 = useStableCallback((source, registration) => { | |
| 9353 | + if (!registration) { | |
| 9354 | + if (activeFieldControlSourceRef.current === source) { | |
| 9355 | + activeFieldControlSourceRef.current = null; | |
| 9356 | + change(void 0, true); | |
| 9357 | + deleteRegistration(); | |
| 9358 | + registrationRef.current = null; | |
| 9359 | + setRegisteredFieldName(void 0); | |
| 9360 | + registeredFieldIdRef.current = void 0; | |
| 9361 | + } | |
| 9362 | + return; | |
| 9363 | + } | |
| 9364 | + const previousId = registrationRef.current?.id; | |
| 9365 | + const previousSource = activeFieldControlSourceRef.current; | |
| 9366 | + if (previousSource && previousSource !== source) { | |
| 9367 | + change(void 0, true); | |
| 9368 | + } | |
| 9369 | + activeFieldControlSourceRef.current = source; | |
| 9370 | + registrationRef.current = registration; | |
| 9371 | + if (!name) { | |
| 9372 | + setRegisteredFieldName(registration.name); | |
| 9373 | + } | |
| 9374 | + registeredFieldIdRef.current = registration.id; | |
| 9375 | + if (previousId && previousId !== registration.id) { | |
| 9376 | + deleteRegistration(previousId); | |
| 9377 | + } | |
| 9378 | + captureInitialValue(registration); | |
| 9379 | + refreshRegistration(); | |
| 9380 | + }); | |
| 9381 | + return [validate, register2]; | |
| 9382 | +} | |
| 9383 | + | |
| 9384 | +// node_modules/@base-ui/react/field/root/FieldRoot.mjs | |
| 9385 | +var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); | |
| 9386 | +var FieldRootInner = /* @__PURE__ */ React49.forwardRef(function FieldRootInner2(componentProps, forwardedRef) { | |
| 9387 | + const { | |
| 9388 | + errors, | |
| 9389 | + validationMode: formValidationMode, | |
| 9390 | + submitCountRef | |
| 9391 | + } = useFormContext(); | |
| 9392 | + const { | |
| 9393 | + render: render4, | |
| 9394 | + className, | |
| 9395 | + validate: validateProp, | |
| 9396 | + validationDebounceTime = 0, | |
| 9397 | + validationMode = formValidationMode, | |
| 9398 | + name, | |
| 9399 | + disabled: disabledProp = false, | |
| 9400 | + invalid: invalidProp, | |
| 9401 | + dirty: dirtyProp, | |
| 9402 | + touched: touchedProp, | |
| 9403 | + actionsRef, | |
| 9404 | + style, | |
| 9405 | + ...elementProps | |
| 9406 | + } = componentProps; | |
| 9407 | + const disabledFieldset = useFieldsetRootContext(true)?.disabled; | |
| 9408 | + const validate = useStableCallback(validateProp || (() => null)); | |
| 9409 | + const disabled2 = disabledFieldset || disabledProp; | |
| 9410 | + const [touchedState, setTouchedUnwrapped] = React49.useState(false); | |
| 9411 | + const [dirtyState, setDirtyUnwrapped] = React49.useState(false); | |
| 9412 | + const [filled, setFilled] = React49.useState(false); | |
| 9413 | + const [focused, setFocused] = React49.useState(false); | |
| 9414 | + const dirty = dirtyProp ?? dirtyState; | |
| 9415 | + const touched = touchedProp ?? touchedState; | |
| 9416 | + const markedDirtyRef = React49.useRef(dirty); | |
| 9417 | + const registeredFieldIdRef = React49.useRef(void 0); | |
| 9418 | + const [registeredFieldName, setRegisteredFieldName] = React49.useState(); | |
| 9419 | + const effectiveName = name ?? registeredFieldName; | |
| 9420 | + useIsoLayoutEffect(() => { | |
| 9421 | + if (dirtyProp !== void 0) { | |
| 9422 | + markedDirtyRef.current = dirtyProp; | |
| 9423 | + } | |
| 9424 | + }, [dirtyProp]); | |
| 9425 | + const setDirty = useStableCallback((value) => { | |
| 9426 | + if (dirtyProp !== void 0) { | |
| 9427 | + return; | |
| 9428 | + } | |
| 9429 | + if (value) { | |
| 9430 | + markedDirtyRef.current = true; | |
| 9431 | + } | |
| 9432 | + setDirtyUnwrapped(value); | |
| 9433 | + }); | |
| 9434 | + const setTouched = useStableCallback((value) => { | |
| 9435 | + if (touchedProp !== void 0) { | |
| 9436 | + return; | |
| 9437 | + } | |
| 9438 | + setTouchedUnwrapped(value); | |
| 9439 | + }); | |
| 9440 | + const shouldValidateOnChange = useStableCallback(() => validationMode === "onChange" || validationMode === "onSubmit" && submitCountRef.current > 0); | |
| 9441 | + const formError = effectiveName && Object.hasOwn(errors, effectiveName) ? errors[effectiveName] : null; | |
| 9442 | + const hasFormError = !!(Array.isArray(formError) ? formError.length : formError); | |
| 9443 | + const invalid2 = invalidProp === true || hasFormError; | |
| 9444 | + const [validityData, setValidityData] = React49.useState({ | |
| 9445 | + state: DEFAULT_VALIDITY_STATE, | |
| 9446 | + error: "", | |
| 9447 | + errors: [], | |
| 9448 | + value: null, | |
| 9449 | + initialValue: null | |
| 9450 | + }); | |
| 9451 | + const valid2 = !invalid2 && (disabled2 ? null : validityData.state.valid); | |
| 9452 | + const state = React49.useMemo(() => ({ | |
| 9453 | + disabled: disabled2, | |
| 9454 | + touched, | |
| 9455 | + dirty, | |
| 9456 | + valid: valid2, | |
| 9457 | + filled, | |
| 9458 | + focused | |
| 9459 | + }), [disabled2, touched, dirty, valid2, filled, focused]); | |
| 9460 | + const validation = useFieldValidation({ | |
| 9461 | + setValidityData, | |
| 9462 | + validate, | |
| 9463 | + validityData, | |
| 9464 | + validationDebounceTime, | |
| 9465 | + invalid: invalid2, | |
| 9466 | + markedDirtyRef, | |
| 9467 | + state, | |
| 9468 | + shouldValidateOnChange, | |
| 9469 | + validationMode, | |
| 9470 | + registeredFieldIdRef | |
| 9471 | + }); | |
| 9472 | + const [validateFieldControl, registerFieldControl] = useFieldControlRegistration({ | |
| 9473 | + change: validation.change, | |
| 9474 | + commit: validation.commit, | |
| 9475 | + invalid: invalid2, | |
| 9476 | + markedDirtyRef, | |
| 9477 | + name, | |
| 9478 | + setRegisteredFieldName, | |
| 9479 | + registeredFieldIdRef, | |
| 9480 | + setValidityData, | |
| 9481 | + validityData | |
| 9482 | + }); | |
| 9483 | + React49.useImperativeHandle(actionsRef, () => ({ | |
| 9484 | + validate: validateFieldControl | |
| 9485 | + }), [validateFieldControl]); | |
| 9486 | + const contextValue = React49.useMemo(() => ({ | |
| 9487 | + invalid: invalid2, | |
| 9488 | + name: effectiveName, | |
| 9489 | + validityData, | |
| 9490 | + setValidityData, | |
| 9491 | + disabled: disabled2, | |
| 9492 | + setTouched, | |
| 9493 | + setDirty, | |
| 9494 | + setFilled, | |
| 9495 | + setFocused, | |
| 9496 | + validationMode, | |
| 9497 | + shouldValidateOnChange, | |
| 9498 | + state, | |
| 9499 | + registerFieldControl, | |
| 9500 | + validation | |
| 9501 | + }), [invalid2, effectiveName, validityData, disabled2, setTouched, setDirty, setFilled, setFocused, validationMode, shouldValidateOnChange, state, registerFieldControl, validation]); | |
| 9502 | + const element = useRenderElement("div", componentProps, { | |
| 9503 | + ref: forwardedRef, | |
| 9504 | + state, | |
| 9505 | + props: elementProps, | |
| 9506 | + stateAttributesMapping: fieldValidityMapping | |
| 9507 | + }); | |
| 9508 | + return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(FieldRootContext.Provider, { | |
| 9509 | + value: contextValue, | |
| 9510 | + children: element | |
| 9511 | + }); | |
| 9512 | +}); | |
| 9513 | +if (true) FieldRootInner.displayName = "FieldRootInner"; | |
| 9514 | +var FieldRoot = /* @__PURE__ */ React49.forwardRef(function FieldRoot2(componentProps, forwardedRef) { | |
| 9515 | + return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(LabelableProvider, { | |
| 9516 | + children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(FieldRootInner, { | |
| 9517 | + ...componentProps, | |
| 9518 | + ref: forwardedRef | |
| 9519 | + }) | |
| 9520 | + }); | |
| 9521 | +}); | |
| 9522 | +if (true) FieldRoot.displayName = "FieldRoot"; | |
| 9523 | + | |
| 9524 | +// node_modules/@base-ui/react/field/label/FieldLabel.mjs | |
| 9525 | +var React50 = __toESM(require_react(), 1); | |
| 9526 | +var FieldLabel = /* @__PURE__ */ React50.forwardRef(function FieldLabel2(componentProps, forwardedRef) { | |
| 9527 | + const { | |
| 9528 | + render: render4, | |
| 9529 | + className, | |
| 9530 | + style, | |
| 9531 | + id: idProp, | |
| 9532 | + nativeLabel = true, | |
| 9533 | + ...elementProps | |
| 9534 | + } = componentProps; | |
| 9535 | + const fieldRootContext = useFieldRootContext(false); | |
| 9536 | + const fieldItemContext = useFieldItemContext(); | |
| 9537 | + const { | |
| 9538 | + labelId | |
| 9539 | + } = useLabelableContext(); | |
| 9540 | + const state = { | |
| 9541 | + ...fieldRootContext.state, | |
| 9542 | + disabled: fieldRootContext.disabled || fieldItemContext.disabled | |
| 9543 | + }; | |
| 9544 | + const labelRef = React50.useRef(null); | |
| 9545 | + const labelProps = useLabel({ | |
| 9546 | + id: labelId ?? idProp, | |
| 9547 | + native: nativeLabel | |
| 9548 | + }); | |
| 9549 | + if (true) { | |
| 9550 | + React50.useEffect(() => { | |
| 9551 | + if (!labelRef.current) { | |
| 9552 | + return; | |
| 9553 | + } | |
| 9554 | + const isLabelTag = labelRef.current.tagName === "LABEL"; | |
| 9555 | + if (nativeLabel) { | |
| 9556 | + if (!isLabelTag) { | |
| 9557 | + const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; | |
| 9558 | + const message2 = "<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`."; | |
| 9559 | + error(`${message2}${ownerStackMessage}`); | |
| 9560 | + } | |
| 9561 | + } else if (isLabelTag) { | |
| 9562 | + const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; | |
| 9563 | + const message2 = "<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`."; | |
| 9564 | + error(`${message2}${ownerStackMessage}`); | |
| 9565 | + } | |
| 9566 | + }, [nativeLabel]); | |
| 9567 | + } | |
| 9568 | + const element = useRenderElement("label", componentProps, { | |
| 9569 | + ref: [forwardedRef, labelRef], | |
| 9570 | + state, | |
| 9571 | + props: [labelProps, elementProps], | |
| 9572 | + stateAttributesMapping: fieldValidityMapping | |
| 9573 | + }); | |
| 9574 | + return element; | |
| 9575 | +}); | |
| 9576 | +if (true) FieldLabel.displayName = "FieldLabel"; | |
| 9577 | + | |
| 9578 | +// node_modules/@base-ui/react/field/error/FieldError.mjs | |
| 9579 | +var React51 = __toESM(require_react(), 1); | |
| 9580 | +var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); | |
| 9581 | +var stateAttributesMapping = { | |
| 9582 | + ...fieldValidityMapping, | |
| 9583 | + ...transitionStatusMapping | |
| 9584 | +}; | |
| 9585 | +var FieldError = /* @__PURE__ */ React51.forwardRef(function FieldError2(componentProps, forwardedRef) { | |
| 9586 | + const { | |
| 9587 | + render: render4, | |
| 9588 | + id: idProp, | |
| 9589 | + className, | |
| 9590 | + match: match2, | |
| 9591 | + style, | |
| 9592 | + ...elementProps | |
| 9593 | + } = componentProps; | |
| 9594 | + const id = useBaseUiId(idProp); | |
| 9595 | + const { | |
| 9596 | + validityData, | |
| 9597 | + state: fieldState, | |
| 9598 | + name | |
| 9599 | + } = useFieldRootContext(false); | |
| 9600 | + const { | |
| 9601 | + setMessageIds | |
| 9602 | + } = useLabelableContext(); | |
| 9603 | + const { | |
| 9604 | + errors | |
| 9605 | + } = useFormContext(); | |
| 9606 | + const formError = name && Object.hasOwn(errors, name) ? errors[name] : null; | |
| 9607 | + const hasFormError = !!(Array.isArray(formError) ? formError.length : formError); | |
| 9608 | + const hasSpecificMatch = typeof match2 === "string"; | |
| 9609 | + let rendered = false; | |
| 9610 | + if (match2 === true) { | |
| 9611 | + rendered = true; | |
| 9612 | + } else if (fieldState.disabled) { | |
| 9613 | + rendered = false; | |
| 9614 | + } else if (hasSpecificMatch) { | |
| 9615 | + rendered = Boolean(validityData.state[match2]); | |
| 9616 | + } else { | |
| 9617 | + rendered = hasFormError || validityData.state.valid === false; | |
| 9618 | + } | |
| 9619 | + const { | |
| 9620 | + mounted, | |
| 9621 | + transitionStatus, | |
| 9622 | + setMounted | |
| 9623 | + } = useTransitionStatus(rendered); | |
| 9624 | + useIsoLayoutEffect(() => { | |
| 9625 | + if (!rendered || !id) { | |
| 9626 | + return void 0; | |
| 9627 | + } | |
| 9628 | + setMessageIds((v2) => v2.concat(id)); | |
| 9629 | + return () => { | |
| 9630 | + setMessageIds((v2) => v2.filter((item) => item !== id)); | |
| 9631 | + }; | |
| 9632 | + }, [rendered, id, setMessageIds]); | |
| 9633 | + const errorRef = React51.useRef(null); | |
| 9634 | + const [lastRenderedMessage, setLastRenderedMessage] = React51.useState(null); | |
| 9635 | + const [lastRenderedMessageKey, setLastRenderedMessageKey] = React51.useState(null); | |
| 9636 | + let error2 = validityData.error; | |
| 9637 | + if (!hasSpecificMatch && hasFormError) { | |
| 9638 | + error2 = formError; | |
| 9639 | + } else if (validityData.errors.length > 1) { | |
| 9640 | + error2 = validityData.errors; | |
| 9641 | + } | |
| 9642 | + let errorMessage = error2; | |
| 9643 | + if (Array.isArray(error2)) { | |
| 9644 | + errorMessage = error2.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { | |
| 9645 | + children: error2.map((message2) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("li", { | |
| 9646 | + children: message2 | |
| 9647 | + }, message2)) | |
| 9648 | + }) : error2[0]; | |
| 9649 | + } | |
| 9650 | + const errorKey = Array.isArray(error2) ? JSON.stringify(error2) : error2; | |
| 9651 | + if (rendered && errorKey !== lastRenderedMessageKey) { | |
| 9652 | + setLastRenderedMessageKey(errorKey); | |
| 9653 | + setLastRenderedMessage(errorMessage); | |
| 9654 | + } | |
| 9655 | + useOpenChangeComplete({ | |
| 9656 | + open: rendered, | |
| 9657 | + ref: errorRef, | |
| 9658 | + onComplete() { | |
| 9659 | + if (!rendered) { | |
| 9660 | + setMounted(false); | |
| 9661 | + } | |
| 9662 | + } | |
| 9663 | + }); | |
| 9664 | + const state = { | |
| 9665 | + ...fieldState, | |
| 9666 | + transitionStatus | |
| 9667 | + }; | |
| 9668 | + const element = useRenderElement("div", componentProps, { | |
| 9669 | + ref: [forwardedRef, errorRef], | |
| 9670 | + state, | |
| 9671 | + props: [{ | |
| 9672 | + id, | |
| 9673 | + children: rendered ? errorMessage : lastRenderedMessage | |
| 9674 | + }, elementProps], | |
| 9675 | + stateAttributesMapping, | |
| 9676 | + enabled: mounted | |
| 9677 | + }); | |
| 9678 | + if (!mounted) { | |
| 9679 | + return null; | |
| 9680 | + } | |
| 9681 | + return element; | |
| 9682 | +}); | |
| 9683 | +if (true) FieldError.displayName = "FieldError"; | |
| 9684 | + | |
| 9685 | +// node_modules/@base-ui/react/field/description/FieldDescription.mjs | |
| 9686 | +var React52 = __toESM(require_react(), 1); | |
| 9687 | +var FieldDescription = /* @__PURE__ */ React52.forwardRef(function FieldDescription2(componentProps, forwardedRef) { | |
| 9688 | + const { | |
| 9689 | + render: render4, | |
| 9690 | + id: idProp, | |
| 9691 | + className, | |
| 9692 | + style, | |
| 9693 | + ...elementProps | |
| 9694 | + } = componentProps; | |
| 9695 | + const id = useBaseUiId(idProp); | |
| 9696 | + const fieldRootContext = useFieldRootContext(false); | |
| 9697 | + const fieldItemContext = useFieldItemContext(); | |
| 9698 | + const { | |
| 9699 | + setMessageIds | |
| 9700 | + } = useLabelableContext(); | |
| 9701 | + const state = { | |
| 9702 | + ...fieldRootContext.state, | |
| 9703 | + disabled: fieldRootContext.disabled || fieldItemContext.disabled | |
| 9704 | + }; | |
| 9705 | + useIsoLayoutEffect(() => { | |
| 9706 | + if (!id) { | |
| 9707 | + return void 0; | |
| 9708 | + } | |
| 9709 | + setMessageIds((v2) => v2.concat(id)); | |
| 9710 | + return () => { | |
| 9711 | + setMessageIds((v2) => v2.filter((item) => item !== id)); | |
| 9712 | + }; | |
| 9713 | + }, [id, setMessageIds]); | |
| 9714 | + const element = useRenderElement("p", componentProps, { | |
| 9715 | + ref: forwardedRef, | |
| 9716 | + state, | |
| 9717 | + props: [{ | |
| 9718 | + id | |
| 9719 | + }, elementProps], | |
| 9720 | + stateAttributesMapping: fieldValidityMapping | |
| 9721 | + }); | |
| 9722 | + return element; | |
| 9723 | +}); | |
| 9724 | +if (true) FieldDescription.displayName = "FieldDescription"; | |
| 9725 | + | |
| 9726 | +// node_modules/@base-ui/react/field/control/FieldControl.mjs | |
| 9727 | +var React53 = __toESM(require_react(), 1); | |
| 9728 | +var FieldControl = /* @__PURE__ */ React53.forwardRef(function FieldControl2(componentProps, forwardedRef) { | |
| 9729 | + const { | |
| 9730 | + render: render4, | |
| 9731 | + className, | |
| 9732 | + id: idProp, | |
| 9733 | + name: nameProp, | |
| 9734 | + value: valueProp, | |
| 9735 | + disabled: disabledProp = false, | |
| 9736 | + onValueChange, | |
| 9737 | + defaultValue, | |
| 9738 | + autoFocus = false, | |
| 9739 | + style, | |
| 9740 | + ...elementProps | |
| 9741 | + } = componentProps; | |
| 9742 | + const { | |
| 9743 | + state: fieldState, | |
| 9744 | + name: fieldName, | |
| 9745 | + disabled: fieldDisabled, | |
| 9746 | + setTouched, | |
| 9747 | + setDirty, | |
| 9748 | + validityData, | |
| 9749 | + setFocused, | |
| 9750 | + setFilled, | |
| 9751 | + validationMode, | |
| 9752 | + validation | |
| 9753 | + } = useFieldRootContext(); | |
| 9754 | + const { | |
| 9755 | + clearErrors, | |
| 9756 | + elementRef: formElementRef, | |
| 9757 | + submitCountRef | |
| 9758 | + } = useFormContext(); | |
| 9759 | + const disabled2 = fieldDisabled || disabledProp; | |
| 9760 | + const name = fieldName ?? nameProp; | |
| 9761 | + const state = { | |
| 9762 | + ...fieldState, | |
| 9763 | + disabled: disabled2 | |
| 9764 | + }; | |
| 9765 | + const { | |
| 9766 | + labelId | |
| 9767 | + } = useLabelableContext(); | |
| 9768 | + const id = useLabelableId({ | |
| 9769 | + id: idProp | |
| 9770 | + }); | |
| 9771 | + const [valueUnwrapped] = useControlled({ | |
| 9772 | + controlled: valueProp, | |
| 9773 | + default: defaultValue, | |
| 9774 | + name: "FieldControl", | |
| 9775 | + state: "value" | |
| 9776 | + }); | |
| 9777 | + const isControlled = valueProp !== void 0; | |
| 9778 | + const value = isControlled ? valueUnwrapped : void 0; | |
| 9779 | + const serializedValue = value == null ? void 0 : String(value); | |
| 9780 | + const getValueFromInput = useStableCallback(() => validation.inputRef.current?.value); | |
| 9781 | + useRegisterFieldControl(validation.inputRef, id, serializedValue, getValueFromInput, !disabled2, nameProp); | |
| 9782 | + useIsoLayoutEffect(() => { | |
| 9783 | + const currentValue = serializedValue ?? validation.inputRef.current?.value; | |
| 9784 | + if (currentValue !== void 0) { | |
| 9785 | + setFilled(currentValue !== ""); | |
| 9786 | + } | |
| 9787 | + }, [serializedValue, validation.inputRef, setFilled]); | |
| 9788 | + useValueChanged(serializedValue, () => { | |
| 9789 | + if (serializedValue === void 0) { | |
| 9790 | + return; | |
| 9791 | + } | |
| 9792 | + clearErrors(name); | |
| 9793 | + setDirty(serializedValue !== (validityData.initialValue ?? "")); | |
| 9794 | + validation.change(serializedValue); | |
| 9795 | + }); | |
| 9796 | + const inputRef = React53.useRef(null); | |
| 9797 | + const enterValidationTimeout = useTimeout(); | |
| 9798 | + useIsoLayoutEffect(() => { | |
| 9799 | + if (autoFocus && inputRef.current === activeElement(ownerDocument(inputRef.current))) { | |
| 9800 | + setFocused(true); | |
| 9801 | + } | |
| 9802 | + }, [autoFocus, setFocused]); | |
| 9803 | + const element = useRenderElement("input", componentProps, { | |
| 9804 | + ref: [forwardedRef, inputRef], | |
| 9805 | + state, | |
| 9806 | + props: [{ | |
| 9807 | + id, | |
| 9808 | + disabled: disabled2, | |
| 9809 | + name, | |
| 9810 | + ref: validation.inputRef, | |
| 9811 | + "aria-labelledby": labelId, | |
| 9812 | + autoFocus, | |
| 9813 | + ...isControlled ? { | |
| 9814 | + value | |
| 9815 | + } : { | |
| 9816 | + defaultValue | |
| 9817 | + }, | |
| 9818 | + onChange(event) { | |
| 9819 | + const inputValue = event.currentTarget.value; | |
| 9820 | + const details = createChangeEventDetails(reason_parts_exports.none, event.nativeEvent); | |
| 9821 | + onValueChange?.(inputValue, details); | |
| 9822 | + if (isControlled) { | |
| 9823 | + return; | |
| 9824 | + } | |
| 9825 | + setDirty(inputValue !== (validityData.initialValue ?? "")); | |
| 9826 | + setFilled(inputValue !== ""); | |
| 9827 | + if (!event.nativeEvent.defaultPrevented && !details.isCanceled) { | |
| 9828 | + clearErrors(name); | |
| 9829 | + validation.change(inputValue); | |
| 9830 | + } | |
| 9831 | + }, | |
| 9832 | + onFocus() { | |
| 9833 | + setFocused(true); | |
| 9834 | + }, | |
| 9835 | + onBlur(event) { | |
| 9836 | + setTouched(true); | |
| 9837 | + setFocused(false); | |
| 9838 | + if (validationMode === "onBlur") { | |
| 9839 | + const inputValue = event.currentTarget.value; | |
| 9840 | + validation.commit(inputValue); | |
| 9841 | + if (isControlled) { | |
| 9842 | + queueMicrotask(() => { | |
| 9843 | + const nextValue = validation.inputRef.current?.value; | |
| 9844 | + if (nextValue !== void 0 && nextValue !== inputValue && nextValue !== (validityData.initialValue ?? "")) { | |
| 9845 | + validation.commit(nextValue); | |
| 9846 | + } | |
| 9847 | + }); | |
| 9848 | + } | |
| 9849 | + } | |
| 9850 | + }, | |
| 9851 | + onKeyDown(event) { | |
| 9852 | + if (event.currentTarget.tagName === "INPUT" && event.key === "Enter") { | |
| 9853 | + setTouched(true); | |
| 9854 | + const value2 = event.currentTarget.value; | |
| 9855 | + const form = event.currentTarget.form; | |
| 9856 | + if (form && form === formElementRef.current && !event.defaultPrevented) { | |
| 9857 | + const input = event.currentTarget; | |
| 9858 | + const submitCount = submitCountRef.current; | |
| 9859 | + enterValidationTimeout.start(0, () => { | |
| 9860 | + if (submitCountRef.current === submitCount) { | |
| 9861 | + validation.commit(input.value); | |
| 9862 | + } | |
| 9863 | + }); | |
| 9864 | + } else { | |
| 9865 | + validation.commit(value2); | |
| 9866 | + } | |
| 9867 | + } | |
| 9868 | + } | |
| 9869 | + }, elementProps, (props) => validation.getValidationProps(disabled2, props)], | |
| 9870 | + stateAttributesMapping: fieldValidityMapping | |
| 9871 | + }); | |
| 9872 | + return element; | |
| 9873 | +}); | |
| 9874 | +if (true) FieldControl.displayName = "FieldControl"; | |
| 9875 | + | |
| 9876 | +// node_modules/@base-ui/react/field/validity/FieldValidity.mjs | |
| 9877 | +var React54 = __toESM(require_react(), 1); | |
| 9878 | +var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); | |
| 9879 | +var FieldValidity = function FieldValidity2(props) { | |
| 9880 | + const { | |
| 9881 | + children | |
| 9882 | + } = props; | |
| 9883 | + const { | |
| 9884 | + validityData, | |
| 9885 | + invalid: invalid2 | |
| 9886 | + } = useFieldRootContext(false); | |
| 9887 | + const combinedFieldValidityData = React54.useMemo(() => getCombinedFieldValidityData(validityData, invalid2), [validityData, invalid2]); | |
| 9888 | + const isInvalid = combinedFieldValidityData.state.valid === false; | |
| 9889 | + const { | |
| 9890 | + transitionStatus | |
| 9891 | + } = useTransitionStatus(isInvalid); | |
| 9892 | + const fieldValidityState = React54.useMemo(() => { | |
| 9893 | + return { | |
| 9894 | + ...combinedFieldValidityData, | |
| 9895 | + validity: combinedFieldValidityData.state, | |
| 9896 | + transitionStatus | |
| 9897 | + }; | |
| 9898 | + }, [combinedFieldValidityData, transitionStatus]); | |
| 9899 | + return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(React54.Fragment, { | |
| 9900 | + children: children(fieldValidityState) | |
| 9901 | + }); | |
| 9902 | +}; | |
| 9903 | +if (true) FieldValidity.displayName = "FieldValidity"; | |
| 9904 | + | |
| 9905 | +// node_modules/@base-ui/react/field/item/FieldItem.mjs | |
| 9906 | +var React55 = __toESM(require_react(), 1); | |
| 9907 | +var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); | |
| 9908 | +var FieldItem = /* @__PURE__ */ React55.forwardRef(function FieldItem2(componentProps, forwardedRef) { | |
| 9909 | + const { | |
| 9910 | + render: render4, | |
| 9911 | + className, | |
| 9912 | + style, | |
| 9913 | + disabled: disabledProp = false, | |
| 9914 | + ...elementProps | |
| 9915 | + } = componentProps; | |
| 9916 | + const { | |
| 9917 | + state: fieldState, | |
| 9918 | + disabled: rootDisabled | |
| 9919 | + } = useFieldRootContext(false); | |
| 9920 | + const disabled2 = rootDisabled || disabledProp; | |
| 9921 | + const state = { | |
| 9922 | + ...fieldState, | |
| 9923 | + disabled: disabled2 | |
| 9924 | + }; | |
| 9925 | + const fieldItemContext = React55.useMemo(() => ({ | |
| 9926 | + disabled: disabled2 | |
| 9927 | + }), [disabled2]); | |
| 9928 | + const element = useRenderElement("div", componentProps, { | |
| 9929 | + ref: forwardedRef, | |
| 9930 | + state, | |
| 9931 | + props: elementProps, | |
| 9932 | + stateAttributesMapping: fieldValidityMapping | |
| 9933 | + }); | |
| 9934 | + return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LabelableProvider, { | |
| 9935 | + children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FieldItemContext.Provider, { | |
| 9936 | + value: fieldItemContext, | |
| 9937 | + children: element | |
| 9938 | + }) | |
| 9939 | + }); | |
| 9940 | +}); | |
| 9941 | +if (true) FieldItem.displayName = "FieldItem"; | |
| 9942 | + | |
| 9943 | +// node_modules/@base-ui/react/input/Input.mjs | |
| 9944 | +var React56 = __toESM(require_react(), 1); | |
| 9945 | +var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); | |
| 9946 | +var Input = /* @__PURE__ */ React56.forwardRef(function Input2(props, forwardedRef) { | |
| 9947 | + return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(index_parts_exports.Control, { | |
| 9948 | + ref: forwardedRef, | |
| 9949 | + ...props | |
| 9950 | + }); | |
| 9951 | +}); | |
| 9952 | +if (true) Input.displayName = "Input"; | |
| 9953 | + | |
| 9954 | +// node_modules/@base-ui/react/utils/FloatingPortalLite.mjs | |
| 9955 | +var React57 = __toESM(require_react(), 1); | |
| 9956 | +var ReactDOM7 = __toESM(require_react_dom(), 1); | |
| 9957 | +var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); | |
| 9958 | +var FloatingPortalLite = /* @__PURE__ */ React57.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) { | |
| 9959 | + const { | |
| 9960 | + children, | |
| 9961 | + container, | |
| 9962 | + className, | |
| 9963 | + render: render4, | |
| 9964 | + style, | |
| 9965 | + ...elementProps | |
| 9966 | + } = componentProps; | |
| 9967 | + const { | |
| 9968 | + node: portalNode, | |
| 9969 | + subtree: portalSubtree | |
| 9970 | + } = useFloatingPortalNode({ | |
| 9971 | + container, | |
| 9972 | + ref: forwardedRef, | |
| 9973 | + componentProps, | |
| 9974 | + elementProps | |
| 9975 | + }); | |
| 9976 | + if (!portalSubtree && !portalNode) { | |
| 9977 | + return null; | |
| 9978 | + } | |
| 9979 | + return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(React57.Fragment, { | |
| 9980 | + children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM7.createPortal(children, portalNode)] | |
| 9981 | + }); | |
| 9982 | +}); | |
| 9983 | +if (true) FloatingPortalLite.displayName = "FloatingPortalLite"; | |
| 9984 | + | |
| 9985 | +// node_modules/@base-ui/react/tooltip/index.parts.mjs | |
| 9986 | +var index_parts_exports2 = {}; | |
| 9987 | +__export(index_parts_exports2, { | |
| 9988 | + Arrow: () => TooltipArrow, | |
| 9989 | + Handle: () => TooltipHandle, | |
| 9990 | + Popup: () => TooltipPopup, | |
| 9991 | + Portal: () => TooltipPortal, | |
| 9992 | + Positioner: () => TooltipPositioner, | |
| 9993 | + Provider: () => TooltipProvider, | |
| 9994 | + Root: () => TooltipRoot, | |
| 9995 | + Trigger: () => TooltipTrigger, | |
| 9996 | + Viewport: () => TooltipViewport, | |
| 9997 | + createHandle: () => createTooltipHandle | |
| 9998 | +}); | |
| 9999 | + | |
| 10000 | +// node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs | |
| 10001 | +var React60 = __toESM(require_react(), 1); | |
| 10002 | + | |
| 10003 | +// node_modules/@base-ui/react/tooltip/root/TooltipRootContext.mjs | |
| 10004 | +var React58 = __toESM(require_react(), 1); | |
| 10005 | +var TooltipRootContext = /* @__PURE__ */ React58.createContext(void 0); | |
| 10006 | +if (true) TooltipRootContext.displayName = "TooltipRootContext"; | |
| 10007 | +function useTooltipRootContext(optional) { | |
| 10008 | + const context = React58.useContext(TooltipRootContext); | |
| 10009 | + if (context === void 0 && !optional) { | |
| 10010 | + throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72)); | |
| 10011 | + } | |
| 10012 | + return context; | |
| 10013 | +} | |
| 10014 | + | |
| 10015 | +// node_modules/@base-ui/react/tooltip/store/TooltipStore.mjs | |
| 10016 | +var React59 = __toESM(require_react(), 1); | |
| 10017 | +var selectors2 = { | |
| 10018 | + ...popupStoreSelectors, | |
| 10019 | + disabled: (state) => state.disabled, | |
| 10020 | + instantType: (state) => state.instantType, | |
| 10021 | + isInstantPhase: (state) => state.isInstantPhase, | |
| 10022 | + trackCursorAxis: (state) => state.trackCursorAxis, | |
| 10023 | + disableHoverablePopup: (state) => state.disableHoverablePopup, | |
| 10024 | + lastOpenChangeReason: (state) => state.openChangeReason, | |
| 10025 | + closeOnClick: (state) => state.closeOnClick, | |
| 10026 | + closeDelay: (state) => state.closeDelay, | |
| 10027 | + adaptiveOrigin: (state) => state.adaptiveOrigin | |
| 10028 | +}; | |
| 10029 | +var TooltipStore = class extends ReactStore { | |
| 10030 | + constructor(initialState, floatingId, nested) { | |
| 10031 | + const triggerElements = new PopupTriggerMap(); | |
| 10032 | + super(createInitialState(initialState, triggerElements, floatingId, nested), createInitialContext(triggerElements), selectors2); | |
| 10033 | + } | |
| 10034 | + setOpen = (nextOpen, eventDetails) => { | |
| 10035 | + applyPopupOpenChange(this, nextOpen, eventDetails, { | |
| 10036 | + extraState: { | |
| 10037 | + openChangeReason: eventDetails.reason | |
| 10038 | + } | |
| 10039 | + }); | |
| 10040 | + }; | |
| 10041 | + // Used by trigger clicks to clear a delayed hover open without reporting a public open-state change. | |
| 10042 | + cancelPendingOpen(event) { | |
| 10043 | + this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event)); | |
| 10044 | + } | |
| 10045 | +}; | |
| 10046 | +function createNullTooltipStore() { | |
| 10047 | + const triggerElements = new PopupTriggerMap(); | |
| 10048 | + const store = new NullStore(Object.freeze(createInitialState(void 0, triggerElements)), Object.freeze(createInitialContext(triggerElements)), selectors2); | |
| 10049 | + return Object.assign(store, { | |
| 10050 | + setOpen: NOOP, | |
| 10051 | + cancelPendingOpen: NOOP | |
| 10052 | + }); | |
| 10053 | +} | |
| 10054 | +function createInitialState(initialState, triggerElements, floatingId, nested = false) { | |
| 10055 | + const state = { | |
| 10056 | + ...createInitialPopupStoreState(triggerElements, floatingId, nested), | |
| 10057 | + disabled: false, | |
| 10058 | + instantType: void 0, | |
| 10059 | + isInstantPhase: false, | |
| 10060 | + trackCursorAxis: "none", | |
| 10061 | + disableHoverablePopup: false, | |
| 10062 | + openChangeReason: null, | |
| 10063 | + closeOnClick: true, | |
| 10064 | + closeDelay: 0, | |
| 10065 | + adaptiveOrigin: void 0, | |
| 10066 | + ...initialState | |
| 10067 | + }; | |
| 10068 | + return state; | |
| 10069 | +} | |
| 10070 | +function createInitialContext(triggerElements) { | |
| 10071 | + return { | |
| 10072 | + popupRef: /* @__PURE__ */ React59.createRef(), | |
| 10073 | + onOpenChange: void 0, | |
| 10074 | + onOpenChangeComplete: void 0, | |
| 10075 | + triggerElements | |
| 10076 | + }; | |
| 10077 | +} | |
| 10078 | + | |
| 10079 | +// node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs | |
| 10080 | +var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); | |
| 10081 | +var TooltipRoot = fastComponent(function TooltipRoot2(props) { | |
| 10082 | + const { | |
| 10083 | + disabled: disabled2 = false, | |
| 10084 | + defaultOpen = false, | |
| 10085 | + open: openProp, | |
| 10086 | + disableHoverablePopup = false, | |
| 10087 | + trackCursorAxis = "none", | |
| 10088 | + actionsRef, | |
| 10089 | + onOpenChange, | |
| 10090 | + onOpenChangeComplete, | |
| 10091 | + handle, | |
| 10092 | + triggerId: triggerIdProp, | |
| 10093 | + defaultTriggerId: defaultTriggerIdProp = null, | |
| 10094 | + children | |
| 10095 | + } = props; | |
| 10096 | + const store = usePopupRootStore((floatingId, nested) => new TooltipStore({ | |
| 10097 | + open: defaultOpen, | |
| 10098 | + openProp, | |
| 10099 | + activeTriggerId: defaultTriggerIdProp, | |
| 10100 | + triggerIdProp | |
| 10101 | + }, floatingId, nested)); | |
| 10102 | + store.useControlledProp("openProp", openProp); | |
| 10103 | + store.useControlledProp("triggerIdProp", triggerIdProp); | |
| 10104 | + store.useContextCallback("onOpenChange", onOpenChange); | |
| 10105 | + store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete); | |
| 10106 | + const openState = store.useState("open"); | |
| 10107 | + const open2 = !disabled2 && openState; | |
| 10108 | + const activeTriggerId = store.useState("activeTriggerId"); | |
| 10109 | + const mounted = store.useState("mounted"); | |
| 10110 | + const payload = store.useState("payload"); | |
| 10111 | + store.useSyncedValues({ | |
| 10112 | + trackCursorAxis, | |
| 10113 | + disableHoverablePopup, | |
| 10114 | + disabled: disabled2 | |
| 10115 | + }); | |
| 10116 | + useImplicitActiveTrigger(store, { | |
| 10117 | + closeOnActiveTriggerUnmount: true | |
| 10118 | + }); | |
| 10119 | + const { | |
| 10120 | + forceUnmount, | |
| 10121 | + transitionStatus | |
| 10122 | + } = useOpenStateTransitions(open2, store); | |
| 10123 | + const isInstantPhase = store.useState("isInstantPhase"); | |
| 10124 | + const instantType = store.useState("instantType"); | |
| 10125 | + const lastOpenChangeReason = store.useState("lastOpenChangeReason"); | |
| 10126 | + const previousInstantTypeRef = React60.useRef(null); | |
| 10127 | + useIsoLayoutEffect(() => { | |
| 10128 | + if (openState && disabled2) { | |
| 10129 | + store.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled)); | |
| 10130 | + } | |
| 10131 | + }, [openState, disabled2, store]); | |
| 10132 | + useIsoLayoutEffect(() => { | |
| 10133 | + if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) { | |
| 10134 | + if (instantType !== "delay") { | |
| 10135 | + previousInstantTypeRef.current = instantType; | |
| 10136 | + } | |
| 10137 | + store.set("instantType", "delay"); | |
| 10138 | + } else if (previousInstantTypeRef.current !== null) { | |
| 10139 | + store.set("instantType", previousInstantTypeRef.current); | |
| 10140 | + previousInstantTypeRef.current = null; | |
| 10141 | + } | |
| 10142 | + }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store]); | |
| 10143 | + useIsoLayoutEffect(() => { | |
| 10144 | + if (open2) { | |
| 10145 | + if (activeTriggerId == null) { | |
| 10146 | + store.set("payload", void 0); | |
| 10147 | + } | |
| 10148 | + } | |
| 10149 | + }, [store, activeTriggerId, open2]); | |
| 10150 | + React60.useImperativeHandle(actionsRef, () => ({ | |
| 10151 | + unmount: forceUnmount, | |
| 10152 | + close: () => store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)) | |
| 10153 | + }), [forceUnmount, store]); | |
| 10154 | + const shouldRenderInteractions = open2 || mounted || !disabled2 && trackCursorAxis !== "none"; | |
| 10155 | + return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(TooltipRootContext.Provider, { | |
| 10156 | + value: store, | |
| 10157 | + children: [handle && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PopupHandleAttachment, { | |
| 10158 | + handle, | |
| 10159 | + store | |
| 10160 | + }), shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TooltipInteractions, { | |
| 10161 | + store, | |
| 10162 | + disabled: disabled2, | |
| 10163 | + trackCursorAxis | |
| 10164 | + }), typeof children === "function" ? children({ | |
| 10165 | + payload | |
| 10166 | + }) : children] | |
| 10167 | + }); | |
| 10168 | +}); | |
| 10169 | +if (true) TooltipRoot.displayName = "TooltipRoot"; | |
| 10170 | +function TooltipInteractions({ | |
| 10171 | + store, | |
| 10172 | + disabled: disabled2, | |
| 10173 | + trackCursorAxis | |
| 10174 | +}) { | |
| 10175 | + const floatingRootContext = store.useState("floatingRootContext"); | |
| 10176 | + const dismiss = useDismiss(floatingRootContext, { | |
| 10177 | + enabled: !disabled2, | |
| 10178 | + referencePress: () => store.select("closeOnClick") | |
| 10179 | + }); | |
| 10180 | + const clientPoint = useClientPoint(floatingRootContext, { | |
| 10181 | + enabled: !disabled2 && trackCursorAxis !== "none", | |
| 10182 | + axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis | |
| 10183 | + }); | |
| 10184 | + const triggerProps = React60.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]); | |
| 10185 | + usePopupInteractionProps(store, { | |
| 10186 | + activeTriggerProps: triggerProps, | |
| 10187 | + inactiveTriggerProps: triggerProps, | |
| 10188 | + popupProps: dismiss.floating ?? EMPTY_OBJECT | |
| 10189 | + }); | |
| 10190 | + return null; | |
| 10191 | +} | |
| 10192 | + | |
| 10193 | +// node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs | |
| 10194 | +var React62 = __toESM(require_react(), 1); | |
| 10195 | + | |
| 10196 | +// node_modules/@base-ui/react/tooltip/provider/TooltipProviderContext.mjs | |
| 10197 | +var React61 = __toESM(require_react(), 1); | |
| 10198 | +var TooltipProviderContext = /* @__PURE__ */ React61.createContext(void 0); | |
| 10199 | +if (true) TooltipProviderContext.displayName = "TooltipProviderContext"; | |
| 10200 | +function useTooltipProviderContext() { | |
| 10201 | + return React61.useContext(TooltipProviderContext); | |
| 10202 | +} | |
| 10203 | + | |
| 10204 | +// node_modules/@base-ui/react/tooltip/utils/constants.mjs | |
| 10205 | +var OPEN_DELAY = 600; | |
| 10206 | + | |
| 10207 | +// node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs | |
| 10208 | +var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger"; | |
| 10209 | +function getTargetElement(event) { | |
| 10210 | + if ("composedPath" in event) { | |
| 10211 | + const path = event.composedPath(); | |
| 10212 | + for (let i = 0; i < path.length; i += 1) { | |
| 10213 | + const element = path[i]; | |
| 10214 | + if (isElement(element)) { | |
| 10215 | + return element; | |
| 10216 | + } | |
| 10217 | + } | |
| 10218 | + } | |
| 10219 | + const target = event.target; | |
| 10220 | + if (isElement(target)) { | |
| 10221 | + return target; | |
| 10222 | + } | |
| 10223 | + return null; | |
| 10224 | +} | |
| 10225 | +function closestEnabledTooltipTrigger(element) { | |
| 10226 | + let current = element; | |
| 10227 | + while (current) { | |
| 10228 | + const trigger = current.closest(`[${TOOLTIP_TRIGGER_IDENTIFIER}]`); | |
| 10229 | + if (trigger) { | |
| 10230 | + return trigger; | |
| 10231 | + } | |
| 10232 | + const root = current.getRootNode(); | |
| 10233 | + current = "host" in root && isElement(root.host) ? root.host : null; | |
| 10234 | + } | |
| 10235 | + return null; | |
| 10236 | +} | |
| 10237 | +var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) { | |
| 10238 | + const { | |
| 10239 | + render: render4, | |
| 10240 | + className, | |
| 10241 | + style, | |
| 10242 | + handle, | |
| 10243 | + payload, | |
| 10244 | + disabled: disabledProp, | |
| 10245 | + delay, | |
| 10246 | + closeOnClick = true, | |
| 10247 | + closeDelay, | |
| 10248 | + id: idProp, | |
| 10249 | + ...elementProps | |
| 10250 | + } = componentProps; | |
| 10251 | + const rootContext = useTooltipRootContext(true); | |
| 10252 | + const handleStore = usePopupHandleStore(handle); | |
| 10253 | + const store = handleStore ?? rootContext; | |
| 10254 | + if (!store) { | |
| 10255 | + 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)); | |
| 10256 | + } | |
| 10257 | + const thisTriggerId = useBaseUiId(idProp); | |
| 10258 | + const isTriggerActive = store.useState("isTriggerActive", thisTriggerId); | |
| 10259 | + const isOpenedByThisTrigger = store.useState("isOpenedByTrigger", thisTriggerId); | |
| 10260 | + const floatingRootContext = store.useState("floatingRootContext"); | |
| 10261 | + const triggerElementRef = React62.useRef(null); | |
| 10262 | + const closeDelayWithDefault = closeDelay ?? 0; | |
| 10263 | + const { | |
| 10264 | + registerTrigger, | |
| 10265 | + isMountedByThisTrigger | |
| 10266 | + } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, { | |
| 10267 | + payload, | |
| 10268 | + closeOnClick, | |
| 10269 | + closeDelay: closeDelayWithDefault | |
| 10270 | + }); | |
| 10271 | + const providerDelay = useTooltipProviderContext(); | |
| 10272 | + const { | |
| 10273 | + activeIdRef, | |
| 10274 | + delayRef, | |
| 10275 | + isInstantPhase, | |
| 10276 | + hasProvider | |
| 10277 | + } = useDelayGroup(floatingRootContext, { | |
| 10278 | + open: isOpenedByThisTrigger | |
| 10279 | + }); | |
| 10280 | + const hoverInteraction = useHoverInteractionSharedState(floatingRootContext); | |
| 10281 | + store.useSyncedValue("isInstantPhase", isInstantPhase); | |
| 10282 | + const rootDisabled = store.useState("disabled"); | |
| 10283 | + const disabled2 = disabledProp ?? rootDisabled; | |
| 10284 | + const disabledRef = useValueAsRef(disabled2); | |
| 10285 | + const trackCursorAxis = store.useState("trackCursorAxis"); | |
| 10286 | + const disableHoverablePopup = store.useState("disableHoverablePopup"); | |
| 10287 | + const isNestedTriggerHoveredRef = React62.useRef(false); | |
| 10288 | + const nestedTriggerOpenTimeout = useTimeout(); | |
| 10289 | + const pointerTypeRef = React62.useRef(void 0); | |
| 10290 | + function getOpenDelay() { | |
| 10291 | + if (hasProvider && activeIdRef.current != null) { | |
| 10292 | + return 0; | |
| 10293 | + } | |
| 10294 | + return delay ?? providerDelay ?? OPEN_DELAY; | |
| 10295 | + } | |
| 10296 | + function isEnabledNestedTriggerTarget(target) { | |
| 10297 | + const triggerEl = triggerElementRef.current; | |
| 10298 | + if (!triggerEl || !target) { | |
| 10299 | + return false; | |
| 10300 | + } | |
| 10301 | + const nearestTrigger = closestEnabledTooltipTrigger(target); | |
| 10302 | + return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger); | |
| 10303 | + } | |
| 10304 | + function detectNestedTriggerHover(target) { | |
| 10305 | + const nestedTriggerHovered = isEnabledNestedTriggerTarget(target); | |
| 10306 | + isNestedTriggerHoveredRef.current = nestedTriggerHovered; | |
| 10307 | + if (nestedTriggerHovered) { | |
| 10308 | + hoverInteraction.openChangeTimeout.clear(); | |
| 10309 | + hoverInteraction.restTimeout.clear(); | |
| 10310 | + hoverInteraction.restTimeoutPending = false; | |
| 10311 | + nestedTriggerOpenTimeout.clear(); | |
| 10312 | + } | |
| 10313 | + return nestedTriggerHovered; | |
| 10314 | + } | |
| 10315 | + const hoverProps = useHoverReferenceInteraction(floatingRootContext, { | |
| 10316 | + enabled: !disabled2, | |
| 10317 | + mouseOnly: true, | |
| 10318 | + move: false, | |
| 10319 | + handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null, | |
| 10320 | + restMs: getOpenDelay, | |
| 10321 | + delay() { | |
| 10322 | + if (closeDelay == null && hasProvider) { | |
| 10323 | + return { | |
| 10324 | + close: getDelay(delayRef.current, "close") | |
| 10325 | + }; | |
| 10326 | + } | |
| 10327 | + return { | |
| 10328 | + close: closeDelayWithDefault | |
| 10329 | + }; | |
| 10330 | + }, | |
| 10331 | + triggerElementRef, | |
| 10332 | + isActiveTrigger: isTriggerActive, | |
| 10333 | + isClosing: () => store.select("transitionStatus") === "ending", | |
| 10334 | + shouldOpen() { | |
| 10335 | + return !isNestedTriggerHoveredRef.current; | |
| 10336 | + } | |
| 10337 | + }); | |
| 10338 | + const focusProps = useFocus(floatingRootContext, { | |
| 10339 | + enabled: !disabled2 | |
| 10340 | + }).reference; | |
| 10341 | + const handleNestedTriggerHover = (event) => { | |
| 10342 | + const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current; | |
| 10343 | + const target = getTargetElement(event); | |
| 10344 | + const nestedTriggerHovered = detectNestedTriggerHover(target); | |
| 10345 | + const triggerEl = triggerElementRef.current; | |
| 10346 | + const targetInsideTrigger = triggerEl && target && contains(triggerEl, target); | |
| 10347 | + if (nestedTriggerHovered && store.select("open") && store.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) { | |
| 10348 | + store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); | |
| 10349 | + return; | |
| 10350 | + } | |
| 10351 | + if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences. | |
| 10352 | + isMouseLikePointerType(pointerTypeRef.current)) { | |
| 10353 | + const open2 = () => { | |
| 10354 | + if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store.select("open")) { | |
| 10355 | + store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl)); | |
| 10356 | + } | |
| 10357 | + }; | |
| 10358 | + const openDelay = getOpenDelay(); | |
| 10359 | + if (openDelay === 0) { | |
| 10360 | + nestedTriggerOpenTimeout.clear(); | |
| 10361 | + open2(); | |
| 10362 | + } else { | |
| 10363 | + nestedTriggerOpenTimeout.start(openDelay, open2); | |
| 10364 | + } | |
| 10365 | + } | |
| 10366 | + }; | |
| 10367 | + const rootTriggerProps = store.useState("triggerProps", isMountedByThisTrigger); | |
| 10368 | + const shouldApplyRootTriggerProps = isMountedByThisTrigger || trackCursorAxis !== "none"; | |
| 10369 | + const state = { | |
| 10370 | + open: isOpenedByThisTrigger | |
| 10371 | + }; | |
| 10372 | + const element = useRenderElement("button", componentProps, { | |
| 10373 | + state, | |
| 10374 | + ref: [forwardedRef, registerTrigger, triggerElementRef], | |
| 10375 | + props: [hoverProps, focusProps, shouldApplyRootTriggerProps ? rootTriggerProps : void 0, { | |
| 10376 | + onMouseOver(event) { | |
| 10377 | + handleNestedTriggerHover(event.nativeEvent); | |
| 10378 | + }, | |
| 10379 | + onFocus(event) { | |
| 10380 | + if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) { | |
| 10381 | + event.preventBaseUIHandler(); | |
| 10382 | + } | |
| 10383 | + }, | |
| 10384 | + onMouseLeave() { | |
| 10385 | + isNestedTriggerHoveredRef.current = false; | |
| 10386 | + nestedTriggerOpenTimeout.clear(); | |
| 10387 | + pointerTypeRef.current = void 0; | |
| 10388 | + }, | |
| 10389 | + onPointerEnter(event) { | |
| 10390 | + pointerTypeRef.current = event.pointerType; | |
| 10391 | + }, | |
| 10392 | + onPointerDown(event) { | |
| 10393 | + pointerTypeRef.current = event.pointerType; | |
| 10394 | + store.set("closeOnClick", closeOnClick); | |
| 10395 | + if (closeOnClick && !store.select("open")) { | |
| 10396 | + store.cancelPendingOpen(event.nativeEvent); | |
| 10397 | + } | |
| 10398 | + }, | |
| 10399 | + onClick(event) { | |
| 10400 | + if (closeOnClick && !store.select("open")) { | |
| 10401 | + store.cancelPendingOpen(event.nativeEvent); | |
| 10402 | + } | |
| 10403 | + }, | |
| 10404 | + id: thisTriggerId, | |
| 10405 | + [triggerDisabled]: disabled2 ? "" : void 0, | |
| 10406 | + [TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : "" | |
| 10407 | + }, elementProps], | |
| 10408 | + stateAttributesMapping: triggerOpenStateMapping | |
| 10409 | + }); | |
| 10410 | + return element; | |
| 10411 | +}); | |
| 10412 | +if (true) TooltipTrigger.displayName = "TooltipTrigger"; | |
| 10413 | + | |
| 10414 | +// node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs | |
| 10415 | +var React64 = __toESM(require_react(), 1); | |
| 10416 | + | |
| 10417 | +// node_modules/@base-ui/react/tooltip/portal/TooltipPortalContext.mjs | |
| 10418 | +var React63 = __toESM(require_react(), 1); | |
| 10419 | +var TooltipPortalContext = /* @__PURE__ */ React63.createContext(void 0); | |
| 10420 | +if (true) TooltipPortalContext.displayName = "TooltipPortalContext"; | |
| 10421 | +function useTooltipPortalContext() { | |
| 10422 | + const value = React63.useContext(TooltipPortalContext); | |
| 10423 | + if (value === void 0) { | |
| 10424 | + throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70)); | |
| 10425 | + } | |
| 10426 | + return value; | |
| 10427 | +} | |
| 10428 | + | |
| 10429 | +// node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs | |
| 10430 | +var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); | |
| 10431 | +var TooltipPortal = /* @__PURE__ */ React64.forwardRef(function TooltipPortal2(props, forwardedRef) { | |
| 10432 | + const { | |
| 10433 | + keepMounted = false, | |
| 10434 | + ...portalProps | |
| 10435 | + } = props; | |
| 10436 | + const store = useTooltipRootContext(); | |
| 10437 | + const mounted = store.useState("mounted"); | |
| 10438 | + const shouldRender = mounted || keepMounted; | |
| 10439 | + if (!shouldRender) { | |
| 10440 | + return null; | |
| 10441 | + } | |
| 10442 | + return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipPortalContext.Provider, { | |
| 10443 | + value: keepMounted, | |
| 10444 | + children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FloatingPortalLite, { | |
| 10445 | + ref: forwardedRef, | |
| 10446 | + ...portalProps | |
| 10447 | + }) | |
| 10448 | + }); | |
| 10449 | +}); | |
| 10450 | +if (true) TooltipPortal.displayName = "TooltipPortal"; | |
| 10451 | + | |
| 10452 | +// node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs | |
| 10453 | +var React66 = __toESM(require_react(), 1); | |
| 10454 | + | |
| 10455 | +// node_modules/@base-ui/react/tooltip/positioner/TooltipPositionerContext.mjs | |
| 10456 | +var React65 = __toESM(require_react(), 1); | |
| 10457 | +var TooltipPositionerContext = /* @__PURE__ */ React65.createContext(void 0); | |
| 10458 | +if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext"; | |
| 10459 | +function useTooltipPositionerContext() { | |
| 10460 | + const context = React65.useContext(TooltipPositionerContext); | |
| 10461 | + if (context === void 0) { | |
| 10462 | + throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71)); | |
| 10463 | + } | |
| 10464 | + return context; | |
| 10465 | +} | |
| 10466 | + | |
| 10467 | +// node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs | |
| 10468 | +var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); | |
| 10469 | +var TooltipPositioner = /* @__PURE__ */ React66.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) { | |
| 10470 | + const { | |
| 10471 | + render: render4, | |
| 10472 | + className, | |
| 10473 | + anchor, | |
| 10474 | + positionMethod = "absolute", | |
| 10475 | + side = "top", | |
| 10476 | + align = "center", | |
| 10477 | + sideOffset = 0, | |
| 10478 | + alignOffset = 0, | |
| 10479 | + collisionBoundary = "clipping-ancestors", | |
| 10480 | + collisionPadding = 5, | |
| 10481 | + arrowPadding = 5, | |
| 10482 | + sticky = false, | |
| 10483 | + disableAnchorTracking = false, | |
| 10484 | + collisionAvoidance = POPUP_COLLISION_AVOIDANCE, | |
| 10485 | + style, | |
| 10486 | + ...elementProps | |
| 10487 | + } = componentProps; | |
| 10488 | + const store = useTooltipRootContext(); | |
| 10489 | + const keepMounted = useTooltipPortalContext(); | |
| 10490 | + const open2 = store.useState("open"); | |
| 10491 | + const mounted = store.useState("mounted"); | |
| 10492 | + const trackCursorAxis = store.useState("trackCursorAxis"); | |
| 10493 | + const disableHoverablePopup = store.useState("disableHoverablePopup"); | |
| 10494 | + const floatingRootContext = store.useState("floatingRootContext"); | |
| 10495 | + const instantType = store.useState("instantType"); | |
| 10496 | + const transitionStatus = store.useState("transitionStatus"); | |
| 10497 | + const adaptiveOrigin2 = store.useState("adaptiveOrigin"); | |
| 10498 | + const positioning = useAnchorPositioning({ | |
| 10499 | + anchor, | |
| 10500 | + positionMethod, | |
| 10501 | + floatingRootContext, | |
| 10502 | + mounted, | |
| 10503 | + side, | |
| 10504 | + sideOffset, | |
| 10505 | + align, | |
| 10506 | + alignOffset, | |
| 10507 | + collisionBoundary, | |
| 10508 | + collisionPadding, | |
| 10509 | + sticky, | |
| 10510 | + arrowPadding, | |
| 10511 | + disableAnchorTracking, | |
| 10512 | + keepMounted, | |
| 10513 | + collisionAvoidance, | |
| 10514 | + adaptiveOrigin: adaptiveOrigin2 | |
| 10515 | + }); | |
| 10516 | + const state = React66.useMemo(() => ({ | |
| 10517 | + open: open2, | |
| 10518 | + side: positioning.side, | |
| 10519 | + align: positioning.align, | |
| 10520 | + anchorHidden: positioning.anchorHidden, | |
| 10521 | + instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType | |
| 10522 | + }), [open2, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]); | |
| 10523 | + const element = usePositioner(componentProps, state, { | |
| 10524 | + styles: positioning.positionerStyles, | |
| 10525 | + transitionStatus, | |
| 10526 | + props: elementProps, | |
| 10527 | + refs: [forwardedRef, store.useStateSetter("positionerElement")], | |
| 10528 | + hidden: !mounted, | |
| 10529 | + inert: !open2 || trackCursorAxis === "both" || disableHoverablePopup | |
| 10530 | + }); | |
| 10531 | + return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TooltipPositionerContext.Provider, { | |
| 10532 | + value: positioning, | |
| 10533 | + children: element | |
| 10534 | + }); | |
| 10535 | +}); | |
| 10536 | +if (true) TooltipPositioner.displayName = "TooltipPositioner"; | |
| 10537 | + | |
| 10538 | +// node_modules/@base-ui/react/tooltip/popup/TooltipPopup.mjs | |
| 10539 | +var React67 = __toESM(require_react(), 1); | |
| 10540 | +var TooltipPopup = /* @__PURE__ */ React67.forwardRef(function TooltipPopup2(componentProps, forwardedRef) { | |
| 10541 | + const { | |
| 10542 | + render: render4, | |
| 10543 | + className, | |
| 10544 | + style, | |
| 10545 | + ...elementProps | |
| 10546 | + } = componentProps; | |
| 10547 | + const store = useTooltipRootContext(); | |
| 10548 | + const { | |
| 10549 | + side, | |
| 10550 | + align | |
| 10551 | + } = useTooltipPositionerContext(); | |
| 10552 | + const open2 = store.useState("open"); | |
| 10553 | + const instantType = store.useState("instantType"); | |
| 10554 | + const transitionStatus = store.useState("transitionStatus"); | |
| 10555 | + const popupProps = store.useState("popupProps"); | |
| 10556 | + const floatingContext = store.useState("floatingRootContext"); | |
| 10557 | + const disabled2 = store.useState("disabled"); | |
| 10558 | + const closeDelay = store.useState("closeDelay"); | |
| 10559 | + useOpenChangeComplete({ | |
| 10560 | + open: open2, | |
| 10561 | + ref: store.context.popupRef, | |
| 10562 | + onComplete() { | |
| 10563 | + if (open2) { | |
| 10564 | + store.context.onOpenChangeComplete?.(true); | |
| 10565 | + } | |
| 10566 | + } | |
| 10567 | + }); | |
| 10568 | + useHoverFloatingInteraction(floatingContext, { | |
| 10569 | + enabled: !disabled2, | |
| 10570 | + closeDelay | |
| 10571 | + }); | |
| 10572 | + const setPopupElement = store.useStateSetter("popupElement"); | |
| 10573 | + const state = { | |
| 10574 | + open: open2, | |
| 10575 | + side, | |
| 10576 | + align, | |
| 10577 | + instant: instantType, | |
| 10578 | + transitionStatus | |
| 10579 | + }; | |
| 10580 | + const element = useRenderElement("div", componentProps, { | |
| 10581 | + state, | |
| 10582 | + ref: [forwardedRef, store.context.popupRef, setPopupElement], | |
| 10583 | + props: [FOCUSABLE_POPUP_PROPS, popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps], | |
| 10584 | + stateAttributesMapping: popupTransitionStateMapping | |
| 10585 | + }); | |
| 10586 | + return element; | |
| 10587 | +}); | |
| 10588 | +if (true) TooltipPopup.displayName = "TooltipPopup"; | |
| 10589 | + | |
| 10590 | +// node_modules/@base-ui/react/tooltip/arrow/TooltipArrow.mjs | |
| 10591 | +var React68 = __toESM(require_react(), 1); | |
| 10592 | +var TooltipArrow = /* @__PURE__ */ React68.forwardRef(function TooltipArrow2(componentProps, forwardedRef) { | |
| 10593 | + const { | |
| 10594 | + render: render4, | |
| 10595 | + className, | |
| 10596 | + style, | |
| 10597 | + ...elementProps | |
| 10598 | + } = componentProps; | |
| 10599 | + const store = useTooltipRootContext(); | |
| 10600 | + const { | |
| 10601 | + arrowRef, | |
| 10602 | + side, | |
| 10603 | + align, | |
| 10604 | + arrowUncentered, | |
| 10605 | + arrowStyles | |
| 10606 | + } = useTooltipPositionerContext(); | |
| 10607 | + const open2 = store.useState("open"); | |
| 10608 | + const instantType = store.useState("instantType"); | |
| 10609 | + const state = { | |
| 10610 | + open: open2, | |
| 10611 | + side, | |
| 10612 | + align, | |
| 10613 | + uncentered: arrowUncentered, | |
| 10614 | + instant: instantType | |
| 10615 | + }; | |
| 10616 | + const element = useRenderElement("div", componentProps, { | |
| 10617 | + state, | |
| 10618 | + ref: [forwardedRef, arrowRef], | |
| 10619 | + props: [{ | |
| 10620 | + style: arrowStyles, | |
| 10621 | + "aria-hidden": true | |
| 10622 | + }, elementProps], | |
| 10623 | + stateAttributesMapping: popupStateMapping | |
| 10624 | + }); | |
| 10625 | + return element; | |
| 10626 | +}); | |
| 10627 | +if (true) TooltipArrow.displayName = "TooltipArrow"; | |
| 10628 | + | |
| 10629 | +// node_modules/@base-ui/react/tooltip/provider/TooltipProvider.mjs | |
| 10630 | +var React69 = __toESM(require_react(), 1); | |
| 10631 | +var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); | |
| 10632 | +var TooltipProvider = function TooltipProvider2(props) { | |
| 10633 | + const { | |
| 10634 | + delay, | |
| 10635 | + closeDelay, | |
| 10636 | + timeout = 400 | |
| 10637 | + } = props; | |
| 10638 | + const delayValue = React69.useMemo(() => ({ | |
| 10639 | + open: delay, | |
| 10640 | + close: closeDelay | |
| 10641 | + }), [delay, closeDelay]); | |
| 10642 | + return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TooltipProviderContext.Provider, { | |
| 10643 | + value: delay, | |
| 10644 | + children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FloatingDelayGroup, { | |
| 10645 | + delay: delayValue, | |
| 10646 | + timeoutMs: timeout, | |
| 10647 | + children: props.children | |
| 10648 | + }) | |
| 10649 | + }); | |
| 10650 | +}; | |
| 10651 | +if (true) TooltipProvider.displayName = "TooltipProvider"; | |
| 10652 | + | |
| 10653 | +// node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs | |
| 10654 | +var React70 = __toESM(require_react(), 1); | |
| 10655 | +var TooltipViewport = /* @__PURE__ */ React70.forwardRef(function TooltipViewport2(componentProps, forwardedRef) { | |
| 10656 | + const { | |
| 10657 | + render: render4, | |
| 10658 | + className, | |
| 10659 | + style, | |
| 10660 | + children, | |
| 10661 | + ...elementProps | |
| 10662 | + } = componentProps; | |
| 10663 | + const store = useTooltipRootContext(); | |
| 10664 | + const positioner = useTooltipPositionerContext(); | |
| 10665 | + const instantType = store.useState("instantType"); | |
| 10666 | + const { | |
| 10667 | + children: childrenToRender, | |
| 10668 | + state: viewportState | |
| 10669 | + } = usePopupViewport({ | |
| 10670 | + store, | |
| 10671 | + side: positioner.side, | |
| 10672 | + children | |
| 10673 | + }); | |
| 10674 | + const state = { | |
| 10675 | + activationDirection: viewportState.activationDirection, | |
| 10676 | + transitioning: viewportState.transitioning, | |
| 10677 | + instant: instantType | |
| 10678 | + }; | |
| 10679 | + return useRenderElement("div", componentProps, { | |
| 10680 | + state, | |
| 10681 | + ref: forwardedRef, | |
| 10682 | + props: [elementProps, { | |
| 10683 | + children: childrenToRender | |
| 10684 | + }], | |
| 10685 | + stateAttributesMapping: popupViewportStateMapping | |
| 10686 | + }); | |
| 10687 | +}); | |
| 10688 | +if (true) TooltipViewport.displayName = "TooltipViewport"; | |
| 10689 | + | |
| 10690 | +// node_modules/@base-ui/react/tooltip/store/TooltipHandle.mjs | |
| 10691 | +var TooltipHandle = class extends BasePopupHandle { | |
| 10692 | + constructor() { | |
| 10693 | + super(createNullTooltipStore(), "Tooltip"); | |
| 10694 | + } | |
| 10695 | + /** | |
| 10696 | + * Opens the tooltip and associates it with the trigger with the given id. | |
| 10697 | + * | |
| 10698 | + * This method should only be called in an event handler or an effect (not during rendering). | |
| 10699 | + * | |
| 10700 | + * @param triggerId ID of the trigger to associate with the tooltip. The trigger must be a matching | |
| 10701 | + * `Tooltip.Trigger` with this handle passed as a prop. | |
| 10702 | + */ | |
| 10703 | + open(triggerId) { | |
| 10704 | + this.openByTrigger(triggerId); | |
| 10705 | + } | |
| 10706 | + /** | |
| 10707 | + * Closes the tooltip. | |
| 10708 | + * | |
| 10709 | + * This method should only be called in an event handler or an effect (not during rendering). | |
| 10710 | + */ | |
| 10711 | + close() { | |
| 10712 | + this.closePopup(); | |
| 10713 | + } | |
| 10714 | + /** | |
| 10715 | + * Whether the tooltip is currently open. Returns `false` while no root is attached to the handle. | |
| 10716 | + */ | |
| 10717 | + get isOpen() { | |
| 10718 | + return this.attachedStore?.select("open") ?? false; | |
| 10719 | + } | |
| 10720 | +}; | |
| 10721 | +function createTooltipHandle() { | |
| 10722 | + return new TooltipHandle(); | |
| 10723 | +} | |
| 10724 | + | |
| 10725 | +// node_modules/@base-ui/react/use-render/useRender.mjs | |
| 10726 | +function useRender(params) { | |
| 10727 | + return useRenderElement(params.defaultTagName ?? "div", params, params); | |
| 10728 | +} | |
| 10729 | + | |
| 10730 | +// packages/ui/build-module/tooltip/popup.mjs | |
| 10731 | +var import_element13 = __toESM(require_element(), 1); | |
| 10732 | + | |
| 10733 | +// packages/ui/build-module/tooltip/portal.mjs | |
| 10734 | +var import_element10 = __toESM(require_element(), 1); | |
| 10735 | + | |
| 10736 | +// packages/ui/build-module/utils/wp-compat-overlay-slot.mjs | |
| 10737 | +var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; | |
| 10738 | +function getRuntime() { | |
| 10739 | + const globalScope = globalThis; | |
| 10740 | + if (globalScope.__wpStyleRuntime) { | |
| 10741 | + return globalScope.__wpStyleRuntime; | |
| 10742 | + } | |
| 10743 | + globalScope.__wpStyleRuntime = { | |
| 10744 | + documents: /* @__PURE__ */ new Map(), | |
| 10745 | + styles: /* @__PURE__ */ new Map(), | |
| 10746 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 10747 | + }; | |
| 10748 | + if (typeof document !== "undefined") { | |
| 10749 | + registerDocument(document); | |
| 10750 | + } | |
| 10751 | + return globalScope.__wpStyleRuntime; | |
| 10752 | +} | |
| 10753 | +function documentContainsStyleHash(targetDocument, hash) { | |
| 10754 | + if (!targetDocument.head) { | |
| 10755 | + return false; | |
| 10756 | + } | |
| 10757 | + for (const style of targetDocument.head.querySelectorAll( | |
| 10758 | + `style[${STYLE_HASH_ATTRIBUTE}]` | |
| 10759 | + )) { | |
| 10760 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) { | |
| 10761 | + return true; | |
| 10762 | + } | |
| 10763 | + } | |
| 10764 | + return false; | |
| 10765 | +} | |
| 10766 | +function injectStyle(targetDocument, hash, css) { | |
| 10767 | + if (!targetDocument.head) { | |
| 10768 | + return; | |
| 10769 | + } | |
| 10770 | + const runtime = getRuntime(); | |
| 10771 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 10772 | + if (!injectedStyles) { | |
| 10773 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 10774 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 10775 | + } | |
| 10776 | + if (injectedStyles.has(hash)) { | |
| 10777 | + return; | |
| 10778 | + } | |
| 10779 | + if (documentContainsStyleHash(targetDocument, hash)) { | |
| 10780 | + injectedStyles.add(hash); | |
| 10781 | + return; | |
| 10782 | + } | |
| 10783 | + const style = targetDocument.createElement("style"); | |
| 10784 | + style.setAttribute(STYLE_HASH_ATTRIBUTE, hash); | |
| 10785 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 10786 | + targetDocument.head.appendChild(style); | |
| 10787 | + injectedStyles.add(hash); | |
| 10788 | +} | |
| 10789 | +function registerDocument(targetDocument) { | |
| 10790 | + const runtime = getRuntime(); | |
| 10791 | + runtime.documents.set( | |
| 10792 | + targetDocument, | |
| 10793 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 153 | 10794 | ); |
| 154 | - const baseView = persistedView ?? defaultView; | |
| 155 | - const page = queryParams?.page ?? 1; | |
| 156 | - const search = queryParams?.search ?? ""; | |
| 157 | - const rawDefaults = config.defaultLayouts?.[baseView?.type]; | |
| 158 | - const layoutTypeDefaults = !rawDefaults || rawDefaults === true ? {} : rawDefaults; | |
| 159 | - const combinedOverrides = { ...layoutTypeDefaults, ...activeViewOverrides }; | |
| 160 | - return mergeActiveViewOverrides( | |
| 161 | - { | |
| 162 | - ...baseView, | |
| 163 | - page, | |
| 164 | - search | |
| 165 | - }, | |
| 166 | - combinedOverrides, | |
| 167 | - defaultView | |
| 10795 | + for (const [hash, css] of runtime.styles) { | |
| 10796 | + injectStyle(targetDocument, hash, css); | |
| 10797 | + } | |
| 10798 | + return () => { | |
| 10799 | + const count = runtime.documents.get(targetDocument); | |
| 10800 | + if (count === void 0) { | |
| 10801 | + return; | |
| 10802 | + } | |
| 10803 | + if (count <= 1) { | |
| 10804 | + runtime.documents.delete(targetDocument); | |
| 10805 | + return; | |
| 10806 | + } | |
| 10807 | + runtime.documents.set(targetDocument, count - 1); | |
| 10808 | + }; | |
| 10809 | +} | |
| 10810 | +function registerStyle(hash, css) { | |
| 10811 | + const runtime = getRuntime(); | |
| 10812 | + runtime.styles.set(hash, css); | |
| 10813 | + for (const targetDocument of runtime.documents.keys()) { | |
| 10814 | + injectStyle(targetDocument, hash, css); | |
| 10815 | + } | |
| 10816 | +} | |
| 10817 | +if (typeof process === "undefined" || true) { | |
| 10818 | + registerStyle("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}}}"); | |
| 10819 | +} | |
| 10820 | +var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" }; | |
| 10821 | +var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot"; | |
| 10822 | +function resolveOwnerDocument() { | |
| 10823 | + return typeof document === "undefined" ? null : document; | |
| 10824 | +} | |
| 10825 | +function isInWordPressEnvironment() { | |
| 10826 | + let topWp; | |
| 10827 | + try { | |
| 10828 | + topWp = window.top?.wp; | |
| 10829 | + } catch { | |
| 10830 | + } | |
| 10831 | + const wp = topWp ?? window.wp; | |
| 10832 | + return typeof wp?.components === "object" && wp.components !== null; | |
| 10833 | +} | |
| 10834 | +var cachedSlot = null; | |
| 10835 | +function ensureSlotIsAccessible(element) { | |
| 10836 | + element.setAttribute("aria-hidden", "false"); | |
| 10837 | + return element; | |
| 10838 | +} | |
| 10839 | +function createSlot(ownerDocument2) { | |
| 10840 | + const element = ownerDocument2.createElement("div"); | |
| 10841 | + element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, ""); | |
| 10842 | + if (wp_compat_overlay_slot_default.slot) { | |
| 10843 | + element.classList.add(wp_compat_overlay_slot_default.slot); | |
| 10844 | + } | |
| 10845 | + ownerDocument2.body.appendChild(element); | |
| 10846 | + return element; | |
| 10847 | +} | |
| 10848 | +function getWpCompatOverlaySlot() { | |
| 10849 | + if (typeof window === "undefined") { | |
| 10850 | + return void 0; | |
| 10851 | + } | |
| 10852 | + if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) { | |
| 10853 | + return void 0; | |
| 10854 | + } | |
| 10855 | + const ownerDocument2 = resolveOwnerDocument(); | |
| 10856 | + if (!ownerDocument2 || !ownerDocument2.body) { | |
| 10857 | + return void 0; | |
| 10858 | + } | |
| 10859 | + if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) { | |
| 10860 | + return ensureSlotIsAccessible(cachedSlot); | |
| 10861 | + } | |
| 10862 | + const existing = ownerDocument2.querySelector( | |
| 10863 | + `[${WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]` | |
| 168 | 10864 | ); |
| 10865 | + if (existing instanceof HTMLDivElement) { | |
| 10866 | + cachedSlot = ensureSlotIsAccessible(existing); | |
| 10867 | + return cachedSlot; | |
| 10868 | + } | |
| 10869 | + if (cachedSlot?.isConnected) { | |
| 10870 | + cachedSlot.remove(); | |
| 10871 | + } | |
| 10872 | + cachedSlot = ensureSlotIsAccessible(createSlot(ownerDocument2)); | |
| 10873 | + return cachedSlot; | |
| 169 | 10874 | } |
| 170 | 10875 | |
| 171 | -// packages/views/build-module/use-view-config.mjs | |
| 172 | -var import_data3 = __toESM(require_data(), 1); | |
| 173 | -var import_core_data = __toESM(require_core_data(), 1); | |
| 10876 | +// packages/ui/build-module/tooltip/portal.mjs | |
| 10877 | +var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); | |
| 10878 | +var Portal = (0, import_element10.forwardRef)( | |
| 10879 | + function TooltipPortal3({ container, ...restProps }, ref) { | |
| 10880 | + return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( | |
| 10881 | + index_parts_exports2.Portal, | |
| 10882 | + { | |
| 10883 | + container: container ?? getWpCompatOverlaySlot(), | |
| 10884 | + ...restProps, | |
| 10885 | + ref | |
| 10886 | + } | |
| 10887 | + ); | |
| 10888 | + } | |
| 10889 | +); | |
| 174 | 10890 | |
| 175 | -// packages/views/build-module/lock-unlock.mjs | |
| 10891 | +// packages/ui/build-module/tooltip/positioner.mjs | |
| 10892 | +var import_element11 = __toESM(require_element(), 1); | |
| 10893 | +var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); | |
| 10894 | +var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash"; | |
| 10895 | +function getRuntime2() { | |
| 10896 | + const globalScope = globalThis; | |
| 10897 | + if (globalScope.__wpStyleRuntime) { | |
| 10898 | + return globalScope.__wpStyleRuntime; | |
| 10899 | + } | |
| 10900 | + globalScope.__wpStyleRuntime = { | |
| 10901 | + documents: /* @__PURE__ */ new Map(), | |
| 10902 | + styles: /* @__PURE__ */ new Map(), | |
| 10903 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 10904 | + }; | |
| 10905 | + if (typeof document !== "undefined") { | |
| 10906 | + registerDocument2(document); | |
| 10907 | + } | |
| 10908 | + return globalScope.__wpStyleRuntime; | |
| 10909 | +} | |
| 10910 | +function documentContainsStyleHash2(targetDocument, hash) { | |
| 10911 | + if (!targetDocument.head) { | |
| 10912 | + return false; | |
| 10913 | + } | |
| 10914 | + for (const style of targetDocument.head.querySelectorAll( | |
| 10915 | + `style[${STYLE_HASH_ATTRIBUTE2}]` | |
| 10916 | + )) { | |
| 10917 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) { | |
| 10918 | + return true; | |
| 10919 | + } | |
| 10920 | + } | |
| 10921 | + return false; | |
| 10922 | +} | |
| 10923 | +function injectStyle2(targetDocument, hash, css) { | |
| 10924 | + if (!targetDocument.head) { | |
| 10925 | + return; | |
| 10926 | + } | |
| 10927 | + const runtime = getRuntime2(); | |
| 10928 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 10929 | + if (!injectedStyles) { | |
| 10930 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 10931 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 10932 | + } | |
| 10933 | + if (injectedStyles.has(hash)) { | |
| 10934 | + return; | |
| 10935 | + } | |
| 10936 | + if (documentContainsStyleHash2(targetDocument, hash)) { | |
| 10937 | + injectedStyles.add(hash); | |
| 10938 | + return; | |
| 10939 | + } | |
| 10940 | + const style = targetDocument.createElement("style"); | |
| 10941 | + style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash); | |
| 10942 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 10943 | + targetDocument.head.appendChild(style); | |
| 10944 | + injectedStyles.add(hash); | |
| 10945 | +} | |
| 10946 | +function registerDocument2(targetDocument) { | |
| 10947 | + const runtime = getRuntime2(); | |
| 10948 | + runtime.documents.set( | |
| 10949 | + targetDocument, | |
| 10950 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 10951 | + ); | |
| 10952 | + for (const [hash, css] of runtime.styles) { | |
| 10953 | + injectStyle2(targetDocument, hash, css); | |
| 10954 | + } | |
| 10955 | + return () => { | |
| 10956 | + const count = runtime.documents.get(targetDocument); | |
| 10957 | + if (count === void 0) { | |
| 10958 | + return; | |
| 10959 | + } | |
| 10960 | + if (count <= 1) { | |
| 10961 | + runtime.documents.delete(targetDocument); | |
| 10962 | + return; | |
| 10963 | + } | |
| 10964 | + runtime.documents.set(targetDocument, count - 1); | |
| 10965 | + }; | |
| 10966 | +} | |
| 10967 | +function registerStyle2(hash, css) { | |
| 10968 | + const runtime = getRuntime2(); | |
| 10969 | + runtime.styles.set(hash, css); | |
| 10970 | + for (const targetDocument of runtime.documents.keys()) { | |
| 10971 | + injectStyle2(targetDocument, hash, css); | |
| 10972 | + } | |
| 10973 | +} | |
| 10974 | +if (typeof process === "undefined" || true) { | |
| 10975 | + registerStyle2("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); | |
| 10976 | +} | |
| 10977 | +var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; | |
| 10978 | +if (typeof process === "undefined" || true) { | |
| 10979 | + registerStyle2("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}}}}'); | |
| 10980 | +} | |
| 10981 | +var style_default = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; | |
| 10982 | +var Positioner = (0, import_element11.forwardRef)( | |
| 10983 | + function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) { | |
| 10984 | + return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( | |
| 10985 | + index_parts_exports2.Positioner, | |
| 10986 | + { | |
| 10987 | + ref, | |
| 10988 | + align, | |
| 10989 | + side, | |
| 10990 | + sideOffset, | |
| 10991 | + ...props, | |
| 10992 | + className: clsx_default( | |
| 10993 | + resets_default["box-sizing"], | |
| 10994 | + style_default.positioner, | |
| 10995 | + className | |
| 10996 | + ) | |
| 10997 | + } | |
| 10998 | + ); | |
| 10999 | + } | |
| 11000 | +); | |
| 11001 | + | |
| 11002 | +// packages/ui/build-module/utils/render-slot-with-children.mjs | |
| 11003 | +var import_element12 = __toESM(require_element(), 1); | |
| 11004 | +function renderSlotWithChildren(slot, defaultSlot, children) { | |
| 11005 | + return (0, import_element12.cloneElement)(slot ?? defaultSlot, { children }); | |
| 11006 | +} | |
| 11007 | + | |
| 11008 | +// packages/ui/build-module/utils/theme-provider.mjs | |
| 11009 | +var theme = __toESM(require_theme(), 1); | |
| 11010 | + | |
| 11011 | +// packages/ui/build-module/lock-unlock.mjs | |
| 176 | 11012 | var import_private_apis = __toESM(require_private_apis(), 1); |
| 177 | 11013 | var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( |
| 178 | 11014 | "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", |
| 179 | - "@wordpress/views" | |
| 11015 | + "@wordpress/ui" | |
| 180 | 11016 | ); |
| 181 | 11017 | |
| 182 | -// routes/template-list/view-utils.ts | |
| 183 | -var DEFAULT_VIEW = { | |
| 184 | - type: "grid", | |
| 185 | - perPage: 20, | |
| 186 | - sort: { | |
| 187 | - field: "title", | |
| 188 | - direction: "asc" | |
| 11018 | +// packages/ui/build-module/utils/theme-provider.mjs | |
| 11019 | +function getThemeProvider() { | |
| 11020 | + const themePackage = theme; | |
| 11021 | + if (themePackage.ThemeProvider) { | |
| 11022 | + return themePackage.ThemeProvider; | |
| 11023 | + } | |
| 11024 | + if (!themePackage.privateApis) { | |
| 11025 | + throw new Error( | |
| 11026 | + "@wordpress/ui: @wordpress/theme must expose `ThemeProvider` or `privateApis.ThemeProvider`." | |
| 11027 | + ); | |
| 11028 | + } | |
| 11029 | + return unlock( | |
| 11030 | + themePackage.privateApis | |
| 11031 | + ).ThemeProvider; | |
| 11032 | +} | |
| 11033 | +var ThemeProvider = getThemeProvider(); | |
| 11034 | + | |
| 11035 | +// packages/ui/build-module/tooltip/popup.mjs | |
| 11036 | +var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); | |
| 11037 | +var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash"; | |
| 11038 | +function getRuntime3() { | |
| 11039 | + const globalScope = globalThis; | |
| 11040 | + if (globalScope.__wpStyleRuntime) { | |
| 11041 | + return globalScope.__wpStyleRuntime; | |
| 11042 | + } | |
| 11043 | + globalScope.__wpStyleRuntime = { | |
| 11044 | + documents: /* @__PURE__ */ new Map(), | |
| 11045 | + styles: /* @__PURE__ */ new Map(), | |
| 11046 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 11047 | + }; | |
| 11048 | + if (typeof document !== "undefined") { | |
| 11049 | + registerDocument3(document); | |
| 11050 | + } | |
| 11051 | + return globalScope.__wpStyleRuntime; | |
| 11052 | +} | |
| 11053 | +function documentContainsStyleHash3(targetDocument, hash) { | |
| 11054 | + if (!targetDocument.head) { | |
| 11055 | + return false; | |
| 11056 | + } | |
| 11057 | + for (const style of targetDocument.head.querySelectorAll( | |
| 11058 | + `style[${STYLE_HASH_ATTRIBUTE3}]` | |
| 11059 | + )) { | |
| 11060 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) { | |
| 11061 | + return true; | |
| 11062 | + } | |
| 11063 | + } | |
| 11064 | + return false; | |
| 11065 | +} | |
| 11066 | +function injectStyle3(targetDocument, hash, css) { | |
| 11067 | + if (!targetDocument.head) { | |
| 11068 | + return; | |
| 11069 | + } | |
| 11070 | + const runtime = getRuntime3(); | |
| 11071 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 11072 | + if (!injectedStyles) { | |
| 11073 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 11074 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 11075 | + } | |
| 11076 | + if (injectedStyles.has(hash)) { | |
| 11077 | + return; | |
| 11078 | + } | |
| 11079 | + if (documentContainsStyleHash3(targetDocument, hash)) { | |
| 11080 | + injectedStyles.add(hash); | |
| 11081 | + return; | |
| 11082 | + } | |
| 11083 | + const style = targetDocument.createElement("style"); | |
| 11084 | + style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash); | |
| 11085 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 11086 | + targetDocument.head.appendChild(style); | |
| 11087 | + injectedStyles.add(hash); | |
| 11088 | +} | |
| 11089 | +function registerDocument3(targetDocument) { | |
| 11090 | + const runtime = getRuntime3(); | |
| 11091 | + runtime.documents.set( | |
| 11092 | + targetDocument, | |
| 11093 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 11094 | + ); | |
| 11095 | + for (const [hash, css] of runtime.styles) { | |
| 11096 | + injectStyle3(targetDocument, hash, css); | |
| 11097 | + } | |
| 11098 | + return () => { | |
| 11099 | + const count = runtime.documents.get(targetDocument); | |
| 11100 | + if (count === void 0) { | |
| 11101 | + return; | |
| 11102 | + } | |
| 11103 | + if (count <= 1) { | |
| 11104 | + runtime.documents.delete(targetDocument); | |
| 11105 | + return; | |
| 11106 | + } | |
| 11107 | + runtime.documents.set(targetDocument, count - 1); | |
| 11108 | + }; | |
| 11109 | +} | |
| 11110 | +function registerStyle3(hash, css) { | |
| 11111 | + const runtime = getRuntime3(); | |
| 11112 | + runtime.styles.set(hash, css); | |
| 11113 | + for (const targetDocument of runtime.documents.keys()) { | |
| 11114 | + injectStyle3(targetDocument, hash, css); | |
| 11115 | + } | |
| 11116 | +} | |
| 11117 | +if (typeof process === "undefined" || true) { | |
| 11118 | + 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}}}}'); | |
| 11119 | +} | |
| 11120 | +var style_default2 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; | |
| 11121 | +var POPUP_COLOR = { background: "#1e1e1e" }; | |
| 11122 | +var Popup = (0, import_element13.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) { | |
| 11123 | + const popupContent = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)( | |
| 11124 | + index_parts_exports2.Popup, | |
| 11125 | + { | |
| 11126 | + ref, | |
| 11127 | + className: clsx_default(style_default2.popup, className), | |
| 11128 | + ...props, | |
| 11129 | + children | |
| 11130 | + } | |
| 11131 | + ) }); | |
| 11132 | + const positionedPopup = renderSlotWithChildren( | |
| 11133 | + positioner, | |
| 11134 | + /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Positioner, {}), | |
| 11135 | + popupContent | |
| 11136 | + ); | |
| 11137 | + return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Portal, {}), positionedPopup); | |
| 11138 | +}); | |
| 11139 | + | |
| 11140 | +// packages/ui/build-module/tooltip/trigger.mjs | |
| 11141 | +var import_element14 = __toESM(require_element(), 1); | |
| 11142 | +var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); | |
| 11143 | +var Trigger = (0, import_element14.forwardRef)( | |
| 11144 | + function TooltipTrigger3(props, ref) { | |
| 11145 | + return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(index_parts_exports2.Trigger, { ref, ...props }); | |
| 11146 | + } | |
| 11147 | +); | |
| 11148 | + | |
| 11149 | +// packages/ui/build-module/utils/direction-provider.mjs | |
| 11150 | +var import_i18n = __toESM(require_i18n(), 1); | |
| 11151 | +var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); | |
| 11152 | +function DirectionProvider3({ children }) { | |
| 11153 | + return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DirectionProvider, { direction: (0, import_i18n.isRTL)() ? "rtl" : "ltr", children }); | |
| 11154 | +} | |
| 11155 | + | |
| 11156 | +// packages/ui/build-module/tooltip/root.mjs | |
| 11157 | +var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); | |
| 11158 | +function Root(props) { | |
| 11159 | + return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DirectionProvider3, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(index_parts_exports2.Root, { ...props }) }); | |
| 11160 | +} | |
| 11161 | + | |
| 11162 | +// packages/icons/build-module/library/chevron-left.mjs | |
| 11163 | +var import_primitives = __toESM(require_primitives(), 1); | |
| 11164 | +var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); | |
| 11165 | +var chevron_left_default = /* @__PURE__ */ (0, import_jsx_runtime24.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_runtime24.jsx)(import_primitives.Path, { d: "M14 6.5L9 12L14 17.5", vectorEffect: "non-scaling-stroke" }) }); | |
| 11166 | + | |
| 11167 | +// packages/icons/build-module/library/chevron-right.mjs | |
| 11168 | +var import_primitives2 = __toESM(require_primitives(), 1); | |
| 11169 | +var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); | |
| 11170 | +var chevron_right_default = /* @__PURE__ */ (0, import_jsx_runtime25.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_runtime25.jsx)(import_primitives2.Path, { d: "M10 6.5L15 12L10 17.5", vectorEffect: "non-scaling-stroke" }) }); | |
| 11171 | + | |
| 11172 | +// packages/icons/build-module/library/envelope.mjs | |
| 11173 | +var import_primitives3 = __toESM(require_primitives(), 1); | |
| 11174 | +var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); | |
| 11175 | +var envelope_default = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives3.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_runtime26.jsx)(import_primitives3.Path, { d: "M20.25 8.5V7C20.25 6.30964 19.6904 5.75 19 5.75H5C4.30964 5.75 3.75 6.30964 3.75 7V8.5M20.25 8.5V17C20.25 17.6904 19.6904 18.25 19 18.25H5C4.30964 18.25 3.75 17.6904 3.75 17V8.5M20.25 8.5L12 14.5L3.75 8.5", vectorEffect: "non-scaling-stroke" }) }); | |
| 11176 | + | |
| 11177 | +// packages/icons/build-module/library/error.mjs | |
| 11178 | +var import_primitives4 = __toESM(require_primitives(), 1); | |
| 11179 | +var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); | |
| 11180 | +var error_default = /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_primitives4.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_runtime27.jsx)(import_primitives4.Path, { d: "M12 9L12 14M12 15.5V17M11.1284 5.04947L3.83827 18.0097C3.46331 18.6763 3.94502 19.5 4.70985 19.5H19.2902C20.055 19.5 20.5367 18.6763 20.1617 18.0097L12.8716 5.04947C12.4893 4.36982 11.5107 4.36982 11.1284 5.04947Z", vectorEffect: "non-scaling-stroke" }) }); | |
| 11181 | + | |
| 11182 | +// packages/icons/build-module/library/link.mjs | |
| 11183 | +var import_primitives5 = __toESM(require_primitives(), 1); | |
| 11184 | +var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); | |
| 11185 | +var link_default = /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_primitives5.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_runtime28.jsx)(import_primitives5.Path, { d: "M9.5 12L14.5 12M10 7.75H8.25C5.90279 7.75 4 9.65279 4 12C4 14.3472 5.90279 16.25 8.25 16.25H10M14 16.25H15.75C18.0972 16.25 20 14.3472 20 12C20 9.65279 18.0972 7.75 15.75 7.75L14 7.75", vectorEffect: "non-scaling-stroke" }) }); | |
| 11186 | + | |
| 11187 | +// packages/icons/build-module/library/mobile.mjs | |
| 11188 | +var import_primitives6 = __toESM(require_primitives(), 1); | |
| 11189 | +var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); | |
| 11190 | +var mobile_default = /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_primitives6.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_runtime29.jsx)(import_primitives6.Path, { d: "M11 16.5H13M16.25 18V6C16.25 5.30964 15.6904 4.75 15 4.75H9C8.30964 4.75 7.75 5.30964 7.75 6L7.75 18C7.75 18.6904 8.30964 19.25 9 19.25H15C15.6904 19.25 16.25 18.6904 16.25 18Z", vectorEffect: "non-scaling-stroke" }) }); | |
| 11191 | + | |
| 11192 | +// packages/icons/build-module/library/published.mjs | |
| 11193 | +var import_primitives7 = __toESM(require_primitives(), 1); | |
| 11194 | +var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); | |
| 11195 | +var published_default = /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ | |
| 11196 | + /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_primitives7.Path, { d: "M12 19.25C16.0041 19.25 19.25 16.0041 19.25 12C19.25 7.99594 16.0041 4.75 12 4.75C7.99594 4.75 4.75 7.99594 4.75 12C4.75 16.0041 7.99594 19.25 12 19.25Z", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }), | |
| 11197 | + /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_primitives7.Path, { d: "M9 12L11 14L15 10", vectorEffect: "non-scaling-stroke" }) | |
| 11198 | +] }); | |
| 11199 | + | |
| 11200 | +// packages/icons/build-module/library/seen.mjs | |
| 11201 | +var import_primitives8 = __toESM(require_primitives(), 1); | |
| 11202 | +var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); | |
| 11203 | +var seen_default = /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ | |
| 11204 | + /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_primitives8.Path, { d: "M20.0645 13C18.5918 10.0366 15.5337 8 12 8C8.46631 8 5.40825 10.0366 3.93555 13", vectorEffect: "non-scaling-stroke" }), | |
| 11205 | + /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_primitives8.Circle, { cx: "12", cy: "12.5", r: "3", fill: "currentColor", vectorEffect: "non-scaling-stroke" }) | |
| 11206 | +] }); | |
| 11207 | + | |
| 11208 | +// packages/icons/build-module/library/unseen.mjs | |
| 11209 | +var import_primitives9 = __toESM(require_primitives(), 1); | |
| 11210 | +var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1); | |
| 11211 | +var unseen_default = /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ | |
| 11212 | + /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_primitives9.Path, { d: "M8 21L10.6587 15.1842M13.1523 9.72929L13.8553 8.19144L16 3.5M20.0645 13C19.2118 11.2841 17.8276 9.87898 16.1272 9M3.93555 13C5.40825 10.0366 8.46631 8 12 8C12.636 8 13.2566 8.06597 13.8553 8.19144M13.1523 9.72929C12.7975 9.58156 12.4083 9.5 12 9.5C10.3431 9.5 9 10.8431 9 12.5C9 13.6747 9.67519 14.6917 10.6587 15.1842M13.1523 9.72929L10.6587 15.1842M13.1755 15.261C14.2481 14.8037 15 13.7397 15 12.5C15 12.1819 14.9505 11.8753 14.8587 11.5876", vectorEffect: "non-scaling-stroke" }), | |
| 11213 | + /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_primitives9.Path, { d: "M12 9.5C10.3431 9.5 9 10.8431 9 12.5C9 13.6747 9.67519 14.6917 10.6587 15.1842L13.1523 9.72929C12.7975 9.58156 12.4083 9.5 12 9.5Z", fill: "currentColor", vectorEffect: "non-scaling-stroke" }) | |
| 11214 | +] }); | |
| 11215 | + | |
| 11216 | +// packages/ui/build-module/icon/icon.mjs | |
| 11217 | +var import_element15 = __toESM(require_element(), 1); | |
| 11218 | +var import_primitives10 = __toESM(require_primitives(), 1); | |
| 11219 | +var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1); | |
| 11220 | +var Icon = (0, import_element15.forwardRef)(function Icon2({ icon, size: size4 = 24, style, ...restProps }, ref) { | |
| 11221 | + const mergedStyle = icon.props.style || style ? { ...icon.props.style, ...style } : void 0; | |
| 11222 | + return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)( | |
| 11223 | + import_primitives10.SVG, | |
| 11224 | + { | |
| 11225 | + ref, | |
| 11226 | + ...icon.props, | |
| 11227 | + ...restProps, | |
| 11228 | + ...mergedStyle ? { style: mergedStyle } : {}, | |
| 11229 | + width: size4, | |
| 11230 | + height: size4 | |
| 11231 | + } | |
| 11232 | + ); | |
| 11233 | +}); | |
| 11234 | + | |
| 11235 | +// packages/ui/build-module/utils/keyboard-shortcut.mjs | |
| 11236 | +var import_element17 = __toESM(require_element(), 1); | |
| 11237 | +var import_i18n2 = __toESM(require_i18n(), 1); | |
| 11238 | + | |
| 11239 | +// packages/ui/build-module/visually-hidden/visually-hidden.mjs | |
| 11240 | +var import_element16 = __toESM(require_element(), 1); | |
| 11241 | +var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash"; | |
| 11242 | +function getRuntime4() { | |
| 11243 | + const globalScope = globalThis; | |
| 11244 | + if (globalScope.__wpStyleRuntime) { | |
| 11245 | + return globalScope.__wpStyleRuntime; | |
| 11246 | + } | |
| 11247 | + globalScope.__wpStyleRuntime = { | |
| 11248 | + documents: /* @__PURE__ */ new Map(), | |
| 11249 | + styles: /* @__PURE__ */ new Map(), | |
| 11250 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 11251 | + }; | |
| 11252 | + if (typeof document !== "undefined") { | |
| 11253 | + registerDocument4(document); | |
| 11254 | + } | |
| 11255 | + return globalScope.__wpStyleRuntime; | |
| 11256 | +} | |
| 11257 | +function documentContainsStyleHash4(targetDocument, hash) { | |
| 11258 | + if (!targetDocument.head) { | |
| 11259 | + return false; | |
| 11260 | + } | |
| 11261 | + for (const style of targetDocument.head.querySelectorAll( | |
| 11262 | + `style[${STYLE_HASH_ATTRIBUTE4}]` | |
| 11263 | + )) { | |
| 11264 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) { | |
| 11265 | + return true; | |
| 11266 | + } | |
| 11267 | + } | |
| 11268 | + return false; | |
| 11269 | +} | |
| 11270 | +function injectStyle4(targetDocument, hash, css) { | |
| 11271 | + if (!targetDocument.head) { | |
| 11272 | + return; | |
| 11273 | + } | |
| 11274 | + const runtime = getRuntime4(); | |
| 11275 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 11276 | + if (!injectedStyles) { | |
| 11277 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 11278 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 11279 | + } | |
| 11280 | + if (injectedStyles.has(hash)) { | |
| 11281 | + return; | |
| 11282 | + } | |
| 11283 | + if (documentContainsStyleHash4(targetDocument, hash)) { | |
| 11284 | + injectedStyles.add(hash); | |
| 11285 | + return; | |
| 11286 | + } | |
| 11287 | + const style = targetDocument.createElement("style"); | |
| 11288 | + style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash); | |
| 11289 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 11290 | + targetDocument.head.appendChild(style); | |
| 11291 | + injectedStyles.add(hash); | |
| 11292 | +} | |
| 11293 | +function registerDocument4(targetDocument) { | |
| 11294 | + const runtime = getRuntime4(); | |
| 11295 | + runtime.documents.set( | |
| 11296 | + targetDocument, | |
| 11297 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 11298 | + ); | |
| 11299 | + for (const [hash, css] of runtime.styles) { | |
| 11300 | + injectStyle4(targetDocument, hash, css); | |
| 11301 | + } | |
| 11302 | + return () => { | |
| 11303 | + const count = runtime.documents.get(targetDocument); | |
| 11304 | + if (count === void 0) { | |
| 11305 | + return; | |
| 11306 | + } | |
| 11307 | + if (count <= 1) { | |
| 11308 | + runtime.documents.delete(targetDocument); | |
| 11309 | + return; | |
| 11310 | + } | |
| 11311 | + runtime.documents.set(targetDocument, count - 1); | |
| 11312 | + }; | |
| 11313 | +} | |
| 11314 | +function registerStyle4(hash, css) { | |
| 11315 | + const runtime = getRuntime4(); | |
| 11316 | + runtime.styles.set(hash, css); | |
| 11317 | + for (const targetDocument of runtime.documents.keys()) { | |
| 11318 | + injectStyle4(targetDocument, hash, css); | |
| 11319 | + } | |
| 11320 | +} | |
| 11321 | +if (typeof process === "undefined" || true) { | |
| 11322 | + registerStyle4("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}}}"); | |
| 11323 | +} | |
| 11324 | +var style_default3 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" }; | |
| 11325 | +var VisuallyHidden = (0, import_element16.forwardRef)( | |
| 11326 | + function VisuallyHidden2({ render: render4, ...restProps }, ref) { | |
| 11327 | + const element = useRender({ | |
| 11328 | + render: render4, | |
| 11329 | + ref, | |
| 11330 | + props: mergeProps( | |
| 11331 | + { className: style_default3["visually-hidden"] }, | |
| 11332 | + restProps, | |
| 11333 | + { | |
| 11334 | + // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it. | |
| 11335 | + "data-visually-hidden": "" | |
| 11336 | + } | |
| 11337 | + ) | |
| 11338 | + }); | |
| 11339 | + return element; | |
| 11340 | + } | |
| 11341 | +); | |
| 11342 | + | |
| 11343 | +// packages/ui/build-module/utils/keyboard-shortcut.mjs | |
| 11344 | +var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1); | |
| 11345 | +function useKeyboardShortcutProps({ | |
| 11346 | + "aria-describedby": ariaDescribedBy, | |
| 11347 | + "aria-keyshortcuts": ariaKeyShortcuts, | |
| 11348 | + shortcut | |
| 11349 | +}) { | |
| 11350 | + const generatedDescriptionId = (0, import_element17.useId)(); | |
| 11351 | + const descriptionId = shortcut ? generatedDescriptionId : void 0; | |
| 11352 | + const describedBy = [ariaDescribedBy, descriptionId].filter(Boolean).join(" "); | |
| 11353 | + return { | |
| 11354 | + descriptionId, | |
| 11355 | + targetProps: { | |
| 11356 | + "aria-describedby": describedBy || void 0, | |
| 11357 | + "aria-keyshortcuts": shortcut?.ariaKeyShortcut ?? ariaKeyShortcuts | |
| 11358 | + } | |
| 11359 | + }; | |
| 11360 | +} | |
| 11361 | +var KeyboardShortcutDescription = (0, import_element17.forwardRef)(function KeyboardShortcutDescription2({ descriptionId, shortcut }, ref) { | |
| 11362 | + return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)( | |
| 11363 | + VisuallyHidden, | |
| 11364 | + { | |
| 11365 | + id: descriptionId, | |
| 11366 | + "aria-hidden": "true", | |
| 11367 | + render: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { ref }), | |
| 11368 | + children: (0, import_i18n2.sprintf)( | |
| 11369 | + /* translators: %s: keyboard shortcut. */ | |
| 11370 | + (0, import_i18n2.__)("Keyboard shortcut: %s"), | |
| 11371 | + shortcut.label ?? shortcut.ariaKeyShortcut | |
| 11372 | + ) | |
| 11373 | + } | |
| 11374 | + ); | |
| 11375 | +}); | |
| 11376 | +var KeyboardShortcutDisplay = (0, import_element17.forwardRef)(function KeyboardShortcutDisplay2({ className, shortcut }, ref) { | |
| 11377 | + return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { ref, "aria-hidden": "true", className, dir: "ltr", children: shortcut.displayShortcut }); | |
| 11378 | +}); | |
| 11379 | + | |
| 11380 | +// packages/ui/build-module/button/button.mjs | |
| 11381 | +var import_element18 = __toESM(require_element(), 1); | |
| 11382 | +var import_i18n3 = __toESM(require_i18n(), 1); | |
| 11383 | +var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1); | |
| 11384 | +import { speak } from "@wordpress/a11y"; | |
| 11385 | +var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash"; | |
| 11386 | +function getRuntime5() { | |
| 11387 | + const globalScope = globalThis; | |
| 11388 | + if (globalScope.__wpStyleRuntime) { | |
| 11389 | + return globalScope.__wpStyleRuntime; | |
| 11390 | + } | |
| 11391 | + globalScope.__wpStyleRuntime = { | |
| 11392 | + documents: /* @__PURE__ */ new Map(), | |
| 11393 | + styles: /* @__PURE__ */ new Map(), | |
| 11394 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 11395 | + }; | |
| 11396 | + if (typeof document !== "undefined") { | |
| 11397 | + registerDocument5(document); | |
| 11398 | + } | |
| 11399 | + return globalScope.__wpStyleRuntime; | |
| 11400 | +} | |
| 11401 | +function documentContainsStyleHash5(targetDocument, hash) { | |
| 11402 | + if (!targetDocument.head) { | |
| 11403 | + return false; | |
| 11404 | + } | |
| 11405 | + for (const style of targetDocument.head.querySelectorAll( | |
| 11406 | + `style[${STYLE_HASH_ATTRIBUTE5}]` | |
| 11407 | + )) { | |
| 11408 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) { | |
| 11409 | + return true; | |
| 11410 | + } | |
| 11411 | + } | |
| 11412 | + return false; | |
| 11413 | +} | |
| 11414 | +function injectStyle5(targetDocument, hash, css) { | |
| 11415 | + if (!targetDocument.head) { | |
| 11416 | + return; | |
| 11417 | + } | |
| 11418 | + const runtime = getRuntime5(); | |
| 11419 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 11420 | + if (!injectedStyles) { | |
| 11421 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 11422 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 11423 | + } | |
| 11424 | + if (injectedStyles.has(hash)) { | |
| 11425 | + return; | |
| 11426 | + } | |
| 11427 | + if (documentContainsStyleHash5(targetDocument, hash)) { | |
| 11428 | + injectedStyles.add(hash); | |
| 11429 | + return; | |
| 11430 | + } | |
| 11431 | + const style = targetDocument.createElement("style"); | |
| 11432 | + style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash); | |
| 11433 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 11434 | + targetDocument.head.appendChild(style); | |
| 11435 | + injectedStyles.add(hash); | |
| 11436 | +} | |
| 11437 | +function registerDocument5(targetDocument) { | |
| 11438 | + const runtime = getRuntime5(); | |
| 11439 | + runtime.documents.set( | |
| 11440 | + targetDocument, | |
| 11441 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 11442 | + ); | |
| 11443 | + for (const [hash, css] of runtime.styles) { | |
| 11444 | + injectStyle5(targetDocument, hash, css); | |
| 11445 | + } | |
| 11446 | + return () => { | |
| 11447 | + const count = runtime.documents.get(targetDocument); | |
| 11448 | + if (count === void 0) { | |
| 11449 | + return; | |
| 11450 | + } | |
| 11451 | + if (count <= 1) { | |
| 11452 | + runtime.documents.delete(targetDocument); | |
| 11453 | + return; | |
| 11454 | + } | |
| 11455 | + runtime.documents.set(targetDocument, count - 1); | |
| 11456 | + }; | |
| 11457 | +} | |
| 11458 | +function registerStyle5(hash, css) { | |
| 11459 | + const runtime = getRuntime5(); | |
| 11460 | + runtime.styles.set(hash, css); | |
| 11461 | + for (const targetDocument of runtime.documents.keys()) { | |
| 11462 | + injectStyle5(targetDocument, hash, css); | |
| 11463 | + } | |
| 11464 | +} | |
| 11465 | +if (typeof process === "undefined" || true) { | |
| 11466 | + registerStyle5("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)}}}'); | |
| 11467 | +} | |
| 11468 | +var style_default4 = { "button": "_97b0fc33c028be1a__button", "is-unstyled": "abbb272e2ce49bd6__is-unstyled", "is-loading": "_914b42f315c0e580__is-loading", "is-small": "_908205475f9f2a92__is-small", "icon": "_9f6fc6553aeb36fe__icon", "is-brand": "dd460c965226cc77__is-brand", "is-outline": "_62d5a778b7b258ee__is-outline", "is-minimal": "ad0619a3217c6a5b__is-minimal", "is-neutral": "e722a8f96726aa99__is-neutral", "is-solid": "b50b3358c5fb4d0b__is-solid", "is-compact": "cf59cf1b69629838__is-compact", "loading-animation": "_5a1d53da6f830c8d__loading-animation" }; | |
| 11469 | +if (typeof process === "undefined" || true) { | |
| 11470 | + registerStyle5("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); | |
| 11471 | +} | |
| 11472 | +var resets_default2 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; | |
| 11473 | +if (typeof process === "undefined" || true) { | |
| 11474 | + registerStyle5("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))}}}"); | |
| 11475 | +} | |
| 11476 | +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" }; | |
| 11477 | +if (typeof process === "undefined" || true) { | |
| 11478 | + registerStyle5("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)}"); | |
| 11479 | +} | |
| 11480 | +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" }; | |
| 11481 | +var Button3 = (0, import_element18.forwardRef)( | |
| 11482 | + function Button22({ | |
| 11483 | + tone = "brand", | |
| 11484 | + variant = "solid", | |
| 11485 | + size: size4 = "default", | |
| 11486 | + className, | |
| 11487 | + focusableWhenDisabled = true, | |
| 11488 | + disabled: disabled2, | |
| 11489 | + loading, | |
| 11490 | + loadingAnnouncement = (0, import_i18n3.__)("Loading"), | |
| 11491 | + children, | |
| 11492 | + ...props | |
| 11493 | + }, ref) { | |
| 11494 | + const mergedClassName = clsx_default( | |
| 11495 | + global_css_defense_default.button, | |
| 11496 | + resets_default2["box-sizing"], | |
| 11497 | + focus_module_default["outset-ring--focus-except-active"], | |
| 11498 | + variant !== "unstyled" && style_default4.button, | |
| 11499 | + style_default4[`is-${tone}`], | |
| 11500 | + style_default4[`is-${variant}`], | |
| 11501 | + style_default4[`is-${size4}`], | |
| 11502 | + loading && style_default4["is-loading"], | |
| 11503 | + className | |
| 11504 | + ); | |
| 11505 | + (0, import_element18.useEffect)(() => { | |
| 11506 | + if (loading && loadingAnnouncement) { | |
| 11507 | + speak(loadingAnnouncement); | |
| 11508 | + } | |
| 11509 | + }, [loading, loadingAnnouncement]); | |
| 11510 | + return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( | |
| 11511 | + Button, | |
| 11512 | + { | |
| 11513 | + ref, | |
| 11514 | + className: mergedClassName, | |
| 11515 | + focusableWhenDisabled, | |
| 11516 | + disabled: disabled2 ?? loading, | |
| 11517 | + ...props, | |
| 11518 | + children | |
| 11519 | + } | |
| 11520 | + ); | |
| 11521 | + } | |
| 11522 | +); | |
| 11523 | + | |
| 11524 | +// packages/ui/build-module/button/icon.mjs | |
| 11525 | +var import_element19 = __toESM(require_element(), 1); | |
| 11526 | +var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1); | |
| 11527 | +var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash"; | |
| 11528 | +function getRuntime6() { | |
| 11529 | + const globalScope = globalThis; | |
| 11530 | + if (globalScope.__wpStyleRuntime) { | |
| 11531 | + return globalScope.__wpStyleRuntime; | |
| 11532 | + } | |
| 11533 | + globalScope.__wpStyleRuntime = { | |
| 11534 | + documents: /* @__PURE__ */ new Map(), | |
| 11535 | + styles: /* @__PURE__ */ new Map(), | |
| 11536 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 11537 | + }; | |
| 11538 | + if (typeof document !== "undefined") { | |
| 11539 | + registerDocument6(document); | |
| 11540 | + } | |
| 11541 | + return globalScope.__wpStyleRuntime; | |
| 11542 | +} | |
| 11543 | +function documentContainsStyleHash6(targetDocument, hash) { | |
| 11544 | + if (!targetDocument.head) { | |
| 11545 | + return false; | |
| 11546 | + } | |
| 11547 | + for (const style of targetDocument.head.querySelectorAll( | |
| 11548 | + `style[${STYLE_HASH_ATTRIBUTE6}]` | |
| 11549 | + )) { | |
| 11550 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) { | |
| 11551 | + return true; | |
| 11552 | + } | |
| 11553 | + } | |
| 11554 | + return false; | |
| 11555 | +} | |
| 11556 | +function injectStyle6(targetDocument, hash, css) { | |
| 11557 | + if (!targetDocument.head) { | |
| 11558 | + return; | |
| 11559 | + } | |
| 11560 | + const runtime = getRuntime6(); | |
| 11561 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 11562 | + if (!injectedStyles) { | |
| 11563 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 11564 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 11565 | + } | |
| 11566 | + if (injectedStyles.has(hash)) { | |
| 11567 | + return; | |
| 11568 | + } | |
| 11569 | + if (documentContainsStyleHash6(targetDocument, hash)) { | |
| 11570 | + injectedStyles.add(hash); | |
| 11571 | + return; | |
| 11572 | + } | |
| 11573 | + const style = targetDocument.createElement("style"); | |
| 11574 | + style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash); | |
| 11575 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 11576 | + targetDocument.head.appendChild(style); | |
| 11577 | + injectedStyles.add(hash); | |
| 11578 | +} | |
| 11579 | +function registerDocument6(targetDocument) { | |
| 11580 | + const runtime = getRuntime6(); | |
| 11581 | + runtime.documents.set( | |
| 11582 | + targetDocument, | |
| 11583 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 11584 | + ); | |
| 11585 | + for (const [hash, css] of runtime.styles) { | |
| 11586 | + injectStyle6(targetDocument, hash, css); | |
| 11587 | + } | |
| 11588 | + return () => { | |
| 11589 | + const count = runtime.documents.get(targetDocument); | |
| 11590 | + if (count === void 0) { | |
| 11591 | + return; | |
| 11592 | + } | |
| 11593 | + if (count <= 1) { | |
| 11594 | + runtime.documents.delete(targetDocument); | |
| 11595 | + return; | |
| 11596 | + } | |
| 11597 | + runtime.documents.set(targetDocument, count - 1); | |
| 11598 | + }; | |
| 11599 | +} | |
| 11600 | +function registerStyle6(hash, css) { | |
| 11601 | + const runtime = getRuntime6(); | |
| 11602 | + runtime.styles.set(hash, css); | |
| 11603 | + for (const targetDocument of runtime.documents.keys()) { | |
| 11604 | + injectStyle6(targetDocument, hash, css); | |
| 11605 | + } | |
| 11606 | +} | |
| 11607 | +if (typeof process === "undefined" || true) { | |
| 11608 | + 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)}}}'); | |
| 11609 | +} | |
| 11610 | +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" }; | |
| 11611 | +var ButtonIcon = (0, import_element19.forwardRef)( | |
| 11612 | + function ButtonIcon2({ className, icon, ...props }, ref) { | |
| 11613 | + return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( | |
| 11614 | + Icon, | |
| 11615 | + { | |
| 11616 | + ref, | |
| 11617 | + icon, | |
| 11618 | + className: clsx_default(style_default5.icon, className), | |
| 11619 | + size: 24, | |
| 11620 | + ...props | |
| 11621 | + } | |
| 11622 | + ); | |
| 11623 | + } | |
| 11624 | +); | |
| 11625 | + | |
| 11626 | +// packages/ui/build-module/button/index.mjs | |
| 11627 | +ButtonIcon.displayName = "Button.Icon"; | |
| 11628 | +var Button4 = Object.assign(Button3, { | |
| 11629 | + /** | |
| 11630 | + * An icon component specifically designed to work well when rendered inside | |
| 11631 | + * a `Button` component. | |
| 11632 | + */ | |
| 11633 | + Icon: ButtonIcon | |
| 11634 | +}); | |
| 11635 | + | |
| 11636 | +// node_modules/@date-fns/tz/tzName/index.js | |
| 11637 | +function tzName(timeZone, date, format7 = "long") { | |
| 11638 | + return new Intl.DateTimeFormat("en-US", { | |
| 11639 | + // Enforces engine to render the time. Without the option JavaScriptCore omits it. | |
| 11640 | + hour: "numeric", | |
| 11641 | + timeZone, | |
| 11642 | + timeZoneName: format7 | |
| 11643 | + }).format(date).split(/\s/g).slice(2).join(" "); | |
| 11644 | +} | |
| 11645 | + | |
| 11646 | +// node_modules/@date-fns/tz/tzOffset/index.js | |
| 11647 | +var offsetFormatCache = {}; | |
| 11648 | +var offsetCache = {}; | |
| 11649 | +function tzOffset(timeZone, date) { | |
| 11650 | + try { | |
| 11651 | + const format7 = offsetFormatCache[timeZone] ||= new Intl.DateTimeFormat("en-US", { | |
| 11652 | + timeZone, | |
| 11653 | + timeZoneName: "longOffset" | |
| 11654 | + }).format; | |
| 11655 | + const offsetStr = format7(date).split("GMT")[1]; | |
| 11656 | + if (offsetStr in offsetCache) return offsetCache[offsetStr]; | |
| 11657 | + return calcOffset(offsetStr, offsetStr.split(":")); | |
| 11658 | + } catch { | |
| 11659 | + if (timeZone in offsetCache) return offsetCache[timeZone]; | |
| 11660 | + const captures = timeZone?.match(offsetRe); | |
| 11661 | + if (captures) return calcOffset(timeZone, captures.slice(1)); | |
| 11662 | + return NaN; | |
| 11663 | + } | |
| 11664 | +} | |
| 11665 | +var offsetRe = /([+-]\d\d):?(\d\d)?/; | |
| 11666 | +function calcOffset(cacheStr, values) { | |
| 11667 | + const hours = +(values[0] || 0); | |
| 11668 | + const minutes = +(values[1] || 0); | |
| 11669 | + const seconds = +(values[2] || 0) / 60; | |
| 11670 | + return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds; | |
| 11671 | +} | |
| 11672 | + | |
| 11673 | +// node_modules/@date-fns/tz/date/mini.js | |
| 11674 | +var TZDateMini = class _TZDateMini extends Date { | |
| 11675 | + //#region static | |
| 11676 | + constructor(...args) { | |
| 11677 | + super(); | |
| 11678 | + if (args.length > 1 && typeof args[args.length - 1] === "string") { | |
| 11679 | + this.timeZone = args.pop(); | |
| 11680 | + } | |
| 11681 | + this.internal = /* @__PURE__ */ new Date(); | |
| 11682 | + if (isNaN(tzOffset(this.timeZone, this))) { | |
| 11683 | + this.setTime(NaN); | |
| 11684 | + } else { | |
| 11685 | + if (!args.length) { | |
| 11686 | + this.setTime(Date.now()); | |
| 11687 | + } else if (typeof args[0] === "number" && (args.length === 1 || args.length === 2 && typeof args[1] !== "number")) { | |
| 11688 | + this.setTime(args[0]); | |
| 11689 | + } else if (typeof args[0] === "string") { | |
| 11690 | + this.setTime(+new Date(args[0])); | |
| 11691 | + } else if (args[0] instanceof Date) { | |
| 11692 | + this.setTime(+args[0]); | |
| 11693 | + } else { | |
| 11694 | + this.setTime(+new Date(...args)); | |
| 11695 | + adjustToSystemTZ(this, args); | |
| 11696 | + } | |
| 11697 | + } | |
| 11698 | + } | |
| 11699 | + static tz(tz, ...args) { | |
| 11700 | + return args.length ? new _TZDateMini(...args, tz) : new _TZDateMini(Date.now(), tz); | |
| 11701 | + } | |
| 11702 | + //#endregion | |
| 11703 | + //#region time zone | |
| 11704 | + withTimeZone(timeZone) { | |
| 11705 | + return new _TZDateMini(+this, timeZone); | |
| 11706 | + } | |
| 11707 | + getTimezoneOffset() { | |
| 11708 | + const offset4 = -tzOffset(this.timeZone, this); | |
| 11709 | + return offset4 > 0 ? Math.floor(offset4) : Math.ceil(offset4); | |
| 11710 | + } | |
| 11711 | + //#endregion | |
| 11712 | + //#region time | |
| 11713 | + setTime(_time) { | |
| 11714 | + Date.prototype.setTime.apply(this, arguments); | |
| 11715 | + syncToInternal(this); | |
| 11716 | + return +this; | |
| 11717 | + } | |
| 11718 | + //#endregion | |
| 11719 | + //#region date-fns integration | |
| 11720 | + [/* @__PURE__ */ Symbol.for("constructDateFrom")](date) { | |
| 11721 | + return new _TZDateMini(+new Date(date), this.timeZone); | |
| 11722 | + } | |
| 11723 | + //#endregion | |
| 11724 | +}; | |
| 11725 | +var re = /^(get|set)(?!UTC)/; | |
| 11726 | +Object.getOwnPropertyNames(Date.prototype).forEach((method) => { | |
| 11727 | + if (!re.test(method)) return; | |
| 11728 | + const utcMethod = method.replace(re, "$1UTC"); | |
| 11729 | + if (!TZDateMini.prototype[utcMethod]) return; | |
| 11730 | + if (method.startsWith("get")) { | |
| 11731 | + TZDateMini.prototype[method] = function() { | |
| 11732 | + return this.internal[utcMethod](); | |
| 11733 | + }; | |
| 11734 | + } else { | |
| 11735 | + TZDateMini.prototype[method] = function() { | |
| 11736 | + Date.prototype[utcMethod].apply(this.internal, arguments); | |
| 11737 | + syncFromInternal(this); | |
| 11738 | + return +this; | |
| 11739 | + }; | |
| 11740 | + TZDateMini.prototype[utcMethod] = function() { | |
| 11741 | + Date.prototype[utcMethod].apply(this, arguments); | |
| 11742 | + syncToInternal(this); | |
| 11743 | + return +this; | |
| 11744 | + }; | |
| 11745 | + } | |
| 11746 | +}); | |
| 11747 | +function syncToInternal(date) { | |
| 11748 | + date.internal.setTime(+date); | |
| 11749 | + date.internal.setUTCSeconds(date.internal.getUTCSeconds() - // Round after converting minutes to seconds to avoid fractional offset | |
| 11750 | + // precision errors from historical offsets. | |
| 11751 | + Math.round(-tzOffset(date.timeZone, date) * 60)); | |
| 11752 | +} | |
| 11753 | +function syncFromInternal(date) { | |
| 11754 | + Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate()); | |
| 11755 | + Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds()); | |
| 11756 | + adjustToSystemTZ(date); | |
| 11757 | +} | |
| 11758 | +function adjustToSystemTZ(date, constructorArgs) { | |
| 11759 | + const expectedInternalTime = Array.isArray(constructorArgs) ? constructorArgsToInternalTime(constructorArgs) : +date.internal; | |
| 11760 | + const offsetWithSeconds = tzOffset(date.timeZone, date); | |
| 11761 | + const offset4 = offsetWithSeconds > 0 ? Math.floor(offsetWithSeconds) : Math.ceil(offsetWithSeconds); | |
| 11762 | + const prevHour = /* @__PURE__ */ new Date(+date); | |
| 11763 | + prevHour.setUTCHours(prevHour.getUTCHours() - 1); | |
| 11764 | + const systemOffset = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset(); | |
| 11765 | + const prevHourSystemOffset = -(/* @__PURE__ */ new Date(+prevHour)).getTimezoneOffset(); | |
| 11766 | + const systemDSTChange = systemOffset - prevHourSystemOffset; | |
| 11767 | + let systemOffsetForDiff = systemOffset; | |
| 11768 | + if (systemDSTChange && systemOffset !== offset4) { | |
| 11769 | + const systemHour = Date.prototype.getHours.apply(date); | |
| 11770 | + const expectedHour = Array.isArray(constructorArgs) ? constructorArgs[3] || 0 : date.internal.getUTCHours(); | |
| 11771 | + if (systemHour !== expectedHour) { | |
| 11772 | + const testDate = /* @__PURE__ */ new Date(+date); | |
| 11773 | + const testOffsetDiff = systemOffset - offset4; | |
| 11774 | + if (testOffsetDiff) testDate.setUTCMinutes(testDate.getUTCMinutes() + testOffsetDiff); | |
| 11775 | + const testOffsetWithSeconds = tzOffset(date.timeZone, testDate); | |
| 11776 | + const testOffset = testOffsetWithSeconds > 0 ? Math.floor(testOffsetWithSeconds) : Math.ceil(testOffsetWithSeconds); | |
| 11777 | + if (testOffset === offset4) systemOffsetForDiff = prevHourSystemOffset; | |
| 11778 | + } | |
| 11779 | + } | |
| 11780 | + const offsetDiff = systemOffsetForDiff - offset4; | |
| 11781 | + if (offsetDiff) | |
| 11782 | + Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff); | |
| 11783 | + const systemDate = /* @__PURE__ */ new Date(+date); | |
| 11784 | + systemDate.setUTCSeconds(0); | |
| 11785 | + const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60; | |
| 11786 | + const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60; | |
| 11787 | + if (secondsOffset || systemSecondsOffset) | |
| 11788 | + Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset); | |
| 11789 | + const postOffsetWithSeconds = tzOffset(date.timeZone, date); | |
| 11790 | + const postOffset = postOffsetWithSeconds > 0 ? Math.floor(postOffsetWithSeconds) : Math.ceil(postOffsetWithSeconds); | |
| 11791 | + const postSystemOffset = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset(); | |
| 11792 | + const postOffsetDiff = postSystemOffset - postOffset; | |
| 11793 | + const offsetChanged = postOffset !== offset4; | |
| 11794 | + const postDiff = postOffsetDiff - offsetDiff; | |
| 11795 | + const targetDSTShift = postOffset - offset4; | |
| 11796 | + const postOffsetCandidate = expectedInternalTime - postOffset * 60 * 1e3; | |
| 11797 | + const normalizedTargetDSTGap = targetDSTShift > 0 && targetInternalTime(date) - expectedInternalTime === targetDSTShift * 60 * 1e3 && targetInternalTime(date, postOffsetCandidate) !== expectedInternalTime; | |
| 11798 | + if (offsetChanged && postDiff && !normalizedTargetDSTGap) { | |
| 11799 | + Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff); | |
| 11800 | + const newOffsetWithSeconds = tzOffset(date.timeZone, date); | |
| 11801 | + const newOffset = newOffsetWithSeconds > 0 ? Math.floor(newOffsetWithSeconds) : Math.ceil(newOffsetWithSeconds); | |
| 11802 | + const offsetChange = postOffset - newOffset; | |
| 11803 | + if (offsetChange && postDiff < 0) { | |
| 11804 | + Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetChange); | |
| 11805 | + } | |
| 11806 | + } | |
| 11807 | + syncToInternal(date); | |
| 11808 | + const expectedTime = constructorArgs ? expectedInternalTime : expectedInternalTime + secondsOffset * 1e3; | |
| 11809 | + const drift = expectedTime - +date.internal; | |
| 11810 | + if (drift && Math.abs(drift) < 30 * 60 * 1e3) { | |
| 11811 | + Date.prototype.setTime.call(date, +date + drift); | |
| 11812 | + syncToInternal(date); | |
| 11813 | + } | |
| 11814 | +} | |
| 11815 | +function constructorArgsToInternalTime(args) { | |
| 11816 | + return Date.UTC(args[0], args.length > 1 ? args[1] : 0, args.length > 2 ? args[2] : 1, ...args.slice(3)); | |
| 11817 | +} | |
| 11818 | +function targetInternalTime(date, time) { | |
| 11819 | + const internal = new Date(time ?? +date); | |
| 11820 | + internal.setUTCSeconds(internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, internal) * 60)); | |
| 11821 | + return +internal; | |
| 11822 | +} | |
| 11823 | + | |
| 11824 | +// node_modules/@date-fns/tz/date/index.js | |
| 11825 | +var TZDate = class _TZDate extends TZDateMini { | |
| 11826 | + //#region static | |
| 11827 | + static tz(tz, ...args) { | |
| 11828 | + return args.length ? new _TZDate(...args, tz) : new _TZDate(Date.now(), tz); | |
| 11829 | + } | |
| 11830 | + //#endregion | |
| 11831 | + //#region representation | |
| 11832 | + toISOString() { | |
| 11833 | + const [sign, hours, minutes] = this.tzComponents(); | |
| 11834 | + const tz = `${sign}${hours}:${minutes}`; | |
| 11835 | + return this.internal.toISOString().slice(0, -1) + tz; | |
| 11836 | + } | |
| 11837 | + toString() { | |
| 11838 | + return `${this.toDateString()} ${this.toTimeString()}`; | |
| 11839 | + } | |
| 11840 | + toDateString() { | |
| 11841 | + const [day, date, month, year] = this.internal.toUTCString().split(" "); | |
| 11842 | + return `${day?.slice(0, -1)} ${month} ${date} ${year}`; | |
| 11843 | + } | |
| 11844 | + toTimeString() { | |
| 11845 | + const time = this.internal.toUTCString().split(" ")[4]; | |
| 11846 | + const [sign, hours, minutes] = this.tzComponents(); | |
| 11847 | + return `${time} GMT${sign}${hours}${minutes} (${tzName(this.timeZone, this)})`; | |
| 11848 | + } | |
| 11849 | + toLocaleString(locales, options) { | |
| 11850 | + return Date.prototype.toLocaleString.call(this, locales, { | |
| 11851 | + ...options, | |
| 11852 | + timeZone: options?.timeZone || this.timeZone | |
| 11853 | + }); | |
| 11854 | + } | |
| 11855 | + toLocaleDateString(locales, options) { | |
| 11856 | + return Date.prototype.toLocaleDateString.call(this, locales, { | |
| 11857 | + ...options, | |
| 11858 | + timeZone: options?.timeZone || this.timeZone | |
| 11859 | + }); | |
| 11860 | + } | |
| 11861 | + toLocaleTimeString(locales, options) { | |
| 11862 | + return Date.prototype.toLocaleTimeString.call(this, locales, { | |
| 11863 | + ...options, | |
| 11864 | + timeZone: options?.timeZone || this.timeZone | |
| 11865 | + }); | |
| 11866 | + } | |
| 11867 | + //#endregion | |
| 11868 | + //#region private | |
| 11869 | + tzComponents() { | |
| 11870 | + const offset4 = this.getTimezoneOffset(); | |
| 11871 | + const sign = offset4 > 0 ? "-" : "+"; | |
| 11872 | + const hours = String(Math.floor(Math.abs(offset4) / 60)).padStart(2, "0"); | |
| 11873 | + const minutes = String(Math.abs(offset4) % 60).padStart(2, "0"); | |
| 11874 | + return [sign, hours, minutes]; | |
| 11875 | + } | |
| 11876 | + //#endregion | |
| 11877 | + withTimeZone(timeZone) { | |
| 11878 | + return new _TZDate(+this, timeZone); | |
| 11879 | + } | |
| 11880 | + //#region date-fns integration | |
| 11881 | + [/* @__PURE__ */ Symbol.for("constructDateFrom")](date) { | |
| 11882 | + return new _TZDate(+new Date(date), this.timeZone); | |
| 11883 | + } | |
| 11884 | + //#endregion | |
| 11885 | +}; | |
| 11886 | + | |
| 11887 | +// node_modules/date-fns/constants.js | |
| 11888 | +var daysInYear = 365.2425; | |
| 11889 | +var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3; | |
| 11890 | +var minTime = -maxTime; | |
| 11891 | +var millisecondsInWeek = 6048e5; | |
| 11892 | +var millisecondsInDay = 864e5; | |
| 11893 | +var millisecondsInMinute = 6e4; | |
| 11894 | +var millisecondsInHour = 36e5; | |
| 11895 | +var millisecondsInSecond = 1e3; | |
| 11896 | +var secondsInHour = 3600; | |
| 11897 | +var secondsInDay = secondsInHour * 24; | |
| 11898 | +var secondsInWeek = secondsInDay * 7; | |
| 11899 | +var secondsInYear = secondsInDay * daysInYear; | |
| 11900 | +var secondsInMonth = secondsInYear / 12; | |
| 11901 | +var secondsInQuarter = secondsInMonth * 3; | |
| 11902 | +var constructFromSymbol = /* @__PURE__ */ Symbol.for("constructDateFrom"); | |
| 11903 | + | |
| 11904 | +// node_modules/date-fns/constructFrom.js | |
| 11905 | +function constructFrom(date, value) { | |
| 11906 | + if (typeof date === "function") return date(value); | |
| 11907 | + if (date && typeof date === "object" && constructFromSymbol in date) | |
| 11908 | + return date[constructFromSymbol](value); | |
| 11909 | + if (date instanceof Date) return new date.constructor(value); | |
| 11910 | + return new Date(value); | |
| 11911 | +} | |
| 11912 | + | |
| 11913 | +// node_modules/date-fns/toDate.js | |
| 11914 | +function toDate(argument, context) { | |
| 11915 | + return constructFrom(context || argument, argument); | |
| 11916 | +} | |
| 11917 | + | |
| 11918 | +// node_modules/date-fns/addDays.js | |
| 11919 | +function addDays(date, amount, options) { | |
| 11920 | + const _date = toDate(date, options?.in); | |
| 11921 | + if (isNaN(amount)) return constructFrom(options?.in || date, NaN); | |
| 11922 | + if (!amount) return _date; | |
| 11923 | + _date.setDate(_date.getDate() + amount); | |
| 11924 | + return _date; | |
| 11925 | +} | |
| 11926 | + | |
| 11927 | +// node_modules/date-fns/addMonths.js | |
| 11928 | +function addMonths(date, amount, options) { | |
| 11929 | + const _date = toDate(date, options?.in); | |
| 11930 | + if (isNaN(amount)) return constructFrom(options?.in || date, NaN); | |
| 11931 | + if (!amount) { | |
| 11932 | + return _date; | |
| 11933 | + } | |
| 11934 | + const dayOfMonth = _date.getDate(); | |
| 11935 | + const endOfDesiredMonth = constructFrom(options?.in || date, _date.getTime()); | |
| 11936 | + endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0); | |
| 11937 | + const daysInMonth = endOfDesiredMonth.getDate(); | |
| 11938 | + if (dayOfMonth >= daysInMonth) { | |
| 11939 | + return endOfDesiredMonth; | |
| 11940 | + } else { | |
| 11941 | + _date.setFullYear( | |
| 11942 | + endOfDesiredMonth.getFullYear(), | |
| 11943 | + endOfDesiredMonth.getMonth(), | |
| 11944 | + dayOfMonth | |
| 11945 | + ); | |
| 11946 | + return _date; | |
| 11947 | + } | |
| 11948 | +} | |
| 11949 | + | |
| 11950 | +// node_modules/date-fns/_lib/defaultOptions.js | |
| 11951 | +var defaultOptions = {}; | |
| 11952 | +function getDefaultOptions() { | |
| 11953 | + return defaultOptions; | |
| 11954 | +} | |
| 11955 | + | |
| 11956 | +// node_modules/date-fns/startOfWeek.js | |
| 11957 | +function startOfWeek(date, options) { | |
| 11958 | + const defaultOptions2 = getDefaultOptions(); | |
| 11959 | + const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0; | |
| 11960 | + const _date = toDate(date, options?.in); | |
| 11961 | + const day = _date.getDay(); | |
| 11962 | + const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; | |
| 11963 | + _date.setDate(_date.getDate() - diff); | |
| 11964 | + _date.setHours(0, 0, 0, 0); | |
| 11965 | + return _date; | |
| 11966 | +} | |
| 11967 | + | |
| 11968 | +// node_modules/date-fns/startOfISOWeek.js | |
| 11969 | +function startOfISOWeek(date, options) { | |
| 11970 | + return startOfWeek(date, { ...options, weekStartsOn: 1 }); | |
| 11971 | +} | |
| 11972 | + | |
| 11973 | +// node_modules/date-fns/getISOWeekYear.js | |
| 11974 | +function getISOWeekYear(date, options) { | |
| 11975 | + const _date = toDate(date, options?.in); | |
| 11976 | + const year = _date.getFullYear(); | |
| 11977 | + const fourthOfJanuaryOfNextYear = constructFrom(_date, 0); | |
| 11978 | + fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4); | |
| 11979 | + fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0); | |
| 11980 | + const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear); | |
| 11981 | + const fourthOfJanuaryOfThisYear = constructFrom(_date, 0); | |
| 11982 | + fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4); | |
| 11983 | + fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0); | |
| 11984 | + const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear); | |
| 11985 | + if (_date.getTime() >= startOfNextYear.getTime()) { | |
| 11986 | + return year + 1; | |
| 11987 | + } else if (_date.getTime() >= startOfThisYear.getTime()) { | |
| 11988 | + return year; | |
| 11989 | + } else { | |
| 11990 | + return year - 1; | |
| 11991 | + } | |
| 11992 | +} | |
| 11993 | + | |
| 11994 | +// node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js | |
| 11995 | +function getTimezoneOffsetInMilliseconds(date) { | |
| 11996 | + const _date = toDate(date); | |
| 11997 | + const utcDate = new Date( | |
| 11998 | + Date.UTC( | |
| 11999 | + _date.getFullYear(), | |
| 12000 | + _date.getMonth(), | |
| 12001 | + _date.getDate(), | |
| 12002 | + _date.getHours(), | |
| 12003 | + _date.getMinutes(), | |
| 12004 | + _date.getSeconds(), | |
| 12005 | + _date.getMilliseconds() | |
| 12006 | + ) | |
| 12007 | + ); | |
| 12008 | + utcDate.setUTCFullYear(_date.getFullYear()); | |
| 12009 | + return +date - +utcDate; | |
| 12010 | +} | |
| 12011 | + | |
| 12012 | +// node_modules/date-fns/_lib/normalizeDates.js | |
| 12013 | +function normalizeDates(context, ...dates) { | |
| 12014 | + const normalize = constructFrom.bind( | |
| 12015 | + null, | |
| 12016 | + context || dates.find((date) => typeof date === "object") | |
| 12017 | + ); | |
| 12018 | + return dates.map(normalize); | |
| 12019 | +} | |
| 12020 | + | |
| 12021 | +// node_modules/date-fns/startOfDay.js | |
| 12022 | +function startOfDay(date, options) { | |
| 12023 | + const _date = toDate(date, options?.in); | |
| 12024 | + _date.setHours(0, 0, 0, 0); | |
| 12025 | + return _date; | |
| 12026 | +} | |
| 12027 | + | |
| 12028 | +// node_modules/date-fns/differenceInCalendarDays.js | |
| 12029 | +function differenceInCalendarDays(laterDate, earlierDate, options) { | |
| 12030 | + const [laterDate_, earlierDate_] = normalizeDates( | |
| 12031 | + options?.in, | |
| 12032 | + laterDate, | |
| 12033 | + earlierDate | |
| 12034 | + ); | |
| 12035 | + const laterStartOfDay = startOfDay(laterDate_); | |
| 12036 | + const earlierStartOfDay = startOfDay(earlierDate_); | |
| 12037 | + const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay); | |
| 12038 | + const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay); | |
| 12039 | + return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay); | |
| 12040 | +} | |
| 12041 | + | |
| 12042 | +// node_modules/date-fns/startOfISOWeekYear.js | |
| 12043 | +function startOfISOWeekYear(date, options) { | |
| 12044 | + const year = getISOWeekYear(date, options); | |
| 12045 | + const fourthOfJanuary = constructFrom(options?.in || date, 0); | |
| 12046 | + fourthOfJanuary.setFullYear(year, 0, 4); | |
| 12047 | + fourthOfJanuary.setHours(0, 0, 0, 0); | |
| 12048 | + return startOfISOWeek(fourthOfJanuary); | |
| 12049 | +} | |
| 12050 | + | |
| 12051 | +// node_modules/date-fns/addWeeks.js | |
| 12052 | +function addWeeks(date, amount, options) { | |
| 12053 | + return addDays(date, amount * 7, options); | |
| 12054 | +} | |
| 12055 | + | |
| 12056 | +// node_modules/date-fns/addYears.js | |
| 12057 | +function addYears(date, amount, options) { | |
| 12058 | + return addMonths(date, amount * 12, options); | |
| 12059 | +} | |
| 12060 | + | |
| 12061 | +// node_modules/date-fns/areIntervalsOverlapping.js | |
| 12062 | +function areIntervalsOverlapping(intervalLeft, intervalRight, options) { | |
| 12063 | + const [leftStartTime, leftEndTime] = [ | |
| 12064 | + +toDate(intervalLeft.start, options?.in), | |
| 12065 | + +toDate(intervalLeft.end, options?.in) | |
| 12066 | + ].sort((a, b) => a - b); | |
| 12067 | + const [rightStartTime, rightEndTime] = [ | |
| 12068 | + +toDate(intervalRight.start, options?.in), | |
| 12069 | + +toDate(intervalRight.end, options?.in) | |
| 12070 | + ].sort((a, b) => a - b); | |
| 12071 | + if (options?.inclusive) | |
| 12072 | + return leftStartTime <= rightEndTime && rightStartTime <= leftEndTime; | |
| 12073 | + return leftStartTime < rightEndTime && rightStartTime < leftEndTime; | |
| 12074 | +} | |
| 12075 | + | |
| 12076 | +// node_modules/date-fns/max.js | |
| 12077 | +function max2(dates, options) { | |
| 12078 | + let result; | |
| 12079 | + let context = options?.in; | |
| 12080 | + dates.forEach((date) => { | |
| 12081 | + if (!context && typeof date === "object") | |
| 12082 | + context = constructFrom.bind(null, date); | |
| 12083 | + const date_ = toDate(date, context); | |
| 12084 | + if (!result || result < date_ || isNaN(+date_)) result = date_; | |
| 12085 | + }); | |
| 12086 | + return constructFrom(context, result || NaN); | |
| 12087 | +} | |
| 12088 | + | |
| 12089 | +// node_modules/date-fns/min.js | |
| 12090 | +function min2(dates, options) { | |
| 12091 | + let result; | |
| 12092 | + let context = options?.in; | |
| 12093 | + dates.forEach((date) => { | |
| 12094 | + if (!context && typeof date === "object") | |
| 12095 | + context = constructFrom.bind(null, date); | |
| 12096 | + const date_ = toDate(date, context); | |
| 12097 | + if (!result || result > date_ || isNaN(+date_)) result = date_; | |
| 12098 | + }); | |
| 12099 | + return constructFrom(context, result || NaN); | |
| 12100 | +} | |
| 12101 | + | |
| 12102 | +// node_modules/date-fns/isSameDay.js | |
| 12103 | +function isSameDay(laterDate, earlierDate, options) { | |
| 12104 | + const [dateLeft_, dateRight_] = normalizeDates( | |
| 12105 | + options?.in, | |
| 12106 | + laterDate, | |
| 12107 | + earlierDate | |
| 12108 | + ); | |
| 12109 | + return +startOfDay(dateLeft_) === +startOfDay(dateRight_); | |
| 12110 | +} | |
| 12111 | + | |
| 12112 | +// node_modules/date-fns/isDate.js | |
| 12113 | +function isDate(value) { | |
| 12114 | + return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]"; | |
| 12115 | +} | |
| 12116 | + | |
| 12117 | +// node_modules/date-fns/isValid.js | |
| 12118 | +function isValid(date) { | |
| 12119 | + return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date))); | |
| 12120 | +} | |
| 12121 | + | |
| 12122 | +// node_modules/date-fns/differenceInCalendarMonths.js | |
| 12123 | +function differenceInCalendarMonths(laterDate, earlierDate, options) { | |
| 12124 | + const [laterDate_, earlierDate_] = normalizeDates( | |
| 12125 | + options?.in, | |
| 12126 | + laterDate, | |
| 12127 | + earlierDate | |
| 12128 | + ); | |
| 12129 | + const yearsDiff = laterDate_.getFullYear() - earlierDate_.getFullYear(); | |
| 12130 | + const monthsDiff = laterDate_.getMonth() - earlierDate_.getMonth(); | |
| 12131 | + return yearsDiff * 12 + monthsDiff; | |
| 12132 | +} | |
| 12133 | + | |
| 12134 | +// node_modules/date-fns/endOfMonth.js | |
| 12135 | +function endOfMonth(date, options) { | |
| 12136 | + const _date = toDate(date, options?.in); | |
| 12137 | + const month = _date.getMonth(); | |
| 12138 | + _date.setFullYear(_date.getFullYear(), month + 1, 0); | |
| 12139 | + _date.setHours(23, 59, 59, 999); | |
| 12140 | + return _date; | |
| 12141 | +} | |
| 12142 | + | |
| 12143 | +// node_modules/date-fns/_lib/normalizeInterval.js | |
| 12144 | +function normalizeInterval(context, interval) { | |
| 12145 | + const [start, end] = normalizeDates(context, interval.start, interval.end); | |
| 12146 | + return { start, end }; | |
| 12147 | +} | |
| 12148 | + | |
| 12149 | +// node_modules/date-fns/eachMonthOfInterval.js | |
| 12150 | +function eachMonthOfInterval(interval, options) { | |
| 12151 | + const { start, end } = normalizeInterval(options?.in, interval); | |
| 12152 | + let reversed = +start > +end; | |
| 12153 | + const endTime = reversed ? +start : +end; | |
| 12154 | + const date = reversed ? end : start; | |
| 12155 | + date.setHours(0, 0, 0, 0); | |
| 12156 | + date.setDate(1); | |
| 12157 | + let step = options?.step ?? 1; | |
| 12158 | + if (!step) return []; | |
| 12159 | + if (step < 0) { | |
| 12160 | + step = -step; | |
| 12161 | + reversed = !reversed; | |
| 12162 | + } | |
| 12163 | + const dates = []; | |
| 12164 | + while (+date <= endTime) { | |
| 12165 | + dates.push(constructFrom(start, date)); | |
| 12166 | + date.setMonth(date.getMonth() + step); | |
| 12167 | + } | |
| 12168 | + return reversed ? dates.reverse() : dates; | |
| 12169 | +} | |
| 12170 | + | |
| 12171 | +// node_modules/date-fns/startOfMonth.js | |
| 12172 | +function startOfMonth(date, options) { | |
| 12173 | + const _date = toDate(date, options?.in); | |
| 12174 | + _date.setDate(1); | |
| 12175 | + _date.setHours(0, 0, 0, 0); | |
| 12176 | + return _date; | |
| 12177 | +} | |
| 12178 | + | |
| 12179 | +// node_modules/date-fns/endOfYear.js | |
| 12180 | +function endOfYear(date, options) { | |
| 12181 | + const _date = toDate(date, options?.in); | |
| 12182 | + const year = _date.getFullYear(); | |
| 12183 | + _date.setFullYear(year + 1, 0, 0); | |
| 12184 | + _date.setHours(23, 59, 59, 999); | |
| 12185 | + return _date; | |
| 12186 | +} | |
| 12187 | + | |
| 12188 | +// node_modules/date-fns/startOfYear.js | |
| 12189 | +function startOfYear(date, options) { | |
| 12190 | + const date_ = toDate(date, options?.in); | |
| 12191 | + date_.setFullYear(date_.getFullYear(), 0, 1); | |
| 12192 | + date_.setHours(0, 0, 0, 0); | |
| 12193 | + return date_; | |
| 12194 | +} | |
| 12195 | + | |
| 12196 | +// node_modules/date-fns/eachYearOfInterval.js | |
| 12197 | +function eachYearOfInterval(interval, options) { | |
| 12198 | + const { start, end } = normalizeInterval(options?.in, interval); | |
| 12199 | + let reversed = +start > +end; | |
| 12200 | + const endTime = reversed ? +start : +end; | |
| 12201 | + const date = reversed ? end : start; | |
| 12202 | + date.setHours(0, 0, 0, 0); | |
| 12203 | + date.setMonth(0, 1); | |
| 12204 | + let step = options?.step ?? 1; | |
| 12205 | + if (!step) return []; | |
| 12206 | + if (step < 0) { | |
| 12207 | + step = -step; | |
| 12208 | + reversed = !reversed; | |
| 12209 | + } | |
| 12210 | + const dates = []; | |
| 12211 | + while (+date <= endTime) { | |
| 12212 | + dates.push(constructFrom(start, date)); | |
| 12213 | + date.setFullYear(date.getFullYear() + step); | |
| 12214 | + } | |
| 12215 | + return reversed ? dates.reverse() : dates; | |
| 12216 | +} | |
| 12217 | + | |
| 12218 | +// node_modules/date-fns/endOfWeek.js | |
| 12219 | +function endOfWeek(date, options) { | |
| 12220 | + const defaultOptions2 = getDefaultOptions(); | |
| 12221 | + const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0; | |
| 12222 | + const _date = toDate(date, options?.in); | |
| 12223 | + const day = _date.getDay(); | |
| 12224 | + const diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn); | |
| 12225 | + _date.setDate(_date.getDate() + diff); | |
| 12226 | + _date.setHours(23, 59, 59, 999); | |
| 12227 | + return _date; | |
| 12228 | +} | |
| 12229 | + | |
| 12230 | +// node_modules/date-fns/endOfISOWeek.js | |
| 12231 | +function endOfISOWeek(date, options) { | |
| 12232 | + return endOfWeek(date, { ...options, weekStartsOn: 1 }); | |
| 12233 | +} | |
| 12234 | + | |
| 12235 | +// node_modules/date-fns/locale/en-US/_lib/formatDistance.js | |
| 12236 | +var formatDistanceLocale = { | |
| 12237 | + lessThanXSeconds: { | |
| 12238 | + one: "less than a second", | |
| 12239 | + other: "less than {{count}} seconds" | |
| 189 | 12240 | }, |
| 190 | - fields: ["author", "active", "slug"], | |
| 191 | - titleField: "title", | |
| 192 | - descriptionField: "description", | |
| 193 | - mediaField: "preview", | |
| 194 | - filters: [] | |
| 12241 | + xSeconds: { | |
| 12242 | + one: "1 second", | |
| 12243 | + other: "{{count}} seconds" | |
| 12244 | + }, | |
| 12245 | + halfAMinute: "half a minute", | |
| 12246 | + lessThanXMinutes: { | |
| 12247 | + one: "less than a minute", | |
| 12248 | + other: "less than {{count}} minutes" | |
| 12249 | + }, | |
| 12250 | + xMinutes: { | |
| 12251 | + one: "1 minute", | |
| 12252 | + other: "{{count}} minutes" | |
| 12253 | + }, | |
| 12254 | + aboutXHours: { | |
| 12255 | + one: "about 1 hour", | |
| 12256 | + other: "about {{count}} hours" | |
| 12257 | + }, | |
| 12258 | + xHours: { | |
| 12259 | + one: "1 hour", | |
| 12260 | + other: "{{count}} hours" | |
| 12261 | + }, | |
| 12262 | + xDays: { | |
| 12263 | + one: "1 day", | |
| 12264 | + other: "{{count}} days" | |
| 12265 | + }, | |
| 12266 | + aboutXWeeks: { | |
| 12267 | + one: "about 1 week", | |
| 12268 | + other: "about {{count}} weeks" | |
| 12269 | + }, | |
| 12270 | + xWeeks: { | |
| 12271 | + one: "1 week", | |
| 12272 | + other: "{{count}} weeks" | |
| 12273 | + }, | |
| 12274 | + aboutXMonths: { | |
| 12275 | + one: "about 1 month", | |
| 12276 | + other: "about {{count}} months" | |
| 12277 | + }, | |
| 12278 | + xMonths: { | |
| 12279 | + one: "1 month", | |
| 12280 | + other: "{{count}} months" | |
| 12281 | + }, | |
| 12282 | + aboutXYears: { | |
| 12283 | + one: "about 1 year", | |
| 12284 | + other: "about {{count}} years" | |
| 12285 | + }, | |
| 12286 | + xYears: { | |
| 12287 | + one: "1 year", | |
| 12288 | + other: "{{count}} years" | |
| 12289 | + }, | |
| 12290 | + overXYears: { | |
| 12291 | + one: "over 1 year", | |
| 12292 | + other: "over {{count}} years" | |
| 12293 | + }, | |
| 12294 | + almostXYears: { | |
| 12295 | + one: "almost 1 year", | |
| 12296 | + other: "almost {{count}} years" | |
| 12297 | + } | |
| 195 | 12298 | }; |
| 196 | -var DEFAULT_VIEW_LEGACY = { | |
| 197 | - ...DEFAULT_VIEW, | |
| 198 | - fields: ["author"] | |
| 12299 | +var formatDistance = (token, count, options) => { | |
| 12300 | + let result; | |
| 12301 | + const tokenValue = formatDistanceLocale[token]; | |
| 12302 | + if (typeof tokenValue === "string") { | |
| 12303 | + result = tokenValue; | |
| 12304 | + } else if (count === 1) { | |
| 12305 | + result = tokenValue.one; | |
| 12306 | + } else { | |
| 12307 | + result = tokenValue.other.replace("{{count}}", count.toString()); | |
| 12308 | + } | |
| 12309 | + if (options?.addSuffix) { | |
| 12310 | + if (options.comparison && options.comparison > 0) { | |
| 12311 | + return "in " + result; | |
| 12312 | + } else { | |
| 12313 | + return result + " ago"; | |
| 12314 | + } | |
| 12315 | + } | |
| 12316 | + return result; | |
| 199 | 12317 | }; |
| 200 | -function getActiveViewOverridesForTab(activeView) { | |
| 201 | - if (activeView === "user") { | |
| 12318 | + | |
| 12319 | +// node_modules/date-fns/locale/_lib/buildFormatLongFn.js | |
| 12320 | +function buildFormatLongFn(args) { | |
| 12321 | + return (options = {}) => { | |
| 12322 | + const width = options.width ? String(options.width) : args.defaultWidth; | |
| 12323 | + const format7 = args.formats[width] || args.formats[args.defaultWidth]; | |
| 12324 | + return format7; | |
| 12325 | + }; | |
| 12326 | +} | |
| 12327 | + | |
| 12328 | +// node_modules/date-fns/locale/en-US/_lib/formatLong.js | |
| 12329 | +var dateFormats = { | |
| 12330 | + full: "EEEE, MMMM do, y", | |
| 12331 | + long: "MMMM do, y", | |
| 12332 | + medium: "MMM d, y", | |
| 12333 | + short: "MM/dd/yyyy" | |
| 12334 | +}; | |
| 12335 | +var timeFormats = { | |
| 12336 | + full: "h:mm:ss a zzzz", | |
| 12337 | + long: "h:mm:ss a z", | |
| 12338 | + medium: "h:mm:ss a", | |
| 12339 | + short: "h:mm a" | |
| 12340 | +}; | |
| 12341 | +var dateTimeFormats = { | |
| 12342 | + full: "{{date}} 'at' {{time}}", | |
| 12343 | + long: "{{date}} 'at' {{time}}", | |
| 12344 | + medium: "{{date}}, {{time}}", | |
| 12345 | + short: "{{date}}, {{time}}" | |
| 12346 | +}; | |
| 12347 | +var formatLong = { | |
| 12348 | + date: buildFormatLongFn({ | |
| 12349 | + formats: dateFormats, | |
| 12350 | + defaultWidth: "full" | |
| 12351 | + }), | |
| 12352 | + time: buildFormatLongFn({ | |
| 12353 | + formats: timeFormats, | |
| 12354 | + defaultWidth: "full" | |
| 12355 | + }), | |
| 12356 | + dateTime: buildFormatLongFn({ | |
| 12357 | + formats: dateTimeFormats, | |
| 12358 | + defaultWidth: "full" | |
| 12359 | + }) | |
| 12360 | +}; | |
| 12361 | + | |
| 12362 | +// node_modules/date-fns/locale/en-US/_lib/formatRelative.js | |
| 12363 | +var formatRelativeLocale = { | |
| 12364 | + lastWeek: "'last' eeee 'at' p", | |
| 12365 | + yesterday: "'yesterday at' p", | |
| 12366 | + today: "'today at' p", | |
| 12367 | + tomorrow: "'tomorrow at' p", | |
| 12368 | + nextWeek: "eeee 'at' p", | |
| 12369 | + other: "P" | |
| 12370 | +}; | |
| 12371 | +var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token]; | |
| 12372 | + | |
| 12373 | +// node_modules/date-fns/locale/_lib/buildLocalizeFn.js | |
| 12374 | +function buildLocalizeFn(args) { | |
| 12375 | + return (value, options) => { | |
| 12376 | + const context = options?.context ? String(options.context) : "standalone"; | |
| 12377 | + let valuesArray; | |
| 12378 | + if (context === "formatting" && args.formattingValues) { | |
| 12379 | + const defaultWidth = args.defaultFormattingWidth || args.defaultWidth; | |
| 12380 | + const width = options?.width ? String(options.width) : defaultWidth; | |
| 12381 | + valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth]; | |
| 12382 | + } else { | |
| 12383 | + const defaultWidth = args.defaultWidth; | |
| 12384 | + const width = options?.width ? String(options.width) : args.defaultWidth; | |
| 12385 | + valuesArray = args.values[width] || args.values[defaultWidth]; | |
| 12386 | + } | |
| 12387 | + const index2 = args.argumentCallback ? args.argumentCallback(value) : value; | |
| 12388 | + return valuesArray[index2]; | |
| 12389 | + }; | |
| 12390 | +} | |
| 12391 | + | |
| 12392 | +// node_modules/date-fns/locale/en-US/_lib/localize.js | |
| 12393 | +var eraValues = { | |
| 12394 | + narrow: ["B", "A"], | |
| 12395 | + abbreviated: ["BC", "AD"], | |
| 12396 | + wide: ["Before Christ", "Anno Domini"] | |
| 12397 | +}; | |
| 12398 | +var quarterValues = { | |
| 12399 | + narrow: ["1", "2", "3", "4"], | |
| 12400 | + abbreviated: ["Q1", "Q2", "Q3", "Q4"], | |
| 12401 | + wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"] | |
| 12402 | +}; | |
| 12403 | +var monthValues = { | |
| 12404 | + narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], | |
| 12405 | + abbreviated: [ | |
| 12406 | + "Jan", | |
| 12407 | + "Feb", | |
| 12408 | + "Mar", | |
| 12409 | + "Apr", | |
| 12410 | + "May", | |
| 12411 | + "Jun", | |
| 12412 | + "Jul", | |
| 12413 | + "Aug", | |
| 12414 | + "Sep", | |
| 12415 | + "Oct", | |
| 12416 | + "Nov", | |
| 12417 | + "Dec" | |
| 12418 | + ], | |
| 12419 | + wide: [ | |
| 12420 | + "January", | |
| 12421 | + "February", | |
| 12422 | + "March", | |
| 12423 | + "April", | |
| 12424 | + "May", | |
| 12425 | + "June", | |
| 12426 | + "July", | |
| 12427 | + "August", | |
| 12428 | + "September", | |
| 12429 | + "October", | |
| 12430 | + "November", | |
| 12431 | + "December" | |
| 12432 | + ] | |
| 12433 | +}; | |
| 12434 | +var dayValues = { | |
| 12435 | + narrow: ["S", "M", "T", "W", "T", "F", "S"], | |
| 12436 | + short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], | |
| 12437 | + abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], | |
| 12438 | + wide: [ | |
| 12439 | + "Sunday", | |
| 12440 | + "Monday", | |
| 12441 | + "Tuesday", | |
| 12442 | + "Wednesday", | |
| 12443 | + "Thursday", | |
| 12444 | + "Friday", | |
| 12445 | + "Saturday" | |
| 12446 | + ] | |
| 12447 | +}; | |
| 12448 | +var dayPeriodValues = { | |
| 12449 | + narrow: { | |
| 12450 | + am: "a", | |
| 12451 | + pm: "p", | |
| 12452 | + midnight: "mi", | |
| 12453 | + noon: "n", | |
| 12454 | + morning: "morning", | |
| 12455 | + afternoon: "afternoon", | |
| 12456 | + evening: "evening", | |
| 12457 | + night: "night" | |
| 12458 | + }, | |
| 12459 | + abbreviated: { | |
| 12460 | + am: "AM", | |
| 12461 | + pm: "PM", | |
| 12462 | + midnight: "midnight", | |
| 12463 | + noon: "noon", | |
| 12464 | + morning: "morning", | |
| 12465 | + afternoon: "afternoon", | |
| 12466 | + evening: "evening", | |
| 12467 | + night: "night" | |
| 12468 | + }, | |
| 12469 | + wide: { | |
| 12470 | + am: "a.m.", | |
| 12471 | + pm: "p.m.", | |
| 12472 | + midnight: "midnight", | |
| 12473 | + noon: "noon", | |
| 12474 | + morning: "morning", | |
| 12475 | + afternoon: "afternoon", | |
| 12476 | + evening: "evening", | |
| 12477 | + night: "night" | |
| 12478 | + } | |
| 12479 | +}; | |
| 12480 | +var formattingDayPeriodValues = { | |
| 12481 | + narrow: { | |
| 12482 | + am: "a", | |
| 12483 | + pm: "p", | |
| 12484 | + midnight: "mi", | |
| 12485 | + noon: "n", | |
| 12486 | + morning: "in the morning", | |
| 12487 | + afternoon: "in the afternoon", | |
| 12488 | + evening: "in the evening", | |
| 12489 | + night: "at night" | |
| 12490 | + }, | |
| 12491 | + abbreviated: { | |
| 12492 | + am: "AM", | |
| 12493 | + pm: "PM", | |
| 12494 | + midnight: "midnight", | |
| 12495 | + noon: "noon", | |
| 12496 | + morning: "in the morning", | |
| 12497 | + afternoon: "in the afternoon", | |
| 12498 | + evening: "in the evening", | |
| 12499 | + night: "at night" | |
| 12500 | + }, | |
| 12501 | + wide: { | |
| 12502 | + am: "a.m.", | |
| 12503 | + pm: "p.m.", | |
| 12504 | + midnight: "midnight", | |
| 12505 | + noon: "noon", | |
| 12506 | + morning: "in the morning", | |
| 12507 | + afternoon: "in the afternoon", | |
| 12508 | + evening: "in the evening", | |
| 12509 | + night: "at night" | |
| 12510 | + } | |
| 12511 | +}; | |
| 12512 | +var ordinalNumber = (dirtyNumber, _options) => { | |
| 12513 | + const number = Number(dirtyNumber); | |
| 12514 | + const rem100 = number % 100; | |
| 12515 | + if (rem100 > 20 || rem100 < 10) { | |
| 12516 | + switch (rem100 % 10) { | |
| 12517 | + case 1: | |
| 12518 | + return number + "st"; | |
| 12519 | + case 2: | |
| 12520 | + return number + "nd"; | |
| 12521 | + case 3: | |
| 12522 | + return number + "rd"; | |
| 12523 | + } | |
| 12524 | + } | |
| 12525 | + return number + "th"; | |
| 12526 | +}; | |
| 12527 | +var localize = { | |
| 12528 | + ordinalNumber, | |
| 12529 | + era: buildLocalizeFn({ | |
| 12530 | + values: eraValues, | |
| 12531 | + defaultWidth: "wide" | |
| 12532 | + }), | |
| 12533 | + quarter: buildLocalizeFn({ | |
| 12534 | + values: quarterValues, | |
| 12535 | + defaultWidth: "wide", | |
| 12536 | + argumentCallback: (quarter) => quarter - 1 | |
| 12537 | + }), | |
| 12538 | + month: buildLocalizeFn({ | |
| 12539 | + values: monthValues, | |
| 12540 | + defaultWidth: "wide" | |
| 12541 | + }), | |
| 12542 | + day: buildLocalizeFn({ | |
| 12543 | + values: dayValues, | |
| 12544 | + defaultWidth: "wide" | |
| 12545 | + }), | |
| 12546 | + dayPeriod: buildLocalizeFn({ | |
| 12547 | + values: dayPeriodValues, | |
| 12548 | + defaultWidth: "wide", | |
| 12549 | + formattingValues: formattingDayPeriodValues, | |
| 12550 | + defaultFormattingWidth: "wide" | |
| 12551 | + }) | |
| 12552 | +}; | |
| 12553 | + | |
| 12554 | +// node_modules/date-fns/locale/_lib/buildMatchFn.js | |
| 12555 | +function buildMatchFn(args) { | |
| 12556 | + return (string, options = {}) => { | |
| 12557 | + const width = options.width; | |
| 12558 | + const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth]; | |
| 12559 | + const matchResult = string.match(matchPattern); | |
| 12560 | + if (!matchResult) { | |
| 12561 | + return null; | |
| 12562 | + } | |
| 12563 | + const matchedString = matchResult[0]; | |
| 12564 | + const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth]; | |
| 12565 | + const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : ( | |
| 12566 | + // [TODO] -- I challenge you to fix the type | |
| 12567 | + findKey(parsePatterns, (pattern) => pattern.test(matchedString)) | |
| 12568 | + ); | |
| 12569 | + let value; | |
| 12570 | + value = args.valueCallback ? args.valueCallback(key) : key; | |
| 12571 | + value = options.valueCallback ? ( | |
| 12572 | + // [TODO] -- I challenge you to fix the type | |
| 12573 | + options.valueCallback(value) | |
| 12574 | + ) : value; | |
| 12575 | + const rest = string.slice(matchedString.length); | |
| 12576 | + return { value, rest }; | |
| 12577 | + }; | |
| 12578 | +} | |
| 12579 | +function findKey(object, predicate) { | |
| 12580 | + for (const key in object) { | |
| 12581 | + if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) { | |
| 12582 | + return key; | |
| 12583 | + } | |
| 12584 | + } | |
| 12585 | + return void 0; | |
| 12586 | +} | |
| 12587 | +function findIndex(array, predicate) { | |
| 12588 | + for (let key = 0; key < array.length; key++) { | |
| 12589 | + if (predicate(array[key])) { | |
| 12590 | + return key; | |
| 12591 | + } | |
| 12592 | + } | |
| 12593 | + return void 0; | |
| 12594 | +} | |
| 12595 | + | |
| 12596 | +// node_modules/date-fns/locale/_lib/buildMatchPatternFn.js | |
| 12597 | +function buildMatchPatternFn(args) { | |
| 12598 | + return (string, options = {}) => { | |
| 12599 | + const matchResult = string.match(args.matchPattern); | |
| 12600 | + if (!matchResult) return null; | |
| 12601 | + const matchedString = matchResult[0]; | |
| 12602 | + const parseResult = string.match(args.parsePattern); | |
| 12603 | + if (!parseResult) return null; | |
| 12604 | + let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0]; | |
| 12605 | + value = options.valueCallback ? options.valueCallback(value) : value; | |
| 12606 | + const rest = string.slice(matchedString.length); | |
| 12607 | + return { value, rest }; | |
| 12608 | + }; | |
| 12609 | +} | |
| 12610 | + | |
| 12611 | +// node_modules/date-fns/locale/en-US/_lib/match.js | |
| 12612 | +var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i; | |
| 12613 | +var parseOrdinalNumberPattern = /\d+/i; | |
| 12614 | +var matchEraPatterns = { | |
| 12615 | + narrow: /^(b|a)/i, | |
| 12616 | + abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i, | |
| 12617 | + wide: /^(before christ|before common era|anno domini|common era)/i | |
| 12618 | +}; | |
| 12619 | +var parseEraPatterns = { | |
| 12620 | + any: [/^b/i, /^(a|c)/i] | |
| 12621 | +}; | |
| 12622 | +var matchQuarterPatterns = { | |
| 12623 | + narrow: /^[1234]/i, | |
| 12624 | + abbreviated: /^q[1234]/i, | |
| 12625 | + wide: /^[1234](th|st|nd|rd)? quarter/i | |
| 12626 | +}; | |
| 12627 | +var parseQuarterPatterns = { | |
| 12628 | + any: [/1/i, /2/i, /3/i, /4/i] | |
| 12629 | +}; | |
| 12630 | +var matchMonthPatterns = { | |
| 12631 | + narrow: /^[jfmasond]/i, | |
| 12632 | + abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i, | |
| 12633 | + wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i | |
| 12634 | +}; | |
| 12635 | +var parseMonthPatterns = { | |
| 12636 | + narrow: [ | |
| 12637 | + /^j/i, | |
| 12638 | + /^f/i, | |
| 12639 | + /^m/i, | |
| 12640 | + /^a/i, | |
| 12641 | + /^m/i, | |
| 12642 | + /^j/i, | |
| 12643 | + /^j/i, | |
| 12644 | + /^a/i, | |
| 12645 | + /^s/i, | |
| 12646 | + /^o/i, | |
| 12647 | + /^n/i, | |
| 12648 | + /^d/i | |
| 12649 | + ], | |
| 12650 | + any: [ | |
| 12651 | + /^ja/i, | |
| 12652 | + /^f/i, | |
| 12653 | + /^mar/i, | |
| 12654 | + /^ap/i, | |
| 12655 | + /^may/i, | |
| 12656 | + /^jun/i, | |
| 12657 | + /^jul/i, | |
| 12658 | + /^au/i, | |
| 12659 | + /^s/i, | |
| 12660 | + /^o/i, | |
| 12661 | + /^n/i, | |
| 12662 | + /^d/i | |
| 12663 | + ] | |
| 12664 | +}; | |
| 12665 | +var matchDayPatterns = { | |
| 12666 | + narrow: /^[smtwf]/i, | |
| 12667 | + short: /^(su|mo|tu|we|th|fr|sa)/i, | |
| 12668 | + abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i, | |
| 12669 | + wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i | |
| 12670 | +}; | |
| 12671 | +var parseDayPatterns = { | |
| 12672 | + narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i], | |
| 12673 | + any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i] | |
| 12674 | +}; | |
| 12675 | +var matchDayPeriodPatterns = { | |
| 12676 | + narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i, | |
| 12677 | + any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i | |
| 12678 | +}; | |
| 12679 | +var parseDayPeriodPatterns = { | |
| 12680 | + any: { | |
| 12681 | + am: /^a/i, | |
| 12682 | + pm: /^p/i, | |
| 12683 | + midnight: /^mi/i, | |
| 12684 | + noon: /^no/i, | |
| 12685 | + morning: /morning/i, | |
| 12686 | + afternoon: /afternoon/i, | |
| 12687 | + evening: /evening/i, | |
| 12688 | + night: /night/i | |
| 12689 | + } | |
| 12690 | +}; | |
| 12691 | +var match = { | |
| 12692 | + ordinalNumber: buildMatchPatternFn({ | |
| 12693 | + matchPattern: matchOrdinalNumberPattern, | |
| 12694 | + parsePattern: parseOrdinalNumberPattern, | |
| 12695 | + valueCallback: (value) => parseInt(value, 10) | |
| 12696 | + }), | |
| 12697 | + era: buildMatchFn({ | |
| 12698 | + matchPatterns: matchEraPatterns, | |
| 12699 | + defaultMatchWidth: "wide", | |
| 12700 | + parsePatterns: parseEraPatterns, | |
| 12701 | + defaultParseWidth: "any" | |
| 12702 | + }), | |
| 12703 | + quarter: buildMatchFn({ | |
| 12704 | + matchPatterns: matchQuarterPatterns, | |
| 12705 | + defaultMatchWidth: "wide", | |
| 12706 | + parsePatterns: parseQuarterPatterns, | |
| 12707 | + defaultParseWidth: "any", | |
| 12708 | + valueCallback: (index2) => index2 + 1 | |
| 12709 | + }), | |
| 12710 | + month: buildMatchFn({ | |
| 12711 | + matchPatterns: matchMonthPatterns, | |
| 12712 | + defaultMatchWidth: "wide", | |
| 12713 | + parsePatterns: parseMonthPatterns, | |
| 12714 | + defaultParseWidth: "any" | |
| 12715 | + }), | |
| 12716 | + day: buildMatchFn({ | |
| 12717 | + matchPatterns: matchDayPatterns, | |
| 12718 | + defaultMatchWidth: "wide", | |
| 12719 | + parsePatterns: parseDayPatterns, | |
| 12720 | + defaultParseWidth: "any" | |
| 12721 | + }), | |
| 12722 | + dayPeriod: buildMatchFn({ | |
| 12723 | + matchPatterns: matchDayPeriodPatterns, | |
| 12724 | + defaultMatchWidth: "any", | |
| 12725 | + parsePatterns: parseDayPeriodPatterns, | |
| 12726 | + defaultParseWidth: "any" | |
| 12727 | + }) | |
| 12728 | +}; | |
| 12729 | + | |
| 12730 | +// node_modules/date-fns/locale/en-US.js | |
| 12731 | +var enUS = { | |
| 12732 | + code: "en-US", | |
| 12733 | + formatDistance, | |
| 12734 | + formatLong, | |
| 12735 | + formatRelative, | |
| 12736 | + localize, | |
| 12737 | + match, | |
| 12738 | + options: { | |
| 12739 | + weekStartsOn: 0, | |
| 12740 | + firstWeekContainsDate: 1 | |
| 12741 | + } | |
| 12742 | +}; | |
| 12743 | + | |
| 12744 | +// node_modules/date-fns/getDayOfYear.js | |
| 12745 | +function getDayOfYear(date, options) { | |
| 12746 | + const _date = toDate(date, options?.in); | |
| 12747 | + const diff = differenceInCalendarDays(_date, startOfYear(_date)); | |
| 12748 | + const dayOfYear = diff + 1; | |
| 12749 | + return dayOfYear; | |
| 12750 | +} | |
| 12751 | + | |
| 12752 | +// node_modules/date-fns/getISOWeek.js | |
| 12753 | +function getISOWeek(date, options) { | |
| 12754 | + const _date = toDate(date, options?.in); | |
| 12755 | + const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date); | |
| 12756 | + return Math.round(diff / millisecondsInWeek) + 1; | |
| 12757 | +} | |
| 12758 | + | |
| 12759 | +// node_modules/date-fns/getWeekYear.js | |
| 12760 | +function getWeekYear(date, options) { | |
| 12761 | + const _date = toDate(date, options?.in); | |
| 12762 | + const year = _date.getFullYear(); | |
| 12763 | + const defaultOptions2 = getDefaultOptions(); | |
| 12764 | + const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1; | |
| 12765 | + const firstWeekOfNextYear = constructFrom(options?.in || date, 0); | |
| 12766 | + firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate); | |
| 12767 | + firstWeekOfNextYear.setHours(0, 0, 0, 0); | |
| 12768 | + const startOfNextYear = startOfWeek(firstWeekOfNextYear, options); | |
| 12769 | + const firstWeekOfThisYear = constructFrom(options?.in || date, 0); | |
| 12770 | + firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate); | |
| 12771 | + firstWeekOfThisYear.setHours(0, 0, 0, 0); | |
| 12772 | + const startOfThisYear = startOfWeek(firstWeekOfThisYear, options); | |
| 12773 | + if (+_date >= +startOfNextYear) { | |
| 12774 | + return year + 1; | |
| 12775 | + } else if (+_date >= +startOfThisYear) { | |
| 12776 | + return year; | |
| 12777 | + } else { | |
| 12778 | + return year - 1; | |
| 12779 | + } | |
| 12780 | +} | |
| 12781 | + | |
| 12782 | +// node_modules/date-fns/startOfWeekYear.js | |
| 12783 | +function startOfWeekYear(date, options) { | |
| 12784 | + const defaultOptions2 = getDefaultOptions(); | |
| 12785 | + const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1; | |
| 12786 | + const year = getWeekYear(date, options); | |
| 12787 | + const firstWeek = constructFrom(options?.in || date, 0); | |
| 12788 | + firstWeek.setFullYear(year, 0, firstWeekContainsDate); | |
| 12789 | + firstWeek.setHours(0, 0, 0, 0); | |
| 12790 | + const _date = startOfWeek(firstWeek, options); | |
| 12791 | + return _date; | |
| 12792 | +} | |
| 12793 | + | |
| 12794 | +// node_modules/date-fns/getWeek.js | |
| 12795 | +function getWeek(date, options) { | |
| 12796 | + const _date = toDate(date, options?.in); | |
| 12797 | + const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options); | |
| 12798 | + return Math.round(diff / millisecondsInWeek) + 1; | |
| 12799 | +} | |
| 12800 | + | |
| 12801 | +// node_modules/date-fns/_lib/addLeadingZeros.js | |
| 12802 | +function addLeadingZeros(number, targetLength) { | |
| 12803 | + const sign = number < 0 ? "-" : ""; | |
| 12804 | + const output = Math.abs(number).toString().padStart(targetLength, "0"); | |
| 12805 | + return sign + output; | |
| 12806 | +} | |
| 12807 | + | |
| 12808 | +// node_modules/date-fns/_lib/format/lightFormatters.js | |
| 12809 | +var lightFormatters = { | |
| 12810 | + // Year | |
| 12811 | + y(date, token) { | |
| 12812 | + const signedYear = date.getFullYear(); | |
| 12813 | + const year = signedYear > 0 ? signedYear : 1 - signedYear; | |
| 12814 | + return addLeadingZeros(token === "yy" ? year % 100 : year, token.length); | |
| 12815 | + }, | |
| 12816 | + // Month | |
| 12817 | + M(date, token) { | |
| 12818 | + const month = date.getMonth(); | |
| 12819 | + return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2); | |
| 12820 | + }, | |
| 12821 | + // Day of the month | |
| 12822 | + d(date, token) { | |
| 12823 | + return addLeadingZeros(date.getDate(), token.length); | |
| 12824 | + }, | |
| 12825 | + // AM or PM | |
| 12826 | + a(date, token) { | |
| 12827 | + const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am"; | |
| 12828 | + switch (token) { | |
| 12829 | + case "a": | |
| 12830 | + case "aa": | |
| 12831 | + return dayPeriodEnumValue.toUpperCase(); | |
| 12832 | + case "aaa": | |
| 12833 | + return dayPeriodEnumValue; | |
| 12834 | + case "aaaaa": | |
| 12835 | + return dayPeriodEnumValue[0]; | |
| 12836 | + case "aaaa": | |
| 12837 | + default: | |
| 12838 | + return dayPeriodEnumValue === "am" ? "a.m." : "p.m."; | |
| 12839 | + } | |
| 12840 | + }, | |
| 12841 | + // Hour [1-12] | |
| 12842 | + h(date, token) { | |
| 12843 | + return addLeadingZeros(date.getHours() % 12 || 12, token.length); | |
| 12844 | + }, | |
| 12845 | + // Hour [0-23] | |
| 12846 | + H(date, token) { | |
| 12847 | + return addLeadingZeros(date.getHours(), token.length); | |
| 12848 | + }, | |
| 12849 | + // Minute | |
| 12850 | + m(date, token) { | |
| 12851 | + return addLeadingZeros(date.getMinutes(), token.length); | |
| 12852 | + }, | |
| 12853 | + // Second | |
| 12854 | + s(date, token) { | |
| 12855 | + return addLeadingZeros(date.getSeconds(), token.length); | |
| 12856 | + }, | |
| 12857 | + // Fraction of second | |
| 12858 | + S(date, token) { | |
| 12859 | + const numberOfDigits = token.length; | |
| 12860 | + const milliseconds = date.getMilliseconds(); | |
| 12861 | + const fractionalSeconds = Math.trunc( | |
| 12862 | + milliseconds * Math.pow(10, numberOfDigits - 3) | |
| 12863 | + ); | |
| 12864 | + return addLeadingZeros(fractionalSeconds, token.length); | |
| 12865 | + } | |
| 12866 | +}; | |
| 12867 | + | |
| 12868 | +// node_modules/date-fns/_lib/format/formatters.js | |
| 12869 | +var dayPeriodEnum = { | |
| 12870 | + am: "am", | |
| 12871 | + pm: "pm", | |
| 12872 | + midnight: "midnight", | |
| 12873 | + noon: "noon", | |
| 12874 | + morning: "morning", | |
| 12875 | + afternoon: "afternoon", | |
| 12876 | + evening: "evening", | |
| 12877 | + night: "night" | |
| 12878 | +}; | |
| 12879 | +var formatters = { | |
| 12880 | + // Era | |
| 12881 | + G: function(date, token, localize2) { | |
| 12882 | + const era = date.getFullYear() > 0 ? 1 : 0; | |
| 12883 | + switch (token) { | |
| 12884 | + // AD, BC | |
| 12885 | + case "G": | |
| 12886 | + case "GG": | |
| 12887 | + case "GGG": | |
| 12888 | + return localize2.era(era, { width: "abbreviated" }); | |
| 12889 | + // A, B | |
| 12890 | + case "GGGGG": | |
| 12891 | + return localize2.era(era, { width: "narrow" }); | |
| 12892 | + // Anno Domini, Before Christ | |
| 12893 | + case "GGGG": | |
| 12894 | + default: | |
| 12895 | + return localize2.era(era, { width: "wide" }); | |
| 12896 | + } | |
| 12897 | + }, | |
| 12898 | + // Year | |
| 12899 | + y: function(date, token, localize2) { | |
| 12900 | + if (token === "yo") { | |
| 12901 | + const signedYear = date.getFullYear(); | |
| 12902 | + const year = signedYear > 0 ? signedYear : 1 - signedYear; | |
| 12903 | + return localize2.ordinalNumber(year, { unit: "year" }); | |
| 12904 | + } | |
| 12905 | + return lightFormatters.y(date, token); | |
| 12906 | + }, | |
| 12907 | + // Local week-numbering year | |
| 12908 | + Y: function(date, token, localize2, options) { | |
| 12909 | + const signedWeekYear = getWeekYear(date, options); | |
| 12910 | + const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; | |
| 12911 | + if (token === "YY") { | |
| 12912 | + const twoDigitYear = weekYear % 100; | |
| 12913 | + return addLeadingZeros(twoDigitYear, 2); | |
| 12914 | + } | |
| 12915 | + if (token === "Yo") { | |
| 12916 | + return localize2.ordinalNumber(weekYear, { unit: "year" }); | |
| 12917 | + } | |
| 12918 | + return addLeadingZeros(weekYear, token.length); | |
| 12919 | + }, | |
| 12920 | + // ISO week-numbering year | |
| 12921 | + R: function(date, token) { | |
| 12922 | + const isoWeekYear = getISOWeekYear(date); | |
| 12923 | + return addLeadingZeros(isoWeekYear, token.length); | |
| 12924 | + }, | |
| 12925 | + // Extended year. This is a single number designating the year of this calendar system. | |
| 12926 | + // The main difference between `y` and `u` localizers are B.C. years: | |
| 12927 | + // | Year | `y` | `u` | | |
| 12928 | + // |------|-----|-----| | |
| 12929 | + // | AC 1 | 1 | 1 | | |
| 12930 | + // | BC 1 | 1 | 0 | | |
| 12931 | + // | BC 2 | 2 | -1 | | |
| 12932 | + // Also `yy` always returns the last two digits of a year, | |
| 12933 | + // while `uu` pads single digit years to 2 characters and returns other years unchanged. | |
| 12934 | + u: function(date, token) { | |
| 12935 | + const year = date.getFullYear(); | |
| 12936 | + return addLeadingZeros(year, token.length); | |
| 12937 | + }, | |
| 12938 | + // Quarter | |
| 12939 | + Q: function(date, token, localize2) { | |
| 12940 | + const quarter = Math.ceil((date.getMonth() + 1) / 3); | |
| 12941 | + switch (token) { | |
| 12942 | + // 1, 2, 3, 4 | |
| 12943 | + case "Q": | |
| 12944 | + return String(quarter); | |
| 12945 | + // 01, 02, 03, 04 | |
| 12946 | + case "QQ": | |
| 12947 | + return addLeadingZeros(quarter, 2); | |
| 12948 | + // 1st, 2nd, 3rd, 4th | |
| 12949 | + case "Qo": | |
| 12950 | + return localize2.ordinalNumber(quarter, { unit: "quarter" }); | |
| 12951 | + // Q1, Q2, Q3, Q4 | |
| 12952 | + case "QQQ": | |
| 12953 | + return localize2.quarter(quarter, { | |
| 12954 | + width: "abbreviated", | |
| 12955 | + context: "formatting" | |
| 12956 | + }); | |
| 12957 | + // 1, 2, 3, 4 (narrow quarter; could be not numerical) | |
| 12958 | + case "QQQQQ": | |
| 12959 | + return localize2.quarter(quarter, { | |
| 12960 | + width: "narrow", | |
| 12961 | + context: "formatting" | |
| 12962 | + }); | |
| 12963 | + // 1st quarter, 2nd quarter, ... | |
| 12964 | + case "QQQQ": | |
| 12965 | + default: | |
| 12966 | + return localize2.quarter(quarter, { | |
| 12967 | + width: "wide", | |
| 12968 | + context: "formatting" | |
| 12969 | + }); | |
| 12970 | + } | |
| 12971 | + }, | |
| 12972 | + // Stand-alone quarter | |
| 12973 | + q: function(date, token, localize2) { | |
| 12974 | + const quarter = Math.ceil((date.getMonth() + 1) / 3); | |
| 12975 | + switch (token) { | |
| 12976 | + // 1, 2, 3, 4 | |
| 12977 | + case "q": | |
| 12978 | + return String(quarter); | |
| 12979 | + // 01, 02, 03, 04 | |
| 12980 | + case "qq": | |
| 12981 | + return addLeadingZeros(quarter, 2); | |
| 12982 | + // 1st, 2nd, 3rd, 4th | |
| 12983 | + case "qo": | |
| 12984 | + return localize2.ordinalNumber(quarter, { unit: "quarter" }); | |
| 12985 | + // Q1, Q2, Q3, Q4 | |
| 12986 | + case "qqq": | |
| 12987 | + return localize2.quarter(quarter, { | |
| 12988 | + width: "abbreviated", | |
| 12989 | + context: "standalone" | |
| 12990 | + }); | |
| 12991 | + // 1, 2, 3, 4 (narrow quarter; could be not numerical) | |
| 12992 | + case "qqqqq": | |
| 12993 | + return localize2.quarter(quarter, { | |
| 12994 | + width: "narrow", | |
| 12995 | + context: "standalone" | |
| 12996 | + }); | |
| 12997 | + // 1st quarter, 2nd quarter, ... | |
| 12998 | + case "qqqq": | |
| 12999 | + default: | |
| 13000 | + return localize2.quarter(quarter, { | |
| 13001 | + width: "wide", | |
| 13002 | + context: "standalone" | |
| 13003 | + }); | |
| 13004 | + } | |
| 13005 | + }, | |
| 13006 | + // Month | |
| 13007 | + M: function(date, token, localize2) { | |
| 13008 | + const month = date.getMonth(); | |
| 13009 | + switch (token) { | |
| 13010 | + case "M": | |
| 13011 | + case "MM": | |
| 13012 | + return lightFormatters.M(date, token); | |
| 13013 | + // 1st, 2nd, ..., 12th | |
| 13014 | + case "Mo": | |
| 13015 | + return localize2.ordinalNumber(month + 1, { unit: "month" }); | |
| 13016 | + // Jan, Feb, ..., Dec | |
| 13017 | + case "MMM": | |
| 13018 | + return localize2.month(month, { | |
| 13019 | + width: "abbreviated", | |
| 13020 | + context: "formatting" | |
| 13021 | + }); | |
| 13022 | + // J, F, ..., D | |
| 13023 | + case "MMMMM": | |
| 13024 | + return localize2.month(month, { | |
| 13025 | + width: "narrow", | |
| 13026 | + context: "formatting" | |
| 13027 | + }); | |
| 13028 | + // January, February, ..., December | |
| 13029 | + case "MMMM": | |
| 13030 | + default: | |
| 13031 | + return localize2.month(month, { width: "wide", context: "formatting" }); | |
| 13032 | + } | |
| 13033 | + }, | |
| 13034 | + // Stand-alone month | |
| 13035 | + L: function(date, token, localize2) { | |
| 13036 | + const month = date.getMonth(); | |
| 13037 | + switch (token) { | |
| 13038 | + // 1, 2, ..., 12 | |
| 13039 | + case "L": | |
| 13040 | + return String(month + 1); | |
| 13041 | + // 01, 02, ..., 12 | |
| 13042 | + case "LL": | |
| 13043 | + return addLeadingZeros(month + 1, 2); | |
| 13044 | + // 1st, 2nd, ..., 12th | |
| 13045 | + case "Lo": | |
| 13046 | + return localize2.ordinalNumber(month + 1, { unit: "month" }); | |
| 13047 | + // Jan, Feb, ..., Dec | |
| 13048 | + case "LLL": | |
| 13049 | + return localize2.month(month, { | |
| 13050 | + width: "abbreviated", | |
| 13051 | + context: "standalone" | |
| 13052 | + }); | |
| 13053 | + // J, F, ..., D | |
| 13054 | + case "LLLLL": | |
| 13055 | + return localize2.month(month, { | |
| 13056 | + width: "narrow", | |
| 13057 | + context: "standalone" | |
| 13058 | + }); | |
| 13059 | + // January, February, ..., December | |
| 13060 | + case "LLLL": | |
| 13061 | + default: | |
| 13062 | + return localize2.month(month, { width: "wide", context: "standalone" }); | |
| 13063 | + } | |
| 13064 | + }, | |
| 13065 | + // Local week of year | |
| 13066 | + w: function(date, token, localize2, options) { | |
| 13067 | + const week = getWeek(date, options); | |
| 13068 | + if (token === "wo") { | |
| 13069 | + return localize2.ordinalNumber(week, { unit: "week" }); | |
| 13070 | + } | |
| 13071 | + return addLeadingZeros(week, token.length); | |
| 13072 | + }, | |
| 13073 | + // ISO week of year | |
| 13074 | + I: function(date, token, localize2) { | |
| 13075 | + const isoWeek = getISOWeek(date); | |
| 13076 | + if (token === "Io") { | |
| 13077 | + return localize2.ordinalNumber(isoWeek, { unit: "week" }); | |
| 13078 | + } | |
| 13079 | + return addLeadingZeros(isoWeek, token.length); | |
| 13080 | + }, | |
| 13081 | + // Day of the month | |
| 13082 | + d: function(date, token, localize2) { | |
| 13083 | + if (token === "do") { | |
| 13084 | + return localize2.ordinalNumber(date.getDate(), { unit: "date" }); | |
| 13085 | + } | |
| 13086 | + return lightFormatters.d(date, token); | |
| 13087 | + }, | |
| 13088 | + // Day of year | |
| 13089 | + D: function(date, token, localize2) { | |
| 13090 | + const dayOfYear = getDayOfYear(date); | |
| 13091 | + if (token === "Do") { | |
| 13092 | + return localize2.ordinalNumber(dayOfYear, { unit: "dayOfYear" }); | |
| 13093 | + } | |
| 13094 | + return addLeadingZeros(dayOfYear, token.length); | |
| 13095 | + }, | |
| 13096 | + // Day of week | |
| 13097 | + E: function(date, token, localize2) { | |
| 13098 | + const dayOfWeek = date.getDay(); | |
| 13099 | + switch (token) { | |
| 13100 | + // Tue | |
| 13101 | + case "E": | |
| 13102 | + case "EE": | |
| 13103 | + case "EEE": | |
| 13104 | + return localize2.day(dayOfWeek, { | |
| 13105 | + width: "abbreviated", | |
| 13106 | + context: "formatting" | |
| 13107 | + }); | |
| 13108 | + // T | |
| 13109 | + case "EEEEE": | |
| 13110 | + return localize2.day(dayOfWeek, { | |
| 13111 | + width: "narrow", | |
| 13112 | + context: "formatting" | |
| 13113 | + }); | |
| 13114 | + // Tu | |
| 13115 | + case "EEEEEE": | |
| 13116 | + return localize2.day(dayOfWeek, { | |
| 13117 | + width: "short", | |
| 13118 | + context: "formatting" | |
| 13119 | + }); | |
| 13120 | + // Tuesday | |
| 13121 | + case "EEEE": | |
| 13122 | + default: | |
| 13123 | + return localize2.day(dayOfWeek, { | |
| 13124 | + width: "wide", | |
| 13125 | + context: "formatting" | |
| 13126 | + }); | |
| 13127 | + } | |
| 13128 | + }, | |
| 13129 | + // Local day of week | |
| 13130 | + e: function(date, token, localize2, options) { | |
| 13131 | + const dayOfWeek = date.getDay(); | |
| 13132 | + const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; | |
| 13133 | + switch (token) { | |
| 13134 | + // Numerical value (Nth day of week with current locale or weekStartsOn) | |
| 13135 | + case "e": | |
| 13136 | + return String(localDayOfWeek); | |
| 13137 | + // Padded numerical value | |
| 13138 | + case "ee": | |
| 13139 | + return addLeadingZeros(localDayOfWeek, 2); | |
| 13140 | + // 1st, 2nd, ..., 7th | |
| 13141 | + case "eo": | |
| 13142 | + return localize2.ordinalNumber(localDayOfWeek, { unit: "day" }); | |
| 13143 | + case "eee": | |
| 13144 | + return localize2.day(dayOfWeek, { | |
| 13145 | + width: "abbreviated", | |
| 13146 | + context: "formatting" | |
| 13147 | + }); | |
| 13148 | + // T | |
| 13149 | + case "eeeee": | |
| 13150 | + return localize2.day(dayOfWeek, { | |
| 13151 | + width: "narrow", | |
| 13152 | + context: "formatting" | |
| 13153 | + }); | |
| 13154 | + // Tu | |
| 13155 | + case "eeeeee": | |
| 13156 | + return localize2.day(dayOfWeek, { | |
| 13157 | + width: "short", | |
| 13158 | + context: "formatting" | |
| 13159 | + }); | |
| 13160 | + // Tuesday | |
| 13161 | + case "eeee": | |
| 13162 | + default: | |
| 13163 | + return localize2.day(dayOfWeek, { | |
| 13164 | + width: "wide", | |
| 13165 | + context: "formatting" | |
| 13166 | + }); | |
| 13167 | + } | |
| 13168 | + }, | |
| 13169 | + // Stand-alone local day of week | |
| 13170 | + c: function(date, token, localize2, options) { | |
| 13171 | + const dayOfWeek = date.getDay(); | |
| 13172 | + const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; | |
| 13173 | + switch (token) { | |
| 13174 | + // Numerical value (same as in `e`) | |
| 13175 | + case "c": | |
| 13176 | + return String(localDayOfWeek); | |
| 13177 | + // Padded numerical value | |
| 13178 | + case "cc": | |
| 13179 | + return addLeadingZeros(localDayOfWeek, token.length); | |
| 13180 | + // 1st, 2nd, ..., 7th | |
| 13181 | + case "co": | |
| 13182 | + return localize2.ordinalNumber(localDayOfWeek, { unit: "day" }); | |
| 13183 | + case "ccc": | |
| 13184 | + return localize2.day(dayOfWeek, { | |
| 13185 | + width: "abbreviated", | |
| 13186 | + context: "standalone" | |
| 13187 | + }); | |
| 13188 | + // T | |
| 13189 | + case "ccccc": | |
| 13190 | + return localize2.day(dayOfWeek, { | |
| 13191 | + width: "narrow", | |
| 13192 | + context: "standalone" | |
| 13193 | + }); | |
| 13194 | + // Tu | |
| 13195 | + case "cccccc": | |
| 13196 | + return localize2.day(dayOfWeek, { | |
| 13197 | + width: "short", | |
| 13198 | + context: "standalone" | |
| 13199 | + }); | |
| 13200 | + // Tuesday | |
| 13201 | + case "cccc": | |
| 13202 | + default: | |
| 13203 | + return localize2.day(dayOfWeek, { | |
| 13204 | + width: "wide", | |
| 13205 | + context: "standalone" | |
| 13206 | + }); | |
| 13207 | + } | |
| 13208 | + }, | |
| 13209 | + // ISO day of week | |
| 13210 | + i: function(date, token, localize2) { | |
| 13211 | + const dayOfWeek = date.getDay(); | |
| 13212 | + const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek; | |
| 13213 | + switch (token) { | |
| 13214 | + // 2 | |
| 13215 | + case "i": | |
| 13216 | + return String(isoDayOfWeek); | |
| 13217 | + // 02 | |
| 13218 | + case "ii": | |
| 13219 | + return addLeadingZeros(isoDayOfWeek, token.length); | |
| 13220 | + // 2nd | |
| 13221 | + case "io": | |
| 13222 | + return localize2.ordinalNumber(isoDayOfWeek, { unit: "day" }); | |
| 13223 | + // Tue | |
| 13224 | + case "iii": | |
| 13225 | + return localize2.day(dayOfWeek, { | |
| 13226 | + width: "abbreviated", | |
| 13227 | + context: "formatting" | |
| 13228 | + }); | |
| 13229 | + // T | |
| 13230 | + case "iiiii": | |
| 13231 | + return localize2.day(dayOfWeek, { | |
| 13232 | + width: "narrow", | |
| 13233 | + context: "formatting" | |
| 13234 | + }); | |
| 13235 | + // Tu | |
| 13236 | + case "iiiiii": | |
| 13237 | + return localize2.day(dayOfWeek, { | |
| 13238 | + width: "short", | |
| 13239 | + context: "formatting" | |
| 13240 | + }); | |
| 13241 | + // Tuesday | |
| 13242 | + case "iiii": | |
| 13243 | + default: | |
| 13244 | + return localize2.day(dayOfWeek, { | |
| 13245 | + width: "wide", | |
| 13246 | + context: "formatting" | |
| 13247 | + }); | |
| 13248 | + } | |
| 13249 | + }, | |
| 13250 | + // AM or PM | |
| 13251 | + a: function(date, token, localize2) { | |
| 13252 | + const hours = date.getHours(); | |
| 13253 | + const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; | |
| 13254 | + switch (token) { | |
| 13255 | + case "a": | |
| 13256 | + case "aa": | |
| 13257 | + return localize2.dayPeriod(dayPeriodEnumValue, { | |
| 13258 | + width: "abbreviated", | |
| 13259 | + context: "formatting" | |
| 13260 | + }); | |
| 13261 | + case "aaa": | |
| 13262 | + return localize2.dayPeriod(dayPeriodEnumValue, { | |
| 13263 | + width: "abbreviated", | |
| 13264 | + context: "formatting" | |
| 13265 | + }).toLowerCase(); | |
| 13266 | + case "aaaaa": | |
| 13267 | + return localize2.dayPeriod(dayPeriodEnumValue, { | |
| 13268 | + width: "narrow", | |
| 13269 | + context: "formatting" | |
| 13270 | + }); | |
| 13271 | + case "aaaa": | |
| 13272 | + default: | |
| 13273 | + return localize2.dayPeriod(dayPeriodEnumValue, { | |
| 13274 | + width: "wide", | |
| 13275 | + context: "formatting" | |
| 13276 | + }); | |
| 13277 | + } | |
| 13278 | + }, | |
| 13279 | + // AM, PM, midnight, noon | |
| 13280 | + b: function(date, token, localize2) { | |
| 13281 | + const hours = date.getHours(); | |
| 13282 | + let dayPeriodEnumValue; | |
| 13283 | + if (hours === 12) { | |
| 13284 | + dayPeriodEnumValue = dayPeriodEnum.noon; | |
| 13285 | + } else if (hours === 0) { | |
| 13286 | + dayPeriodEnumValue = dayPeriodEnum.midnight; | |
| 13287 | + } else { | |
| 13288 | + dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; | |
| 13289 | + } | |
| 13290 | + switch (token) { | |
| 13291 | + case "b": | |
| 13292 | + case "bb": | |
| 13293 | + return localize2.dayPeriod(dayPeriodEnumValue, { | |
| 13294 | + width: "abbreviated", | |
| 13295 | + context: "formatting" | |
| 13296 | + }); | |
| 13297 | + case "bbb": | |
| 13298 | + return localize2.dayPeriod(dayPeriodEnumValue, { | |
| 13299 | + width: "abbreviated", | |
| 13300 | + context: "formatting" | |
| 13301 | + }).toLowerCase(); | |
| 13302 | + case "bbbbb": | |
| 13303 | + return localize2.dayPeriod(dayPeriodEnumValue, { | |
| 13304 | + width: "narrow", | |
| 13305 | + context: "formatting" | |
| 13306 | + }); | |
| 13307 | + case "bbbb": | |
| 13308 | + default: | |
| 13309 | + return localize2.dayPeriod(dayPeriodEnumValue, { | |
| 13310 | + width: "wide", | |
| 13311 | + context: "formatting" | |
| 13312 | + }); | |
| 13313 | + } | |
| 13314 | + }, | |
| 13315 | + // in the morning, in the afternoon, in the evening, at night | |
| 13316 | + B: function(date, token, localize2) { | |
| 13317 | + const hours = date.getHours(); | |
| 13318 | + let dayPeriodEnumValue; | |
| 13319 | + if (hours >= 17) { | |
| 13320 | + dayPeriodEnumValue = dayPeriodEnum.evening; | |
| 13321 | + } else if (hours >= 12) { | |
| 13322 | + dayPeriodEnumValue = dayPeriodEnum.afternoon; | |
| 13323 | + } else if (hours >= 4) { | |
| 13324 | + dayPeriodEnumValue = dayPeriodEnum.morning; | |
| 13325 | + } else { | |
| 13326 | + dayPeriodEnumValue = dayPeriodEnum.night; | |
| 13327 | + } | |
| 13328 | + switch (token) { | |
| 13329 | + case "B": | |
| 13330 | + case "BB": | |
| 13331 | + case "BBB": | |
| 13332 | + return localize2.dayPeriod(dayPeriodEnumValue, { | |
| 13333 | + width: "abbreviated", | |
| 13334 | + context: "formatting" | |
| 13335 | + }); | |
| 13336 | + case "BBBBB": | |
| 13337 | + return localize2.dayPeriod(dayPeriodEnumValue, { | |
| 13338 | + width: "narrow", | |
| 13339 | + context: "formatting" | |
| 13340 | + }); | |
| 13341 | + case "BBBB": | |
| 13342 | + default: | |
| 13343 | + return localize2.dayPeriod(dayPeriodEnumValue, { | |
| 13344 | + width: "wide", | |
| 13345 | + context: "formatting" | |
| 13346 | + }); | |
| 13347 | + } | |
| 13348 | + }, | |
| 13349 | + // Hour [1-12] | |
| 13350 | + h: function(date, token, localize2) { | |
| 13351 | + if (token === "ho") { | |
| 13352 | + let hours = date.getHours() % 12; | |
| 13353 | + if (hours === 0) hours = 12; | |
| 13354 | + return localize2.ordinalNumber(hours, { unit: "hour" }); | |
| 13355 | + } | |
| 13356 | + return lightFormatters.h(date, token); | |
| 13357 | + }, | |
| 13358 | + // Hour [0-23] | |
| 13359 | + H: function(date, token, localize2) { | |
| 13360 | + if (token === "Ho") { | |
| 13361 | + return localize2.ordinalNumber(date.getHours(), { unit: "hour" }); | |
| 13362 | + } | |
| 13363 | + return lightFormatters.H(date, token); | |
| 13364 | + }, | |
| 13365 | + // Hour [0-11] | |
| 13366 | + K: function(date, token, localize2) { | |
| 13367 | + const hours = date.getHours() % 12; | |
| 13368 | + if (token === "Ko") { | |
| 13369 | + return localize2.ordinalNumber(hours, { unit: "hour" }); | |
| 13370 | + } | |
| 13371 | + return addLeadingZeros(hours, token.length); | |
| 13372 | + }, | |
| 13373 | + // Hour [1-24] | |
| 13374 | + k: function(date, token, localize2) { | |
| 13375 | + let hours = date.getHours(); | |
| 13376 | + if (hours === 0) hours = 24; | |
| 13377 | + if (token === "ko") { | |
| 13378 | + return localize2.ordinalNumber(hours, { unit: "hour" }); | |
| 13379 | + } | |
| 13380 | + return addLeadingZeros(hours, token.length); | |
| 13381 | + }, | |
| 13382 | + // Minute | |
| 13383 | + m: function(date, token, localize2) { | |
| 13384 | + if (token === "mo") { | |
| 13385 | + return localize2.ordinalNumber(date.getMinutes(), { unit: "minute" }); | |
| 13386 | + } | |
| 13387 | + return lightFormatters.m(date, token); | |
| 13388 | + }, | |
| 13389 | + // Second | |
| 13390 | + s: function(date, token, localize2) { | |
| 13391 | + if (token === "so") { | |
| 13392 | + return localize2.ordinalNumber(date.getSeconds(), { unit: "second" }); | |
| 13393 | + } | |
| 13394 | + return lightFormatters.s(date, token); | |
| 13395 | + }, | |
| 13396 | + // Fraction of second | |
| 13397 | + S: function(date, token) { | |
| 13398 | + return lightFormatters.S(date, token); | |
| 13399 | + }, | |
| 13400 | + // Timezone (ISO-8601. If offset is 0, output is always `'Z'`) | |
| 13401 | + X: function(date, token, _localize) { | |
| 13402 | + const timezoneOffset = date.getTimezoneOffset(); | |
| 13403 | + if (timezoneOffset === 0) { | |
| 13404 | + return "Z"; | |
| 13405 | + } | |
| 13406 | + switch (token) { | |
| 13407 | + // Hours and optional minutes | |
| 13408 | + case "X": | |
| 13409 | + return formatTimezoneWithOptionalMinutes(timezoneOffset); | |
| 13410 | + // Hours, minutes and optional seconds without `:` delimiter | |
| 13411 | + // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets | |
| 13412 | + // so this token always has the same output as `XX` | |
| 13413 | + case "XXXX": | |
| 13414 | + case "XX": | |
| 13415 | + return formatTimezone(timezoneOffset); | |
| 13416 | + // Hours, minutes and optional seconds with `:` delimiter | |
| 13417 | + // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets | |
| 13418 | + // so this token always has the same output as `XXX` | |
| 13419 | + case "XXXXX": | |
| 13420 | + case "XXX": | |
| 13421 | + // Hours and minutes with `:` delimiter | |
| 13422 | + default: | |
| 13423 | + return formatTimezone(timezoneOffset, ":"); | |
| 13424 | + } | |
| 13425 | + }, | |
| 13426 | + // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent) | |
| 13427 | + x: function(date, token, _localize) { | |
| 13428 | + const timezoneOffset = date.getTimezoneOffset(); | |
| 13429 | + switch (token) { | |
| 13430 | + // Hours and optional minutes | |
| 13431 | + case "x": | |
| 13432 | + return formatTimezoneWithOptionalMinutes(timezoneOffset); | |
| 13433 | + // Hours, minutes and optional seconds without `:` delimiter | |
| 13434 | + // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets | |
| 13435 | + // so this token always has the same output as `xx` | |
| 13436 | + case "xxxx": | |
| 13437 | + case "xx": | |
| 13438 | + return formatTimezone(timezoneOffset); | |
| 13439 | + // Hours, minutes and optional seconds with `:` delimiter | |
| 13440 | + // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets | |
| 13441 | + // so this token always has the same output as `xxx` | |
| 13442 | + case "xxxxx": | |
| 13443 | + case "xxx": | |
| 13444 | + // Hours and minutes with `:` delimiter | |
| 13445 | + default: | |
| 13446 | + return formatTimezone(timezoneOffset, ":"); | |
| 13447 | + } | |
| 13448 | + }, | |
| 13449 | + // Timezone (GMT) | |
| 13450 | + O: function(date, token, _localize) { | |
| 13451 | + const timezoneOffset = date.getTimezoneOffset(); | |
| 13452 | + switch (token) { | |
| 13453 | + // Short | |
| 13454 | + case "O": | |
| 13455 | + case "OO": | |
| 13456 | + case "OOO": | |
| 13457 | + return "GMT" + formatTimezoneShort(timezoneOffset, ":"); | |
| 13458 | + // Long | |
| 13459 | + case "OOOO": | |
| 13460 | + default: | |
| 13461 | + return "GMT" + formatTimezone(timezoneOffset, ":"); | |
| 13462 | + } | |
| 13463 | + }, | |
| 13464 | + // Timezone (specific non-location) | |
| 13465 | + z: function(date, token, _localize) { | |
| 13466 | + const timezoneOffset = date.getTimezoneOffset(); | |
| 13467 | + switch (token) { | |
| 13468 | + // Short | |
| 13469 | + case "z": | |
| 13470 | + case "zz": | |
| 13471 | + case "zzz": | |
| 13472 | + return "GMT" + formatTimezoneShort(timezoneOffset, ":"); | |
| 13473 | + // Long | |
| 13474 | + case "zzzz": | |
| 13475 | + default: | |
| 13476 | + return "GMT" + formatTimezone(timezoneOffset, ":"); | |
| 13477 | + } | |
| 13478 | + }, | |
| 13479 | + // Seconds timestamp | |
| 13480 | + t: function(date, token, _localize) { | |
| 13481 | + const timestamp = Math.trunc(+date / 1e3); | |
| 13482 | + return addLeadingZeros(timestamp, token.length); | |
| 13483 | + }, | |
| 13484 | + // Milliseconds timestamp | |
| 13485 | + T: function(date, token, _localize) { | |
| 13486 | + return addLeadingZeros(+date, token.length); | |
| 13487 | + } | |
| 13488 | +}; | |
| 13489 | +function formatTimezoneShort(offset4, delimiter = "") { | |
| 13490 | + const sign = offset4 > 0 ? "-" : "+"; | |
| 13491 | + const absOffset = Math.abs(offset4); | |
| 13492 | + const hours = Math.trunc(absOffset / 60); | |
| 13493 | + const minutes = absOffset % 60; | |
| 13494 | + if (minutes === 0) { | |
| 13495 | + return sign + String(hours); | |
| 13496 | + } | |
| 13497 | + return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2); | |
| 13498 | +} | |
| 13499 | +function formatTimezoneWithOptionalMinutes(offset4, delimiter) { | |
| 13500 | + if (offset4 % 60 === 0) { | |
| 13501 | + const sign = offset4 > 0 ? "-" : "+"; | |
| 13502 | + return sign + addLeadingZeros(Math.abs(offset4) / 60, 2); | |
| 13503 | + } | |
| 13504 | + return formatTimezone(offset4, delimiter); | |
| 13505 | +} | |
| 13506 | +function formatTimezone(offset4, delimiter = "") { | |
| 13507 | + const sign = offset4 > 0 ? "-" : "+"; | |
| 13508 | + const absOffset = Math.abs(offset4); | |
| 13509 | + const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2); | |
| 13510 | + const minutes = addLeadingZeros(absOffset % 60, 2); | |
| 13511 | + return sign + hours + delimiter + minutes; | |
| 13512 | +} | |
| 13513 | + | |
| 13514 | +// node_modules/date-fns/_lib/format/longFormatters.js | |
| 13515 | +var dateLongFormatter = (pattern, formatLong2) => { | |
| 13516 | + switch (pattern) { | |
| 13517 | + case "P": | |
| 13518 | + return formatLong2.date({ width: "short" }); | |
| 13519 | + case "PP": | |
| 13520 | + return formatLong2.date({ width: "medium" }); | |
| 13521 | + case "PPP": | |
| 13522 | + return formatLong2.date({ width: "long" }); | |
| 13523 | + case "PPPP": | |
| 13524 | + default: | |
| 13525 | + return formatLong2.date({ width: "full" }); | |
| 13526 | + } | |
| 13527 | +}; | |
| 13528 | +var timeLongFormatter = (pattern, formatLong2) => { | |
| 13529 | + switch (pattern) { | |
| 13530 | + case "p": | |
| 13531 | + return formatLong2.time({ width: "short" }); | |
| 13532 | + case "pp": | |
| 13533 | + return formatLong2.time({ width: "medium" }); | |
| 13534 | + case "ppp": | |
| 13535 | + return formatLong2.time({ width: "long" }); | |
| 13536 | + case "pppp": | |
| 13537 | + default: | |
| 13538 | + return formatLong2.time({ width: "full" }); | |
| 13539 | + } | |
| 13540 | +}; | |
| 13541 | +var dateTimeLongFormatter = (pattern, formatLong2) => { | |
| 13542 | + const matchResult = pattern.match(/(P+)(p+)?/) || []; | |
| 13543 | + const datePattern = matchResult[1]; | |
| 13544 | + const timePattern = matchResult[2]; | |
| 13545 | + if (!timePattern) { | |
| 13546 | + return dateLongFormatter(pattern, formatLong2); | |
| 13547 | + } | |
| 13548 | + let dateTimeFormat; | |
| 13549 | + switch (datePattern) { | |
| 13550 | + case "P": | |
| 13551 | + dateTimeFormat = formatLong2.dateTime({ width: "short" }); | |
| 13552 | + break; | |
| 13553 | + case "PP": | |
| 13554 | + dateTimeFormat = formatLong2.dateTime({ width: "medium" }); | |
| 13555 | + break; | |
| 13556 | + case "PPP": | |
| 13557 | + dateTimeFormat = formatLong2.dateTime({ width: "long" }); | |
| 13558 | + break; | |
| 13559 | + case "PPPP": | |
| 13560 | + default: | |
| 13561 | + dateTimeFormat = formatLong2.dateTime({ width: "full" }); | |
| 13562 | + break; | |
| 13563 | + } | |
| 13564 | + return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2)); | |
| 13565 | +}; | |
| 13566 | +var longFormatters = { | |
| 13567 | + p: timeLongFormatter, | |
| 13568 | + P: dateTimeLongFormatter | |
| 13569 | +}; | |
| 13570 | + | |
| 13571 | +// node_modules/date-fns/_lib/protectedTokens.js | |
| 13572 | +var dayOfYearTokenRE = /^D+$/; | |
| 13573 | +var weekYearTokenRE = /^Y+$/; | |
| 13574 | +var throwTokens = ["D", "DD", "YY", "YYYY"]; | |
| 13575 | +function isProtectedDayOfYearToken(token) { | |
| 13576 | + return dayOfYearTokenRE.test(token); | |
| 13577 | +} | |
| 13578 | +function isProtectedWeekYearToken(token) { | |
| 13579 | + return weekYearTokenRE.test(token); | |
| 13580 | +} | |
| 13581 | +function warnOrThrowProtectedError(token, format7, input) { | |
| 13582 | + const _message = message(token, format7, input); | |
| 13583 | + console.warn(_message); | |
| 13584 | + if (throwTokens.includes(token)) throw new RangeError(_message); | |
| 13585 | +} | |
| 13586 | +function message(token, format7, input) { | |
| 13587 | + const subject = token[0] === "Y" ? "years" : "days of the month"; | |
| 13588 | + return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format7}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`; | |
| 13589 | +} | |
| 13590 | + | |
| 13591 | +// node_modules/date-fns/format.js | |
| 13592 | +var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; | |
| 13593 | +var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g; | |
| 13594 | +var escapedStringRegExp = /^'([^]*?)'?$/; | |
| 13595 | +var doubleQuoteRegExp = /''/g; | |
| 13596 | +var unescapedLatinCharacterRegExp = /[a-zA-Z]/; | |
| 13597 | +function format(date, formatStr, options) { | |
| 13598 | + const defaultOptions2 = getDefaultOptions(); | |
| 13599 | + const locale = options?.locale ?? defaultOptions2.locale ?? enUS; | |
| 13600 | + const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1; | |
| 13601 | + const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0; | |
| 13602 | + const originalDate = toDate(date, options?.in); | |
| 13603 | + if (!isValid(originalDate)) { | |
| 13604 | + throw new RangeError("Invalid time value"); | |
| 13605 | + } | |
| 13606 | + let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => { | |
| 13607 | + const firstCharacter = substring[0]; | |
| 13608 | + if (firstCharacter === "p" || firstCharacter === "P") { | |
| 13609 | + const longFormatter = longFormatters[firstCharacter]; | |
| 13610 | + return longFormatter(substring, locale.formatLong); | |
| 13611 | + } | |
| 13612 | + return substring; | |
| 13613 | + }).join("").match(formattingTokensRegExp).map((substring) => { | |
| 13614 | + if (substring === "''") { | |
| 13615 | + return { isToken: false, value: "'" }; | |
| 13616 | + } | |
| 13617 | + const firstCharacter = substring[0]; | |
| 13618 | + if (firstCharacter === "'") { | |
| 13619 | + return { isToken: false, value: cleanEscapedString(substring) }; | |
| 13620 | + } | |
| 13621 | + if (formatters[firstCharacter]) { | |
| 13622 | + return { isToken: true, value: substring }; | |
| 13623 | + } | |
| 13624 | + if (firstCharacter.match(unescapedLatinCharacterRegExp)) { | |
| 13625 | + throw new RangeError( | |
| 13626 | + "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`" | |
| 13627 | + ); | |
| 13628 | + } | |
| 13629 | + return { isToken: false, value: substring }; | |
| 13630 | + }); | |
| 13631 | + if (locale.localize.preprocessor) { | |
| 13632 | + parts = locale.localize.preprocessor(originalDate, parts); | |
| 13633 | + } | |
| 13634 | + const formatterOptions = { | |
| 13635 | + firstWeekContainsDate, | |
| 13636 | + weekStartsOn, | |
| 13637 | + locale | |
| 13638 | + }; | |
| 13639 | + return parts.map((part) => { | |
| 13640 | + if (!part.isToken) return part.value; | |
| 13641 | + const token = part.value; | |
| 13642 | + if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) { | |
| 13643 | + warnOrThrowProtectedError(token, formatStr, String(date)); | |
| 13644 | + } | |
| 13645 | + const formatter = formatters[token[0]]; | |
| 13646 | + return formatter(originalDate, token, locale.localize, formatterOptions); | |
| 13647 | + }).join(""); | |
| 13648 | +} | |
| 13649 | +function cleanEscapedString(input) { | |
| 13650 | + const matched = input.match(escapedStringRegExp); | |
| 13651 | + if (!matched) { | |
| 13652 | + return input; | |
| 13653 | + } | |
| 13654 | + return matched[1].replace(doubleQuoteRegExp, "'"); | |
| 13655 | +} | |
| 13656 | + | |
| 13657 | +// node_modules/date-fns/getDaysInMonth.js | |
| 13658 | +function getDaysInMonth(date, options) { | |
| 13659 | + const _date = toDate(date, options?.in); | |
| 13660 | + const year = _date.getFullYear(); | |
| 13661 | + const monthIndex = _date.getMonth(); | |
| 13662 | + const lastDayOfMonth = constructFrom(_date, 0); | |
| 13663 | + lastDayOfMonth.setFullYear(year, monthIndex + 1, 0); | |
| 13664 | + lastDayOfMonth.setHours(0, 0, 0, 0); | |
| 13665 | + return lastDayOfMonth.getDate(); | |
| 13666 | +} | |
| 13667 | + | |
| 13668 | +// node_modules/date-fns/getDefaultOptions.js | |
| 13669 | +function getDefaultOptions2() { | |
| 13670 | + return Object.assign({}, getDefaultOptions()); | |
| 13671 | +} | |
| 13672 | + | |
| 13673 | +// node_modules/date-fns/getISODay.js | |
| 13674 | +function getISODay(date, options) { | |
| 13675 | + const day = toDate(date, options?.in).getDay(); | |
| 13676 | + return day === 0 ? 7 : day; | |
| 13677 | +} | |
| 13678 | + | |
| 13679 | +// node_modules/date-fns/getMonth.js | |
| 13680 | +function getMonth(date, options) { | |
| 13681 | + return toDate(date, options?.in).getMonth(); | |
| 13682 | +} | |
| 13683 | + | |
| 13684 | +// node_modules/date-fns/getYear.js | |
| 13685 | +function getYear(date, options) { | |
| 13686 | + return toDate(date, options?.in).getFullYear(); | |
| 13687 | +} | |
| 13688 | + | |
| 13689 | +// node_modules/date-fns/isAfter.js | |
| 13690 | +function isAfter(date, dateToCompare) { | |
| 13691 | + return +toDate(date) > +toDate(dateToCompare); | |
| 13692 | +} | |
| 13693 | + | |
| 13694 | +// node_modules/date-fns/isBefore.js | |
| 13695 | +function isBefore(date, dateToCompare) { | |
| 13696 | + return +toDate(date) < +toDate(dateToCompare); | |
| 13697 | +} | |
| 13698 | + | |
| 13699 | +// node_modules/date-fns/transpose.js | |
| 13700 | +function transpose(date, constructor) { | |
| 13701 | + const date_ = isConstructor(constructor) ? new constructor(0) : constructFrom(constructor, 0); | |
| 13702 | + date_.setFullYear(date.getFullYear(), date.getMonth(), date.getDate()); | |
| 13703 | + date_.setHours( | |
| 13704 | + date.getHours(), | |
| 13705 | + date.getMinutes(), | |
| 13706 | + date.getSeconds(), | |
| 13707 | + date.getMilliseconds() | |
| 13708 | + ); | |
| 13709 | + return date_; | |
| 13710 | +} | |
| 13711 | +function isConstructor(constructor) { | |
| 13712 | + return typeof constructor === "function" && constructor.prototype?.constructor === constructor; | |
| 13713 | +} | |
| 13714 | + | |
| 13715 | +// node_modules/date-fns/parse/_lib/Setter.js | |
| 13716 | +var TIMEZONE_UNIT_PRIORITY = 10; | |
| 13717 | +var Setter = class { | |
| 13718 | + subPriority = 0; | |
| 13719 | + validate(_utcDate, _options) { | |
| 13720 | + return true; | |
| 13721 | + } | |
| 13722 | +}; | |
| 13723 | +var ValueSetter = class extends Setter { | |
| 13724 | + constructor(value, validateValue, setValue, priority, subPriority) { | |
| 13725 | + super(); | |
| 13726 | + this.value = value; | |
| 13727 | + this.validateValue = validateValue; | |
| 13728 | + this.setValue = setValue; | |
| 13729 | + this.priority = priority; | |
| 13730 | + if (subPriority) { | |
| 13731 | + this.subPriority = subPriority; | |
| 13732 | + } | |
| 13733 | + } | |
| 13734 | + validate(date, options) { | |
| 13735 | + return this.validateValue(date, this.value, options); | |
| 13736 | + } | |
| 13737 | + set(date, flags, options) { | |
| 13738 | + return this.setValue(date, flags, this.value, options); | |
| 13739 | + } | |
| 13740 | +}; | |
| 13741 | +var DateTimezoneSetter = class extends Setter { | |
| 13742 | + priority = TIMEZONE_UNIT_PRIORITY; | |
| 13743 | + subPriority = -1; | |
| 13744 | + constructor(context, reference) { | |
| 13745 | + super(); | |
| 13746 | + this.context = context || ((date) => constructFrom(reference, date)); | |
| 13747 | + } | |
| 13748 | + set(date, flags) { | |
| 13749 | + if (flags.timestampIsSet) return date; | |
| 13750 | + return constructFrom(date, transpose(date, this.context)); | |
| 13751 | + } | |
| 13752 | +}; | |
| 13753 | + | |
| 13754 | +// node_modules/date-fns/parse/_lib/Parser.js | |
| 13755 | +var Parser = class { | |
| 13756 | + run(dateString, token, match2, options) { | |
| 13757 | + const result = this.parse(dateString, token, match2, options); | |
| 13758 | + if (!result) { | |
| 13759 | + return null; | |
| 13760 | + } | |
| 202 | 13761 | return { |
| 203 | - sort: { field: "date", direction: "desc" } | |
| 13762 | + setter: new ValueSetter( | |
| 13763 | + result.value, | |
| 13764 | + this.validate, | |
| 13765 | + this.set, | |
| 13766 | + this.priority, | |
| 13767 | + this.subPriority | |
| 13768 | + ), | |
| 13769 | + rest: result.rest | |
| 204 | 13770 | }; |
| 205 | 13771 | } |
| 206 | - if (activeView === "active") { | |
| 207 | - return {}; | |
| 13772 | + validate(_utcDate, _value, _options) { | |
| 13773 | + return true; | |
| 208 | 13774 | } |
| 13775 | +}; | |
| 13776 | + | |
| 13777 | +// node_modules/date-fns/parse/_lib/parsers/EraParser.js | |
| 13778 | +var EraParser = class extends Parser { | |
| 13779 | + priority = 140; | |
| 13780 | + parse(dateString, token, match2) { | |
| 13781 | + switch (token) { | |
| 13782 | + // AD, BC | |
| 13783 | + case "G": | |
| 13784 | + case "GG": | |
| 13785 | + case "GGG": | |
| 13786 | + return match2.era(dateString, { width: "abbreviated" }) || match2.era(dateString, { width: "narrow" }); | |
| 13787 | + // A, B | |
| 13788 | + case "GGGGG": | |
| 13789 | + return match2.era(dateString, { width: "narrow" }); | |
| 13790 | + // Anno Domini, Before Christ | |
| 13791 | + case "GGGG": | |
| 13792 | + default: | |
| 13793 | + return match2.era(dateString, { width: "wide" }) || match2.era(dateString, { width: "abbreviated" }) || match2.era(dateString, { width: "narrow" }); | |
| 13794 | + } | |
| 13795 | + } | |
| 13796 | + set(date, flags, value) { | |
| 13797 | + flags.era = value; | |
| 13798 | + date.setFullYear(value, 0, 1); | |
| 13799 | + date.setHours(0, 0, 0, 0); | |
| 13800 | + return date; | |
| 13801 | + } | |
| 13802 | + incompatibleTokens = ["R", "u", "t", "T"]; | |
| 13803 | +}; | |
| 13804 | + | |
| 13805 | +// node_modules/date-fns/parse/_lib/constants.js | |
| 13806 | +var numericPatterns = { | |
| 13807 | + month: /^(1[0-2]|0?\d)/, | |
| 13808 | + // 0 to 12 | |
| 13809 | + date: /^(3[0-1]|[0-2]?\d)/, | |
| 13810 | + // 0 to 31 | |
| 13811 | + dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/, | |
| 13812 | + // 0 to 366 | |
| 13813 | + week: /^(5[0-3]|[0-4]?\d)/, | |
| 13814 | + // 0 to 53 | |
| 13815 | + hour23h: /^(2[0-3]|[0-1]?\d)/, | |
| 13816 | + // 0 to 23 | |
| 13817 | + hour24h: /^(2[0-4]|[0-1]?\d)/, | |
| 13818 | + // 0 to 24 | |
| 13819 | + hour11h: /^(1[0-1]|0?\d)/, | |
| 13820 | + // 0 to 11 | |
| 13821 | + hour12h: /^(1[0-2]|0?\d)/, | |
| 13822 | + // 0 to 12 | |
| 13823 | + minute: /^[0-5]?\d/, | |
| 13824 | + // 0 to 59 | |
| 13825 | + second: /^[0-5]?\d/, | |
| 13826 | + // 0 to 59 | |
| 13827 | + singleDigit: /^\d/, | |
| 13828 | + // 0 to 9 | |
| 13829 | + twoDigits: /^\d{1,2}/, | |
| 13830 | + // 0 to 99 | |
| 13831 | + threeDigits: /^\d{1,3}/, | |
| 13832 | + // 0 to 999 | |
| 13833 | + fourDigits: /^\d{1,4}/, | |
| 13834 | + // 0 to 9999 | |
| 13835 | + anyDigitsSigned: /^-?\d+/, | |
| 13836 | + singleDigitSigned: /^-?\d/, | |
| 13837 | + // 0 to 9, -0 to -9 | |
| 13838 | + twoDigitsSigned: /^-?\d{1,2}/, | |
| 13839 | + // 0 to 99, -0 to -99 | |
| 13840 | + threeDigitsSigned: /^-?\d{1,3}/, | |
| 13841 | + // 0 to 999, -0 to -999 | |
| 13842 | + fourDigitsSigned: /^-?\d{1,4}/ | |
| 13843 | + // 0 to 9999, -0 to -9999 | |
| 13844 | +}; | |
| 13845 | +var timezonePatterns = { | |
| 13846 | + basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/, | |
| 13847 | + basic: /^([+-])(\d{2})(\d{2})|Z/, | |
| 13848 | + basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/, | |
| 13849 | + extended: /^([+-])(\d{2}):(\d{2})|Z/, | |
| 13850 | + extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/ | |
| 13851 | +}; | |
| 13852 | + | |
| 13853 | +// node_modules/date-fns/parse/_lib/utils.js | |
| 13854 | +function mapValue(parseFnResult, mapFn) { | |
| 13855 | + if (!parseFnResult) { | |
| 13856 | + return parseFnResult; | |
| 13857 | + } | |
| 209 | 13858 | return { |
| 210 | - filters: [ | |
| 13859 | + value: mapFn(parseFnResult.value), | |
| 13860 | + rest: parseFnResult.rest | |
| 13861 | + }; | |
| 13862 | +} | |
| 13863 | +function parseNumericPattern(pattern, dateString) { | |
| 13864 | + const matchResult = dateString.match(pattern); | |
| 13865 | + if (!matchResult) { | |
| 13866 | + return null; | |
| 13867 | + } | |
| 13868 | + return { | |
| 13869 | + value: parseInt(matchResult[0], 10), | |
| 13870 | + rest: dateString.slice(matchResult[0].length) | |
| 13871 | + }; | |
| 13872 | +} | |
| 13873 | +function parseTimezonePattern(pattern, dateString) { | |
| 13874 | + const matchResult = dateString.match(pattern); | |
| 13875 | + if (!matchResult) { | |
| 13876 | + return null; | |
| 13877 | + } | |
| 13878 | + if (matchResult[0] === "Z") { | |
| 13879 | + return { | |
| 13880 | + value: 0, | |
| 13881 | + rest: dateString.slice(1) | |
| 13882 | + }; | |
| 13883 | + } | |
| 13884 | + const sign = matchResult[1] === "+" ? 1 : -1; | |
| 13885 | + const hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0; | |
| 13886 | + const minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0; | |
| 13887 | + const seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0; | |
| 13888 | + return { | |
| 13889 | + value: sign * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond), | |
| 13890 | + rest: dateString.slice(matchResult[0].length) | |
| 13891 | + }; | |
| 13892 | +} | |
| 13893 | +function parseAnyDigitsSigned(dateString) { | |
| 13894 | + return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString); | |
| 13895 | +} | |
| 13896 | +function parseNDigits(n, dateString) { | |
| 13897 | + switch (n) { | |
| 13898 | + case 1: | |
| 13899 | + return parseNumericPattern(numericPatterns.singleDigit, dateString); | |
| 13900 | + case 2: | |
| 13901 | + return parseNumericPattern(numericPatterns.twoDigits, dateString); | |
| 13902 | + case 3: | |
| 13903 | + return parseNumericPattern(numericPatterns.threeDigits, dateString); | |
| 13904 | + case 4: | |
| 13905 | + return parseNumericPattern(numericPatterns.fourDigits, dateString); | |
| 13906 | + default: | |
| 13907 | + return parseNumericPattern(new RegExp("^\\d{1," + n + "}"), dateString); | |
| 13908 | + } | |
| 13909 | +} | |
| 13910 | +function parseNDigitsSigned(n, dateString) { | |
| 13911 | + switch (n) { | |
| 13912 | + case 1: | |
| 13913 | + return parseNumericPattern(numericPatterns.singleDigitSigned, dateString); | |
| 13914 | + case 2: | |
| 13915 | + return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString); | |
| 13916 | + case 3: | |
| 13917 | + return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString); | |
| 13918 | + case 4: | |
| 13919 | + return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString); | |
| 13920 | + default: | |
| 13921 | + return parseNumericPattern(new RegExp("^-?\\d{1," + n + "}"), dateString); | |
| 13922 | + } | |
| 13923 | +} | |
| 13924 | +function dayPeriodEnumToHours(dayPeriod) { | |
| 13925 | + switch (dayPeriod) { | |
| 13926 | + case "morning": | |
| 13927 | + return 4; | |
| 13928 | + case "evening": | |
| 13929 | + return 17; | |
| 13930 | + case "pm": | |
| 13931 | + case "noon": | |
| 13932 | + case "afternoon": | |
| 13933 | + return 12; | |
| 13934 | + case "am": | |
| 13935 | + case "midnight": | |
| 13936 | + case "night": | |
| 13937 | + default: | |
| 13938 | + return 0; | |
| 13939 | + } | |
| 13940 | +} | |
| 13941 | +function normalizeTwoDigitYear(twoDigitYear, currentYear) { | |
| 13942 | + const isCommonEra = currentYear > 0; | |
| 13943 | + const absCurrentYear = isCommonEra ? currentYear : 1 - currentYear; | |
| 13944 | + let result; | |
| 13945 | + if (absCurrentYear <= 50) { | |
| 13946 | + result = twoDigitYear || 100; | |
| 13947 | + } else { | |
| 13948 | + const rangeEnd = absCurrentYear + 50; | |
| 13949 | + const rangeEndCentury = Math.trunc(rangeEnd / 100) * 100; | |
| 13950 | + const isPreviousCentury = twoDigitYear >= rangeEnd % 100; | |
| 13951 | + result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0); | |
| 13952 | + } | |
| 13953 | + return isCommonEra ? result : 1 - result; | |
| 13954 | +} | |
| 13955 | +function isLeapYearIndex(year) { | |
| 13956 | + return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0; | |
| 13957 | +} | |
| 13958 | + | |
| 13959 | +// node_modules/date-fns/parse/_lib/parsers/YearParser.js | |
| 13960 | +var YearParser = class extends Parser { | |
| 13961 | + priority = 130; | |
| 13962 | + incompatibleTokens = ["Y", "R", "u", "w", "I", "i", "e", "c", "t", "T"]; | |
| 13963 | + parse(dateString, token, match2) { | |
| 13964 | + const valueCallback = (year) => ({ | |
| 13965 | + year, | |
| 13966 | + isTwoDigitYear: token === "yy" | |
| 13967 | + }); | |
| 13968 | + switch (token) { | |
| 13969 | + case "y": | |
| 13970 | + return mapValue(parseNDigits(4, dateString), valueCallback); | |
| 13971 | + case "yo": | |
| 13972 | + return mapValue( | |
| 13973 | + match2.ordinalNumber(dateString, { | |
| 13974 | + unit: "year" | |
| 13975 | + }), | |
| 13976 | + valueCallback | |
| 13977 | + ); | |
| 13978 | + default: | |
| 13979 | + return mapValue(parseNDigits(token.length, dateString), valueCallback); | |
| 13980 | + } | |
| 13981 | + } | |
| 13982 | + validate(_date, value) { | |
| 13983 | + return value.isTwoDigitYear || value.year > 0; | |
| 13984 | + } | |
| 13985 | + set(date, flags, value) { | |
| 13986 | + const currentYear = date.getFullYear(); | |
| 13987 | + if (value.isTwoDigitYear) { | |
| 13988 | + const normalizedTwoDigitYear = normalizeTwoDigitYear( | |
| 13989 | + value.year, | |
| 13990 | + currentYear | |
| 13991 | + ); | |
| 13992 | + date.setFullYear(normalizedTwoDigitYear, 0, 1); | |
| 13993 | + date.setHours(0, 0, 0, 0); | |
| 13994 | + return date; | |
| 13995 | + } | |
| 13996 | + const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year; | |
| 13997 | + date.setFullYear(year, 0, 1); | |
| 13998 | + date.setHours(0, 0, 0, 0); | |
| 13999 | + return date; | |
| 14000 | + } | |
| 14001 | +}; | |
| 14002 | + | |
| 14003 | +// node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.js | |
| 14004 | +var LocalWeekYearParser = class extends Parser { | |
| 14005 | + priority = 130; | |
| 14006 | + parse(dateString, token, match2) { | |
| 14007 | + const valueCallback = (year) => ({ | |
| 14008 | + year, | |
| 14009 | + isTwoDigitYear: token === "YY" | |
| 14010 | + }); | |
| 14011 | + switch (token) { | |
| 14012 | + case "Y": | |
| 14013 | + return mapValue(parseNDigits(4, dateString), valueCallback); | |
| 14014 | + case "Yo": | |
| 14015 | + return mapValue( | |
| 14016 | + match2.ordinalNumber(dateString, { | |
| 14017 | + unit: "year" | |
| 14018 | + }), | |
| 14019 | + valueCallback | |
| 14020 | + ); | |
| 14021 | + default: | |
| 14022 | + return mapValue(parseNDigits(token.length, dateString), valueCallback); | |
| 14023 | + } | |
| 14024 | + } | |
| 14025 | + validate(_date, value) { | |
| 14026 | + return value.isTwoDigitYear || value.year > 0; | |
| 14027 | + } | |
| 14028 | + set(date, flags, value, options) { | |
| 14029 | + const currentYear = getWeekYear(date, options); | |
| 14030 | + if (value.isTwoDigitYear) { | |
| 14031 | + const normalizedTwoDigitYear = normalizeTwoDigitYear( | |
| 14032 | + value.year, | |
| 14033 | + currentYear | |
| 14034 | + ); | |
| 14035 | + date.setFullYear( | |
| 14036 | + normalizedTwoDigitYear, | |
| 14037 | + 0, | |
| 14038 | + options.firstWeekContainsDate | |
| 14039 | + ); | |
| 14040 | + date.setHours(0, 0, 0, 0); | |
| 14041 | + return startOfWeek(date, options); | |
| 14042 | + } | |
| 14043 | + const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year; | |
| 14044 | + date.setFullYear(year, 0, options.firstWeekContainsDate); | |
| 14045 | + date.setHours(0, 0, 0, 0); | |
| 14046 | + return startOfWeek(date, options); | |
| 14047 | + } | |
| 14048 | + incompatibleTokens = [ | |
| 14049 | + "y", | |
| 14050 | + "R", | |
| 14051 | + "u", | |
| 14052 | + "Q", | |
| 14053 | + "q", | |
| 14054 | + "M", | |
| 14055 | + "L", | |
| 14056 | + "I", | |
| 14057 | + "d", | |
| 14058 | + "D", | |
| 14059 | + "i", | |
| 14060 | + "t", | |
| 14061 | + "T" | |
| 14062 | + ]; | |
| 14063 | +}; | |
| 14064 | + | |
| 14065 | +// node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.js | |
| 14066 | +var ISOWeekYearParser = class extends Parser { | |
| 14067 | + priority = 130; | |
| 14068 | + parse(dateString, token) { | |
| 14069 | + if (token === "R") { | |
| 14070 | + return parseNDigitsSigned(4, dateString); | |
| 14071 | + } | |
| 14072 | + return parseNDigitsSigned(token.length, dateString); | |
| 14073 | + } | |
| 14074 | + set(date, _flags, value) { | |
| 14075 | + const firstWeekOfYear = constructFrom(date, 0); | |
| 14076 | + firstWeekOfYear.setFullYear(value, 0, 4); | |
| 14077 | + firstWeekOfYear.setHours(0, 0, 0, 0); | |
| 14078 | + return startOfISOWeek(firstWeekOfYear); | |
| 14079 | + } | |
| 14080 | + incompatibleTokens = [ | |
| 14081 | + "G", | |
| 14082 | + "y", | |
| 14083 | + "Y", | |
| 14084 | + "u", | |
| 14085 | + "Q", | |
| 14086 | + "q", | |
| 14087 | + "M", | |
| 14088 | + "L", | |
| 14089 | + "w", | |
| 14090 | + "d", | |
| 14091 | + "D", | |
| 14092 | + "e", | |
| 14093 | + "c", | |
| 14094 | + "t", | |
| 14095 | + "T" | |
| 14096 | + ]; | |
| 14097 | +}; | |
| 14098 | + | |
| 14099 | +// node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.js | |
| 14100 | +var ExtendedYearParser = class extends Parser { | |
| 14101 | + priority = 130; | |
| 14102 | + parse(dateString, token) { | |
| 14103 | + if (token === "u") { | |
| 14104 | + return parseNDigitsSigned(4, dateString); | |
| 14105 | + } | |
| 14106 | + return parseNDigitsSigned(token.length, dateString); | |
| 14107 | + } | |
| 14108 | + set(date, _flags, value) { | |
| 14109 | + date.setFullYear(value, 0, 1); | |
| 14110 | + date.setHours(0, 0, 0, 0); | |
| 14111 | + return date; | |
| 14112 | + } | |
| 14113 | + incompatibleTokens = ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"]; | |
| 14114 | +}; | |
| 14115 | + | |
| 14116 | +// node_modules/date-fns/parse/_lib/parsers/QuarterParser.js | |
| 14117 | +var QuarterParser = class extends Parser { | |
| 14118 | + priority = 120; | |
| 14119 | + parse(dateString, token, match2) { | |
| 14120 | + switch (token) { | |
| 14121 | + // 1, 2, 3, 4 | |
| 14122 | + case "Q": | |
| 14123 | + case "QQ": | |
| 14124 | + return parseNDigits(token.length, dateString); | |
| 14125 | + // 1st, 2nd, 3rd, 4th | |
| 14126 | + case "Qo": | |
| 14127 | + return match2.ordinalNumber(dateString, { unit: "quarter" }); | |
| 14128 | + // Q1, Q2, Q3, Q4 | |
| 14129 | + case "QQQ": | |
| 14130 | + return match2.quarter(dateString, { | |
| 14131 | + width: "abbreviated", | |
| 14132 | + context: "formatting" | |
| 14133 | + }) || match2.quarter(dateString, { | |
| 14134 | + width: "narrow", | |
| 14135 | + context: "formatting" | |
| 14136 | + }); | |
| 14137 | + // 1, 2, 3, 4 (narrow quarter; could be not numerical) | |
| 14138 | + case "QQQQQ": | |
| 14139 | + return match2.quarter(dateString, { | |
| 14140 | + width: "narrow", | |
| 14141 | + context: "formatting" | |
| 14142 | + }); | |
| 14143 | + // 1st quarter, 2nd quarter, ... | |
| 14144 | + case "QQQQ": | |
| 14145 | + default: | |
| 14146 | + return match2.quarter(dateString, { | |
| 14147 | + width: "wide", | |
| 14148 | + context: "formatting" | |
| 14149 | + }) || match2.quarter(dateString, { | |
| 14150 | + width: "abbreviated", | |
| 14151 | + context: "formatting" | |
| 14152 | + }) || match2.quarter(dateString, { | |
| 14153 | + width: "narrow", | |
| 14154 | + context: "formatting" | |
| 14155 | + }); | |
| 14156 | + } | |
| 14157 | + } | |
| 14158 | + validate(_date, value) { | |
| 14159 | + return value >= 1 && value <= 4; | |
| 14160 | + } | |
| 14161 | + set(date, _flags, value) { | |
| 14162 | + date.setMonth((value - 1) * 3, 1); | |
| 14163 | + date.setHours(0, 0, 0, 0); | |
| 14164 | + return date; | |
| 14165 | + } | |
| 14166 | + incompatibleTokens = [ | |
| 14167 | + "Y", | |
| 14168 | + "R", | |
| 14169 | + "q", | |
| 14170 | + "M", | |
| 14171 | + "L", | |
| 14172 | + "w", | |
| 14173 | + "I", | |
| 14174 | + "d", | |
| 14175 | + "D", | |
| 14176 | + "i", | |
| 14177 | + "e", | |
| 14178 | + "c", | |
| 14179 | + "t", | |
| 14180 | + "T" | |
| 14181 | + ]; | |
| 14182 | +}; | |
| 14183 | + | |
| 14184 | +// node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js | |
| 14185 | +var StandAloneQuarterParser = class extends Parser { | |
| 14186 | + priority = 120; | |
| 14187 | + parse(dateString, token, match2) { | |
| 14188 | + switch (token) { | |
| 14189 | + // 1, 2, 3, 4 | |
| 14190 | + case "q": | |
| 14191 | + case "qq": | |
| 14192 | + return parseNDigits(token.length, dateString); | |
| 14193 | + // 1st, 2nd, 3rd, 4th | |
| 14194 | + case "qo": | |
| 14195 | + return match2.ordinalNumber(dateString, { unit: "quarter" }); | |
| 14196 | + // Q1, Q2, Q3, Q4 | |
| 14197 | + case "qqq": | |
| 14198 | + return match2.quarter(dateString, { | |
| 14199 | + width: "abbreviated", | |
| 14200 | + context: "standalone" | |
| 14201 | + }) || match2.quarter(dateString, { | |
| 14202 | + width: "narrow", | |
| 14203 | + context: "standalone" | |
| 14204 | + }); | |
| 14205 | + // 1, 2, 3, 4 (narrow quarter; could be not numerical) | |
| 14206 | + case "qqqqq": | |
| 14207 | + return match2.quarter(dateString, { | |
| 14208 | + width: "narrow", | |
| 14209 | + context: "standalone" | |
| 14210 | + }); | |
| 14211 | + // 1st quarter, 2nd quarter, ... | |
| 14212 | + case "qqqq": | |
| 14213 | + default: | |
| 14214 | + return match2.quarter(dateString, { | |
| 14215 | + width: "wide", | |
| 14216 | + context: "standalone" | |
| 14217 | + }) || match2.quarter(dateString, { | |
| 14218 | + width: "abbreviated", | |
| 14219 | + context: "standalone" | |
| 14220 | + }) || match2.quarter(dateString, { | |
| 14221 | + width: "narrow", | |
| 14222 | + context: "standalone" | |
| 14223 | + }); | |
| 14224 | + } | |
| 14225 | + } | |
| 14226 | + validate(_date, value) { | |
| 14227 | + return value >= 1 && value <= 4; | |
| 14228 | + } | |
| 14229 | + set(date, _flags, value) { | |
| 14230 | + date.setMonth((value - 1) * 3, 1); | |
| 14231 | + date.setHours(0, 0, 0, 0); | |
| 14232 | + return date; | |
| 14233 | + } | |
| 14234 | + incompatibleTokens = [ | |
| 14235 | + "Y", | |
| 14236 | + "R", | |
| 14237 | + "Q", | |
| 14238 | + "M", | |
| 14239 | + "L", | |
| 14240 | + "w", | |
| 14241 | + "I", | |
| 14242 | + "d", | |
| 14243 | + "D", | |
| 14244 | + "i", | |
| 14245 | + "e", | |
| 14246 | + "c", | |
| 14247 | + "t", | |
| 14248 | + "T" | |
| 14249 | + ]; | |
| 14250 | +}; | |
| 14251 | + | |
| 14252 | +// node_modules/date-fns/parse/_lib/parsers/MonthParser.js | |
| 14253 | +var MonthParser = class extends Parser { | |
| 14254 | + incompatibleTokens = [ | |
| 14255 | + "Y", | |
| 14256 | + "R", | |
| 14257 | + "q", | |
| 14258 | + "Q", | |
| 14259 | + "L", | |
| 14260 | + "w", | |
| 14261 | + "I", | |
| 14262 | + "D", | |
| 14263 | + "i", | |
| 14264 | + "e", | |
| 14265 | + "c", | |
| 14266 | + "t", | |
| 14267 | + "T" | |
| 14268 | + ]; | |
| 14269 | + priority = 110; | |
| 14270 | + parse(dateString, token, match2) { | |
| 14271 | + const valueCallback = (value) => value - 1; | |
| 14272 | + switch (token) { | |
| 14273 | + // 1, 2, ..., 12 | |
| 14274 | + case "M": | |
| 14275 | + return mapValue( | |
| 14276 | + parseNumericPattern(numericPatterns.month, dateString), | |
| 14277 | + valueCallback | |
| 14278 | + ); | |
| 14279 | + // 01, 02, ..., 12 | |
| 14280 | + case "MM": | |
| 14281 | + return mapValue(parseNDigits(2, dateString), valueCallback); | |
| 14282 | + // 1st, 2nd, ..., 12th | |
| 14283 | + case "Mo": | |
| 14284 | + return mapValue( | |
| 14285 | + match2.ordinalNumber(dateString, { | |
| 14286 | + unit: "month" | |
| 14287 | + }), | |
| 14288 | + valueCallback | |
| 14289 | + ); | |
| 14290 | + // Jan, Feb, ..., Dec | |
| 14291 | + case "MMM": | |
| 14292 | + return match2.month(dateString, { | |
| 14293 | + width: "abbreviated", | |
| 14294 | + context: "formatting" | |
| 14295 | + }) || match2.month(dateString, { width: "narrow", context: "formatting" }); | |
| 14296 | + // J, F, ..., D | |
| 14297 | + case "MMMMM": | |
| 14298 | + return match2.month(dateString, { | |
| 14299 | + width: "narrow", | |
| 14300 | + context: "formatting" | |
| 14301 | + }); | |
| 14302 | + // January, February, ..., December | |
| 14303 | + case "MMMM": | |
| 14304 | + default: | |
| 14305 | + return match2.month(dateString, { width: "wide", context: "formatting" }) || match2.month(dateString, { | |
| 14306 | + width: "abbreviated", | |
| 14307 | + context: "formatting" | |
| 14308 | + }) || match2.month(dateString, { width: "narrow", context: "formatting" }); | |
| 14309 | + } | |
| 14310 | + } | |
| 14311 | + validate(_date, value) { | |
| 14312 | + return value >= 0 && value <= 11; | |
| 14313 | + } | |
| 14314 | + set(date, _flags, value) { | |
| 14315 | + date.setMonth(value, 1); | |
| 14316 | + date.setHours(0, 0, 0, 0); | |
| 14317 | + return date; | |
| 14318 | + } | |
| 14319 | +}; | |
| 14320 | + | |
| 14321 | +// node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.js | |
| 14322 | +var StandAloneMonthParser = class extends Parser { | |
| 14323 | + priority = 110; | |
| 14324 | + parse(dateString, token, match2) { | |
| 14325 | + const valueCallback = (value) => value - 1; | |
| 14326 | + switch (token) { | |
| 14327 | + // 1, 2, ..., 12 | |
| 14328 | + case "L": | |
| 14329 | + return mapValue( | |
| 14330 | + parseNumericPattern(numericPatterns.month, dateString), | |
| 14331 | + valueCallback | |
| 14332 | + ); | |
| 14333 | + // 01, 02, ..., 12 | |
| 14334 | + case "LL": | |
| 14335 | + return mapValue(parseNDigits(2, dateString), valueCallback); | |
| 14336 | + // 1st, 2nd, ..., 12th | |
| 14337 | + case "Lo": | |
| 14338 | + return mapValue( | |
| 14339 | + match2.ordinalNumber(dateString, { | |
| 14340 | + unit: "month" | |
| 14341 | + }), | |
| 14342 | + valueCallback | |
| 14343 | + ); | |
| 14344 | + // Jan, Feb, ..., Dec | |
| 14345 | + case "LLL": | |
| 14346 | + return match2.month(dateString, { | |
| 14347 | + width: "abbreviated", | |
| 14348 | + context: "standalone" | |
| 14349 | + }) || match2.month(dateString, { width: "narrow", context: "standalone" }); | |
| 14350 | + // J, F, ..., D | |
| 14351 | + case "LLLLL": | |
| 14352 | + return match2.month(dateString, { | |
| 14353 | + width: "narrow", | |
| 14354 | + context: "standalone" | |
| 14355 | + }); | |
| 14356 | + // January, February, ..., December | |
| 14357 | + case "LLLL": | |
| 14358 | + default: | |
| 14359 | + return match2.month(dateString, { width: "wide", context: "standalone" }) || match2.month(dateString, { | |
| 14360 | + width: "abbreviated", | |
| 14361 | + context: "standalone" | |
| 14362 | + }) || match2.month(dateString, { width: "narrow", context: "standalone" }); | |
| 14363 | + } | |
| 14364 | + } | |
| 14365 | + validate(_date, value) { | |
| 14366 | + return value >= 0 && value <= 11; | |
| 14367 | + } | |
| 14368 | + set(date, _flags, value) { | |
| 14369 | + date.setMonth(value, 1); | |
| 14370 | + date.setHours(0, 0, 0, 0); | |
| 14371 | + return date; | |
| 14372 | + } | |
| 14373 | + incompatibleTokens = [ | |
| 14374 | + "Y", | |
| 14375 | + "R", | |
| 14376 | + "q", | |
| 14377 | + "Q", | |
| 14378 | + "M", | |
| 14379 | + "w", | |
| 14380 | + "I", | |
| 14381 | + "D", | |
| 14382 | + "i", | |
| 14383 | + "e", | |
| 14384 | + "c", | |
| 14385 | + "t", | |
| 14386 | + "T" | |
| 14387 | + ]; | |
| 14388 | +}; | |
| 14389 | + | |
| 14390 | +// node_modules/date-fns/setWeek.js | |
| 14391 | +function setWeek(date, week, options) { | |
| 14392 | + const date_ = toDate(date, options?.in); | |
| 14393 | + const diff = getWeek(date_, options) - week; | |
| 14394 | + date_.setDate(date_.getDate() - diff * 7); | |
| 14395 | + return toDate(date_, options?.in); | |
| 14396 | +} | |
| 14397 | + | |
| 14398 | +// node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.js | |
| 14399 | +var LocalWeekParser = class extends Parser { | |
| 14400 | + priority = 100; | |
| 14401 | + parse(dateString, token, match2) { | |
| 14402 | + switch (token) { | |
| 14403 | + case "w": | |
| 14404 | + return parseNumericPattern(numericPatterns.week, dateString); | |
| 14405 | + case "wo": | |
| 14406 | + return match2.ordinalNumber(dateString, { unit: "week" }); | |
| 14407 | + default: | |
| 14408 | + return parseNDigits(token.length, dateString); | |
| 14409 | + } | |
| 14410 | + } | |
| 14411 | + validate(_date, value) { | |
| 14412 | + return value >= 1 && value <= 53; | |
| 14413 | + } | |
| 14414 | + set(date, _flags, value, options) { | |
| 14415 | + return startOfWeek(setWeek(date, value, options), options); | |
| 14416 | + } | |
| 14417 | + incompatibleTokens = [ | |
| 14418 | + "y", | |
| 14419 | + "R", | |
| 14420 | + "u", | |
| 14421 | + "q", | |
| 14422 | + "Q", | |
| 14423 | + "M", | |
| 14424 | + "L", | |
| 14425 | + "I", | |
| 14426 | + "d", | |
| 14427 | + "D", | |
| 14428 | + "i", | |
| 14429 | + "t", | |
| 14430 | + "T" | |
| 14431 | + ]; | |
| 14432 | +}; | |
| 14433 | + | |
| 14434 | +// node_modules/date-fns/setISOWeek.js | |
| 14435 | +function setISOWeek(date, week, options) { | |
| 14436 | + const _date = toDate(date, options?.in); | |
| 14437 | + const diff = getISOWeek(_date, options) - week; | |
| 14438 | + _date.setDate(_date.getDate() - diff * 7); | |
| 14439 | + return _date; | |
| 14440 | +} | |
| 14441 | + | |
| 14442 | +// node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.js | |
| 14443 | +var ISOWeekParser = class extends Parser { | |
| 14444 | + priority = 100; | |
| 14445 | + parse(dateString, token, match2) { | |
| 14446 | + switch (token) { | |
| 14447 | + case "I": | |
| 14448 | + return parseNumericPattern(numericPatterns.week, dateString); | |
| 14449 | + case "Io": | |
| 14450 | + return match2.ordinalNumber(dateString, { unit: "week" }); | |
| 14451 | + default: | |
| 14452 | + return parseNDigits(token.length, dateString); | |
| 14453 | + } | |
| 14454 | + } | |
| 14455 | + validate(_date, value) { | |
| 14456 | + return value >= 1 && value <= 53; | |
| 14457 | + } | |
| 14458 | + set(date, _flags, value) { | |
| 14459 | + return startOfISOWeek(setISOWeek(date, value)); | |
| 14460 | + } | |
| 14461 | + incompatibleTokens = [ | |
| 14462 | + "y", | |
| 14463 | + "Y", | |
| 14464 | + "u", | |
| 14465 | + "q", | |
| 14466 | + "Q", | |
| 14467 | + "M", | |
| 14468 | + "L", | |
| 14469 | + "w", | |
| 14470 | + "d", | |
| 14471 | + "D", | |
| 14472 | + "e", | |
| 14473 | + "c", | |
| 14474 | + "t", | |
| 14475 | + "T" | |
| 14476 | + ]; | |
| 14477 | +}; | |
| 14478 | + | |
| 14479 | +// node_modules/date-fns/parse/_lib/parsers/DateParser.js | |
| 14480 | +var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; | |
| 14481 | +var DAYS_IN_MONTH_LEAP_YEAR = [ | |
| 14482 | + 31, | |
| 14483 | + 29, | |
| 14484 | + 31, | |
| 14485 | + 30, | |
| 14486 | + 31, | |
| 14487 | + 30, | |
| 14488 | + 31, | |
| 14489 | + 31, | |
| 14490 | + 30, | |
| 14491 | + 31, | |
| 14492 | + 30, | |
| 14493 | + 31 | |
| 14494 | +]; | |
| 14495 | +var DateParser = class extends Parser { | |
| 14496 | + priority = 90; | |
| 14497 | + subPriority = 1; | |
| 14498 | + parse(dateString, token, match2) { | |
| 14499 | + switch (token) { | |
| 14500 | + case "d": | |
| 14501 | + return parseNumericPattern(numericPatterns.date, dateString); | |
| 14502 | + case "do": | |
| 14503 | + return match2.ordinalNumber(dateString, { unit: "date" }); | |
| 14504 | + default: | |
| 14505 | + return parseNDigits(token.length, dateString); | |
| 14506 | + } | |
| 14507 | + } | |
| 14508 | + validate(date, value) { | |
| 14509 | + const year = date.getFullYear(); | |
| 14510 | + const isLeapYear = isLeapYearIndex(year); | |
| 14511 | + const month = date.getMonth(); | |
| 14512 | + if (isLeapYear) { | |
| 14513 | + return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month]; | |
| 14514 | + } else { | |
| 14515 | + return value >= 1 && value <= DAYS_IN_MONTH[month]; | |
| 14516 | + } | |
| 14517 | + } | |
| 14518 | + set(date, _flags, value) { | |
| 14519 | + date.setDate(value); | |
| 14520 | + date.setHours(0, 0, 0, 0); | |
| 14521 | + return date; | |
| 14522 | + } | |
| 14523 | + incompatibleTokens = [ | |
| 14524 | + "Y", | |
| 14525 | + "R", | |
| 14526 | + "q", | |
| 14527 | + "Q", | |
| 14528 | + "w", | |
| 14529 | + "I", | |
| 14530 | + "D", | |
| 14531 | + "i", | |
| 14532 | + "e", | |
| 14533 | + "c", | |
| 14534 | + "t", | |
| 14535 | + "T" | |
| 14536 | + ]; | |
| 14537 | +}; | |
| 14538 | + | |
| 14539 | +// node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.js | |
| 14540 | +var DayOfYearParser = class extends Parser { | |
| 14541 | + priority = 90; | |
| 14542 | + subpriority = 1; | |
| 14543 | + parse(dateString, token, match2) { | |
| 14544 | + switch (token) { | |
| 14545 | + case "D": | |
| 14546 | + case "DD": | |
| 14547 | + return parseNumericPattern(numericPatterns.dayOfYear, dateString); | |
| 14548 | + case "Do": | |
| 14549 | + return match2.ordinalNumber(dateString, { unit: "date" }); | |
| 14550 | + default: | |
| 14551 | + return parseNDigits(token.length, dateString); | |
| 14552 | + } | |
| 14553 | + } | |
| 14554 | + validate(date, value) { | |
| 14555 | + const year = date.getFullYear(); | |
| 14556 | + const isLeapYear = isLeapYearIndex(year); | |
| 14557 | + if (isLeapYear) { | |
| 14558 | + return value >= 1 && value <= 366; | |
| 14559 | + } else { | |
| 14560 | + return value >= 1 && value <= 365; | |
| 14561 | + } | |
| 14562 | + } | |
| 14563 | + set(date, _flags, value) { | |
| 14564 | + date.setMonth(0, value); | |
| 14565 | + date.setHours(0, 0, 0, 0); | |
| 14566 | + return date; | |
| 14567 | + } | |
| 14568 | + incompatibleTokens = [ | |
| 14569 | + "Y", | |
| 14570 | + "R", | |
| 14571 | + "q", | |
| 14572 | + "Q", | |
| 14573 | + "M", | |
| 14574 | + "L", | |
| 14575 | + "w", | |
| 14576 | + "I", | |
| 14577 | + "d", | |
| 14578 | + "E", | |
| 14579 | + "i", | |
| 14580 | + "e", | |
| 14581 | + "c", | |
| 14582 | + "t", | |
| 14583 | + "T" | |
| 14584 | + ]; | |
| 14585 | +}; | |
| 14586 | + | |
| 14587 | +// node_modules/date-fns/setDay.js | |
| 14588 | +function setDay(date, day, options) { | |
| 14589 | + const defaultOptions2 = getDefaultOptions(); | |
| 14590 | + const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0; | |
| 14591 | + const date_ = toDate(date, options?.in); | |
| 14592 | + const currentDay = date_.getDay(); | |
| 14593 | + const remainder = day % 7; | |
| 14594 | + const dayIndex = (remainder + 7) % 7; | |
| 14595 | + const delta = 7 - weekStartsOn; | |
| 14596 | + const diff = day < 0 || day > 6 ? day - (currentDay + delta) % 7 : (dayIndex + delta) % 7 - (currentDay + delta) % 7; | |
| 14597 | + return addDays(date_, diff, options); | |
| 14598 | +} | |
| 14599 | + | |
| 14600 | +// node_modules/date-fns/parse/_lib/parsers/DayParser.js | |
| 14601 | +var DayParser = class extends Parser { | |
| 14602 | + priority = 90; | |
| 14603 | + parse(dateString, token, match2) { | |
| 14604 | + switch (token) { | |
| 14605 | + // Tue | |
| 14606 | + case "E": | |
| 14607 | + case "EE": | |
| 14608 | + case "EEE": | |
| 14609 | + return match2.day(dateString, { | |
| 14610 | + width: "abbreviated", | |
| 14611 | + context: "formatting" | |
| 14612 | + }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" }); | |
| 14613 | + // T | |
| 14614 | + case "EEEEE": | |
| 14615 | + return match2.day(dateString, { | |
| 14616 | + width: "narrow", | |
| 14617 | + context: "formatting" | |
| 14618 | + }); | |
| 14619 | + // Tu | |
| 14620 | + case "EEEEEE": | |
| 14621 | + return match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" }); | |
| 14622 | + // Tuesday | |
| 14623 | + case "EEEE": | |
| 14624 | + default: | |
| 14625 | + return match2.day(dateString, { width: "wide", context: "formatting" }) || match2.day(dateString, { | |
| 14626 | + width: "abbreviated", | |
| 14627 | + context: "formatting" | |
| 14628 | + }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" }); | |
| 14629 | + } | |
| 14630 | + } | |
| 14631 | + validate(_date, value) { | |
| 14632 | + return value >= 0 && value <= 6; | |
| 14633 | + } | |
| 14634 | + set(date, _flags, value, options) { | |
| 14635 | + date = setDay(date, value, options); | |
| 14636 | + date.setHours(0, 0, 0, 0); | |
| 14637 | + return date; | |
| 14638 | + } | |
| 14639 | + incompatibleTokens = ["D", "i", "e", "c", "t", "T"]; | |
| 14640 | +}; | |
| 14641 | + | |
| 14642 | +// node_modules/date-fns/parse/_lib/parsers/LocalDayParser.js | |
| 14643 | +var LocalDayParser = class extends Parser { | |
| 14644 | + priority = 90; | |
| 14645 | + parse(dateString, token, match2, options) { | |
| 14646 | + const valueCallback = (value) => { | |
| 14647 | + const wholeWeekDays = Math.floor((value - 1) / 7) * 7; | |
| 14648 | + return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays; | |
| 14649 | + }; | |
| 14650 | + switch (token) { | |
| 14651 | + // 3 | |
| 14652 | + case "e": | |
| 14653 | + case "ee": | |
| 14654 | + return mapValue(parseNDigits(token.length, dateString), valueCallback); | |
| 14655 | + // 3rd | |
| 14656 | + case "eo": | |
| 14657 | + return mapValue( | |
| 14658 | + match2.ordinalNumber(dateString, { | |
| 14659 | + unit: "day" | |
| 14660 | + }), | |
| 14661 | + valueCallback | |
| 14662 | + ); | |
| 14663 | + // Tue | |
| 14664 | + case "eee": | |
| 14665 | + return match2.day(dateString, { | |
| 14666 | + width: "abbreviated", | |
| 14667 | + context: "formatting" | |
| 14668 | + }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" }); | |
| 14669 | + // T | |
| 14670 | + case "eeeee": | |
| 14671 | + return match2.day(dateString, { | |
| 14672 | + width: "narrow", | |
| 14673 | + context: "formatting" | |
| 14674 | + }); | |
| 14675 | + // Tu | |
| 14676 | + case "eeeeee": | |
| 14677 | + return match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" }); | |
| 14678 | + // Tuesday | |
| 14679 | + case "eeee": | |
| 14680 | + default: | |
| 14681 | + return match2.day(dateString, { width: "wide", context: "formatting" }) || match2.day(dateString, { | |
| 14682 | + width: "abbreviated", | |
| 14683 | + context: "formatting" | |
| 14684 | + }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" }); | |
| 14685 | + } | |
| 14686 | + } | |
| 14687 | + validate(_date, value) { | |
| 14688 | + return value >= 0 && value <= 6; | |
| 14689 | + } | |
| 14690 | + set(date, _flags, value, options) { | |
| 14691 | + date = setDay(date, value, options); | |
| 14692 | + date.setHours(0, 0, 0, 0); | |
| 14693 | + return date; | |
| 14694 | + } | |
| 14695 | + incompatibleTokens = [ | |
| 14696 | + "y", | |
| 14697 | + "R", | |
| 14698 | + "u", | |
| 14699 | + "q", | |
| 14700 | + "Q", | |
| 14701 | + "M", | |
| 14702 | + "L", | |
| 14703 | + "I", | |
| 14704 | + "d", | |
| 14705 | + "D", | |
| 14706 | + "E", | |
| 14707 | + "i", | |
| 14708 | + "c", | |
| 14709 | + "t", | |
| 14710 | + "T" | |
| 14711 | + ]; | |
| 14712 | +}; | |
| 14713 | + | |
| 14714 | +// node_modules/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.js | |
| 14715 | +var StandAloneLocalDayParser = class extends Parser { | |
| 14716 | + priority = 90; | |
| 14717 | + parse(dateString, token, match2, options) { | |
| 14718 | + const valueCallback = (value) => { | |
| 14719 | + const wholeWeekDays = Math.floor((value - 1) / 7) * 7; | |
| 14720 | + return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays; | |
| 14721 | + }; | |
| 14722 | + switch (token) { | |
| 14723 | + // 3 | |
| 14724 | + case "c": | |
| 14725 | + case "cc": | |
| 14726 | + return mapValue(parseNDigits(token.length, dateString), valueCallback); | |
| 14727 | + // 3rd | |
| 14728 | + case "co": | |
| 14729 | + return mapValue( | |
| 14730 | + match2.ordinalNumber(dateString, { | |
| 14731 | + unit: "day" | |
| 14732 | + }), | |
| 14733 | + valueCallback | |
| 14734 | + ); | |
| 14735 | + // Tue | |
| 14736 | + case "ccc": | |
| 14737 | + return match2.day(dateString, { | |
| 14738 | + width: "abbreviated", | |
| 14739 | + context: "standalone" | |
| 14740 | + }) || match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" }); | |
| 14741 | + // T | |
| 14742 | + case "ccccc": | |
| 14743 | + return match2.day(dateString, { | |
| 14744 | + width: "narrow", | |
| 14745 | + context: "standalone" | |
| 14746 | + }); | |
| 14747 | + // Tu | |
| 14748 | + case "cccccc": | |
| 14749 | + return match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" }); | |
| 14750 | + // Tuesday | |
| 14751 | + case "cccc": | |
| 14752 | + default: | |
| 14753 | + return match2.day(dateString, { width: "wide", context: "standalone" }) || match2.day(dateString, { | |
| 14754 | + width: "abbreviated", | |
| 14755 | + context: "standalone" | |
| 14756 | + }) || match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" }); | |
| 14757 | + } | |
| 14758 | + } | |
| 14759 | + validate(_date, value) { | |
| 14760 | + return value >= 0 && value <= 6; | |
| 14761 | + } | |
| 14762 | + set(date, _flags, value, options) { | |
| 14763 | + date = setDay(date, value, options); | |
| 14764 | + date.setHours(0, 0, 0, 0); | |
| 14765 | + return date; | |
| 14766 | + } | |
| 14767 | + incompatibleTokens = [ | |
| 14768 | + "y", | |
| 14769 | + "R", | |
| 14770 | + "u", | |
| 14771 | + "q", | |
| 14772 | + "Q", | |
| 14773 | + "M", | |
| 14774 | + "L", | |
| 14775 | + "I", | |
| 14776 | + "d", | |
| 14777 | + "D", | |
| 14778 | + "E", | |
| 14779 | + "i", | |
| 14780 | + "e", | |
| 14781 | + "t", | |
| 14782 | + "T" | |
| 14783 | + ]; | |
| 14784 | +}; | |
| 14785 | + | |
| 14786 | +// node_modules/date-fns/setISODay.js | |
| 14787 | +function setISODay(date, day, options) { | |
| 14788 | + const date_ = toDate(date, options?.in); | |
| 14789 | + const currentDay = getISODay(date_, options); | |
| 14790 | + const diff = day - currentDay; | |
| 14791 | + return addDays(date_, diff, options); | |
| 14792 | +} | |
| 14793 | + | |
| 14794 | +// node_modules/date-fns/parse/_lib/parsers/ISODayParser.js | |
| 14795 | +var ISODayParser = class extends Parser { | |
| 14796 | + priority = 90; | |
| 14797 | + parse(dateString, token, match2) { | |
| 14798 | + const valueCallback = (value) => { | |
| 14799 | + if (value === 0) { | |
| 14800 | + return 7; | |
| 14801 | + } | |
| 14802 | + return value; | |
| 14803 | + }; | |
| 14804 | + switch (token) { | |
| 14805 | + // 2 | |
| 14806 | + case "i": | |
| 14807 | + case "ii": | |
| 14808 | + return parseNDigits(token.length, dateString); | |
| 14809 | + // 2nd | |
| 14810 | + case "io": | |
| 14811 | + return match2.ordinalNumber(dateString, { unit: "day" }); | |
| 14812 | + // Tue | |
| 14813 | + case "iii": | |
| 14814 | + return mapValue( | |
| 14815 | + match2.day(dateString, { | |
| 14816 | + width: "abbreviated", | |
| 14817 | + context: "formatting" | |
| 14818 | + }) || match2.day(dateString, { | |
| 14819 | + width: "short", | |
| 14820 | + context: "formatting" | |
| 14821 | + }) || match2.day(dateString, { | |
| 14822 | + width: "narrow", | |
| 14823 | + context: "formatting" | |
| 14824 | + }), | |
| 14825 | + valueCallback | |
| 14826 | + ); | |
| 14827 | + // T | |
| 14828 | + case "iiiii": | |
| 14829 | + return mapValue( | |
| 14830 | + match2.day(dateString, { | |
| 14831 | + width: "narrow", | |
| 14832 | + context: "formatting" | |
| 14833 | + }), | |
| 14834 | + valueCallback | |
| 14835 | + ); | |
| 14836 | + // Tu | |
| 14837 | + case "iiiiii": | |
| 14838 | + return mapValue( | |
| 14839 | + match2.day(dateString, { | |
| 14840 | + width: "short", | |
| 14841 | + context: "formatting" | |
| 14842 | + }) || match2.day(dateString, { | |
| 14843 | + width: "narrow", | |
| 14844 | + context: "formatting" | |
| 14845 | + }), | |
| 14846 | + valueCallback | |
| 14847 | + ); | |
| 14848 | + // Tuesday | |
| 14849 | + case "iiii": | |
| 14850 | + default: | |
| 14851 | + return mapValue( | |
| 14852 | + match2.day(dateString, { | |
| 14853 | + width: "wide", | |
| 14854 | + context: "formatting" | |
| 14855 | + }) || match2.day(dateString, { | |
| 14856 | + width: "abbreviated", | |
| 14857 | + context: "formatting" | |
| 14858 | + }) || match2.day(dateString, { | |
| 14859 | + width: "short", | |
| 14860 | + context: "formatting" | |
| 14861 | + }) || match2.day(dateString, { | |
| 14862 | + width: "narrow", | |
| 14863 | + context: "formatting" | |
| 14864 | + }), | |
| 14865 | + valueCallback | |
| 14866 | + ); | |
| 14867 | + } | |
| 14868 | + } | |
| 14869 | + validate(_date, value) { | |
| 14870 | + return value >= 1 && value <= 7; | |
| 14871 | + } | |
| 14872 | + set(date, _flags, value) { | |
| 14873 | + date = setISODay(date, value); | |
| 14874 | + date.setHours(0, 0, 0, 0); | |
| 14875 | + return date; | |
| 14876 | + } | |
| 14877 | + incompatibleTokens = [ | |
| 14878 | + "y", | |
| 14879 | + "Y", | |
| 14880 | + "u", | |
| 14881 | + "q", | |
| 14882 | + "Q", | |
| 14883 | + "M", | |
| 14884 | + "L", | |
| 14885 | + "w", | |
| 14886 | + "d", | |
| 14887 | + "D", | |
| 14888 | + "E", | |
| 14889 | + "e", | |
| 14890 | + "c", | |
| 14891 | + "t", | |
| 14892 | + "T" | |
| 14893 | + ]; | |
| 14894 | +}; | |
| 14895 | + | |
| 14896 | +// node_modules/date-fns/parse/_lib/parsers/AMPMParser.js | |
| 14897 | +var AMPMParser = class extends Parser { | |
| 14898 | + priority = 80; | |
| 14899 | + parse(dateString, token, match2) { | |
| 14900 | + switch (token) { | |
| 14901 | + case "a": | |
| 14902 | + case "aa": | |
| 14903 | + case "aaa": | |
| 14904 | + return match2.dayPeriod(dateString, { | |
| 14905 | + width: "abbreviated", | |
| 14906 | + context: "formatting" | |
| 14907 | + }) || match2.dayPeriod(dateString, { | |
| 14908 | + width: "narrow", | |
| 14909 | + context: "formatting" | |
| 14910 | + }); | |
| 14911 | + case "aaaaa": | |
| 14912 | + return match2.dayPeriod(dateString, { | |
| 14913 | + width: "narrow", | |
| 14914 | + context: "formatting" | |
| 14915 | + }); | |
| 14916 | + case "aaaa": | |
| 14917 | + default: | |
| 14918 | + return match2.dayPeriod(dateString, { | |
| 14919 | + width: "wide", | |
| 14920 | + context: "formatting" | |
| 14921 | + }) || match2.dayPeriod(dateString, { | |
| 14922 | + width: "abbreviated", | |
| 14923 | + context: "formatting" | |
| 14924 | + }) || match2.dayPeriod(dateString, { | |
| 14925 | + width: "narrow", | |
| 14926 | + context: "formatting" | |
| 14927 | + }); | |
| 14928 | + } | |
| 14929 | + } | |
| 14930 | + set(date, _flags, value) { | |
| 14931 | + date.setHours(dayPeriodEnumToHours(value), 0, 0, 0); | |
| 14932 | + return date; | |
| 14933 | + } | |
| 14934 | + incompatibleTokens = ["b", "B", "H", "k", "t", "T"]; | |
| 14935 | +}; | |
| 14936 | + | |
| 14937 | +// node_modules/date-fns/parse/_lib/parsers/AMPMMidnightParser.js | |
| 14938 | +var AMPMMidnightParser = class extends Parser { | |
| 14939 | + priority = 80; | |
| 14940 | + parse(dateString, token, match2) { | |
| 14941 | + switch (token) { | |
| 14942 | + case "b": | |
| 14943 | + case "bb": | |
| 14944 | + case "bbb": | |
| 14945 | + return match2.dayPeriod(dateString, { | |
| 14946 | + width: "abbreviated", | |
| 14947 | + context: "formatting" | |
| 14948 | + }) || match2.dayPeriod(dateString, { | |
| 14949 | + width: "narrow", | |
| 14950 | + context: "formatting" | |
| 14951 | + }); | |
| 14952 | + case "bbbbb": | |
| 14953 | + return match2.dayPeriod(dateString, { | |
| 14954 | + width: "narrow", | |
| 14955 | + context: "formatting" | |
| 14956 | + }); | |
| 14957 | + case "bbbb": | |
| 14958 | + default: | |
| 14959 | + return match2.dayPeriod(dateString, { | |
| 14960 | + width: "wide", | |
| 14961 | + context: "formatting" | |
| 14962 | + }) || match2.dayPeriod(dateString, { | |
| 14963 | + width: "abbreviated", | |
| 14964 | + context: "formatting" | |
| 14965 | + }) || match2.dayPeriod(dateString, { | |
| 14966 | + width: "narrow", | |
| 14967 | + context: "formatting" | |
| 14968 | + }); | |
| 14969 | + } | |
| 14970 | + } | |
| 14971 | + set(date, _flags, value) { | |
| 14972 | + date.setHours(dayPeriodEnumToHours(value), 0, 0, 0); | |
| 14973 | + return date; | |
| 14974 | + } | |
| 14975 | + incompatibleTokens = ["a", "B", "H", "k", "t", "T"]; | |
| 14976 | +}; | |
| 14977 | + | |
| 14978 | +// node_modules/date-fns/parse/_lib/parsers/DayPeriodParser.js | |
| 14979 | +var DayPeriodParser = class extends Parser { | |
| 14980 | + priority = 80; | |
| 14981 | + parse(dateString, token, match2) { | |
| 14982 | + switch (token) { | |
| 14983 | + case "B": | |
| 14984 | + case "BB": | |
| 14985 | + case "BBB": | |
| 14986 | + return match2.dayPeriod(dateString, { | |
| 14987 | + width: "abbreviated", | |
| 14988 | + context: "formatting" | |
| 14989 | + }) || match2.dayPeriod(dateString, { | |
| 14990 | + width: "narrow", | |
| 14991 | + context: "formatting" | |
| 14992 | + }); | |
| 14993 | + case "BBBBB": | |
| 14994 | + return match2.dayPeriod(dateString, { | |
| 14995 | + width: "narrow", | |
| 14996 | + context: "formatting" | |
| 14997 | + }); | |
| 14998 | + case "BBBB": | |
| 14999 | + default: | |
| 15000 | + return match2.dayPeriod(dateString, { | |
| 15001 | + width: "wide", | |
| 15002 | + context: "formatting" | |
| 15003 | + }) || match2.dayPeriod(dateString, { | |
| 15004 | + width: "abbreviated", | |
| 15005 | + context: "formatting" | |
| 15006 | + }) || match2.dayPeriod(dateString, { | |
| 15007 | + width: "narrow", | |
| 15008 | + context: "formatting" | |
| 15009 | + }); | |
| 15010 | + } | |
| 15011 | + } | |
| 15012 | + set(date, _flags, value) { | |
| 15013 | + date.setHours(dayPeriodEnumToHours(value), 0, 0, 0); | |
| 15014 | + return date; | |
| 15015 | + } | |
| 15016 | + incompatibleTokens = ["a", "b", "t", "T"]; | |
| 15017 | +}; | |
| 15018 | + | |
| 15019 | +// node_modules/date-fns/parse/_lib/parsers/Hour1to12Parser.js | |
| 15020 | +var Hour1to12Parser = class extends Parser { | |
| 15021 | + priority = 70; | |
| 15022 | + parse(dateString, token, match2) { | |
| 15023 | + switch (token) { | |
| 15024 | + case "h": | |
| 15025 | + return parseNumericPattern(numericPatterns.hour12h, dateString); | |
| 15026 | + case "ho": | |
| 15027 | + return match2.ordinalNumber(dateString, { unit: "hour" }); | |
| 15028 | + default: | |
| 15029 | + return parseNDigits(token.length, dateString); | |
| 15030 | + } | |
| 15031 | + } | |
| 15032 | + validate(_date, value) { | |
| 15033 | + return value >= 1 && value <= 12; | |
| 15034 | + } | |
| 15035 | + set(date, _flags, value) { | |
| 15036 | + const isPM = date.getHours() >= 12; | |
| 15037 | + if (isPM && value < 12) { | |
| 15038 | + date.setHours(value + 12, 0, 0, 0); | |
| 15039 | + } else if (!isPM && value === 12) { | |
| 15040 | + date.setHours(0, 0, 0, 0); | |
| 15041 | + } else { | |
| 15042 | + date.setHours(value, 0, 0, 0); | |
| 15043 | + } | |
| 15044 | + return date; | |
| 15045 | + } | |
| 15046 | + incompatibleTokens = ["H", "K", "k", "t", "T"]; | |
| 15047 | +}; | |
| 15048 | + | |
| 15049 | +// node_modules/date-fns/parse/_lib/parsers/Hour0to23Parser.js | |
| 15050 | +var Hour0to23Parser = class extends Parser { | |
| 15051 | + priority = 70; | |
| 15052 | + parse(dateString, token, match2) { | |
| 15053 | + switch (token) { | |
| 15054 | + case "H": | |
| 15055 | + return parseNumericPattern(numericPatterns.hour23h, dateString); | |
| 15056 | + case "Ho": | |
| 15057 | + return match2.ordinalNumber(dateString, { unit: "hour" }); | |
| 15058 | + default: | |
| 15059 | + return parseNDigits(token.length, dateString); | |
| 15060 | + } | |
| 15061 | + } | |
| 15062 | + validate(_date, value) { | |
| 15063 | + return value >= 0 && value <= 23; | |
| 15064 | + } | |
| 15065 | + set(date, _flags, value) { | |
| 15066 | + date.setHours(value, 0, 0, 0); | |
| 15067 | + return date; | |
| 15068 | + } | |
| 15069 | + incompatibleTokens = ["a", "b", "h", "K", "k", "t", "T"]; | |
| 15070 | +}; | |
| 15071 | + | |
| 15072 | +// node_modules/date-fns/parse/_lib/parsers/Hour0To11Parser.js | |
| 15073 | +var Hour0To11Parser = class extends Parser { | |
| 15074 | + priority = 70; | |
| 15075 | + parse(dateString, token, match2) { | |
| 15076 | + switch (token) { | |
| 15077 | + case "K": | |
| 15078 | + return parseNumericPattern(numericPatterns.hour11h, dateString); | |
| 15079 | + case "Ko": | |
| 15080 | + return match2.ordinalNumber(dateString, { unit: "hour" }); | |
| 15081 | + default: | |
| 15082 | + return parseNDigits(token.length, dateString); | |
| 15083 | + } | |
| 15084 | + } | |
| 15085 | + validate(_date, value) { | |
| 15086 | + return value >= 0 && value <= 11; | |
| 15087 | + } | |
| 15088 | + set(date, _flags, value) { | |
| 15089 | + const isPM = date.getHours() >= 12; | |
| 15090 | + if (isPM && value < 12) { | |
| 15091 | + date.setHours(value + 12, 0, 0, 0); | |
| 15092 | + } else { | |
| 15093 | + date.setHours(value, 0, 0, 0); | |
| 15094 | + } | |
| 15095 | + return date; | |
| 15096 | + } | |
| 15097 | + incompatibleTokens = ["h", "H", "k", "t", "T"]; | |
| 15098 | +}; | |
| 15099 | + | |
| 15100 | +// node_modules/date-fns/parse/_lib/parsers/Hour1To24Parser.js | |
| 15101 | +var Hour1To24Parser = class extends Parser { | |
| 15102 | + priority = 70; | |
| 15103 | + parse(dateString, token, match2) { | |
| 15104 | + switch (token) { | |
| 15105 | + case "k": | |
| 15106 | + return parseNumericPattern(numericPatterns.hour24h, dateString); | |
| 15107 | + case "ko": | |
| 15108 | + return match2.ordinalNumber(dateString, { unit: "hour" }); | |
| 15109 | + default: | |
| 15110 | + return parseNDigits(token.length, dateString); | |
| 15111 | + } | |
| 15112 | + } | |
| 15113 | + validate(_date, value) { | |
| 15114 | + return value >= 1 && value <= 24; | |
| 15115 | + } | |
| 15116 | + set(date, _flags, value) { | |
| 15117 | + const hours = value <= 24 ? value % 24 : value; | |
| 15118 | + date.setHours(hours, 0, 0, 0); | |
| 15119 | + return date; | |
| 15120 | + } | |
| 15121 | + incompatibleTokens = ["a", "b", "h", "H", "K", "t", "T"]; | |
| 15122 | +}; | |
| 15123 | + | |
| 15124 | +// node_modules/date-fns/parse/_lib/parsers/MinuteParser.js | |
| 15125 | +var MinuteParser = class extends Parser { | |
| 15126 | + priority = 60; | |
| 15127 | + parse(dateString, token, match2) { | |
| 15128 | + switch (token) { | |
| 15129 | + case "m": | |
| 15130 | + return parseNumericPattern(numericPatterns.minute, dateString); | |
| 15131 | + case "mo": | |
| 15132 | + return match2.ordinalNumber(dateString, { unit: "minute" }); | |
| 15133 | + default: | |
| 15134 | + return parseNDigits(token.length, dateString); | |
| 15135 | + } | |
| 15136 | + } | |
| 15137 | + validate(_date, value) { | |
| 15138 | + return value >= 0 && value <= 59; | |
| 15139 | + } | |
| 15140 | + set(date, _flags, value) { | |
| 15141 | + date.setMinutes(value, 0, 0); | |
| 15142 | + return date; | |
| 15143 | + } | |
| 15144 | + incompatibleTokens = ["t", "T"]; | |
| 15145 | +}; | |
| 15146 | + | |
| 15147 | +// node_modules/date-fns/parse/_lib/parsers/SecondParser.js | |
| 15148 | +var SecondParser = class extends Parser { | |
| 15149 | + priority = 50; | |
| 15150 | + parse(dateString, token, match2) { | |
| 15151 | + switch (token) { | |
| 15152 | + case "s": | |
| 15153 | + return parseNumericPattern(numericPatterns.second, dateString); | |
| 15154 | + case "so": | |
| 15155 | + return match2.ordinalNumber(dateString, { unit: "second" }); | |
| 15156 | + default: | |
| 15157 | + return parseNDigits(token.length, dateString); | |
| 15158 | + } | |
| 15159 | + } | |
| 15160 | + validate(_date, value) { | |
| 15161 | + return value >= 0 && value <= 59; | |
| 15162 | + } | |
| 15163 | + set(date, _flags, value) { | |
| 15164 | + date.setSeconds(value, 0); | |
| 15165 | + return date; | |
| 15166 | + } | |
| 15167 | + incompatibleTokens = ["t", "T"]; | |
| 15168 | +}; | |
| 15169 | + | |
| 15170 | +// node_modules/date-fns/parse/_lib/parsers/FractionOfSecondParser.js | |
| 15171 | +var FractionOfSecondParser = class extends Parser { | |
| 15172 | + priority = 30; | |
| 15173 | + parse(dateString, token) { | |
| 15174 | + const valueCallback = (value) => Math.trunc(value * Math.pow(10, -token.length + 3)); | |
| 15175 | + return mapValue(parseNDigits(token.length, dateString), valueCallback); | |
| 15176 | + } | |
| 15177 | + set(date, _flags, value) { | |
| 15178 | + date.setMilliseconds(value); | |
| 15179 | + return date; | |
| 15180 | + } | |
| 15181 | + incompatibleTokens = ["t", "T"]; | |
| 15182 | +}; | |
| 15183 | + | |
| 15184 | +// node_modules/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.js | |
| 15185 | +var ISOTimezoneWithZParser = class extends Parser { | |
| 15186 | + priority = 10; | |
| 15187 | + parse(dateString, token) { | |
| 15188 | + switch (token) { | |
| 15189 | + case "X": | |
| 15190 | + return parseTimezonePattern( | |
| 15191 | + timezonePatterns.basicOptionalMinutes, | |
| 15192 | + dateString | |
| 15193 | + ); | |
| 15194 | + case "XX": | |
| 15195 | + return parseTimezonePattern(timezonePatterns.basic, dateString); | |
| 15196 | + case "XXXX": | |
| 15197 | + return parseTimezonePattern( | |
| 15198 | + timezonePatterns.basicOptionalSeconds, | |
| 15199 | + dateString | |
| 15200 | + ); | |
| 15201 | + case "XXXXX": | |
| 15202 | + return parseTimezonePattern( | |
| 15203 | + timezonePatterns.extendedOptionalSeconds, | |
| 15204 | + dateString | |
| 15205 | + ); | |
| 15206 | + case "XXX": | |
| 15207 | + default: | |
| 15208 | + return parseTimezonePattern(timezonePatterns.extended, dateString); | |
| 15209 | + } | |
| 15210 | + } | |
| 15211 | + set(date, flags, value) { | |
| 15212 | + if (flags.timestampIsSet) return date; | |
| 15213 | + return constructFrom( | |
| 15214 | + date, | |
| 15215 | + date.getTime() - getTimezoneOffsetInMilliseconds(date) - value | |
| 15216 | + ); | |
| 15217 | + } | |
| 15218 | + incompatibleTokens = ["t", "T", "x"]; | |
| 15219 | +}; | |
| 15220 | + | |
| 15221 | +// node_modules/date-fns/parse/_lib/parsers/ISOTimezoneParser.js | |
| 15222 | +var ISOTimezoneParser = class extends Parser { | |
| 15223 | + priority = 10; | |
| 15224 | + parse(dateString, token) { | |
| 15225 | + switch (token) { | |
| 15226 | + case "x": | |
| 15227 | + return parseTimezonePattern( | |
| 15228 | + timezonePatterns.basicOptionalMinutes, | |
| 15229 | + dateString | |
| 15230 | + ); | |
| 15231 | + case "xx": | |
| 15232 | + return parseTimezonePattern(timezonePatterns.basic, dateString); | |
| 15233 | + case "xxxx": | |
| 15234 | + return parseTimezonePattern( | |
| 15235 | + timezonePatterns.basicOptionalSeconds, | |
| 15236 | + dateString | |
| 15237 | + ); | |
| 15238 | + case "xxxxx": | |
| 15239 | + return parseTimezonePattern( | |
| 15240 | + timezonePatterns.extendedOptionalSeconds, | |
| 15241 | + dateString | |
| 15242 | + ); | |
| 15243 | + case "xxx": | |
| 15244 | + default: | |
| 15245 | + return parseTimezonePattern(timezonePatterns.extended, dateString); | |
| 15246 | + } | |
| 15247 | + } | |
| 15248 | + set(date, flags, value) { | |
| 15249 | + if (flags.timestampIsSet) return date; | |
| 15250 | + return constructFrom( | |
| 15251 | + date, | |
| 15252 | + date.getTime() - getTimezoneOffsetInMilliseconds(date) - value | |
| 15253 | + ); | |
| 15254 | + } | |
| 15255 | + incompatibleTokens = ["t", "T", "X"]; | |
| 15256 | +}; | |
| 15257 | + | |
| 15258 | +// node_modules/date-fns/parse/_lib/parsers/TimestampSecondsParser.js | |
| 15259 | +var TimestampSecondsParser = class extends Parser { | |
| 15260 | + priority = 40; | |
| 15261 | + parse(dateString) { | |
| 15262 | + return parseAnyDigitsSigned(dateString); | |
| 15263 | + } | |
| 15264 | + set(date, _flags, value) { | |
| 15265 | + return [constructFrom(date, value * 1e3), { timestampIsSet: true }]; | |
| 15266 | + } | |
| 15267 | + incompatibleTokens = "*"; | |
| 15268 | +}; | |
| 15269 | + | |
| 15270 | +// node_modules/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.js | |
| 15271 | +var TimestampMillisecondsParser = class extends Parser { | |
| 15272 | + priority = 20; | |
| 15273 | + parse(dateString) { | |
| 15274 | + return parseAnyDigitsSigned(dateString); | |
| 15275 | + } | |
| 15276 | + set(date, _flags, value) { | |
| 15277 | + return [constructFrom(date, value), { timestampIsSet: true }]; | |
| 15278 | + } | |
| 15279 | + incompatibleTokens = "*"; | |
| 15280 | +}; | |
| 15281 | + | |
| 15282 | +// node_modules/date-fns/parse/_lib/parsers.js | |
| 15283 | +var parsers = { | |
| 15284 | + G: new EraParser(), | |
| 15285 | + y: new YearParser(), | |
| 15286 | + Y: new LocalWeekYearParser(), | |
| 15287 | + R: new ISOWeekYearParser(), | |
| 15288 | + u: new ExtendedYearParser(), | |
| 15289 | + Q: new QuarterParser(), | |
| 15290 | + q: new StandAloneQuarterParser(), | |
| 15291 | + M: new MonthParser(), | |
| 15292 | + L: new StandAloneMonthParser(), | |
| 15293 | + w: new LocalWeekParser(), | |
| 15294 | + I: new ISOWeekParser(), | |
| 15295 | + d: new DateParser(), | |
| 15296 | + D: new DayOfYearParser(), | |
| 15297 | + E: new DayParser(), | |
| 15298 | + e: new LocalDayParser(), | |
| 15299 | + c: new StandAloneLocalDayParser(), | |
| 15300 | + i: new ISODayParser(), | |
| 15301 | + a: new AMPMParser(), | |
| 15302 | + b: new AMPMMidnightParser(), | |
| 15303 | + B: new DayPeriodParser(), | |
| 15304 | + h: new Hour1to12Parser(), | |
| 15305 | + H: new Hour0to23Parser(), | |
| 15306 | + K: new Hour0To11Parser(), | |
| 15307 | + k: new Hour1To24Parser(), | |
| 15308 | + m: new MinuteParser(), | |
| 15309 | + s: new SecondParser(), | |
| 15310 | + S: new FractionOfSecondParser(), | |
| 15311 | + X: new ISOTimezoneWithZParser(), | |
| 15312 | + x: new ISOTimezoneParser(), | |
| 15313 | + t: new TimestampSecondsParser(), | |
| 15314 | + T: new TimestampMillisecondsParser() | |
| 15315 | +}; | |
| 15316 | + | |
| 15317 | +// node_modules/date-fns/parse.js | |
| 15318 | +var formattingTokensRegExp2 = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; | |
| 15319 | +var longFormattingTokensRegExp2 = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g; | |
| 15320 | +var escapedStringRegExp2 = /^'([^]*?)'?$/; | |
| 15321 | +var doubleQuoteRegExp2 = /''/g; | |
| 15322 | +var notWhitespaceRegExp = /\S/; | |
| 15323 | +var unescapedLatinCharacterRegExp2 = /[a-zA-Z]/; | |
| 15324 | +function parse(dateStr, formatStr, referenceDate, options) { | |
| 15325 | + const invalidDate = () => constructFrom(options?.in || referenceDate, NaN); | |
| 15326 | + const defaultOptions2 = getDefaultOptions2(); | |
| 15327 | + const locale = options?.locale ?? defaultOptions2.locale ?? enUS; | |
| 15328 | + const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1; | |
| 15329 | + const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0; | |
| 15330 | + if (!formatStr) | |
| 15331 | + return dateStr ? invalidDate() : toDate(referenceDate, options?.in); | |
| 15332 | + const subFnOptions = { | |
| 15333 | + firstWeekContainsDate, | |
| 15334 | + weekStartsOn, | |
| 15335 | + locale | |
| 15336 | + }; | |
| 15337 | + const setters = [new DateTimezoneSetter(options?.in, referenceDate)]; | |
| 15338 | + const tokens = formatStr.match(longFormattingTokensRegExp2).map((substring) => { | |
| 15339 | + const firstCharacter = substring[0]; | |
| 15340 | + if (firstCharacter in longFormatters) { | |
| 15341 | + const longFormatter = longFormatters[firstCharacter]; | |
| 15342 | + return longFormatter(substring, locale.formatLong); | |
| 15343 | + } | |
| 15344 | + return substring; | |
| 15345 | + }).join("").match(formattingTokensRegExp2); | |
| 15346 | + const usedTokens = []; | |
| 15347 | + for (let token of tokens) { | |
| 15348 | + if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token)) { | |
| 15349 | + warnOrThrowProtectedError(token, formatStr, dateStr); | |
| 15350 | + } | |
| 15351 | + if (!options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) { | |
| 15352 | + warnOrThrowProtectedError(token, formatStr, dateStr); | |
| 15353 | + } | |
| 15354 | + const firstCharacter = token[0]; | |
| 15355 | + const parser = parsers[firstCharacter]; | |
| 15356 | + if (parser) { | |
| 15357 | + const { incompatibleTokens } = parser; | |
| 15358 | + if (Array.isArray(incompatibleTokens)) { | |
| 15359 | + const incompatibleToken = usedTokens.find( | |
| 15360 | + (usedToken) => incompatibleTokens.includes(usedToken.token) || usedToken.token === firstCharacter | |
| 15361 | + ); | |
| 15362 | + if (incompatibleToken) { | |
| 15363 | + throw new RangeError( | |
| 15364 | + `The format string mustn't contain \`${incompatibleToken.fullToken}\` and \`${token}\` at the same time` | |
| 15365 | + ); | |
| 15366 | + } | |
| 15367 | + } else if (parser.incompatibleTokens === "*" && usedTokens.length > 0) { | |
| 15368 | + throw new RangeError( | |
| 15369 | + `The format string mustn't contain \`${token}\` and any other token at the same time` | |
| 15370 | + ); | |
| 15371 | + } | |
| 15372 | + usedTokens.push({ token: firstCharacter, fullToken: token }); | |
| 15373 | + const parseResult = parser.run( | |
| 15374 | + dateStr, | |
| 15375 | + token, | |
| 15376 | + locale.match, | |
| 15377 | + subFnOptions | |
| 15378 | + ); | |
| 15379 | + if (!parseResult) { | |
| 15380 | + return invalidDate(); | |
| 15381 | + } | |
| 15382 | + setters.push(parseResult.setter); | |
| 15383 | + dateStr = parseResult.rest; | |
| 15384 | + } else { | |
| 15385 | + if (firstCharacter.match(unescapedLatinCharacterRegExp2)) { | |
| 15386 | + throw new RangeError( | |
| 15387 | + "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`" | |
| 15388 | + ); | |
| 15389 | + } | |
| 15390 | + if (token === "''") { | |
| 15391 | + token = "'"; | |
| 15392 | + } else if (firstCharacter === "'") { | |
| 15393 | + token = cleanEscapedString2(token); | |
| 15394 | + } | |
| 15395 | + if (dateStr.indexOf(token) === 0) { | |
| 15396 | + dateStr = dateStr.slice(token.length); | |
| 15397 | + } else { | |
| 15398 | + return invalidDate(); | |
| 15399 | + } | |
| 15400 | + } | |
| 15401 | + } | |
| 15402 | + if (dateStr.length > 0 && notWhitespaceRegExp.test(dateStr)) { | |
| 15403 | + return invalidDate(); | |
| 15404 | + } | |
| 15405 | + const uniquePrioritySetters = setters.map((setter) => setter.priority).sort((a, b) => b - a).filter((priority, index2, array) => array.indexOf(priority) === index2).map( | |
| 15406 | + (priority) => setters.filter((setter) => setter.priority === priority).sort((a, b) => b.subPriority - a.subPriority) | |
| 15407 | + ).map((setterArray) => setterArray[0]); | |
| 15408 | + let date = toDate(referenceDate, options?.in); | |
| 15409 | + if (isNaN(+date)) return invalidDate(); | |
| 15410 | + const flags = {}; | |
| 15411 | + for (const setter of uniquePrioritySetters) { | |
| 15412 | + if (!setter.validate(date, subFnOptions)) { | |
| 15413 | + return invalidDate(); | |
| 15414 | + } | |
| 15415 | + const result = setter.set(date, flags, subFnOptions); | |
| 15416 | + if (Array.isArray(result)) { | |
| 15417 | + date = result[0]; | |
| 15418 | + Object.assign(flags, result[1]); | |
| 15419 | + } else { | |
| 15420 | + date = result; | |
| 15421 | + } | |
| 15422 | + } | |
| 15423 | + return date; | |
| 15424 | +} | |
| 15425 | +function cleanEscapedString2(input) { | |
| 15426 | + return input.match(escapedStringRegExp2)[1].replace(doubleQuoteRegExp2, "'"); | |
| 15427 | +} | |
| 15428 | + | |
| 15429 | +// node_modules/date-fns/isSameMonth.js | |
| 15430 | +function isSameMonth(laterDate, earlierDate, options) { | |
| 15431 | + const [laterDate_, earlierDate_] = normalizeDates( | |
| 15432 | + options?.in, | |
| 15433 | + laterDate, | |
| 15434 | + earlierDate | |
| 15435 | + ); | |
| 15436 | + return laterDate_.getFullYear() === earlierDate_.getFullYear() && laterDate_.getMonth() === earlierDate_.getMonth(); | |
| 15437 | +} | |
| 15438 | + | |
| 15439 | +// node_modules/date-fns/isSameYear.js | |
| 15440 | +function isSameYear(laterDate, earlierDate, options) { | |
| 15441 | + const [laterDate_, earlierDate_] = normalizeDates( | |
| 15442 | + options?.in, | |
| 15443 | + laterDate, | |
| 15444 | + earlierDate | |
| 15445 | + ); | |
| 15446 | + return laterDate_.getFullYear() === earlierDate_.getFullYear(); | |
| 15447 | +} | |
| 15448 | + | |
| 15449 | +// node_modules/date-fns/subDays.js | |
| 15450 | +function subDays(date, amount, options) { | |
| 15451 | + return addDays(date, -amount, options); | |
| 15452 | +} | |
| 15453 | + | |
| 15454 | +// node_modules/date-fns/parseISO.js | |
| 15455 | +function parseISO(argument, options) { | |
| 15456 | + const invalidDate = () => constructFrom(options?.in, NaN); | |
| 15457 | + const additionalDigits = options?.additionalDigits ?? 2; | |
| 15458 | + const dateStrings = splitDateString(argument); | |
| 15459 | + let date; | |
| 15460 | + if (dateStrings.date) { | |
| 15461 | + const parseYearResult = parseYear(dateStrings.date, additionalDigits); | |
| 15462 | + date = parseDate(parseYearResult.restDateString, parseYearResult.year); | |
| 15463 | + } | |
| 15464 | + if (!date || isNaN(+date)) return invalidDate(); | |
| 15465 | + const timestamp = +date; | |
| 15466 | + let time = 0; | |
| 15467 | + let offset4; | |
| 15468 | + if (dateStrings.time) { | |
| 15469 | + time = parseTime(dateStrings.time); | |
| 15470 | + if (isNaN(time)) return invalidDate(); | |
| 15471 | + } | |
| 15472 | + if (dateStrings.timezone) { | |
| 15473 | + offset4 = parseTimezone(dateStrings.timezone); | |
| 15474 | + if (isNaN(offset4)) return invalidDate(); | |
| 15475 | + } else { | |
| 15476 | + const tmpDate = new Date(timestamp + time); | |
| 15477 | + const result = toDate(0, options?.in); | |
| 15478 | + result.setFullYear( | |
| 15479 | + tmpDate.getUTCFullYear(), | |
| 15480 | + tmpDate.getUTCMonth(), | |
| 15481 | + tmpDate.getUTCDate() | |
| 15482 | + ); | |
| 15483 | + result.setHours( | |
| 15484 | + tmpDate.getUTCHours(), | |
| 15485 | + tmpDate.getUTCMinutes(), | |
| 15486 | + tmpDate.getUTCSeconds(), | |
| 15487 | + tmpDate.getUTCMilliseconds() | |
| 15488 | + ); | |
| 15489 | + return result; | |
| 15490 | + } | |
| 15491 | + return toDate(timestamp + time + offset4, options?.in); | |
| 15492 | +} | |
| 15493 | +var patterns = { | |
| 15494 | + dateTimeDelimiter: /[T ]/, | |
| 15495 | + timeZoneDelimiter: /[Z ]/i, | |
| 15496 | + timezone: /([Z+-].*)$/ | |
| 15497 | +}; | |
| 15498 | +var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/; | |
| 15499 | +var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/; | |
| 15500 | +var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/; | |
| 15501 | +function splitDateString(dateString) { | |
| 15502 | + const dateStrings = {}; | |
| 15503 | + const array = dateString.split(patterns.dateTimeDelimiter); | |
| 15504 | + let timeString; | |
| 15505 | + if (array.length > 2) { | |
| 15506 | + return dateStrings; | |
| 15507 | + } | |
| 15508 | + if (/:/.test(array[0])) { | |
| 15509 | + timeString = array[0]; | |
| 15510 | + } else { | |
| 15511 | + dateStrings.date = array[0]; | |
| 15512 | + timeString = array[1]; | |
| 15513 | + if (patterns.timeZoneDelimiter.test(dateStrings.date)) { | |
| 15514 | + dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0]; | |
| 15515 | + timeString = dateString.substr( | |
| 15516 | + dateStrings.date.length, | |
| 15517 | + dateString.length | |
| 15518 | + ); | |
| 15519 | + } | |
| 15520 | + } | |
| 15521 | + if (timeString) { | |
| 15522 | + const token = patterns.timezone.exec(timeString); | |
| 15523 | + if (token) { | |
| 15524 | + dateStrings.time = timeString.replace(token[1], ""); | |
| 15525 | + dateStrings.timezone = token[1]; | |
| 15526 | + } else { | |
| 15527 | + dateStrings.time = timeString; | |
| 15528 | + } | |
| 15529 | + } | |
| 15530 | + return dateStrings; | |
| 15531 | +} | |
| 15532 | +function parseYear(dateString, additionalDigits) { | |
| 15533 | + const regex = new RegExp( | |
| 15534 | + "^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)" | |
| 15535 | + ); | |
| 15536 | + const captures = dateString.match(regex); | |
| 15537 | + if (!captures) return { year: NaN, restDateString: "" }; | |
| 15538 | + const year = captures[1] ? parseInt(captures[1]) : null; | |
| 15539 | + const century = captures[2] ? parseInt(captures[2]) : null; | |
| 15540 | + return { | |
| 15541 | + year: century === null ? year : century * 100, | |
| 15542 | + restDateString: dateString.slice((captures[1] || captures[2]).length) | |
| 15543 | + }; | |
| 15544 | +} | |
| 15545 | +function parseDate(dateString, year) { | |
| 15546 | + if (year === null) return /* @__PURE__ */ new Date(NaN); | |
| 15547 | + const captures = dateString.match(dateRegex); | |
| 15548 | + if (!captures) return /* @__PURE__ */ new Date(NaN); | |
| 15549 | + const isWeekDate = !!captures[4]; | |
| 15550 | + const dayOfYear = parseDateUnit(captures[1]); | |
| 15551 | + const month = parseDateUnit(captures[2]) - 1; | |
| 15552 | + const day = parseDateUnit(captures[3]); | |
| 15553 | + const week = parseDateUnit(captures[4]); | |
| 15554 | + const dayOfWeek = parseDateUnit(captures[5]) - 1; | |
| 15555 | + if (isWeekDate) { | |
| 15556 | + if (!validateWeekDate(year, week, dayOfWeek)) { | |
| 15557 | + return /* @__PURE__ */ new Date(NaN); | |
| 15558 | + } | |
| 15559 | + return dayOfISOWeekYear(year, week, dayOfWeek); | |
| 15560 | + } else { | |
| 15561 | + const date = /* @__PURE__ */ new Date(0); | |
| 15562 | + if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) { | |
| 15563 | + return /* @__PURE__ */ new Date(NaN); | |
| 15564 | + } | |
| 15565 | + date.setUTCFullYear(year, month, Math.max(dayOfYear, day)); | |
| 15566 | + return date; | |
| 15567 | + } | |
| 15568 | +} | |
| 15569 | +function parseDateUnit(value) { | |
| 15570 | + return value ? parseInt(value) : 1; | |
| 15571 | +} | |
| 15572 | +function parseTime(timeString) { | |
| 15573 | + const captures = timeString.match(timeRegex); | |
| 15574 | + if (!captures) return NaN; | |
| 15575 | + const hours = parseTimeUnit(captures[1]); | |
| 15576 | + const minutes = parseTimeUnit(captures[2]); | |
| 15577 | + const seconds = parseTimeUnit(captures[3]); | |
| 15578 | + if (!validateTime(hours, minutes, seconds)) { | |
| 15579 | + return NaN; | |
| 15580 | + } | |
| 15581 | + return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1e3; | |
| 15582 | +} | |
| 15583 | +function parseTimeUnit(value) { | |
| 15584 | + return value && parseFloat(value.replace(",", ".")) || 0; | |
| 15585 | +} | |
| 15586 | +function parseTimezone(timezoneString) { | |
| 15587 | + if (timezoneString === "Z") return 0; | |
| 15588 | + const captures = timezoneString.match(timezoneRegex); | |
| 15589 | + if (!captures) return 0; | |
| 15590 | + const sign = captures[1] === "+" ? -1 : 1; | |
| 15591 | + const hours = parseInt(captures[2]); | |
| 15592 | + const minutes = captures[3] && parseInt(captures[3]) || 0; | |
| 15593 | + if (!validateTimezone(hours, minutes)) { | |
| 15594 | + return NaN; | |
| 15595 | + } | |
| 15596 | + return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute); | |
| 15597 | +} | |
| 15598 | +function dayOfISOWeekYear(isoWeekYear, week, day) { | |
| 15599 | + const date = /* @__PURE__ */ new Date(0); | |
| 15600 | + date.setUTCFullYear(isoWeekYear, 0, 4); | |
| 15601 | + const fourthOfJanuaryDay = date.getUTCDay() || 7; | |
| 15602 | + const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay; | |
| 15603 | + date.setUTCDate(date.getUTCDate() + diff); | |
| 15604 | + return date; | |
| 15605 | +} | |
| 15606 | +var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; | |
| 15607 | +function isLeapYearIndex2(year) { | |
| 15608 | + return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0; | |
| 15609 | +} | |
| 15610 | +function validateDate(year, month, date) { | |
| 15611 | + return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex2(year) ? 29 : 28)); | |
| 15612 | +} | |
| 15613 | +function validateDayOfYearDate(year, dayOfYear) { | |
| 15614 | + return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex2(year) ? 366 : 365); | |
| 15615 | +} | |
| 15616 | +function validateWeekDate(_year, week, day) { | |
| 15617 | + return week >= 1 && week <= 53 && day >= 0 && day <= 6; | |
| 15618 | +} | |
| 15619 | +function validateTime(hours, minutes, seconds) { | |
| 15620 | + if (hours === 24) { | |
| 15621 | + return minutes === 0 && seconds === 0; | |
| 15622 | + } | |
| 15623 | + return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25; | |
| 15624 | +} | |
| 15625 | +function validateTimezone(_hours, minutes) { | |
| 15626 | + return minutes >= 0 && minutes <= 59; | |
| 15627 | +} | |
| 15628 | + | |
| 15629 | +// node_modules/date-fns/setMonth.js | |
| 15630 | +function setMonth(date, month, options) { | |
| 15631 | + const _date = toDate(date, options?.in); | |
| 15632 | + const year = _date.getFullYear(); | |
| 15633 | + const day = _date.getDate(); | |
| 15634 | + const midMonth = constructFrom(options?.in || date, 0); | |
| 15635 | + midMonth.setFullYear(year, month, 15); | |
| 15636 | + midMonth.setHours(0, 0, 0, 0); | |
| 15637 | + const daysInMonth = getDaysInMonth(midMonth); | |
| 15638 | + _date.setMonth(month, Math.min(day, daysInMonth)); | |
| 15639 | + return _date; | |
| 15640 | +} | |
| 15641 | + | |
| 15642 | +// node_modules/date-fns/setYear.js | |
| 15643 | +function setYear(date, year, options) { | |
| 15644 | + const date_ = toDate(date, options?.in); | |
| 15645 | + if (isNaN(+date_)) return constructFrom(options?.in || date, NaN); | |
| 15646 | + date_.setFullYear(year); | |
| 15647 | + return date_; | |
| 15648 | +} | |
| 15649 | + | |
| 15650 | +// node_modules/date-fns/subMonths.js | |
| 15651 | +function subMonths(date, amount, options) { | |
| 15652 | + return addMonths(date, -amount, options); | |
| 15653 | +} | |
| 15654 | + | |
| 15655 | +// node_modules/date-fns/subWeeks.js | |
| 15656 | +function subWeeks(date, amount, options) { | |
| 15657 | + return addWeeks(date, -amount, options); | |
| 15658 | +} | |
| 15659 | + | |
| 15660 | +// node_modules/date-fns/subYears.js | |
| 15661 | +function subYears(date, amount, options) { | |
| 15662 | + return addYears(date, -amount, options); | |
| 15663 | +} | |
| 15664 | + | |
| 15665 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getBroadcastWeeksInMonth.js | |
| 15666 | +var FIVE_WEEKS = 5; | |
| 15667 | +var FOUR_WEEKS = 4; | |
| 15668 | +function getBroadcastWeeksInMonth(month, dateLib) { | |
| 15669 | + const firstDayOfMonth = dateLib.startOfMonth(month); | |
| 15670 | + const firstDayOfWeek = firstDayOfMonth.getDay() > 0 ? firstDayOfMonth.getDay() : 7; | |
| 15671 | + const broadcastStartDate = dateLib.addDays(month, -firstDayOfWeek + 1); | |
| 15672 | + const lastDateOfLastWeek = dateLib.addDays(broadcastStartDate, FIVE_WEEKS * 7 - 1); | |
| 15673 | + const numberOfWeeks = dateLib.getMonth(month) === dateLib.getMonth(lastDateOfLastWeek) ? FIVE_WEEKS : FOUR_WEEKS; | |
| 15674 | + return numberOfWeeks; | |
| 15675 | +} | |
| 15676 | + | |
| 15677 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/startOfBroadcastWeek.js | |
| 15678 | +function startOfBroadcastWeek(date, dateLib) { | |
| 15679 | + const firstOfMonth = dateLib.startOfMonth(date); | |
| 15680 | + const dayOfWeek = firstOfMonth.getDay(); | |
| 15681 | + if (dayOfWeek === 1) { | |
| 15682 | + return firstOfMonth; | |
| 15683 | + } else if (dayOfWeek === 0) { | |
| 15684 | + return dateLib.addDays(firstOfMonth, -1 * 6); | |
| 15685 | + } else { | |
| 15686 | + return dateLib.addDays(firstOfMonth, -1 * (dayOfWeek - 1)); | |
| 15687 | + } | |
| 15688 | +} | |
| 15689 | + | |
| 15690 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/endOfBroadcastWeek.js | |
| 15691 | +function endOfBroadcastWeek(date, dateLib) { | |
| 15692 | + const startDate = startOfBroadcastWeek(date, dateLib); | |
| 15693 | + const numberOfWeeks = getBroadcastWeeksInMonth(date, dateLib); | |
| 15694 | + const endDate = dateLib.addDays(startDate, numberOfWeeks * 7 - 1); | |
| 15695 | + return endDate; | |
| 15696 | +} | |
| 15697 | + | |
| 15698 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/locale/en-US.js | |
| 15699 | +var enUS2 = { | |
| 15700 | + ...enUS, | |
| 15701 | + labels: { | |
| 15702 | + labelDayButton: (date, modifiers, options, dateLib) => { | |
| 15703 | + let formatDate2; | |
| 15704 | + if (dateLib && typeof dateLib.format === "function") { | |
| 15705 | + formatDate2 = dateLib.format.bind(dateLib); | |
| 15706 | + } else { | |
| 15707 | + formatDate2 = (d, pattern) => format(d, pattern, { locale: enUS, ...options }); | |
| 15708 | + } | |
| 15709 | + let label = formatDate2(date, "PPPP"); | |
| 15710 | + if (modifiers.today) | |
| 15711 | + label = `Today, ${label}`; | |
| 15712 | + if (modifiers.selected) | |
| 15713 | + label = `${label}, selected`; | |
| 15714 | + return label; | |
| 15715 | + }, | |
| 15716 | + labelMonthDropdown: "Choose the Month", | |
| 15717 | + labelNext: "Go to the Next Month", | |
| 15718 | + labelPrevious: "Go to the Previous Month", | |
| 15719 | + labelWeekNumber: (weekNumber) => `Week ${weekNumber}`, | |
| 15720 | + labelYearDropdown: "Choose the Year", | |
| 15721 | + labelGrid: (date, options, dateLib) => { | |
| 15722 | + let formatDate2; | |
| 15723 | + if (dateLib && typeof dateLib.format === "function") { | |
| 15724 | + formatDate2 = dateLib.format.bind(dateLib); | |
| 15725 | + } else { | |
| 15726 | + formatDate2 = (d, pattern) => format(d, pattern, { locale: enUS, ...options }); | |
| 15727 | + } | |
| 15728 | + return formatDate2(date, "LLLL yyyy"); | |
| 15729 | + }, | |
| 15730 | + labelGridcell: (date, modifiers, options, dateLib) => { | |
| 15731 | + let formatDate2; | |
| 15732 | + if (dateLib && typeof dateLib.format === "function") { | |
| 15733 | + formatDate2 = dateLib.format.bind(dateLib); | |
| 15734 | + } else { | |
| 15735 | + formatDate2 = (d, pattern) => format(d, pattern, { locale: enUS, ...options }); | |
| 15736 | + } | |
| 15737 | + let label = formatDate2(date, "PPPP"); | |
| 15738 | + if (modifiers?.today) { | |
| 15739 | + label = `Today, ${label}`; | |
| 15740 | + } | |
| 15741 | + return label; | |
| 15742 | + }, | |
| 15743 | + labelNav: "Navigation bar", | |
| 15744 | + labelWeekNumberHeader: "Week Number", | |
| 15745 | + labelWeekday: (date, options, dateLib) => { | |
| 15746 | + let formatDate2; | |
| 15747 | + if (dateLib && typeof dateLib.format === "function") { | |
| 15748 | + formatDate2 = dateLib.format.bind(dateLib); | |
| 15749 | + } else { | |
| 15750 | + formatDate2 = (d, pattern) => format(d, pattern, { locale: enUS, ...options }); | |
| 15751 | + } | |
| 15752 | + return formatDate2(date, "cccc"); | |
| 15753 | + } | |
| 15754 | + } | |
| 15755 | +}; | |
| 15756 | + | |
| 15757 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/classes/DateLib.js | |
| 15758 | +var DateLib = class _DateLib { | |
| 15759 | + /** | |
| 15760 | + * Creates an instance of `DateLib`. | |
| 15761 | + * | |
| 15762 | + * @param options Configuration options for the date library. | |
| 15763 | + * @param overrides Custom overrides for the date library functions. | |
| 15764 | + */ | |
| 15765 | + constructor(options, overrides) { | |
| 15766 | + this.today = () => { | |
| 15767 | + if (this.overrides?.today) { | |
| 15768 | + return this.overrides.today(); | |
| 15769 | + } | |
| 15770 | + if (this.options.timeZone) { | |
| 15771 | + return TZDate.tz(this.options.timeZone); | |
| 15772 | + } | |
| 15773 | + const DateCtor = this.options.Date ?? Date; | |
| 15774 | + return new DateCtor(); | |
| 15775 | + }; | |
| 15776 | + this.newDate = (year, monthIndex, date) => { | |
| 15777 | + if (this.overrides?.newDate) { | |
| 15778 | + return this.overrides.newDate(year, monthIndex, date); | |
| 15779 | + } | |
| 15780 | + if (this.options.timeZone) { | |
| 15781 | + return new TZDate(year, monthIndex, date, this.options.timeZone); | |
| 15782 | + } | |
| 15783 | + return new Date(year, monthIndex, date); | |
| 15784 | + }; | |
| 15785 | + this.addDays = (date, amount) => { | |
| 15786 | + return this.overrides?.addDays ? this.overrides.addDays(date, amount) : addDays(date, amount); | |
| 15787 | + }; | |
| 15788 | + this.addMonths = (date, amount) => { | |
| 15789 | + return this.overrides?.addMonths ? this.overrides.addMonths(date, amount) : addMonths(date, amount); | |
| 15790 | + }; | |
| 15791 | + this.addWeeks = (date, amount) => { | |
| 15792 | + return this.overrides?.addWeeks ? this.overrides.addWeeks(date, amount) : addWeeks(date, amount); | |
| 15793 | + }; | |
| 15794 | + this.addYears = (date, amount) => { | |
| 15795 | + return this.overrides?.addYears ? this.overrides.addYears(date, amount) : addYears(date, amount); | |
| 15796 | + }; | |
| 15797 | + this.differenceInCalendarDays = (dateLeft, dateRight) => { | |
| 15798 | + return this.overrides?.differenceInCalendarDays ? this.overrides.differenceInCalendarDays(dateLeft, dateRight) : differenceInCalendarDays(dateLeft, dateRight); | |
| 15799 | + }; | |
| 15800 | + this.differenceInCalendarMonths = (dateLeft, dateRight) => { | |
| 15801 | + return this.overrides?.differenceInCalendarMonths ? this.overrides.differenceInCalendarMonths(dateLeft, dateRight) : differenceInCalendarMonths(dateLeft, dateRight); | |
| 15802 | + }; | |
| 15803 | + this.eachMonthOfInterval = (interval) => { | |
| 15804 | + return this.overrides?.eachMonthOfInterval ? this.overrides.eachMonthOfInterval(interval) : eachMonthOfInterval(interval); | |
| 15805 | + }; | |
| 15806 | + this.eachYearOfInterval = (interval) => { | |
| 15807 | + const years = this.overrides?.eachYearOfInterval ? this.overrides.eachYearOfInterval(interval) : eachYearOfInterval(interval); | |
| 15808 | + const uniqueYears = new Set(years.map((d) => this.getYear(d))); | |
| 15809 | + if (uniqueYears.size === years.length) { | |
| 15810 | + return years; | |
| 15811 | + } | |
| 15812 | + const yearsArray = []; | |
| 15813 | + uniqueYears.forEach((y2) => { | |
| 15814 | + yearsArray.push(new Date(y2, 0, 1)); | |
| 15815 | + }); | |
| 15816 | + return yearsArray; | |
| 15817 | + }; | |
| 15818 | + this.endOfBroadcastWeek = (date) => { | |
| 15819 | + return this.overrides?.endOfBroadcastWeek ? this.overrides.endOfBroadcastWeek(date) : endOfBroadcastWeek(date, this); | |
| 15820 | + }; | |
| 15821 | + this.endOfISOWeek = (date) => { | |
| 15822 | + return this.overrides?.endOfISOWeek ? this.overrides.endOfISOWeek(date) : endOfISOWeek(date); | |
| 15823 | + }; | |
| 15824 | + this.endOfMonth = (date) => { | |
| 15825 | + return this.overrides?.endOfMonth ? this.overrides.endOfMonth(date) : endOfMonth(date); | |
| 15826 | + }; | |
| 15827 | + this.endOfWeek = (date, options2) => { | |
| 15828 | + return this.overrides?.endOfWeek ? this.overrides.endOfWeek(date, options2) : endOfWeek(date, this.options); | |
| 15829 | + }; | |
| 15830 | + this.endOfYear = (date) => { | |
| 15831 | + return this.overrides?.endOfYear ? this.overrides.endOfYear(date) : endOfYear(date); | |
| 15832 | + }; | |
| 15833 | + this.format = (date, formatStr, _options) => { | |
| 15834 | + const formatted = this.overrides?.format ? this.overrides.format(date, formatStr, this.options) : format(date, formatStr, this.options); | |
| 15835 | + if (this.options.numerals && this.options.numerals !== "latn") { | |
| 15836 | + return this.replaceDigits(formatted); | |
| 15837 | + } | |
| 15838 | + return formatted; | |
| 15839 | + }; | |
| 15840 | + this.getISOWeek = (date) => { | |
| 15841 | + return this.overrides?.getISOWeek ? this.overrides.getISOWeek(date) : getISOWeek(date); | |
| 15842 | + }; | |
| 15843 | + this.getMonth = (date, _options) => { | |
| 15844 | + return this.overrides?.getMonth ? this.overrides.getMonth(date, this.options) : getMonth(date, this.options); | |
| 15845 | + }; | |
| 15846 | + this.getYear = (date, _options) => { | |
| 15847 | + return this.overrides?.getYear ? this.overrides.getYear(date, this.options) : getYear(date, this.options); | |
| 15848 | + }; | |
| 15849 | + this.getWeek = (date, _options) => { | |
| 15850 | + return this.overrides?.getWeek ? this.overrides.getWeek(date, this.options) : getWeek(date, this.options); | |
| 15851 | + }; | |
| 15852 | + this.isAfter = (date, dateToCompare) => { | |
| 15853 | + return this.overrides?.isAfter ? this.overrides.isAfter(date, dateToCompare) : isAfter(date, dateToCompare); | |
| 15854 | + }; | |
| 15855 | + this.isBefore = (date, dateToCompare) => { | |
| 15856 | + return this.overrides?.isBefore ? this.overrides.isBefore(date, dateToCompare) : isBefore(date, dateToCompare); | |
| 15857 | + }; | |
| 15858 | + this.isDate = (value) => { | |
| 15859 | + return this.overrides?.isDate ? this.overrides.isDate(value) : isDate(value); | |
| 15860 | + }; | |
| 15861 | + this.isSameDay = (dateLeft, dateRight) => { | |
| 15862 | + return this.overrides?.isSameDay ? this.overrides.isSameDay(dateLeft, dateRight) : isSameDay(dateLeft, dateRight); | |
| 15863 | + }; | |
| 15864 | + this.isSameMonth = (dateLeft, dateRight) => { | |
| 15865 | + return this.overrides?.isSameMonth ? this.overrides.isSameMonth(dateLeft, dateRight) : isSameMonth(dateLeft, dateRight); | |
| 15866 | + }; | |
| 15867 | + this.isSameYear = (dateLeft, dateRight) => { | |
| 15868 | + return this.overrides?.isSameYear ? this.overrides.isSameYear(dateLeft, dateRight) : isSameYear(dateLeft, dateRight); | |
| 15869 | + }; | |
| 15870 | + this.max = (dates) => { | |
| 15871 | + return this.overrides?.max ? this.overrides.max(dates) : max2(dates); | |
| 15872 | + }; | |
| 15873 | + this.min = (dates) => { | |
| 15874 | + return this.overrides?.min ? this.overrides.min(dates) : min2(dates); | |
| 15875 | + }; | |
| 15876 | + this.setMonth = (date, month) => { | |
| 15877 | + return this.overrides?.setMonth ? this.overrides.setMonth(date, month) : setMonth(date, month); | |
| 15878 | + }; | |
| 15879 | + this.setYear = (date, year) => { | |
| 15880 | + return this.overrides?.setYear ? this.overrides.setYear(date, year) : setYear(date, year); | |
| 15881 | + }; | |
| 15882 | + this.startOfBroadcastWeek = (date, _dateLib) => { | |
| 15883 | + return this.overrides?.startOfBroadcastWeek ? this.overrides.startOfBroadcastWeek(date, this) : startOfBroadcastWeek(date, this); | |
| 15884 | + }; | |
| 15885 | + this.startOfDay = (date) => { | |
| 15886 | + return this.overrides?.startOfDay ? this.overrides.startOfDay(date) : startOfDay(date); | |
| 15887 | + }; | |
| 15888 | + this.startOfISOWeek = (date) => { | |
| 15889 | + return this.overrides?.startOfISOWeek ? this.overrides.startOfISOWeek(date) : startOfISOWeek(date); | |
| 15890 | + }; | |
| 15891 | + this.startOfMonth = (date) => { | |
| 15892 | + return this.overrides?.startOfMonth ? this.overrides.startOfMonth(date) : startOfMonth(date); | |
| 15893 | + }; | |
| 15894 | + this.startOfWeek = (date, _options) => { | |
| 15895 | + return this.overrides?.startOfWeek ? this.overrides.startOfWeek(date, this.options) : startOfWeek(date, this.options); | |
| 15896 | + }; | |
| 15897 | + this.startOfYear = (date) => { | |
| 15898 | + return this.overrides?.startOfYear ? this.overrides.startOfYear(date) : startOfYear(date); | |
| 15899 | + }; | |
| 15900 | + this.options = { locale: enUS2, ...options }; | |
| 15901 | + this.overrides = overrides; | |
| 15902 | + } | |
| 15903 | + /** | |
| 15904 | + * Generates a mapping of Arabic digits (0-9) to the target numbering system | |
| 15905 | + * digits. | |
| 15906 | + * | |
| 15907 | + * @since 9.5.0 | |
| 15908 | + * @returns A record mapping Arabic digits to the target numerals. | |
| 15909 | + */ | |
| 15910 | + getDigitMap() { | |
| 15911 | + const { numerals = "latn" } = this.options; | |
| 15912 | + const formatter = new Intl.NumberFormat("en-US", { | |
| 15913 | + numberingSystem: numerals | |
| 15914 | + }); | |
| 15915 | + const digitMap = {}; | |
| 15916 | + for (let i = 0; i < 10; i++) { | |
| 15917 | + digitMap[i.toString()] = formatter.format(i); | |
| 15918 | + } | |
| 15919 | + return digitMap; | |
| 15920 | + } | |
| 15921 | + /** | |
| 15922 | + * Replaces Arabic digits in a string with the target numbering system digits. | |
| 15923 | + * | |
| 15924 | + * @since 9.5.0 | |
| 15925 | + * @param input The string containing Arabic digits. | |
| 15926 | + * @returns The string with digits replaced. | |
| 15927 | + */ | |
| 15928 | + replaceDigits(input) { | |
| 15929 | + const digitMap = this.getDigitMap(); | |
| 15930 | + return input.replace(/\d/g, (digit) => digitMap[digit] || digit); | |
| 15931 | + } | |
| 15932 | + /** | |
| 15933 | + * Formats a number using the configured numbering system. | |
| 15934 | + * | |
| 15935 | + * @since 9.5.0 | |
| 15936 | + * @param value The number to format. | |
| 15937 | + * @returns The formatted number as a string. | |
| 15938 | + */ | |
| 15939 | + formatNumber(value) { | |
| 15940 | + return this.replaceDigits(value.toString()); | |
| 15941 | + } | |
| 15942 | + /** | |
| 15943 | + * Returns the preferred ordering for month and year labels for the current | |
| 15944 | + * locale. | |
| 15945 | + */ | |
| 15946 | + getMonthYearOrder() { | |
| 15947 | + const code = this.options.locale?.code; | |
| 15948 | + if (!code) { | |
| 15949 | + return "month-first"; | |
| 15950 | + } | |
| 15951 | + return _DateLib.yearFirstLocales.has(code) ? "year-first" : "month-first"; | |
| 15952 | + } | |
| 15953 | + /** | |
| 15954 | + * Formats the month/year pair respecting locale conventions. | |
| 15955 | + * | |
| 15956 | + * @since 9.11.0 | |
| 15957 | + */ | |
| 15958 | + formatMonthYear(date) { | |
| 15959 | + const { locale, timeZone, numerals } = this.options; | |
| 15960 | + const localeCode = locale?.code; | |
| 15961 | + if (localeCode && _DateLib.yearFirstLocales.has(localeCode)) { | |
| 15962 | + try { | |
| 15963 | + const intl = new Intl.DateTimeFormat(localeCode, { | |
| 15964 | + month: "long", | |
| 15965 | + year: "numeric", | |
| 15966 | + timeZone, | |
| 15967 | + numberingSystem: numerals | |
| 15968 | + }); | |
| 15969 | + const formatted = intl.format(date); | |
| 15970 | + return formatted; | |
| 15971 | + } catch { | |
| 15972 | + } | |
| 15973 | + } | |
| 15974 | + const pattern = this.getMonthYearOrder() === "year-first" ? "y LLLL" : "LLLL y"; | |
| 15975 | + return this.format(date, pattern); | |
| 15976 | + } | |
| 15977 | +}; | |
| 15978 | +DateLib.yearFirstLocales = /* @__PURE__ */ new Set([ | |
| 15979 | + "eu", | |
| 15980 | + "hu", | |
| 15981 | + "ja", | |
| 15982 | + "ja-Hira", | |
| 15983 | + "ja-JP", | |
| 15984 | + "ko", | |
| 15985 | + "ko-KR", | |
| 15986 | + "lt", | |
| 15987 | + "lt-LT", | |
| 15988 | + "lv", | |
| 15989 | + "lv-LV", | |
| 15990 | + "mn", | |
| 15991 | + "mn-MN", | |
| 15992 | + "zh", | |
| 15993 | + "zh-CN", | |
| 15994 | + "zh-HK", | |
| 15995 | + "zh-TW" | |
| 15996 | +]); | |
| 15997 | +var defaultDateLib = new DateLib(); | |
| 15998 | + | |
| 15999 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/classes/CalendarDay.js | |
| 16000 | +var CalendarDay = class { | |
| 16001 | + constructor(date, displayMonth, dateLib = defaultDateLib) { | |
| 16002 | + this.date = date; | |
| 16003 | + this.displayMonth = displayMonth; | |
| 16004 | + this.outside = Boolean(displayMonth && !dateLib.isSameMonth(date, displayMonth)); | |
| 16005 | + this.dateLib = dateLib; | |
| 16006 | + this.isoDate = dateLib.format(date, "yyyy-MM-dd"); | |
| 16007 | + this.displayMonthId = dateLib.format(displayMonth, "yyyy-MM"); | |
| 16008 | + this.dateMonthId = dateLib.format(date, "yyyy-MM"); | |
| 16009 | + } | |
| 16010 | + /** | |
| 16011 | + * Checks if this day is equal to another `CalendarDay`, considering both the | |
| 16012 | + * date and the displayed month. | |
| 16013 | + * | |
| 16014 | + * @param day The `CalendarDay` to compare with. | |
| 16015 | + * @returns `true` if the days are equal, otherwise `false`. | |
| 16016 | + */ | |
| 16017 | + isEqualTo(day) { | |
| 16018 | + return this.dateLib.isSameDay(day.date, this.date) && this.dateLib.isSameMonth(day.displayMonth, this.displayMonth); | |
| 16019 | + } | |
| 16020 | +}; | |
| 16021 | + | |
| 16022 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/classes/CalendarMonth.js | |
| 16023 | +var CalendarMonth = class { | |
| 16024 | + constructor(month, weeks) { | |
| 16025 | + this.date = month; | |
| 16026 | + this.weeks = weeks; | |
| 16027 | + } | |
| 16028 | +}; | |
| 16029 | + | |
| 16030 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/classes/CalendarWeek.js | |
| 16031 | +var CalendarWeek = class { | |
| 16032 | + constructor(weekNumber, days) { | |
| 16033 | + this.days = days; | |
| 16034 | + this.weekNumber = weekNumber; | |
| 16035 | + } | |
| 16036 | +}; | |
| 16037 | + | |
| 16038 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/custom-components.js | |
| 16039 | +var custom_components_exports = {}; | |
| 16040 | +__export(custom_components_exports, { | |
| 16041 | + CaptionLabel: () => CaptionLabel, | |
| 16042 | + Chevron: () => Chevron, | |
| 16043 | + Day: () => Day, | |
| 16044 | + DayButton: () => DayButton, | |
| 16045 | + Dropdown: () => Dropdown, | |
| 16046 | + DropdownNav: () => DropdownNav, | |
| 16047 | + Footer: () => Footer, | |
| 16048 | + Month: () => Month, | |
| 16049 | + MonthCaption: () => MonthCaption, | |
| 16050 | + MonthGrid: () => MonthGrid, | |
| 16051 | + Months: () => Months, | |
| 16052 | + MonthsDropdown: () => MonthsDropdown, | |
| 16053 | + Nav: () => Nav, | |
| 16054 | + NextMonthButton: () => NextMonthButton, | |
| 16055 | + Option: () => Option, | |
| 16056 | + PreviousMonthButton: () => PreviousMonthButton, | |
| 16057 | + Root: () => Root2, | |
| 16058 | + Select: () => Select, | |
| 16059 | + Week: () => Week, | |
| 16060 | + WeekNumber: () => WeekNumber, | |
| 16061 | + WeekNumberHeader: () => WeekNumberHeader, | |
| 16062 | + Weekday: () => Weekday, | |
| 16063 | + Weekdays: () => Weekdays, | |
| 16064 | + Weeks: () => Weeks, | |
| 16065 | + YearsDropdown: () => YearsDropdown | |
| 16066 | +}); | |
| 16067 | + | |
| 16068 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/CaptionLabel.js | |
| 16069 | +var import_react4 = __toESM(require_react(), 1); | |
| 16070 | +function CaptionLabel(props) { | |
| 16071 | + return import_react4.default.createElement("span", { ...props }); | |
| 16072 | +} | |
| 16073 | + | |
| 16074 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Chevron.js | |
| 16075 | +var import_react5 = __toESM(require_react(), 1); | |
| 16076 | +function Chevron(props) { | |
| 16077 | + const { size: size4 = 24, orientation = "left", className, style } = props; | |
| 16078 | + return import_react5.default.createElement( | |
| 16079 | + "svg", | |
| 16080 | + { className, style, width: size4, height: size4, viewBox: "0 0 24 24" }, | |
| 16081 | + orientation === "up" && import_react5.default.createElement("polygon", { points: "6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28" }), | |
| 16082 | + orientation === "down" && import_react5.default.createElement("polygon", { points: "6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72" }), | |
| 16083 | + orientation === "left" && import_react5.default.createElement("polygon", { points: "16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20" }), | |
| 16084 | + orientation === "right" && import_react5.default.createElement("polygon", { points: "8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20" }) | |
| 16085 | + ); | |
| 16086 | +} | |
| 16087 | + | |
| 16088 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Day.js | |
| 16089 | +var import_react6 = __toESM(require_react(), 1); | |
| 16090 | +function Day(props) { | |
| 16091 | + const { day, modifiers, ...tdProps } = props; | |
| 16092 | + return import_react6.default.createElement("td", { ...tdProps }); | |
| 16093 | +} | |
| 16094 | + | |
| 16095 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/DayButton.js | |
| 16096 | +var import_react7 = __toESM(require_react(), 1); | |
| 16097 | +function DayButton(props) { | |
| 16098 | + const { day, modifiers, ...buttonProps } = props; | |
| 16099 | + const ref = import_react7.default.useRef(null); | |
| 16100 | + import_react7.default.useEffect(() => { | |
| 16101 | + if (modifiers.focused) | |
| 16102 | + ref.current?.focus(); | |
| 16103 | + }, [modifiers.focused]); | |
| 16104 | + return import_react7.default.createElement("button", { ref, ...buttonProps }); | |
| 16105 | +} | |
| 16106 | + | |
| 16107 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Dropdown.js | |
| 16108 | +var import_react9 = __toESM(require_react(), 1); | |
| 16109 | + | |
| 16110 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/UI.js | |
| 16111 | +var UI; | |
| 16112 | +(function(UI2) { | |
| 16113 | + UI2["Root"] = "root"; | |
| 16114 | + UI2["Chevron"] = "chevron"; | |
| 16115 | + UI2["Day"] = "day"; | |
| 16116 | + UI2["DayButton"] = "day_button"; | |
| 16117 | + UI2["CaptionLabel"] = "caption_label"; | |
| 16118 | + UI2["Dropdowns"] = "dropdowns"; | |
| 16119 | + UI2["Dropdown"] = "dropdown"; | |
| 16120 | + UI2["DropdownRoot"] = "dropdown_root"; | |
| 16121 | + UI2["Footer"] = "footer"; | |
| 16122 | + UI2["MonthGrid"] = "month_grid"; | |
| 16123 | + UI2["MonthCaption"] = "month_caption"; | |
| 16124 | + UI2["MonthsDropdown"] = "months_dropdown"; | |
| 16125 | + UI2["Month"] = "month"; | |
| 16126 | + UI2["Months"] = "months"; | |
| 16127 | + UI2["Nav"] = "nav"; | |
| 16128 | + UI2["NextMonthButton"] = "button_next"; | |
| 16129 | + UI2["PreviousMonthButton"] = "button_previous"; | |
| 16130 | + UI2["Week"] = "week"; | |
| 16131 | + UI2["Weeks"] = "weeks"; | |
| 16132 | + UI2["Weekday"] = "weekday"; | |
| 16133 | + UI2["Weekdays"] = "weekdays"; | |
| 16134 | + UI2["WeekNumber"] = "week_number"; | |
| 16135 | + UI2["WeekNumberHeader"] = "week_number_header"; | |
| 16136 | + UI2["YearsDropdown"] = "years_dropdown"; | |
| 16137 | +})(UI || (UI = {})); | |
| 16138 | +var DayFlag; | |
| 16139 | +(function(DayFlag2) { | |
| 16140 | + DayFlag2["disabled"] = "disabled"; | |
| 16141 | + DayFlag2["hidden"] = "hidden"; | |
| 16142 | + DayFlag2["outside"] = "outside"; | |
| 16143 | + DayFlag2["focused"] = "focused"; | |
| 16144 | + DayFlag2["today"] = "today"; | |
| 16145 | +})(DayFlag || (DayFlag = {})); | |
| 16146 | +var SelectionState; | |
| 16147 | +(function(SelectionState2) { | |
| 16148 | + SelectionState2["range_end"] = "range_end"; | |
| 16149 | + SelectionState2["range_middle"] = "range_middle"; | |
| 16150 | + SelectionState2["range_start"] = "range_start"; | |
| 16151 | + SelectionState2["selected"] = "selected"; | |
| 16152 | +})(SelectionState || (SelectionState = {})); | |
| 16153 | +var Animation; | |
| 16154 | +(function(Animation2) { | |
| 16155 | + Animation2["weeks_before_enter"] = "weeks_before_enter"; | |
| 16156 | + Animation2["weeks_before_exit"] = "weeks_before_exit"; | |
| 16157 | + Animation2["weeks_after_enter"] = "weeks_after_enter"; | |
| 16158 | + Animation2["weeks_after_exit"] = "weeks_after_exit"; | |
| 16159 | + Animation2["caption_after_enter"] = "caption_after_enter"; | |
| 16160 | + Animation2["caption_after_exit"] = "caption_after_exit"; | |
| 16161 | + Animation2["caption_before_enter"] = "caption_before_enter"; | |
| 16162 | + Animation2["caption_before_exit"] = "caption_before_exit"; | |
| 16163 | +})(Animation || (Animation = {})); | |
| 16164 | + | |
| 16165 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useDayPicker.js | |
| 16166 | +var import_react8 = __toESM(require_react(), 1); | |
| 16167 | +var dayPickerContext = (0, import_react8.createContext)(void 0); | |
| 16168 | +function useDayPicker() { | |
| 16169 | + const context = (0, import_react8.useContext)(dayPickerContext); | |
| 16170 | + if (context === void 0) { | |
| 16171 | + throw new Error("useDayPicker() must be used within a custom component."); | |
| 16172 | + } | |
| 16173 | + return context; | |
| 16174 | +} | |
| 16175 | + | |
| 16176 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Dropdown.js | |
| 16177 | +function Dropdown(props) { | |
| 16178 | + const { options, className, ...selectProps } = props; | |
| 16179 | + const { classNames, components, styles } = useDayPicker(); | |
| 16180 | + const cssClassSelect = [classNames[UI.Dropdown], className].join(" "); | |
| 16181 | + const selectedOption = options?.find(({ value }) => value === selectProps.value); | |
| 16182 | + return import_react9.default.createElement( | |
| 16183 | + "span", | |
| 16184 | + { "data-disabled": selectProps.disabled, className: classNames[UI.DropdownRoot], style: styles?.[UI.DropdownRoot] }, | |
| 16185 | + import_react9.default.createElement(components.Select, { className: cssClassSelect, ...selectProps }, options?.map(({ value, label, disabled: disabled2 }) => import_react9.default.createElement(components.Option, { key: value, value, disabled: disabled2 }, label))), | |
| 16186 | + import_react9.default.createElement( | |
| 16187 | + "span", | |
| 16188 | + { className: classNames[UI.CaptionLabel], style: styles?.[UI.CaptionLabel], "aria-hidden": true }, | |
| 16189 | + selectedOption?.label, | |
| 16190 | + import_react9.default.createElement(components.Chevron, { orientation: "down", size: 18, className: classNames[UI.Chevron], style: styles?.[UI.Chevron] }) | |
| 16191 | + ) | |
| 16192 | + ); | |
| 16193 | +} | |
| 16194 | + | |
| 16195 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/DropdownNav.js | |
| 16196 | +var import_react10 = __toESM(require_react(), 1); | |
| 16197 | +function DropdownNav(props) { | |
| 16198 | + return import_react10.default.createElement("div", { ...props }); | |
| 16199 | +} | |
| 16200 | + | |
| 16201 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Footer.js | |
| 16202 | +var import_react11 = __toESM(require_react(), 1); | |
| 16203 | +function Footer(props) { | |
| 16204 | + return import_react11.default.createElement("div", { ...props }); | |
| 16205 | +} | |
| 16206 | + | |
| 16207 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Month.js | |
| 16208 | +var import_react12 = __toESM(require_react(), 1); | |
| 16209 | +function Month(props) { | |
| 16210 | + const { calendarMonth, displayIndex, ...divProps } = props; | |
| 16211 | + return import_react12.default.createElement("div", { ...divProps }, props.children); | |
| 16212 | +} | |
| 16213 | + | |
| 16214 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/MonthCaption.js | |
| 16215 | +var import_react13 = __toESM(require_react(), 1); | |
| 16216 | +function MonthCaption(props) { | |
| 16217 | + const { calendarMonth, displayIndex, ...divProps } = props; | |
| 16218 | + return import_react13.default.createElement("div", { ...divProps }); | |
| 16219 | +} | |
| 16220 | + | |
| 16221 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/MonthGrid.js | |
| 16222 | +var import_react14 = __toESM(require_react(), 1); | |
| 16223 | +function MonthGrid(props) { | |
| 16224 | + return import_react14.default.createElement("table", { ...props }); | |
| 16225 | +} | |
| 16226 | + | |
| 16227 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Months.js | |
| 16228 | +var import_react15 = __toESM(require_react(), 1); | |
| 16229 | +function Months(props) { | |
| 16230 | + return import_react15.default.createElement("div", { ...props }); | |
| 16231 | +} | |
| 16232 | + | |
| 16233 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/MonthsDropdown.js | |
| 16234 | +var import_react16 = __toESM(require_react(), 1); | |
| 16235 | +function MonthsDropdown(props) { | |
| 16236 | + const { components } = useDayPicker(); | |
| 16237 | + return import_react16.default.createElement(components.Dropdown, { ...props }); | |
| 16238 | +} | |
| 16239 | + | |
| 16240 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Nav.js | |
| 16241 | +var import_react17 = __toESM(require_react(), 1); | |
| 16242 | +function Nav(props) { | |
| 16243 | + const { onPreviousClick, onNextClick, previousMonth, nextMonth, ...navProps } = props; | |
| 16244 | + const { components, classNames, styles, labels: { labelPrevious: labelPrevious2, labelNext: labelNext2 } } = useDayPicker(); | |
| 16245 | + const handleNextClick = (0, import_react17.useCallback)((e) => { | |
| 16246 | + if (nextMonth) { | |
| 16247 | + onNextClick?.(e); | |
| 16248 | + } | |
| 16249 | + }, [nextMonth, onNextClick]); | |
| 16250 | + const handlePreviousClick = (0, import_react17.useCallback)((e) => { | |
| 16251 | + if (previousMonth) { | |
| 16252 | + onPreviousClick?.(e); | |
| 16253 | + } | |
| 16254 | + }, [previousMonth, onPreviousClick]); | |
| 16255 | + return import_react17.default.createElement( | |
| 16256 | + "nav", | |
| 16257 | + { ...navProps }, | |
| 16258 | + import_react17.default.createElement( | |
| 16259 | + components.PreviousMonthButton, | |
| 16260 | + { type: "button", className: classNames[UI.PreviousMonthButton], style: styles?.[UI.PreviousMonthButton], tabIndex: previousMonth ? void 0 : -1, "aria-disabled": previousMonth ? void 0 : true, "aria-label": labelPrevious2(previousMonth), onClick: handlePreviousClick }, | |
| 16261 | + import_react17.default.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: "left" }) | |
| 16262 | + ), | |
| 16263 | + import_react17.default.createElement( | |
| 16264 | + components.NextMonthButton, | |
| 16265 | + { type: "button", className: classNames[UI.NextMonthButton], style: styles?.[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick }, | |
| 16266 | + import_react17.default.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, orientation: "right", className: classNames[UI.Chevron], style: styles?.[UI.Chevron] }) | |
| 16267 | + ) | |
| 16268 | + ); | |
| 16269 | +} | |
| 16270 | + | |
| 16271 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/NextMonthButton.js | |
| 16272 | +var import_react18 = __toESM(require_react(), 1); | |
| 16273 | +function NextMonthButton(props) { | |
| 16274 | + return import_react18.default.createElement("button", { ...props }); | |
| 16275 | +} | |
| 16276 | + | |
| 16277 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Option.js | |
| 16278 | +var import_react19 = __toESM(require_react(), 1); | |
| 16279 | +function Option(props) { | |
| 16280 | + return import_react19.default.createElement("option", { ...props }); | |
| 16281 | +} | |
| 16282 | + | |
| 16283 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/PreviousMonthButton.js | |
| 16284 | +var import_react20 = __toESM(require_react(), 1); | |
| 16285 | +function PreviousMonthButton(props) { | |
| 16286 | + return import_react20.default.createElement("button", { ...props }); | |
| 16287 | +} | |
| 16288 | + | |
| 16289 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Root.js | |
| 16290 | +var import_react21 = __toESM(require_react(), 1); | |
| 16291 | +function Root2(props) { | |
| 16292 | + const { rootRef, ...rest } = props; | |
| 16293 | + return import_react21.default.createElement("div", { ...rest, ref: rootRef }); | |
| 16294 | +} | |
| 16295 | + | |
| 16296 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Select.js | |
| 16297 | +var import_react22 = __toESM(require_react(), 1); | |
| 16298 | +function Select(props) { | |
| 16299 | + return import_react22.default.createElement("select", { ...props }); | |
| 16300 | +} | |
| 16301 | + | |
| 16302 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Week.js | |
| 16303 | +var import_react23 = __toESM(require_react(), 1); | |
| 16304 | +function Week(props) { | |
| 16305 | + const { week, ...trProps } = props; | |
| 16306 | + return import_react23.default.createElement("tr", { ...trProps }); | |
| 16307 | +} | |
| 16308 | + | |
| 16309 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Weekday.js | |
| 16310 | +var import_react24 = __toESM(require_react(), 1); | |
| 16311 | +function Weekday(props) { | |
| 16312 | + return import_react24.default.createElement("th", { ...props }); | |
| 16313 | +} | |
| 16314 | + | |
| 16315 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Weekdays.js | |
| 16316 | +var import_react25 = __toESM(require_react(), 1); | |
| 16317 | +function Weekdays(props) { | |
| 16318 | + return import_react25.default.createElement( | |
| 16319 | + "thead", | |
| 16320 | + { "aria-hidden": true }, | |
| 16321 | + import_react25.default.createElement("tr", { ...props }) | |
| 16322 | + ); | |
| 16323 | +} | |
| 16324 | + | |
| 16325 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/WeekNumber.js | |
| 16326 | +var import_react26 = __toESM(require_react(), 1); | |
| 16327 | +function WeekNumber(props) { | |
| 16328 | + const { week, ...thProps } = props; | |
| 16329 | + return import_react26.default.createElement("th", { ...thProps }); | |
| 16330 | +} | |
| 16331 | + | |
| 16332 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/WeekNumberHeader.js | |
| 16333 | +var import_react27 = __toESM(require_react(), 1); | |
| 16334 | +function WeekNumberHeader(props) { | |
| 16335 | + return import_react27.default.createElement("th", { ...props }); | |
| 16336 | +} | |
| 16337 | + | |
| 16338 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Weeks.js | |
| 16339 | +var import_react28 = __toESM(require_react(), 1); | |
| 16340 | +function Weeks(props) { | |
| 16341 | + return import_react28.default.createElement("tbody", { ...props }); | |
| 16342 | +} | |
| 16343 | + | |
| 16344 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/YearsDropdown.js | |
| 16345 | +var import_react29 = __toESM(require_react(), 1); | |
| 16346 | +function YearsDropdown(props) { | |
| 16347 | + const { components } = useDayPicker(); | |
| 16348 | + return import_react29.default.createElement(components.Dropdown, { ...props }); | |
| 16349 | +} | |
| 16350 | + | |
| 16351 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/DayPicker.js | |
| 16352 | +var import_react34 = __toESM(require_react(), 1); | |
| 16353 | + | |
| 16354 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/rangeIncludesDate.js | |
| 16355 | +function rangeIncludesDate(range, date, excludeEnds = false, dateLib = defaultDateLib) { | |
| 16356 | + let { from, to } = range; | |
| 16357 | + const { differenceInCalendarDays: differenceInCalendarDays2, isSameDay: isSameDay2 } = dateLib; | |
| 16358 | + if (from && to) { | |
| 16359 | + const isRangeInverted = differenceInCalendarDays2(to, from) < 0; | |
| 16360 | + if (isRangeInverted) { | |
| 16361 | + [from, to] = [to, from]; | |
| 16362 | + } | |
| 16363 | + const isInRange = differenceInCalendarDays2(date, from) >= (excludeEnds ? 1 : 0) && differenceInCalendarDays2(to, date) >= (excludeEnds ? 1 : 0); | |
| 16364 | + return isInRange; | |
| 16365 | + } | |
| 16366 | + if (!excludeEnds && to) { | |
| 16367 | + return isSameDay2(to, date); | |
| 16368 | + } | |
| 16369 | + if (!excludeEnds && from) { | |
| 16370 | + return isSameDay2(from, date); | |
| 16371 | + } | |
| 16372 | + return false; | |
| 16373 | +} | |
| 16374 | + | |
| 16375 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/typeguards.js | |
| 16376 | +function isDateInterval(matcher) { | |
| 16377 | + return Boolean(matcher && typeof matcher === "object" && "before" in matcher && "after" in matcher); | |
| 16378 | +} | |
| 16379 | +function isDateRange(value) { | |
| 16380 | + return Boolean(value && typeof value === "object" && "from" in value); | |
| 16381 | +} | |
| 16382 | +function isDateAfterType(value) { | |
| 16383 | + return Boolean(value && typeof value === "object" && "after" in value); | |
| 16384 | +} | |
| 16385 | +function isDateBeforeType(value) { | |
| 16386 | + return Boolean(value && typeof value === "object" && "before" in value); | |
| 16387 | +} | |
| 16388 | +function isDayOfWeekType(value) { | |
| 16389 | + return Boolean(value && typeof value === "object" && "dayOfWeek" in value); | |
| 16390 | +} | |
| 16391 | +function isDatesArray(value, dateLib) { | |
| 16392 | + return Array.isArray(value) && value.every(dateLib.isDate); | |
| 16393 | +} | |
| 16394 | + | |
| 16395 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/dateMatchModifiers.js | |
| 16396 | +function dateMatchModifiers(date, matchers, dateLib = defaultDateLib) { | |
| 16397 | + const matchersArr = !Array.isArray(matchers) ? [matchers] : matchers; | |
| 16398 | + const { isSameDay: isSameDay2, differenceInCalendarDays: differenceInCalendarDays2, isAfter: isAfter2 } = dateLib; | |
| 16399 | + return matchersArr.some((matcher) => { | |
| 16400 | + if (typeof matcher === "boolean") { | |
| 16401 | + return matcher; | |
| 16402 | + } | |
| 16403 | + if (dateLib.isDate(matcher)) { | |
| 16404 | + return isSameDay2(date, matcher); | |
| 16405 | + } | |
| 16406 | + if (isDatesArray(matcher, dateLib)) { | |
| 16407 | + return matcher.some((matcherDate) => isSameDay2(date, matcherDate)); | |
| 16408 | + } | |
| 16409 | + if (isDateRange(matcher)) { | |
| 16410 | + return rangeIncludesDate(matcher, date, false, dateLib); | |
| 16411 | + } | |
| 16412 | + if (isDayOfWeekType(matcher)) { | |
| 16413 | + if (!Array.isArray(matcher.dayOfWeek)) { | |
| 16414 | + return matcher.dayOfWeek === date.getDay(); | |
| 16415 | + } | |
| 16416 | + return matcher.dayOfWeek.includes(date.getDay()); | |
| 16417 | + } | |
| 16418 | + if (isDateInterval(matcher)) { | |
| 16419 | + const diffBefore = differenceInCalendarDays2(matcher.before, date); | |
| 16420 | + const diffAfter = differenceInCalendarDays2(matcher.after, date); | |
| 16421 | + const isDayBefore = diffBefore > 0; | |
| 16422 | + const isDayAfter = diffAfter < 0; | |
| 16423 | + const isClosedInterval = isAfter2(matcher.before, matcher.after); | |
| 16424 | + if (isClosedInterval) { | |
| 16425 | + return isDayAfter && isDayBefore; | |
| 16426 | + } else { | |
| 16427 | + return isDayBefore || isDayAfter; | |
| 16428 | + } | |
| 16429 | + } | |
| 16430 | + if (isDateAfterType(matcher)) { | |
| 16431 | + return differenceInCalendarDays2(date, matcher.after) > 0; | |
| 16432 | + } | |
| 16433 | + if (isDateBeforeType(matcher)) { | |
| 16434 | + return differenceInCalendarDays2(matcher.before, date) > 0; | |
| 16435 | + } | |
| 16436 | + if (typeof matcher === "function") { | |
| 16437 | + return matcher(date); | |
| 16438 | + } | |
| 16439 | + return false; | |
| 16440 | + }); | |
| 16441 | +} | |
| 16442 | + | |
| 16443 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/createGetModifiers.js | |
| 16444 | +function createGetModifiers(days, props, navStart, navEnd, dateLib) { | |
| 16445 | + const { disabled: disabled2, hidden, modifiers, showOutsideDays, broadcastCalendar, today = dateLib.today() } = props; | |
| 16446 | + const { isSameDay: isSameDay2, isSameMonth: isSameMonth2, startOfMonth: startOfMonth2, isBefore: isBefore2, endOfMonth: endOfMonth2, isAfter: isAfter2 } = dateLib; | |
| 16447 | + const computedNavStart = navStart && startOfMonth2(navStart); | |
| 16448 | + const computedNavEnd = navEnd && endOfMonth2(navEnd); | |
| 16449 | + const internalModifiersMap = { | |
| 16450 | + [DayFlag.focused]: [], | |
| 16451 | + [DayFlag.outside]: [], | |
| 16452 | + [DayFlag.disabled]: [], | |
| 16453 | + [DayFlag.hidden]: [], | |
| 16454 | + [DayFlag.today]: [] | |
| 16455 | + }; | |
| 16456 | + const customModifiersMap = {}; | |
| 16457 | + for (const day of days) { | |
| 16458 | + const { date, displayMonth } = day; | |
| 16459 | + const isOutside = Boolean(displayMonth && !isSameMonth2(date, displayMonth)); | |
| 16460 | + const isBeforeNavStart = Boolean(computedNavStart && isBefore2(date, computedNavStart)); | |
| 16461 | + const isAfterNavEnd = Boolean(computedNavEnd && isAfter2(date, computedNavEnd)); | |
| 16462 | + const isDisabled = Boolean(disabled2 && dateMatchModifiers(date, disabled2, dateLib)); | |
| 16463 | + const isHidden = Boolean(hidden && dateMatchModifiers(date, hidden, dateLib)) || isBeforeNavStart || isAfterNavEnd || // Broadcast calendar will show outside days as default | |
| 16464 | + !broadcastCalendar && !showOutsideDays && isOutside || broadcastCalendar && showOutsideDays === false && isOutside; | |
| 16465 | + const isToday = isSameDay2(date, today); | |
| 16466 | + if (isOutside) | |
| 16467 | + internalModifiersMap.outside.push(day); | |
| 16468 | + if (isDisabled) | |
| 16469 | + internalModifiersMap.disabled.push(day); | |
| 16470 | + if (isHidden) | |
| 16471 | + internalModifiersMap.hidden.push(day); | |
| 16472 | + if (isToday) | |
| 16473 | + internalModifiersMap.today.push(day); | |
| 16474 | + if (modifiers) { | |
| 16475 | + Object.keys(modifiers).forEach((name) => { | |
| 16476 | + const modifierValue = modifiers?.[name]; | |
| 16477 | + const isMatch = modifierValue ? dateMatchModifiers(date, modifierValue, dateLib) : false; | |
| 16478 | + if (!isMatch) | |
| 16479 | + return; | |
| 16480 | + if (customModifiersMap[name]) { | |
| 16481 | + customModifiersMap[name].push(day); | |
| 16482 | + } else { | |
| 16483 | + customModifiersMap[name] = [day]; | |
| 16484 | + } | |
| 16485 | + }); | |
| 16486 | + } | |
| 16487 | + } | |
| 16488 | + return (day) => { | |
| 16489 | + const dayFlags = { | |
| 16490 | + [DayFlag.focused]: false, | |
| 16491 | + [DayFlag.disabled]: false, | |
| 16492 | + [DayFlag.hidden]: false, | |
| 16493 | + [DayFlag.outside]: false, | |
| 16494 | + [DayFlag.today]: false | |
| 16495 | + }; | |
| 16496 | + const customModifiers = {}; | |
| 16497 | + for (const name in internalModifiersMap) { | |
| 16498 | + const days2 = internalModifiersMap[name]; | |
| 16499 | + dayFlags[name] = days2.some((d) => d === day); | |
| 16500 | + } | |
| 16501 | + for (const name in customModifiersMap) { | |
| 16502 | + customModifiers[name] = customModifiersMap[name].some((d) => d === day); | |
| 16503 | + } | |
| 16504 | + return { | |
| 16505 | + ...dayFlags, | |
| 16506 | + // custom modifiers should override all the previous ones | |
| 16507 | + ...customModifiers | |
| 16508 | + }; | |
| 16509 | + }; | |
| 16510 | +} | |
| 16511 | + | |
| 16512 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getClassNamesForModifiers.js | |
| 16513 | +function getClassNamesForModifiers(modifiers, classNames, modifiersClassNames = {}) { | |
| 16514 | + const modifierClassNames = Object.entries(modifiers).filter(([, active]) => active === true).reduce((previousValue, [key]) => { | |
| 16515 | + if (modifiersClassNames[key]) { | |
| 16516 | + previousValue.push(modifiersClassNames[key]); | |
| 16517 | + } else if (classNames[DayFlag[key]]) { | |
| 16518 | + previousValue.push(classNames[DayFlag[key]]); | |
| 16519 | + } else if (classNames[SelectionState[key]]) { | |
| 16520 | + previousValue.push(classNames[SelectionState[key]]); | |
| 16521 | + } | |
| 16522 | + return previousValue; | |
| 16523 | + }, [classNames[UI.Day]]); | |
| 16524 | + return modifierClassNames; | |
| 16525 | +} | |
| 16526 | + | |
| 16527 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getComponents.js | |
| 16528 | +function getComponents(customComponents) { | |
| 16529 | + return { | |
| 16530 | + ...custom_components_exports, | |
| 16531 | + ...customComponents | |
| 16532 | + }; | |
| 16533 | +} | |
| 16534 | + | |
| 16535 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDataAttributes.js | |
| 16536 | +function getDataAttributes(props) { | |
| 16537 | + const dataAttributes = { | |
| 16538 | + "data-mode": props.mode ?? void 0, | |
| 16539 | + "data-required": "required" in props ? props.required : void 0, | |
| 16540 | + "data-multiple-months": props.numberOfMonths && props.numberOfMonths > 1 || void 0, | |
| 16541 | + "data-week-numbers": props.showWeekNumber || void 0, | |
| 16542 | + "data-broadcast-calendar": props.broadcastCalendar || void 0, | |
| 16543 | + "data-nav-layout": props.navLayout || void 0 | |
| 16544 | + }; | |
| 16545 | + Object.entries(props).forEach(([key, val]) => { | |
| 16546 | + if (key.startsWith("data-")) { | |
| 16547 | + dataAttributes[key] = val; | |
| 16548 | + } | |
| 16549 | + }); | |
| 16550 | + return dataAttributes; | |
| 16551 | +} | |
| 16552 | + | |
| 16553 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js | |
| 16554 | +function getDefaultClassNames() { | |
| 16555 | + const classNames = {}; | |
| 16556 | + for (const key in UI) { | |
| 16557 | + classNames[UI[key]] = `rdp-${UI[key]}`; | |
| 16558 | + } | |
| 16559 | + for (const key in DayFlag) { | |
| 16560 | + classNames[DayFlag[key]] = `rdp-${DayFlag[key]}`; | |
| 16561 | + } | |
| 16562 | + for (const key in SelectionState) { | |
| 16563 | + classNames[SelectionState[key]] = `rdp-${SelectionState[key]}`; | |
| 16564 | + } | |
| 16565 | + for (const key in Animation) { | |
| 16566 | + classNames[Animation[key]] = `rdp-${Animation[key]}`; | |
| 16567 | + } | |
| 16568 | + return classNames; | |
| 16569 | +} | |
| 16570 | + | |
| 16571 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/index.js | |
| 16572 | +var formatters_exports = {}; | |
| 16573 | +__export(formatters_exports, { | |
| 16574 | + formatCaption: () => formatCaption, | |
| 16575 | + formatDay: () => formatDay, | |
| 16576 | + formatMonthDropdown: () => formatMonthDropdown, | |
| 16577 | + formatWeekNumber: () => formatWeekNumber, | |
| 16578 | + formatWeekNumberHeader: () => formatWeekNumberHeader, | |
| 16579 | + formatWeekdayName: () => formatWeekdayName, | |
| 16580 | + formatYearDropdown: () => formatYearDropdown | |
| 16581 | +}); | |
| 16582 | + | |
| 16583 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatCaption.js | |
| 16584 | +function formatCaption(month, options, dateLib) { | |
| 16585 | + const lib = dateLib ?? new DateLib(options); | |
| 16586 | + return lib.formatMonthYear(month); | |
| 16587 | +} | |
| 16588 | + | |
| 16589 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatDay.js | |
| 16590 | +function formatDay(date, options, dateLib) { | |
| 16591 | + return (dateLib ?? new DateLib(options)).format(date, "d"); | |
| 16592 | +} | |
| 16593 | + | |
| 16594 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatMonthDropdown.js | |
| 16595 | +function formatMonthDropdown(month, dateLib = defaultDateLib) { | |
| 16596 | + return dateLib.format(month, "LLLL"); | |
| 16597 | +} | |
| 16598 | + | |
| 16599 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatWeekdayName.js | |
| 16600 | +function formatWeekdayName(weekday, options, dateLib) { | |
| 16601 | + return (dateLib ?? new DateLib(options)).format(weekday, "cccccc"); | |
| 16602 | +} | |
| 16603 | + | |
| 16604 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumber.js | |
| 16605 | +function formatWeekNumber(weekNumber, dateLib = defaultDateLib) { | |
| 16606 | + if (weekNumber < 10) { | |
| 16607 | + return dateLib.formatNumber(`0${weekNumber.toLocaleString()}`); | |
| 16608 | + } | |
| 16609 | + return dateLib.formatNumber(`${weekNumber.toLocaleString()}`); | |
| 16610 | +} | |
| 16611 | + | |
| 16612 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumberHeader.js | |
| 16613 | +function formatWeekNumberHeader() { | |
| 16614 | + return ``; | |
| 16615 | +} | |
| 16616 | + | |
| 16617 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatYearDropdown.js | |
| 16618 | +function formatYearDropdown(year, dateLib = defaultDateLib) { | |
| 16619 | + return dateLib.format(year, "yyyy"); | |
| 16620 | +} | |
| 16621 | + | |
| 16622 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getFormatters.js | |
| 16623 | +function getFormatters(customFormatters) { | |
| 16624 | + return { | |
| 16625 | + ...formatters_exports, | |
| 16626 | + ...customFormatters | |
| 16627 | + }; | |
| 16628 | +} | |
| 16629 | + | |
| 16630 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/index.js | |
| 16631 | +var labels_exports = {}; | |
| 16632 | +__export(labels_exports, { | |
| 16633 | + labelDayButton: () => labelDayButton, | |
| 16634 | + labelGrid: () => labelGrid, | |
| 16635 | + labelGridcell: () => labelGridcell, | |
| 16636 | + labelMonthDropdown: () => labelMonthDropdown, | |
| 16637 | + labelNav: () => labelNav, | |
| 16638 | + labelNext: () => labelNext, | |
| 16639 | + labelPrevious: () => labelPrevious, | |
| 16640 | + labelWeekNumber: () => labelWeekNumber, | |
| 16641 | + labelWeekNumberHeader: () => labelWeekNumberHeader, | |
| 16642 | + labelWeekday: () => labelWeekday, | |
| 16643 | + labelYearDropdown: () => labelYearDropdown | |
| 16644 | +}); | |
| 16645 | + | |
| 16646 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelDayButton.js | |
| 16647 | +function labelDayButton(date, modifiers, options, dateLib) { | |
| 16648 | + let label = (dateLib ?? new DateLib(options)).format(date, "PPPP"); | |
| 16649 | + if (modifiers.today) | |
| 16650 | + label = `Today, ${label}`; | |
| 16651 | + if (modifiers.selected) | |
| 16652 | + label = `${label}, selected`; | |
| 16653 | + return label; | |
| 16654 | +} | |
| 16655 | + | |
| 16656 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelGrid.js | |
| 16657 | +function labelGrid(date, options, dateLib) { | |
| 16658 | + const lib = dateLib ?? new DateLib(options); | |
| 16659 | + return lib.formatMonthYear(date); | |
| 16660 | +} | |
| 16661 | + | |
| 16662 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelGridcell.js | |
| 16663 | +function labelGridcell(date, modifiers, options, dateLib) { | |
| 16664 | + let label = (dateLib ?? new DateLib(options)).format(date, "PPPP"); | |
| 16665 | + if (modifiers?.today) { | |
| 16666 | + label = `Today, ${label}`; | |
| 16667 | + } | |
| 16668 | + return label; | |
| 16669 | +} | |
| 16670 | + | |
| 16671 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelMonthDropdown.js | |
| 16672 | +function labelMonthDropdown(_options) { | |
| 16673 | + return "Choose the Month"; | |
| 16674 | +} | |
| 16675 | + | |
| 16676 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelNav.js | |
| 16677 | +function labelNav() { | |
| 16678 | + return ""; | |
| 16679 | +} | |
| 16680 | + | |
| 16681 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelNext.js | |
| 16682 | +var defaultLabel = "Go to the Next Month"; | |
| 16683 | +function labelNext(_month, _options) { | |
| 16684 | + return defaultLabel; | |
| 16685 | +} | |
| 16686 | + | |
| 16687 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelPrevious.js | |
| 16688 | +function labelPrevious(_month) { | |
| 16689 | + return "Go to the Previous Month"; | |
| 16690 | +} | |
| 16691 | + | |
| 16692 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelWeekday.js | |
| 16693 | +function labelWeekday(date, options, dateLib) { | |
| 16694 | + return (dateLib ?? new DateLib(options)).format(date, "cccc"); | |
| 16695 | +} | |
| 16696 | + | |
| 16697 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelWeekNumber.js | |
| 16698 | +function labelWeekNumber(weekNumber, _options) { | |
| 16699 | + return `Week ${weekNumber}`; | |
| 16700 | +} | |
| 16701 | + | |
| 16702 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelWeekNumberHeader.js | |
| 16703 | +function labelWeekNumberHeader(_options) { | |
| 16704 | + return "Week Number"; | |
| 16705 | +} | |
| 16706 | + | |
| 16707 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelYearDropdown.js | |
| 16708 | +function labelYearDropdown(_options) { | |
| 16709 | + return "Choose the Year"; | |
| 16710 | +} | |
| 16711 | + | |
| 16712 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getLabels.js | |
| 16713 | +var resolveLabel = (defaultLabel2, customLabel, localeLabel) => { | |
| 16714 | + if (customLabel) | |
| 16715 | + return customLabel; | |
| 16716 | + if (localeLabel) { | |
| 16717 | + return typeof localeLabel === "function" ? localeLabel : (..._args) => localeLabel; | |
| 16718 | + } | |
| 16719 | + return defaultLabel2; | |
| 16720 | +}; | |
| 16721 | +function getLabels(customLabels, options) { | |
| 16722 | + const localeLabels = options.locale?.labels ?? {}; | |
| 16723 | + return { | |
| 16724 | + ...labels_exports, | |
| 16725 | + ...customLabels ?? {}, | |
| 16726 | + labelDayButton: resolveLabel(labelDayButton, customLabels?.labelDayButton, localeLabels.labelDayButton), | |
| 16727 | + labelMonthDropdown: resolveLabel(labelMonthDropdown, customLabels?.labelMonthDropdown, localeLabels.labelMonthDropdown), | |
| 16728 | + labelNext: resolveLabel(labelNext, customLabels?.labelNext, localeLabels.labelNext), | |
| 16729 | + labelPrevious: resolveLabel(labelPrevious, customLabels?.labelPrevious, localeLabels.labelPrevious), | |
| 16730 | + labelWeekNumber: resolveLabel(labelWeekNumber, customLabels?.labelWeekNumber, localeLabels.labelWeekNumber), | |
| 16731 | + labelYearDropdown: resolveLabel(labelYearDropdown, customLabels?.labelYearDropdown, localeLabels.labelYearDropdown), | |
| 16732 | + labelGrid: resolveLabel(labelGrid, customLabels?.labelGrid, localeLabels.labelGrid), | |
| 16733 | + labelGridcell: resolveLabel(labelGridcell, customLabels?.labelGridcell, localeLabels.labelGridcell), | |
| 16734 | + labelNav: resolveLabel(labelNav, customLabels?.labelNav, localeLabels.labelNav), | |
| 16735 | + labelWeekNumberHeader: resolveLabel(labelWeekNumberHeader, customLabels?.labelWeekNumberHeader, localeLabels.labelWeekNumberHeader), | |
| 16736 | + labelWeekday: resolveLabel(labelWeekday, customLabels?.labelWeekday, localeLabels.labelWeekday) | |
| 16737 | + }; | |
| 16738 | +} | |
| 16739 | + | |
| 16740 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getMonthOptions.js | |
| 16741 | +function getMonthOptions(displayMonth, navStart, navEnd, formatters2, dateLib) { | |
| 16742 | + const { startOfMonth: startOfMonth2, startOfYear: startOfYear2, endOfYear: endOfYear2, eachMonthOfInterval: eachMonthOfInterval2, getMonth: getMonth2 } = dateLib; | |
| 16743 | + const months = eachMonthOfInterval2({ | |
| 16744 | + start: startOfYear2(displayMonth), | |
| 16745 | + end: endOfYear2(displayMonth) | |
| 16746 | + }); | |
| 16747 | + const options = months.map((month) => { | |
| 16748 | + const label = formatters2.formatMonthDropdown(month, dateLib); | |
| 16749 | + const value = getMonth2(month); | |
| 16750 | + const disabled2 = navStart && month < startOfMonth2(navStart) || navEnd && month > startOfMonth2(navEnd) || false; | |
| 16751 | + return { value, label, disabled: disabled2 }; | |
| 16752 | + }); | |
| 16753 | + return options; | |
| 16754 | +} | |
| 16755 | + | |
| 16756 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getStyleForModifiers.js | |
| 16757 | +function getStyleForModifiers(dayModifiers, styles = {}, modifiersStyles = {}) { | |
| 16758 | + let style = { ...styles?.[UI.Day] }; | |
| 16759 | + Object.entries(dayModifiers).filter(([, active]) => active === true).forEach(([modifier]) => { | |
| 16760 | + style = { | |
| 16761 | + ...style, | |
| 16762 | + ...modifiersStyles?.[modifier] | |
| 16763 | + }; | |
| 16764 | + }); | |
| 16765 | + return style; | |
| 16766 | +} | |
| 16767 | + | |
| 16768 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getWeekdays.js | |
| 16769 | +function getWeekdays(dateLib, ISOWeek, broadcastCalendar, today) { | |
| 16770 | + const referenceToday = today ?? dateLib.today(); | |
| 16771 | + const start = broadcastCalendar ? dateLib.startOfBroadcastWeek(referenceToday, dateLib) : ISOWeek ? dateLib.startOfISOWeek(referenceToday) : dateLib.startOfWeek(referenceToday); | |
| 16772 | + const days = []; | |
| 16773 | + for (let i = 0; i < 7; i++) { | |
| 16774 | + const day = dateLib.addDays(start, i); | |
| 16775 | + days.push(day); | |
| 16776 | + } | |
| 16777 | + return days; | |
| 16778 | +} | |
| 16779 | + | |
| 16780 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getYearOptions.js | |
| 16781 | +function getYearOptions(navStart, navEnd, formatters2, dateLib, reverse = false) { | |
| 16782 | + if (!navStart) | |
| 16783 | + return void 0; | |
| 16784 | + if (!navEnd) | |
| 16785 | + return void 0; | |
| 16786 | + const { startOfYear: startOfYear2, endOfYear: endOfYear2, eachYearOfInterval: eachYearOfInterval2, getYear: getYear2 } = dateLib; | |
| 16787 | + const firstNavYear = startOfYear2(navStart); | |
| 16788 | + const lastNavYear = endOfYear2(navEnd); | |
| 16789 | + const years = eachYearOfInterval2({ start: firstNavYear, end: lastNavYear }); | |
| 16790 | + if (reverse) | |
| 16791 | + years.reverse(); | |
| 16792 | + return years.map((year) => { | |
| 16793 | + const label = formatters2.formatYearDropdown(year, dateLib); | |
| 16794 | + return { | |
| 16795 | + value: getYear2(year), | |
| 16796 | + label, | |
| 16797 | + disabled: false | |
| 16798 | + }; | |
| 16799 | + }); | |
| 16800 | +} | |
| 16801 | + | |
| 16802 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/noonDateLib.js | |
| 16803 | +function createNoonOverrides(timeZone, options = {}) { | |
| 16804 | + const { weekStartsOn, locale } = options; | |
| 16805 | + const fallbackWeekStartsOn = weekStartsOn ?? locale?.options?.weekStartsOn ?? 0; | |
| 16806 | + const toNoonTZDate = (date) => { | |
| 16807 | + const normalizedDate = typeof date === "number" || typeof date === "string" ? new Date(date) : date; | |
| 16808 | + return new TZDate(normalizedDate.getFullYear(), normalizedDate.getMonth(), normalizedDate.getDate(), 12, 0, 0, timeZone); | |
| 16809 | + }; | |
| 16810 | + const toCalendarDate2 = (date) => { | |
| 16811 | + const zoned = toNoonTZDate(date); | |
| 16812 | + return new Date(zoned.getFullYear(), zoned.getMonth(), zoned.getDate(), 0, 0, 0, 0); | |
| 16813 | + }; | |
| 16814 | + return { | |
| 16815 | + today: () => { | |
| 16816 | + return toNoonTZDate(TZDate.tz(timeZone)); | |
| 16817 | + }, | |
| 16818 | + newDate: (year, monthIndex, date) => { | |
| 16819 | + return new TZDate(year, monthIndex, date, 12, 0, 0, timeZone); | |
| 16820 | + }, | |
| 16821 | + startOfDay: (date) => { | |
| 16822 | + return toNoonTZDate(date); | |
| 16823 | + }, | |
| 16824 | + startOfWeek: (date, options2) => { | |
| 16825 | + const base = toNoonTZDate(date); | |
| 16826 | + const weekStartsOnValue = options2?.weekStartsOn ?? fallbackWeekStartsOn; | |
| 16827 | + const diff = (base.getDay() - weekStartsOnValue + 7) % 7; | |
| 16828 | + base.setDate(base.getDate() - diff); | |
| 16829 | + return base; | |
| 16830 | + }, | |
| 16831 | + startOfISOWeek: (date) => { | |
| 16832 | + const base = toNoonTZDate(date); | |
| 16833 | + const diff = (base.getDay() - 1 + 7) % 7; | |
| 16834 | + base.setDate(base.getDate() - diff); | |
| 16835 | + return base; | |
| 16836 | + }, | |
| 16837 | + startOfMonth: (date) => { | |
| 16838 | + const base = toNoonTZDate(date); | |
| 16839 | + base.setDate(1); | |
| 16840 | + return base; | |
| 16841 | + }, | |
| 16842 | + startOfYear: (date) => { | |
| 16843 | + const base = toNoonTZDate(date); | |
| 16844 | + base.setMonth(0, 1); | |
| 16845 | + return base; | |
| 16846 | + }, | |
| 16847 | + endOfWeek: (date, options2) => { | |
| 16848 | + const base = toNoonTZDate(date); | |
| 16849 | + const weekStartsOnValue = options2?.weekStartsOn ?? fallbackWeekStartsOn; | |
| 16850 | + const endDow = (weekStartsOnValue + 6) % 7; | |
| 16851 | + const diff = (endDow - base.getDay() + 7) % 7; | |
| 16852 | + base.setDate(base.getDate() + diff); | |
| 16853 | + return base; | |
| 16854 | + }, | |
| 16855 | + endOfISOWeek: (date) => { | |
| 16856 | + const base = toNoonTZDate(date); | |
| 16857 | + const diff = (7 - base.getDay()) % 7; | |
| 16858 | + base.setDate(base.getDate() + diff); | |
| 16859 | + return base; | |
| 16860 | + }, | |
| 16861 | + endOfMonth: (date) => { | |
| 16862 | + const base = toNoonTZDate(date); | |
| 16863 | + base.setMonth(base.getMonth() + 1, 0); | |
| 16864 | + return base; | |
| 16865 | + }, | |
| 16866 | + endOfYear: (date) => { | |
| 16867 | + const base = toNoonTZDate(date); | |
| 16868 | + base.setMonth(11, 31); | |
| 16869 | + return base; | |
| 16870 | + }, | |
| 16871 | + eachMonthOfInterval: (interval) => { | |
| 16872 | + const start = toNoonTZDate(interval.start); | |
| 16873 | + const end = toNoonTZDate(interval.end); | |
| 16874 | + const result = []; | |
| 16875 | + const cursor = new TZDate(start.getFullYear(), start.getMonth(), 1, 12, 0, 0, timeZone); | |
| 16876 | + const endKey = end.getFullYear() * 12 + end.getMonth(); | |
| 16877 | + while (cursor.getFullYear() * 12 + cursor.getMonth() <= endKey) { | |
| 16878 | + result.push(new TZDate(cursor, timeZone)); | |
| 16879 | + cursor.setMonth(cursor.getMonth() + 1, 1); | |
| 16880 | + } | |
| 16881 | + return result; | |
| 16882 | + }, | |
| 16883 | + // Normalize to noon once before arithmetic (avoid DST/midnight edge cases), | |
| 16884 | + // mutate the same TZDate, and return it. | |
| 16885 | + addDays: (date, amount) => { | |
| 16886 | + const base = toNoonTZDate(date); | |
| 16887 | + base.setDate(base.getDate() + amount); | |
| 16888 | + return base; | |
| 16889 | + }, | |
| 16890 | + addWeeks: (date, amount) => { | |
| 16891 | + const base = toNoonTZDate(date); | |
| 16892 | + base.setDate(base.getDate() + amount * 7); | |
| 16893 | + return base; | |
| 16894 | + }, | |
| 16895 | + addMonths: (date, amount) => { | |
| 16896 | + const base = toNoonTZDate(date); | |
| 16897 | + base.setMonth(base.getMonth() + amount); | |
| 16898 | + return base; | |
| 16899 | + }, | |
| 16900 | + addYears: (date, amount) => { | |
| 16901 | + const base = toNoonTZDate(date); | |
| 16902 | + base.setFullYear(base.getFullYear() + amount); | |
| 16903 | + return base; | |
| 16904 | + }, | |
| 16905 | + eachYearOfInterval: (interval) => { | |
| 16906 | + const start = toNoonTZDate(interval.start); | |
| 16907 | + const end = toNoonTZDate(interval.end); | |
| 16908 | + const years = []; | |
| 16909 | + const cursor = new TZDate(start.getFullYear(), 0, 1, 12, 0, 0, timeZone); | |
| 16910 | + while (cursor.getFullYear() <= end.getFullYear()) { | |
| 16911 | + years.push(new TZDate(cursor, timeZone)); | |
| 16912 | + cursor.setFullYear(cursor.getFullYear() + 1, 0, 1); | |
| 16913 | + } | |
| 16914 | + return years; | |
| 16915 | + }, | |
| 16916 | + getWeek: (date, options2) => { | |
| 16917 | + const base = toCalendarDate2(date); | |
| 16918 | + return getWeek(base, { | |
| 16919 | + weekStartsOn: options2?.weekStartsOn ?? fallbackWeekStartsOn, | |
| 16920 | + firstWeekContainsDate: options2?.firstWeekContainsDate ?? locale?.options?.firstWeekContainsDate ?? 1 | |
| 16921 | + }); | |
| 16922 | + }, | |
| 16923 | + getISOWeek: (date) => { | |
| 16924 | + const base = toCalendarDate2(date); | |
| 16925 | + return getISOWeek(base); | |
| 16926 | + }, | |
| 16927 | + differenceInCalendarDays: (dateLeft, dateRight) => { | |
| 16928 | + const left = toCalendarDate2(dateLeft); | |
| 16929 | + const right = toCalendarDate2(dateRight); | |
| 16930 | + return differenceInCalendarDays(left, right); | |
| 16931 | + }, | |
| 16932 | + differenceInCalendarMonths: (dateLeft, dateRight) => { | |
| 16933 | + const left = toCalendarDate2(dateLeft); | |
| 16934 | + const right = toCalendarDate2(dateRight); | |
| 16935 | + return differenceInCalendarMonths(left, right); | |
| 16936 | + } | |
| 16937 | + }; | |
| 16938 | +} | |
| 16939 | + | |
| 16940 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useAnimation.js | |
| 16941 | +var import_react30 = __toESM(require_react(), 1); | |
| 16942 | +var asHtmlElement = (element) => { | |
| 16943 | + if (element instanceof HTMLElement) | |
| 16944 | + return element; | |
| 16945 | + return null; | |
| 16946 | +}; | |
| 16947 | +var queryMonthEls = (element) => [ | |
| 16948 | + ...element.querySelectorAll("[data-animated-month]") ?? [] | |
| 16949 | +]; | |
| 16950 | +var queryMonthEl = (element) => asHtmlElement(element.querySelector("[data-animated-month]")); | |
| 16951 | +var queryCaptionEl = (element) => asHtmlElement(element.querySelector("[data-animated-caption]")); | |
| 16952 | +var queryWeeksEl = (element) => asHtmlElement(element.querySelector("[data-animated-weeks]")); | |
| 16953 | +var queryNavEl = (element) => asHtmlElement(element.querySelector("[data-animated-nav]")); | |
| 16954 | +var queryWeekdaysEl = (element) => asHtmlElement(element.querySelector("[data-animated-weekdays]")); | |
| 16955 | +function useAnimation(rootElRef, enabled, { classNames, months, focused, dateLib }) { | |
| 16956 | + const previousRootElSnapshotRef = (0, import_react30.useRef)(null); | |
| 16957 | + const previousMonthsRef = (0, import_react30.useRef)(months); | |
| 16958 | + const animatingRef = (0, import_react30.useRef)(false); | |
| 16959 | + (0, import_react30.useLayoutEffect)(() => { | |
| 16960 | + const previousMonths = previousMonthsRef.current; | |
| 16961 | + previousMonthsRef.current = months; | |
| 16962 | + if (!enabled || !rootElRef.current || // safety check because the ref can be set to anything by consumers | |
| 16963 | + !(rootElRef.current instanceof HTMLElement) || // validation required for the animation to work as expected | |
| 16964 | + months.length === 0 || previousMonths.length === 0 || months.length !== previousMonths.length) { | |
| 16965 | + return; | |
| 16966 | + } | |
| 16967 | + const isSameMonth2 = dateLib.isSameMonth(months[0].date, previousMonths[0].date); | |
| 16968 | + const isAfterPreviousMonth = dateLib.isAfter(months[0].date, previousMonths[0].date); | |
| 16969 | + const captionAnimationClass = isAfterPreviousMonth ? classNames[Animation.caption_after_enter] : classNames[Animation.caption_before_enter]; | |
| 16970 | + const weeksAnimationClass = isAfterPreviousMonth ? classNames[Animation.weeks_after_enter] : classNames[Animation.weeks_before_enter]; | |
| 16971 | + const previousRootElSnapshot = previousRootElSnapshotRef.current; | |
| 16972 | + const rootElSnapshot = rootElRef.current.cloneNode(true); | |
| 16973 | + if (rootElSnapshot instanceof HTMLElement) { | |
| 16974 | + const currentMonthElsSnapshot = queryMonthEls(rootElSnapshot); | |
| 16975 | + currentMonthElsSnapshot.forEach((currentMonthElSnapshot) => { | |
| 16976 | + if (!(currentMonthElSnapshot instanceof HTMLElement)) | |
| 16977 | + return; | |
| 16978 | + const previousMonthElSnapshot = queryMonthEl(currentMonthElSnapshot); | |
| 16979 | + if (previousMonthElSnapshot && currentMonthElSnapshot.contains(previousMonthElSnapshot)) { | |
| 16980 | + currentMonthElSnapshot.removeChild(previousMonthElSnapshot); | |
| 16981 | + } | |
| 16982 | + const captionEl = queryCaptionEl(currentMonthElSnapshot); | |
| 16983 | + if (captionEl) { | |
| 16984 | + captionEl.classList.remove(captionAnimationClass); | |
| 16985 | + } | |
| 16986 | + const weeksEl = queryWeeksEl(currentMonthElSnapshot); | |
| 16987 | + if (weeksEl) { | |
| 16988 | + weeksEl.classList.remove(weeksAnimationClass); | |
| 16989 | + } | |
| 16990 | + }); | |
| 16991 | + previousRootElSnapshotRef.current = rootElSnapshot; | |
| 16992 | + } else { | |
| 16993 | + previousRootElSnapshotRef.current = null; | |
| 16994 | + } | |
| 16995 | + if (animatingRef.current || isSameMonth2 || // skip animation if a day is focused because it can cause issues to the animation and is better for a11y | |
| 16996 | + focused) { | |
| 16997 | + return; | |
| 16998 | + } | |
| 16999 | + const previousMonthEls = previousRootElSnapshot instanceof HTMLElement ? queryMonthEls(previousRootElSnapshot) : []; | |
| 17000 | + const currentMonthEls = queryMonthEls(rootElRef.current); | |
| 17001 | + if (currentMonthEls?.every((el) => el instanceof HTMLElement) && previousMonthEls?.every((el) => el instanceof HTMLElement)) { | |
| 17002 | + animatingRef.current = true; | |
| 17003 | + const cleanUpFunctions = []; | |
| 17004 | + rootElRef.current.style.isolation = "isolate"; | |
| 17005 | + const navEl = queryNavEl(rootElRef.current); | |
| 17006 | + if (navEl) { | |
| 17007 | + navEl.style.zIndex = "1"; | |
| 17008 | + } | |
| 17009 | + currentMonthEls.forEach((currentMonthEl, index2) => { | |
| 17010 | + const previousMonthEl = previousMonthEls[index2]; | |
| 17011 | + if (!previousMonthEl) { | |
| 17012 | + return; | |
| 17013 | + } | |
| 17014 | + currentMonthEl.style.position = "relative"; | |
| 17015 | + currentMonthEl.style.overflow = "hidden"; | |
| 17016 | + const captionEl = queryCaptionEl(currentMonthEl); | |
| 17017 | + if (captionEl) { | |
| 17018 | + captionEl.classList.add(captionAnimationClass); | |
| 17019 | + } | |
| 17020 | + const weeksEl = queryWeeksEl(currentMonthEl); | |
| 17021 | + if (weeksEl) { | |
| 17022 | + weeksEl.classList.add(weeksAnimationClass); | |
| 17023 | + } | |
| 17024 | + const cleanUp = () => { | |
| 17025 | + animatingRef.current = false; | |
| 17026 | + if (rootElRef.current) { | |
| 17027 | + rootElRef.current.style.isolation = ""; | |
| 17028 | + } | |
| 17029 | + if (navEl) { | |
| 17030 | + navEl.style.zIndex = ""; | |
| 17031 | + } | |
| 17032 | + if (captionEl) { | |
| 17033 | + captionEl.classList.remove(captionAnimationClass); | |
| 17034 | + } | |
| 17035 | + if (weeksEl) { | |
| 17036 | + weeksEl.classList.remove(weeksAnimationClass); | |
| 17037 | + } | |
| 17038 | + currentMonthEl.style.position = ""; | |
| 17039 | + currentMonthEl.style.overflow = ""; | |
| 17040 | + if (currentMonthEl.contains(previousMonthEl)) { | |
| 17041 | + currentMonthEl.removeChild(previousMonthEl); | |
| 17042 | + } | |
| 17043 | + }; | |
| 17044 | + cleanUpFunctions.push(cleanUp); | |
| 17045 | + previousMonthEl.style.pointerEvents = "none"; | |
| 17046 | + previousMonthEl.style.position = "absolute"; | |
| 17047 | + previousMonthEl.style.overflow = "hidden"; | |
| 17048 | + previousMonthEl.setAttribute("aria-hidden", "true"); | |
| 17049 | + const previousWeekdaysEl = queryWeekdaysEl(previousMonthEl); | |
| 17050 | + if (previousWeekdaysEl) { | |
| 17051 | + previousWeekdaysEl.style.opacity = "0"; | |
| 17052 | + } | |
| 17053 | + const previousCaptionEl = queryCaptionEl(previousMonthEl); | |
| 17054 | + if (previousCaptionEl) { | |
| 17055 | + previousCaptionEl.classList.add(isAfterPreviousMonth ? classNames[Animation.caption_before_exit] : classNames[Animation.caption_after_exit]); | |
| 17056 | + previousCaptionEl.addEventListener("animationend", cleanUp); | |
| 17057 | + } | |
| 17058 | + const previousWeeksEl = queryWeeksEl(previousMonthEl); | |
| 17059 | + if (previousWeeksEl) { | |
| 17060 | + previousWeeksEl.classList.add(isAfterPreviousMonth ? classNames[Animation.weeks_before_exit] : classNames[Animation.weeks_after_exit]); | |
| 17061 | + } | |
| 17062 | + currentMonthEl.insertBefore(previousMonthEl, currentMonthEl.firstChild); | |
| 17063 | + }); | |
| 17064 | + } | |
| 17065 | + }); | |
| 17066 | +} | |
| 17067 | + | |
| 17068 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useCalendar.js | |
| 17069 | +var import_react32 = __toESM(require_react(), 1); | |
| 17070 | + | |
| 17071 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDates.js | |
| 17072 | +function getDates(displayMonths, maxDate, props, dateLib) { | |
| 17073 | + const firstMonth = displayMonths[0]; | |
| 17074 | + const lastMonth = displayMonths[displayMonths.length - 1]; | |
| 17075 | + const { ISOWeek, fixedWeeks, broadcastCalendar } = props ?? {}; | |
| 17076 | + const { addDays: addDays2, differenceInCalendarDays: differenceInCalendarDays2, differenceInCalendarMonths: differenceInCalendarMonths2, endOfBroadcastWeek: endOfBroadcastWeek2, endOfISOWeek: endOfISOWeek2, endOfMonth: endOfMonth2, endOfWeek: endOfWeek2, isAfter: isAfter2, startOfBroadcastWeek: startOfBroadcastWeek2, startOfISOWeek: startOfISOWeek2, startOfWeek: startOfWeek2 } = dateLib; | |
| 17077 | + const startWeekFirstDate = broadcastCalendar ? startOfBroadcastWeek2(firstMonth, dateLib) : ISOWeek ? startOfISOWeek2(firstMonth) : startOfWeek2(firstMonth); | |
| 17078 | + const displayMonthsWeekEnd = broadcastCalendar ? endOfBroadcastWeek2(lastMonth) : ISOWeek ? endOfISOWeek2(endOfMonth2(lastMonth)) : endOfWeek2(endOfMonth2(lastMonth)); | |
| 17079 | + const constraintWeekEnd = maxDate && (broadcastCalendar ? endOfBroadcastWeek2(maxDate) : ISOWeek ? endOfISOWeek2(maxDate) : endOfWeek2(maxDate)); | |
| 17080 | + const gridEndDate = constraintWeekEnd && isAfter2(displayMonthsWeekEnd, constraintWeekEnd) ? constraintWeekEnd : displayMonthsWeekEnd; | |
| 17081 | + const nOfDays = differenceInCalendarDays2(gridEndDate, startWeekFirstDate); | |
| 17082 | + const nOfMonths = differenceInCalendarMonths2(lastMonth, firstMonth) + 1; | |
| 17083 | + const dates = []; | |
| 17084 | + for (let i = 0; i <= nOfDays; i++) { | |
| 17085 | + const date = addDays2(startWeekFirstDate, i); | |
| 17086 | + dates.push(date); | |
| 17087 | + } | |
| 17088 | + const nrOfDaysWithFixedWeeks = broadcastCalendar ? 35 : 42; | |
| 17089 | + const extraDates = nrOfDaysWithFixedWeeks * nOfMonths; | |
| 17090 | + if (fixedWeeks && dates.length < extraDates) { | |
| 17091 | + const daysToAdd = extraDates - dates.length; | |
| 17092 | + for (let i = 0; i < daysToAdd; i++) { | |
| 17093 | + const date = addDays2(dates[dates.length - 1], 1); | |
| 17094 | + dates.push(date); | |
| 17095 | + } | |
| 17096 | + } | |
| 17097 | + return dates; | |
| 17098 | +} | |
| 17099 | + | |
| 17100 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDays.js | |
| 17101 | +function getDays(calendarMonths) { | |
| 17102 | + const initialDays = []; | |
| 17103 | + return calendarMonths.reduce((days, month) => { | |
| 17104 | + const weekDays = month.weeks.reduce((weekDays2, week) => { | |
| 17105 | + return weekDays2.concat(week.days.slice()); | |
| 17106 | + }, initialDays.slice()); | |
| 17107 | + return days.concat(weekDays.slice()); | |
| 17108 | + }, initialDays.slice()); | |
| 17109 | +} | |
| 17110 | + | |
| 17111 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDisplayMonths.js | |
| 17112 | +function getDisplayMonths(firstDisplayedMonth, calendarEndMonth, props, dateLib) { | |
| 17113 | + const { numberOfMonths = 1 } = props; | |
| 17114 | + const months = []; | |
| 17115 | + for (let i = 0; i < numberOfMonths; i++) { | |
| 17116 | + const month = dateLib.addMonths(firstDisplayedMonth, i); | |
| 17117 | + if (calendarEndMonth && month > calendarEndMonth) { | |
| 17118 | + break; | |
| 17119 | + } | |
| 17120 | + months.push(month); | |
| 17121 | + } | |
| 17122 | + return months; | |
| 17123 | +} | |
| 17124 | + | |
| 17125 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getInitialMonth.js | |
| 17126 | +function getInitialMonth(props, navStart, navEnd, dateLib) { | |
| 17127 | + const { month, defaultMonth, today = dateLib.today(), numberOfMonths = 1 } = props; | |
| 17128 | + let initialMonth = month || defaultMonth || today; | |
| 17129 | + const { differenceInCalendarMonths: differenceInCalendarMonths2, addMonths: addMonths2, startOfMonth: startOfMonth2 } = dateLib; | |
| 17130 | + if (navEnd && differenceInCalendarMonths2(navEnd, initialMonth) < numberOfMonths - 1) { | |
| 17131 | + const offset4 = -1 * (numberOfMonths - 1); | |
| 17132 | + initialMonth = addMonths2(navEnd, offset4); | |
| 17133 | + } | |
| 17134 | + if (navStart && differenceInCalendarMonths2(initialMonth, navStart) < 0) { | |
| 17135 | + initialMonth = navStart; | |
| 17136 | + } | |
| 17137 | + return startOfMonth2(initialMonth); | |
| 17138 | +} | |
| 17139 | + | |
| 17140 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getMonths.js | |
| 17141 | +function getMonths(displayMonths, dates, props, dateLib) { | |
| 17142 | + const { addDays: addDays2, endOfBroadcastWeek: endOfBroadcastWeek2, endOfISOWeek: endOfISOWeek2, endOfMonth: endOfMonth2, endOfWeek: endOfWeek2, getISOWeek: getISOWeek2, getWeek: getWeek2, startOfBroadcastWeek: startOfBroadcastWeek2, startOfISOWeek: startOfISOWeek2, startOfWeek: startOfWeek2 } = dateLib; | |
| 17143 | + const dayPickerMonths = displayMonths.reduce((months, month) => { | |
| 17144 | + const firstDateOfFirstWeek = props.broadcastCalendar ? startOfBroadcastWeek2(month, dateLib) : props.ISOWeek ? startOfISOWeek2(month) : startOfWeek2(month); | |
| 17145 | + const lastDateOfLastWeek = props.broadcastCalendar ? endOfBroadcastWeek2(month) : props.ISOWeek ? endOfISOWeek2(endOfMonth2(month)) : endOfWeek2(endOfMonth2(month)); | |
| 17146 | + const monthDates = dates.filter((date) => { | |
| 17147 | + return date >= firstDateOfFirstWeek && date <= lastDateOfLastWeek; | |
| 17148 | + }); | |
| 17149 | + const nrOfDaysWithFixedWeeks = props.broadcastCalendar ? 35 : 42; | |
| 17150 | + if (props.fixedWeeks && monthDates.length < nrOfDaysWithFixedWeeks) { | |
| 17151 | + const extraDates = dates.filter((date) => { | |
| 17152 | + const daysToAdd = nrOfDaysWithFixedWeeks - monthDates.length; | |
| 17153 | + return date > lastDateOfLastWeek && date <= addDays2(lastDateOfLastWeek, daysToAdd); | |
| 17154 | + }); | |
| 17155 | + monthDates.push(...extraDates); | |
| 17156 | + } | |
| 17157 | + const weeks = monthDates.reduce((weeks2, date) => { | |
| 17158 | + const weekNumber = props.ISOWeek ? getISOWeek2(date) : getWeek2(date); | |
| 17159 | + const week = weeks2.find((week2) => week2.weekNumber === weekNumber); | |
| 17160 | + const day = new CalendarDay(date, month, dateLib); | |
| 17161 | + if (!week) { | |
| 17162 | + weeks2.push(new CalendarWeek(weekNumber, [day])); | |
| 17163 | + } else { | |
| 17164 | + week.days.push(day); | |
| 17165 | + } | |
| 17166 | + return weeks2; | |
| 17167 | + }, []); | |
| 17168 | + const dayPickerMonth = new CalendarMonth(month, weeks); | |
| 17169 | + months.push(dayPickerMonth); | |
| 17170 | + return months; | |
| 17171 | + }, []); | |
| 17172 | + if (!props.reverseMonths) { | |
| 17173 | + return dayPickerMonths; | |
| 17174 | + } else { | |
| 17175 | + return dayPickerMonths.reverse(); | |
| 17176 | + } | |
| 17177 | +} | |
| 17178 | + | |
| 17179 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getNavMonth.js | |
| 17180 | +function getNavMonths(props, dateLib) { | |
| 17181 | + let { startMonth, endMonth } = props; | |
| 17182 | + const { startOfYear: startOfYear2, startOfDay: startOfDay2, startOfMonth: startOfMonth2, endOfMonth: endOfMonth2, addYears: addYears2, endOfYear: endOfYear2, today } = dateLib; | |
| 17183 | + const hasYearDropdown = props.captionLayout === "dropdown" || props.captionLayout === "dropdown-years"; | |
| 17184 | + if (startMonth) { | |
| 17185 | + startMonth = startOfMonth2(startMonth); | |
| 17186 | + } else if (!startMonth && hasYearDropdown) { | |
| 17187 | + startMonth = startOfYear2(addYears2(props.today ?? today(), -100)); | |
| 17188 | + } | |
| 17189 | + if (endMonth) { | |
| 17190 | + endMonth = endOfMonth2(endMonth); | |
| 17191 | + } else if (!endMonth && hasYearDropdown) { | |
| 17192 | + endMonth = endOfYear2(props.today ?? today()); | |
| 17193 | + } | |
| 17194 | + return [ | |
| 17195 | + startMonth ? startOfDay2(startMonth) : startMonth, | |
| 17196 | + endMonth ? startOfDay2(endMonth) : endMonth | |
| 17197 | + ]; | |
| 17198 | +} | |
| 17199 | + | |
| 17200 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getNextMonth.js | |
| 17201 | +function getNextMonth(firstDisplayedMonth, calendarEndMonth, options, dateLib) { | |
| 17202 | + if (options.disableNavigation) { | |
| 17203 | + return void 0; | |
| 17204 | + } | |
| 17205 | + const { pagedNavigation, numberOfMonths = 1 } = options; | |
| 17206 | + const { startOfMonth: startOfMonth2, addMonths: addMonths2, differenceInCalendarMonths: differenceInCalendarMonths2 } = dateLib; | |
| 17207 | + const offset4 = pagedNavigation ? numberOfMonths : 1; | |
| 17208 | + const month = startOfMonth2(firstDisplayedMonth); | |
| 17209 | + if (!calendarEndMonth) { | |
| 17210 | + return addMonths2(month, offset4); | |
| 17211 | + } | |
| 17212 | + const monthsDiff = differenceInCalendarMonths2(calendarEndMonth, firstDisplayedMonth); | |
| 17213 | + if (monthsDiff < numberOfMonths) { | |
| 17214 | + return void 0; | |
| 17215 | + } | |
| 17216 | + return addMonths2(month, offset4); | |
| 17217 | +} | |
| 17218 | + | |
| 17219 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getPreviousMonth.js | |
| 17220 | +function getPreviousMonth(firstDisplayedMonth, calendarStartMonth, options, dateLib) { | |
| 17221 | + if (options.disableNavigation) { | |
| 17222 | + return void 0; | |
| 17223 | + } | |
| 17224 | + const { pagedNavigation, numberOfMonths } = options; | |
| 17225 | + const { startOfMonth: startOfMonth2, addMonths: addMonths2, differenceInCalendarMonths: differenceInCalendarMonths2 } = dateLib; | |
| 17226 | + const offset4 = pagedNavigation ? numberOfMonths ?? 1 : 1; | |
| 17227 | + const month = startOfMonth2(firstDisplayedMonth); | |
| 17228 | + if (!calendarStartMonth) { | |
| 17229 | + return addMonths2(month, -offset4); | |
| 17230 | + } | |
| 17231 | + const monthsDiff = differenceInCalendarMonths2(month, calendarStartMonth); | |
| 17232 | + if (monthsDiff <= 0) { | |
| 17233 | + return void 0; | |
| 17234 | + } | |
| 17235 | + return addMonths2(month, -offset4); | |
| 17236 | +} | |
| 17237 | + | |
| 17238 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getWeeks.js | |
| 17239 | +function getWeeks(months) { | |
| 17240 | + const initialWeeks = []; | |
| 17241 | + return months.reduce((weeks, month) => { | |
| 17242 | + return weeks.concat(month.weeks.slice()); | |
| 17243 | + }, initialWeeks.slice()); | |
| 17244 | +} | |
| 17245 | + | |
| 17246 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/useControlledValue.js | |
| 17247 | +var import_react31 = __toESM(require_react(), 1); | |
| 17248 | +function useControlledValue(defaultValue, controlledValue) { | |
| 17249 | + const [uncontrolledValue, setValue] = (0, import_react31.useState)(defaultValue); | |
| 17250 | + const value = controlledValue === void 0 ? uncontrolledValue : controlledValue; | |
| 17251 | + return [value, setValue]; | |
| 17252 | +} | |
| 17253 | + | |
| 17254 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useCalendar.js | |
| 17255 | +function useCalendar(props, dateLib) { | |
| 17256 | + const [navStart, navEnd] = getNavMonths(props, dateLib); | |
| 17257 | + const { startOfMonth: startOfMonth2, endOfMonth: endOfMonth2 } = dateLib; | |
| 17258 | + const initialMonth = getInitialMonth(props, navStart, navEnd, dateLib); | |
| 17259 | + const [firstMonth, setFirstMonth] = useControlledValue( | |
| 17260 | + initialMonth, | |
| 17261 | + // initialMonth is always computed from props.month if provided | |
| 17262 | + props.month ? initialMonth : void 0 | |
| 17263 | + ); | |
| 17264 | + (0, import_react32.useEffect)(() => { | |
| 17265 | + const newInitialMonth = getInitialMonth(props, navStart, navEnd, dateLib); | |
| 17266 | + setFirstMonth(newInitialMonth); | |
| 17267 | + }, [props.timeZone]); | |
| 17268 | + const { months, weeks, days, previousMonth, nextMonth } = (0, import_react32.useMemo)(() => { | |
| 17269 | + const displayMonths = getDisplayMonths(firstMonth, navEnd, { numberOfMonths: props.numberOfMonths }, dateLib); | |
| 17270 | + const dates = getDates(displayMonths, props.endMonth ? endOfMonth2(props.endMonth) : void 0, { | |
| 17271 | + ISOWeek: props.ISOWeek, | |
| 17272 | + fixedWeeks: props.fixedWeeks, | |
| 17273 | + broadcastCalendar: props.broadcastCalendar | |
| 17274 | + }, dateLib); | |
| 17275 | + const months2 = getMonths(displayMonths, dates, { | |
| 17276 | + broadcastCalendar: props.broadcastCalendar, | |
| 17277 | + fixedWeeks: props.fixedWeeks, | |
| 17278 | + ISOWeek: props.ISOWeek, | |
| 17279 | + reverseMonths: props.reverseMonths | |
| 17280 | + }, dateLib); | |
| 17281 | + const weeks2 = getWeeks(months2); | |
| 17282 | + const days2 = getDays(months2); | |
| 17283 | + const previousMonth2 = getPreviousMonth(firstMonth, navStart, props, dateLib); | |
| 17284 | + const nextMonth2 = getNextMonth(firstMonth, navEnd, props, dateLib); | |
| 17285 | + return { | |
| 17286 | + months: months2, | |
| 17287 | + weeks: weeks2, | |
| 17288 | + days: days2, | |
| 17289 | + previousMonth: previousMonth2, | |
| 17290 | + nextMonth: nextMonth2 | |
| 17291 | + }; | |
| 17292 | + }, [ | |
| 17293 | + dateLib, | |
| 17294 | + firstMonth.getTime(), | |
| 17295 | + navEnd?.getTime(), | |
| 17296 | + navStart?.getTime(), | |
| 17297 | + props.disableNavigation, | |
| 17298 | + props.broadcastCalendar, | |
| 17299 | + props.endMonth?.getTime(), | |
| 17300 | + props.fixedWeeks, | |
| 17301 | + props.ISOWeek, | |
| 17302 | + props.numberOfMonths, | |
| 17303 | + props.pagedNavigation, | |
| 17304 | + props.reverseMonths | |
| 17305 | + ]); | |
| 17306 | + const { disableNavigation, onMonthChange } = props; | |
| 17307 | + const isDayInCalendar = (day) => weeks.some((week) => week.days.some((d) => d.isEqualTo(day))); | |
| 17308 | + const goToMonth = (date) => { | |
| 17309 | + if (disableNavigation) { | |
| 17310 | + return; | |
| 17311 | + } | |
| 17312 | + let newMonth = startOfMonth2(date); | |
| 17313 | + if (navStart && newMonth < startOfMonth2(navStart)) { | |
| 17314 | + newMonth = startOfMonth2(navStart); | |
| 17315 | + } | |
| 17316 | + if (navEnd && newMonth > startOfMonth2(navEnd)) { | |
| 17317 | + newMonth = startOfMonth2(navEnd); | |
| 17318 | + } | |
| 17319 | + setFirstMonth(newMonth); | |
| 17320 | + onMonthChange?.(newMonth); | |
| 17321 | + }; | |
| 17322 | + const goToDay = (day) => { | |
| 17323 | + if (isDayInCalendar(day)) { | |
| 17324 | + return; | |
| 17325 | + } | |
| 17326 | + goToMonth(day.date); | |
| 17327 | + }; | |
| 17328 | + const calendar = { | |
| 17329 | + months, | |
| 17330 | + weeks, | |
| 17331 | + days, | |
| 17332 | + navStart, | |
| 17333 | + navEnd, | |
| 17334 | + previousMonth, | |
| 17335 | + nextMonth, | |
| 17336 | + goToMonth, | |
| 17337 | + goToDay | |
| 17338 | + }; | |
| 17339 | + return calendar; | |
| 17340 | +} | |
| 17341 | + | |
| 17342 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useFocus.js | |
| 17343 | +var import_react33 = __toESM(require_react(), 1); | |
| 17344 | + | |
| 17345 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/calculateFocusTarget.js | |
| 17346 | +var FocusTargetPriority; | |
| 17347 | +(function(FocusTargetPriority2) { | |
| 17348 | + FocusTargetPriority2[FocusTargetPriority2["Today"] = 0] = "Today"; | |
| 17349 | + FocusTargetPriority2[FocusTargetPriority2["Selected"] = 1] = "Selected"; | |
| 17350 | + FocusTargetPriority2[FocusTargetPriority2["LastFocused"] = 2] = "LastFocused"; | |
| 17351 | + FocusTargetPriority2[FocusTargetPriority2["FocusedModifier"] = 3] = "FocusedModifier"; | |
| 17352 | +})(FocusTargetPriority || (FocusTargetPriority = {})); | |
| 17353 | +function isFocusableDay(modifiers) { | |
| 17354 | + return !modifiers[DayFlag.disabled] && !modifiers[DayFlag.hidden] && !modifiers[DayFlag.outside]; | |
| 17355 | +} | |
| 17356 | +function calculateFocusTarget(days, getModifiers, isSelected, lastFocused) { | |
| 17357 | + let focusTarget; | |
| 17358 | + let foundFocusTargetPriority = -1; | |
| 17359 | + for (const day of days) { | |
| 17360 | + const modifiers = getModifiers(day); | |
| 17361 | + if (isFocusableDay(modifiers)) { | |
| 17362 | + if (modifiers[DayFlag.focused] && foundFocusTargetPriority < FocusTargetPriority.FocusedModifier) { | |
| 17363 | + focusTarget = day; | |
| 17364 | + foundFocusTargetPriority = FocusTargetPriority.FocusedModifier; | |
| 17365 | + } else if (lastFocused?.isEqualTo(day) && foundFocusTargetPriority < FocusTargetPriority.LastFocused) { | |
| 17366 | + focusTarget = day; | |
| 17367 | + foundFocusTargetPriority = FocusTargetPriority.LastFocused; | |
| 17368 | + } else if (isSelected(day.date) && foundFocusTargetPriority < FocusTargetPriority.Selected) { | |
| 17369 | + focusTarget = day; | |
| 17370 | + foundFocusTargetPriority = FocusTargetPriority.Selected; | |
| 17371 | + } else if (modifiers[DayFlag.today] && foundFocusTargetPriority < FocusTargetPriority.Today) { | |
| 17372 | + focusTarget = day; | |
| 17373 | + foundFocusTargetPriority = FocusTargetPriority.Today; | |
| 17374 | + } | |
| 17375 | + } | |
| 17376 | + } | |
| 17377 | + if (!focusTarget) { | |
| 17378 | + focusTarget = days.find((day) => isFocusableDay(getModifiers(day))); | |
| 17379 | + } | |
| 17380 | + return focusTarget; | |
| 17381 | +} | |
| 17382 | + | |
| 17383 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getFocusableDate.js | |
| 17384 | +function getFocusableDate(moveBy, moveDir, refDate, navStart, navEnd, props, dateLib) { | |
| 17385 | + const { ISOWeek, broadcastCalendar } = props; | |
| 17386 | + const { addDays: addDays2, addMonths: addMonths2, addWeeks: addWeeks2, addYears: addYears2, endOfBroadcastWeek: endOfBroadcastWeek2, endOfISOWeek: endOfISOWeek2, endOfWeek: endOfWeek2, max: max3, min: min3, startOfBroadcastWeek: startOfBroadcastWeek2, startOfISOWeek: startOfISOWeek2, startOfWeek: startOfWeek2 } = dateLib; | |
| 17387 | + const moveFns = { | |
| 17388 | + day: addDays2, | |
| 17389 | + week: addWeeks2, | |
| 17390 | + month: addMonths2, | |
| 17391 | + year: addYears2, | |
| 17392 | + startOfWeek: (date) => broadcastCalendar ? startOfBroadcastWeek2(date, dateLib) : ISOWeek ? startOfISOWeek2(date) : startOfWeek2(date), | |
| 17393 | + endOfWeek: (date) => broadcastCalendar ? endOfBroadcastWeek2(date) : ISOWeek ? endOfISOWeek2(date) : endOfWeek2(date) | |
| 17394 | + }; | |
| 17395 | + let focusableDate = moveFns[moveBy](refDate, moveDir === "after" ? 1 : -1); | |
| 17396 | + if (moveDir === "before" && navStart) { | |
| 17397 | + focusableDate = max3([navStart, focusableDate]); | |
| 17398 | + } else if (moveDir === "after" && navEnd) { | |
| 17399 | + focusableDate = min3([navEnd, focusableDate]); | |
| 17400 | + } | |
| 17401 | + return focusableDate; | |
| 17402 | +} | |
| 17403 | + | |
| 17404 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getNextFocus.js | |
| 17405 | +function getNextFocus(moveBy, moveDir, refDay, calendarStartMonth, calendarEndMonth, props, dateLib, attempt = 0) { | |
| 17406 | + if (attempt > 365) { | |
| 17407 | + return void 0; | |
| 17408 | + } | |
| 17409 | + const focusableDate = getFocusableDate(moveBy, moveDir, refDay.date, calendarStartMonth, calendarEndMonth, props, dateLib); | |
| 17410 | + const isDisabled = Boolean(props.disabled && dateMatchModifiers(focusableDate, props.disabled, dateLib)); | |
| 17411 | + const isHidden = Boolean(props.hidden && dateMatchModifiers(focusableDate, props.hidden, dateLib)); | |
| 17412 | + const targetMonth = focusableDate; | |
| 17413 | + const focusDay = new CalendarDay(focusableDate, targetMonth, dateLib); | |
| 17414 | + if (!isDisabled && !isHidden) { | |
| 17415 | + return focusDay; | |
| 17416 | + } | |
| 17417 | + return getNextFocus(moveBy, moveDir, focusDay, calendarStartMonth, calendarEndMonth, props, dateLib, attempt + 1); | |
| 17418 | +} | |
| 17419 | + | |
| 17420 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useFocus.js | |
| 17421 | +function useFocus2(props, calendar, getModifiers, isSelected, dateLib) { | |
| 17422 | + const { autoFocus } = props; | |
| 17423 | + const [lastFocused, setLastFocused] = (0, import_react33.useState)(); | |
| 17424 | + const focusTarget = calculateFocusTarget(calendar.days, getModifiers, isSelected || (() => false), lastFocused); | |
| 17425 | + const [focusedDay, setFocused] = (0, import_react33.useState)(autoFocus ? focusTarget : void 0); | |
| 17426 | + const blur = () => { | |
| 17427 | + setLastFocused(focusedDay); | |
| 17428 | + setFocused(void 0); | |
| 17429 | + }; | |
| 17430 | + const moveFocus = (moveBy, moveDir) => { | |
| 17431 | + if (!focusedDay) | |
| 17432 | + return; | |
| 17433 | + const nextFocus = getNextFocus(moveBy, moveDir, focusedDay, calendar.navStart, calendar.navEnd, props, dateLib); | |
| 17434 | + if (!nextFocus) | |
| 17435 | + return; | |
| 17436 | + if (props.disableNavigation) { | |
| 17437 | + const isNextInCalendar = calendar.days.some((day) => day.isEqualTo(nextFocus)); | |
| 17438 | + if (!isNextInCalendar) { | |
| 17439 | + return; | |
| 17440 | + } | |
| 17441 | + } | |
| 17442 | + calendar.goToDay(nextFocus); | |
| 17443 | + setFocused(nextFocus); | |
| 17444 | + }; | |
| 17445 | + const isFocusTarget = (day) => { | |
| 17446 | + return Boolean(focusTarget?.isEqualTo(day)); | |
| 17447 | + }; | |
| 17448 | + const useFocus3 = { | |
| 17449 | + isFocusTarget, | |
| 17450 | + setFocused, | |
| 17451 | + focused: focusedDay, | |
| 17452 | + blur, | |
| 17453 | + moveFocus | |
| 17454 | + }; | |
| 17455 | + return useFocus3; | |
| 17456 | +} | |
| 17457 | + | |
| 17458 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/selection/useMulti.js | |
| 17459 | +function useMulti(props, dateLib) { | |
| 17460 | + const { selected: initiallySelected, required, onSelect } = props; | |
| 17461 | + const [internallySelected, setSelected] = useControlledValue(initiallySelected, onSelect ? initiallySelected : void 0); | |
| 17462 | + const selected = !onSelect ? internallySelected : initiallySelected; | |
| 17463 | + const { isSameDay: isSameDay2 } = dateLib; | |
| 17464 | + const isSelected = (date) => { | |
| 17465 | + return selected?.some((d) => isSameDay2(d, date)) ?? false; | |
| 17466 | + }; | |
| 17467 | + const { min: min3, max: max3 } = props; | |
| 17468 | + const select3 = (triggerDate, modifiers, e) => { | |
| 17469 | + let newDates = [...selected ?? []]; | |
| 17470 | + if (isSelected(triggerDate)) { | |
| 17471 | + if (selected?.length === min3) { | |
| 17472 | + return; | |
| 17473 | + } | |
| 17474 | + if (required && selected?.length === 1) { | |
| 17475 | + return; | |
| 17476 | + } | |
| 17477 | + newDates = selected?.filter((d) => !isSameDay2(d, triggerDate)); | |
| 17478 | + } else { | |
| 17479 | + if (selected?.length === max3) { | |
| 17480 | + newDates = [triggerDate]; | |
| 17481 | + } else { | |
| 17482 | + newDates = [...newDates, triggerDate]; | |
| 17483 | + } | |
| 17484 | + } | |
| 17485 | + if (!onSelect) { | |
| 17486 | + setSelected(newDates); | |
| 17487 | + } | |
| 17488 | + onSelect?.(newDates, triggerDate, modifiers, e); | |
| 17489 | + return newDates; | |
| 17490 | + }; | |
| 17491 | + return { | |
| 17492 | + selected, | |
| 17493 | + select: select3, | |
| 17494 | + isSelected | |
| 17495 | + }; | |
| 17496 | +} | |
| 17497 | + | |
| 17498 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/addToRange.js | |
| 17499 | +function addToRange(date, initialRange, min3 = 0, max3 = 0, required = false, dateLib = defaultDateLib) { | |
| 17500 | + const { from, to } = initialRange || {}; | |
| 17501 | + const { isSameDay: isSameDay2, isAfter: isAfter2, isBefore: isBefore2 } = dateLib; | |
| 17502 | + let range; | |
| 17503 | + if (!from && !to) { | |
| 17504 | + range = { from: date, to: min3 > 0 ? void 0 : date }; | |
| 17505 | + } else if (from && !to) { | |
| 17506 | + if (isSameDay2(from, date)) { | |
| 17507 | + if (min3 === 0) { | |
| 17508 | + range = { from, to: date }; | |
| 17509 | + } else if (required) { | |
| 17510 | + range = { from, to: void 0 }; | |
| 17511 | + } else { | |
| 17512 | + range = void 0; | |
| 17513 | + } | |
| 17514 | + } else if (isBefore2(date, from)) { | |
| 17515 | + range = { from: date, to: from }; | |
| 17516 | + } else { | |
| 17517 | + range = { from, to: date }; | |
| 17518 | + } | |
| 17519 | + } else if (from && to) { | |
| 17520 | + if (isSameDay2(from, date) && isSameDay2(to, date)) { | |
| 17521 | + if (required) { | |
| 17522 | + range = { from, to }; | |
| 17523 | + } else { | |
| 17524 | + range = void 0; | |
| 17525 | + } | |
| 17526 | + } else if (isSameDay2(from, date)) { | |
| 17527 | + range = { from, to: min3 > 0 ? void 0 : date }; | |
| 17528 | + } else if (isSameDay2(to, date)) { | |
| 17529 | + range = { from: date, to: min3 > 0 ? void 0 : date }; | |
| 17530 | + } else if (isBefore2(date, from)) { | |
| 17531 | + range = { from: date, to }; | |
| 17532 | + } else if (isAfter2(date, from)) { | |
| 17533 | + range = { from, to: date }; | |
| 17534 | + } else if (isAfter2(date, to)) { | |
| 17535 | + range = { from, to: date }; | |
| 17536 | + } else { | |
| 17537 | + throw new Error("Invalid range"); | |
| 17538 | + } | |
| 17539 | + } | |
| 17540 | + if (range?.from && range?.to) { | |
| 17541 | + const diff = dateLib.differenceInCalendarDays(range.to, range.from); | |
| 17542 | + if (max3 > 0 && diff > max3) { | |
| 17543 | + range = { from: date, to: void 0 }; | |
| 17544 | + } else if (min3 > 1 && diff < min3) { | |
| 17545 | + range = { from: date, to: void 0 }; | |
| 17546 | + } | |
| 17547 | + } | |
| 17548 | + return range; | |
| 17549 | +} | |
| 17550 | + | |
| 17551 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/rangeContainsDayOfWeek.js | |
| 17552 | +function rangeContainsDayOfWeek(range, dayOfWeek, dateLib = defaultDateLib) { | |
| 17553 | + const dayOfWeekArr = !Array.isArray(dayOfWeek) ? [dayOfWeek] : dayOfWeek; | |
| 17554 | + let date = range.from; | |
| 17555 | + const totalDays = dateLib.differenceInCalendarDays(range.to, range.from); | |
| 17556 | + const totalDaysLimit = Math.min(totalDays, 6); | |
| 17557 | + for (let i = 0; i <= totalDaysLimit; i++) { | |
| 17558 | + if (dayOfWeekArr.includes(date.getDay())) { | |
| 17559 | + return true; | |
| 17560 | + } | |
| 17561 | + date = dateLib.addDays(date, 1); | |
| 17562 | + } | |
| 17563 | + return false; | |
| 17564 | +} | |
| 17565 | + | |
| 17566 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/rangeOverlaps.js | |
| 17567 | +function rangeOverlaps(rangeLeft, rangeRight, dateLib = defaultDateLib) { | |
| 17568 | + return rangeIncludesDate(rangeLeft, rangeRight.from, false, dateLib) || rangeIncludesDate(rangeLeft, rangeRight.to, false, dateLib) || rangeIncludesDate(rangeRight, rangeLeft.from, false, dateLib) || rangeIncludesDate(rangeRight, rangeLeft.to, false, dateLib); | |
| 17569 | +} | |
| 17570 | + | |
| 17571 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/rangeContainsModifiers.js | |
| 17572 | +function rangeContainsModifiers(range, modifiers, dateLib = defaultDateLib) { | |
| 17573 | + const matchers = Array.isArray(modifiers) ? modifiers : [modifiers]; | |
| 17574 | + const nonFunctionMatchers = matchers.filter((matcher) => typeof matcher !== "function"); | |
| 17575 | + const nonFunctionMatchersResult = nonFunctionMatchers.some((matcher) => { | |
| 17576 | + if (typeof matcher === "boolean") | |
| 17577 | + return matcher; | |
| 17578 | + if (dateLib.isDate(matcher)) { | |
| 17579 | + return rangeIncludesDate(range, matcher, false, dateLib); | |
| 17580 | + } | |
| 17581 | + if (isDatesArray(matcher, dateLib)) { | |
| 17582 | + return matcher.some((date) => rangeIncludesDate(range, date, false, dateLib)); | |
| 17583 | + } | |
| 17584 | + if (isDateRange(matcher)) { | |
| 17585 | + if (matcher.from && matcher.to) { | |
| 17586 | + return rangeOverlaps(range, { from: matcher.from, to: matcher.to }, dateLib); | |
| 17587 | + } | |
| 17588 | + return false; | |
| 17589 | + } | |
| 17590 | + if (isDayOfWeekType(matcher)) { | |
| 17591 | + return rangeContainsDayOfWeek(range, matcher.dayOfWeek, dateLib); | |
| 17592 | + } | |
| 17593 | + if (isDateInterval(matcher)) { | |
| 17594 | + const isClosedInterval = dateLib.isAfter(matcher.before, matcher.after); | |
| 17595 | + if (isClosedInterval) { | |
| 17596 | + return rangeOverlaps(range, { | |
| 17597 | + from: dateLib.addDays(matcher.after, 1), | |
| 17598 | + to: dateLib.addDays(matcher.before, -1) | |
| 17599 | + }, dateLib); | |
| 17600 | + } | |
| 17601 | + return dateMatchModifiers(range.from, matcher, dateLib) || dateMatchModifiers(range.to, matcher, dateLib); | |
| 17602 | + } | |
| 17603 | + if (isDateAfterType(matcher) || isDateBeforeType(matcher)) { | |
| 17604 | + return dateMatchModifiers(range.from, matcher, dateLib) || dateMatchModifiers(range.to, matcher, dateLib); | |
| 17605 | + } | |
| 17606 | + return false; | |
| 17607 | + }); | |
| 17608 | + if (nonFunctionMatchersResult) { | |
| 17609 | + return true; | |
| 17610 | + } | |
| 17611 | + const functionMatchers = matchers.filter((matcher) => typeof matcher === "function"); | |
| 17612 | + if (functionMatchers.length) { | |
| 17613 | + let date = range.from; | |
| 17614 | + const totalDays = dateLib.differenceInCalendarDays(range.to, range.from); | |
| 17615 | + for (let i = 0; i <= totalDays; i++) { | |
| 17616 | + if (functionMatchers.some((matcher) => matcher(date))) { | |
| 17617 | + return true; | |
| 17618 | + } | |
| 17619 | + date = dateLib.addDays(date, 1); | |
| 17620 | + } | |
| 17621 | + } | |
| 17622 | + return false; | |
| 17623 | +} | |
| 17624 | + | |
| 17625 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/selection/useRange.js | |
| 17626 | +function useRange(props, dateLib) { | |
| 17627 | + const { disabled: disabled2, excludeDisabled, resetOnSelect, selected: initiallySelected, required, onSelect } = props; | |
| 17628 | + const [internallySelected, setSelected] = useControlledValue(initiallySelected, onSelect ? initiallySelected : void 0); | |
| 17629 | + const selected = !onSelect ? internallySelected : initiallySelected; | |
| 17630 | + const isSelected = (date) => selected && rangeIncludesDate(selected, date, false, dateLib); | |
| 17631 | + const select3 = (triggerDate, modifiers, e) => { | |
| 17632 | + const { min: min3, max: max3 } = props; | |
| 17633 | + let newRange; | |
| 17634 | + if (triggerDate) { | |
| 17635 | + const selectedFrom = selected?.from; | |
| 17636 | + const selectedTo = selected?.to; | |
| 17637 | + const hasFullRange = !!selectedFrom && !!selectedTo; | |
| 17638 | + const isClickingSingleDayRange = !!selectedFrom && !!selectedTo && dateLib.isSameDay(selectedFrom, selectedTo) && dateLib.isSameDay(triggerDate, selectedFrom); | |
| 17639 | + if (resetOnSelect && (hasFullRange || !selected?.from)) { | |
| 17640 | + if (!required && isClickingSingleDayRange) { | |
| 17641 | + newRange = void 0; | |
| 17642 | + } else { | |
| 17643 | + newRange = { from: triggerDate, to: void 0 }; | |
| 17644 | + } | |
| 17645 | + } else { | |
| 17646 | + newRange = addToRange(triggerDate, selected, min3, max3, required, dateLib); | |
| 17647 | + } | |
| 17648 | + } | |
| 17649 | + if (excludeDisabled && disabled2 && newRange?.from && newRange.to) { | |
| 17650 | + if (rangeContainsModifiers({ from: newRange.from, to: newRange.to }, disabled2, dateLib)) { | |
| 17651 | + newRange.from = triggerDate; | |
| 17652 | + newRange.to = void 0; | |
| 17653 | + } | |
| 17654 | + } | |
| 17655 | + if (!onSelect) { | |
| 17656 | + setSelected(newRange); | |
| 17657 | + } | |
| 17658 | + onSelect?.(newRange, triggerDate, modifiers, e); | |
| 17659 | + return newRange; | |
| 17660 | + }; | |
| 17661 | + return { | |
| 17662 | + selected, | |
| 17663 | + select: select3, | |
| 17664 | + isSelected | |
| 17665 | + }; | |
| 17666 | +} | |
| 17667 | + | |
| 17668 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/selection/useSingle.js | |
| 17669 | +function useSingle(props, dateLib) { | |
| 17670 | + const { selected: initiallySelected, required, onSelect } = props; | |
| 17671 | + const [internallySelected, setSelected] = useControlledValue(initiallySelected, onSelect ? initiallySelected : void 0); | |
| 17672 | + const selected = !onSelect ? internallySelected : initiallySelected; | |
| 17673 | + const { isSameDay: isSameDay2 } = dateLib; | |
| 17674 | + const isSelected = (compareDate) => { | |
| 17675 | + return selected ? isSameDay2(selected, compareDate) : false; | |
| 17676 | + }; | |
| 17677 | + const select3 = (triggerDate, modifiers, e) => { | |
| 17678 | + let newDate = triggerDate; | |
| 17679 | + if (!required && selected && selected && isSameDay2(triggerDate, selected)) { | |
| 17680 | + newDate = void 0; | |
| 17681 | + } | |
| 17682 | + if (!onSelect) { | |
| 17683 | + setSelected(newDate); | |
| 17684 | + } | |
| 17685 | + if (required) { | |
| 17686 | + onSelect?.(newDate, triggerDate, modifiers, e); | |
| 17687 | + } else { | |
| 17688 | + onSelect?.(newDate, triggerDate, modifiers, e); | |
| 17689 | + } | |
| 17690 | + return newDate; | |
| 17691 | + }; | |
| 17692 | + return { | |
| 17693 | + selected, | |
| 17694 | + select: select3, | |
| 17695 | + isSelected | |
| 17696 | + }; | |
| 17697 | +} | |
| 17698 | + | |
| 17699 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useSelection.js | |
| 17700 | +function useSelection(props, dateLib) { | |
| 17701 | + const single = useSingle(props, dateLib); | |
| 17702 | + const multi = useMulti(props, dateLib); | |
| 17703 | + const range = useRange(props, dateLib); | |
| 17704 | + switch (props.mode) { | |
| 17705 | + case "single": | |
| 17706 | + return single; | |
| 17707 | + case "multiple": | |
| 17708 | + return multi; | |
| 17709 | + case "range": | |
| 17710 | + return range; | |
| 17711 | + default: | |
| 17712 | + return void 0; | |
| 17713 | + } | |
| 17714 | +} | |
| 17715 | + | |
| 17716 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/toTimeZone.js | |
| 17717 | +function toTimeZone(date, timeZone) { | |
| 17718 | + if (date instanceof TZDate && date.timeZone === timeZone) { | |
| 17719 | + return date; | |
| 17720 | + } | |
| 17721 | + return new TZDate(date, timeZone); | |
| 17722 | +} | |
| 17723 | + | |
| 17724 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/convertMatchersToTimeZone.js | |
| 17725 | +function toZoneNoon(date, timeZone, noonSafe) { | |
| 17726 | + if (!noonSafe) | |
| 17727 | + return toTimeZone(date, timeZone); | |
| 17728 | + const zoned = toTimeZone(date, timeZone); | |
| 17729 | + const noonZoned = new TZDate(zoned.getFullYear(), zoned.getMonth(), zoned.getDate(), 12, 0, 0, timeZone); | |
| 17730 | + return new Date(noonZoned.getTime()); | |
| 17731 | +} | |
| 17732 | +function convertMatcher(matcher, timeZone, noonSafe) { | |
| 17733 | + if (typeof matcher === "boolean" || typeof matcher === "function") { | |
| 17734 | + return matcher; | |
| 17735 | + } | |
| 17736 | + if (matcher instanceof Date) { | |
| 17737 | + return toZoneNoon(matcher, timeZone, noonSafe); | |
| 17738 | + } | |
| 17739 | + if (Array.isArray(matcher)) { | |
| 17740 | + return matcher.map((value) => value instanceof Date ? toZoneNoon(value, timeZone, noonSafe) : value); | |
| 17741 | + } | |
| 17742 | + if (isDateRange(matcher)) { | |
| 17743 | + return { | |
| 17744 | + ...matcher, | |
| 17745 | + from: matcher.from ? toTimeZone(matcher.from, timeZone) : matcher.from, | |
| 17746 | + to: matcher.to ? toTimeZone(matcher.to, timeZone) : matcher.to | |
| 17747 | + }; | |
| 17748 | + } | |
| 17749 | + if (isDateInterval(matcher)) { | |
| 17750 | + return { | |
| 17751 | + before: toZoneNoon(matcher.before, timeZone, noonSafe), | |
| 17752 | + after: toZoneNoon(matcher.after, timeZone, noonSafe) | |
| 17753 | + }; | |
| 17754 | + } | |
| 17755 | + if (isDateAfterType(matcher)) { | |
| 17756 | + return { | |
| 17757 | + after: toZoneNoon(matcher.after, timeZone, noonSafe) | |
| 17758 | + }; | |
| 17759 | + } | |
| 17760 | + if (isDateBeforeType(matcher)) { | |
| 17761 | + return { | |
| 17762 | + before: toZoneNoon(matcher.before, timeZone, noonSafe) | |
| 17763 | + }; | |
| 17764 | + } | |
| 17765 | + return matcher; | |
| 17766 | +} | |
| 17767 | +function convertMatchersToTimeZone(matchers, timeZone, noonSafe) { | |
| 17768 | + if (!matchers) { | |
| 17769 | + return matchers; | |
| 17770 | + } | |
| 17771 | + if (Array.isArray(matchers)) { | |
| 17772 | + return matchers.map((matcher) => convertMatcher(matcher, timeZone, noonSafe)); | |
| 17773 | + } | |
| 17774 | + return convertMatcher(matchers, timeZone, noonSafe); | |
| 17775 | +} | |
| 17776 | + | |
| 17777 | +// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/DayPicker.js | |
| 17778 | +function DayPicker(initialProps) { | |
| 17779 | + let props = initialProps; | |
| 17780 | + const timeZone = props.timeZone; | |
| 17781 | + if (timeZone) { | |
| 17782 | + props = { | |
| 17783 | + ...initialProps, | |
| 17784 | + timeZone | |
| 17785 | + }; | |
| 17786 | + if (props.today) { | |
| 17787 | + props.today = toTimeZone(props.today, timeZone); | |
| 17788 | + } | |
| 17789 | + if (props.month) { | |
| 17790 | + props.month = toTimeZone(props.month, timeZone); | |
| 17791 | + } | |
| 17792 | + if (props.defaultMonth) { | |
| 17793 | + props.defaultMonth = toTimeZone(props.defaultMonth, timeZone); | |
| 17794 | + } | |
| 17795 | + if (props.startMonth) { | |
| 17796 | + props.startMonth = toTimeZone(props.startMonth, timeZone); | |
| 17797 | + } | |
| 17798 | + if (props.endMonth) { | |
| 17799 | + props.endMonth = toTimeZone(props.endMonth, timeZone); | |
| 17800 | + } | |
| 17801 | + if (props.mode === "single" && props.selected) { | |
| 17802 | + props.selected = toTimeZone(props.selected, timeZone); | |
| 17803 | + } else if (props.mode === "multiple" && props.selected) { | |
| 17804 | + props.selected = props.selected?.map((date) => toTimeZone(date, timeZone)); | |
| 17805 | + } else if (props.mode === "range" && props.selected) { | |
| 17806 | + props.selected = { | |
| 17807 | + from: props.selected.from ? toTimeZone(props.selected.from, timeZone) : props.selected.from, | |
| 17808 | + to: props.selected.to ? toTimeZone(props.selected.to, timeZone) : props.selected.to | |
| 17809 | + }; | |
| 17810 | + } | |
| 17811 | + if (props.disabled !== void 0) { | |
| 17812 | + props.disabled = convertMatchersToTimeZone(props.disabled, timeZone); | |
| 17813 | + } | |
| 17814 | + if (props.hidden !== void 0) { | |
| 17815 | + props.hidden = convertMatchersToTimeZone(props.hidden, timeZone); | |
| 17816 | + } | |
| 17817 | + if (props.modifiers) { | |
| 17818 | + const nextModifiers = {}; | |
| 17819 | + Object.keys(props.modifiers).forEach((key) => { | |
| 17820 | + nextModifiers[key] = convertMatchersToTimeZone(props.modifiers?.[key], timeZone); | |
| 17821 | + }); | |
| 17822 | + props.modifiers = nextModifiers; | |
| 17823 | + } | |
| 17824 | + } | |
| 17825 | + const { components, formatters: formatters2, labels, dateLib, locale, classNames } = (0, import_react34.useMemo)(() => { | |
| 17826 | + const locale2 = { ...enUS2, ...props.locale }; | |
| 17827 | + const weekStartsOn = props.broadcastCalendar ? 1 : props.weekStartsOn; | |
| 17828 | + const noonOverrides = props.noonSafe && props.timeZone ? createNoonOverrides(props.timeZone, { | |
| 17829 | + weekStartsOn, | |
| 17830 | + locale: locale2 | |
| 17831 | + }) : void 0; | |
| 17832 | + const overrides = props.dateLib && noonOverrides ? { ...noonOverrides, ...props.dateLib } : props.dateLib ?? noonOverrides; | |
| 17833 | + const dateLib2 = new DateLib({ | |
| 17834 | + locale: locale2, | |
| 17835 | + weekStartsOn, | |
| 17836 | + firstWeekContainsDate: props.firstWeekContainsDate, | |
| 17837 | + useAdditionalWeekYearTokens: props.useAdditionalWeekYearTokens, | |
| 17838 | + useAdditionalDayOfYearTokens: props.useAdditionalDayOfYearTokens, | |
| 17839 | + timeZone: props.timeZone, | |
| 17840 | + numerals: props.numerals | |
| 17841 | + }, overrides); | |
| 17842 | + return { | |
| 17843 | + dateLib: dateLib2, | |
| 17844 | + components: getComponents(props.components), | |
| 17845 | + formatters: getFormatters(props.formatters), | |
| 17846 | + labels: getLabels(props.labels, dateLib2.options), | |
| 17847 | + locale: locale2, | |
| 17848 | + classNames: { ...getDefaultClassNames(), ...props.classNames } | |
| 17849 | + }; | |
| 17850 | + }, [ | |
| 17851 | + props.locale, | |
| 17852 | + props.broadcastCalendar, | |
| 17853 | + props.weekStartsOn, | |
| 17854 | + props.firstWeekContainsDate, | |
| 17855 | + props.useAdditionalWeekYearTokens, | |
| 17856 | + props.useAdditionalDayOfYearTokens, | |
| 17857 | + props.timeZone, | |
| 17858 | + props.numerals, | |
| 17859 | + props.dateLib, | |
| 17860 | + props.noonSafe, | |
| 17861 | + props.components, | |
| 17862 | + props.formatters, | |
| 17863 | + props.labels, | |
| 17864 | + props.classNames | |
| 17865 | + ]); | |
| 17866 | + if (!props.today) { | |
| 17867 | + props = { ...props, today: dateLib.today() }; | |
| 17868 | + } | |
| 17869 | + const { captionLayout, mode, navLayout, numberOfMonths = 1, onDayBlur, onDayClick, onDayFocus, onDayKeyDown, onDayMouseEnter, onDayMouseLeave, onNextClick, onPrevClick, showWeekNumber, styles } = props; | |
| 17870 | + const { formatCaption: formatCaption2, formatDay: formatDay2, formatMonthDropdown: formatMonthDropdown2, formatWeekNumber: formatWeekNumber2, formatWeekNumberHeader: formatWeekNumberHeader2, formatWeekdayName: formatWeekdayName2, formatYearDropdown: formatYearDropdown2 } = formatters2; | |
| 17871 | + const calendar = useCalendar(props, dateLib); | |
| 17872 | + const { days, months, navStart, navEnd, previousMonth, nextMonth, goToMonth } = calendar; | |
| 17873 | + const getModifiers = createGetModifiers(days, props, navStart, navEnd, dateLib); | |
| 17874 | + const { isSelected, select: select3, selected: selectedValue } = useSelection(props, dateLib) ?? {}; | |
| 17875 | + const { blur, focused, isFocusTarget, moveFocus, setFocused } = useFocus2(props, calendar, getModifiers, isSelected ?? (() => false), dateLib); | |
| 17876 | + const { labelDayButton: labelDayButton2, labelGridcell: labelGridcell2, labelGrid: labelGrid2, labelMonthDropdown: labelMonthDropdown2, labelNav: labelNav2, labelPrevious: labelPrevious2, labelNext: labelNext2, labelWeekday: labelWeekday2, labelWeekNumber: labelWeekNumber2, labelWeekNumberHeader: labelWeekNumberHeader2, labelYearDropdown: labelYearDropdown2 } = labels; | |
| 17877 | + const weekdays = (0, import_react34.useMemo)(() => getWeekdays(dateLib, props.ISOWeek, props.broadcastCalendar, props.today), [dateLib, props.ISOWeek, props.broadcastCalendar, props.today]); | |
| 17878 | + const isInteractive = mode !== void 0 || onDayClick !== void 0; | |
| 17879 | + const handlePreviousClick = (0, import_react34.useCallback)(() => { | |
| 17880 | + if (!previousMonth) | |
| 17881 | + return; | |
| 17882 | + goToMonth(previousMonth); | |
| 17883 | + onPrevClick?.(previousMonth); | |
| 17884 | + }, [previousMonth, goToMonth, onPrevClick]); | |
| 17885 | + const handleNextClick = (0, import_react34.useCallback)(() => { | |
| 17886 | + if (!nextMonth) | |
| 17887 | + return; | |
| 17888 | + goToMonth(nextMonth); | |
| 17889 | + onNextClick?.(nextMonth); | |
| 17890 | + }, [goToMonth, nextMonth, onNextClick]); | |
| 17891 | + const handleDayClick = (0, import_react34.useCallback)((day, m2) => (e) => { | |
| 17892 | + e.preventDefault(); | |
| 17893 | + e.stopPropagation(); | |
| 17894 | + setFocused(day); | |
| 17895 | + if (m2.disabled) { | |
| 17896 | + return; | |
| 17897 | + } | |
| 17898 | + select3?.(day.date, m2, e); | |
| 17899 | + onDayClick?.(day.date, m2, e); | |
| 17900 | + }, [select3, onDayClick, setFocused]); | |
| 17901 | + const handleDayFocus = (0, import_react34.useCallback)((day, m2) => (e) => { | |
| 17902 | + setFocused(day); | |
| 17903 | + onDayFocus?.(day.date, m2, e); | |
| 17904 | + }, [onDayFocus, setFocused]); | |
| 17905 | + const handleDayBlur = (0, import_react34.useCallback)((day, m2) => (e) => { | |
| 17906 | + blur(); | |
| 17907 | + onDayBlur?.(day.date, m2, e); | |
| 17908 | + }, [blur, onDayBlur]); | |
| 17909 | + const handleDayKeyDown = (0, import_react34.useCallback)((day, modifiers) => (e) => { | |
| 17910 | + const keyMap = { | |
| 17911 | + ArrowLeft: [ | |
| 17912 | + e.shiftKey ? "month" : "day", | |
| 17913 | + props.dir === "rtl" ? "after" : "before" | |
| 17914 | + ], | |
| 17915 | + ArrowRight: [ | |
| 17916 | + e.shiftKey ? "month" : "day", | |
| 17917 | + props.dir === "rtl" ? "before" : "after" | |
| 17918 | + ], | |
| 17919 | + ArrowDown: [e.shiftKey ? "year" : "week", "after"], | |
| 17920 | + ArrowUp: [e.shiftKey ? "year" : "week", "before"], | |
| 17921 | + PageUp: [e.shiftKey ? "year" : "month", "before"], | |
| 17922 | + PageDown: [e.shiftKey ? "year" : "month", "after"], | |
| 17923 | + Home: ["startOfWeek", "before"], | |
| 17924 | + End: ["endOfWeek", "after"] | |
| 17925 | + }; | |
| 17926 | + if (keyMap[e.key]) { | |
| 17927 | + e.preventDefault(); | |
| 17928 | + e.stopPropagation(); | |
| 17929 | + const [moveBy, moveDir] = keyMap[e.key]; | |
| 17930 | + moveFocus(moveBy, moveDir); | |
| 17931 | + } | |
| 17932 | + onDayKeyDown?.(day.date, modifiers, e); | |
| 17933 | + }, [moveFocus, onDayKeyDown, props.dir]); | |
| 17934 | + const handleDayMouseEnter = (0, import_react34.useCallback)((day, modifiers) => (e) => { | |
| 17935 | + onDayMouseEnter?.(day.date, modifiers, e); | |
| 17936 | + }, [onDayMouseEnter]); | |
| 17937 | + const handleDayMouseLeave = (0, import_react34.useCallback)((day, modifiers) => (e) => { | |
| 17938 | + onDayMouseLeave?.(day.date, modifiers, e); | |
| 17939 | + }, [onDayMouseLeave]); | |
| 17940 | + const handleMonthChange = (0, import_react34.useCallback)((date, monthOffset) => (e) => { | |
| 17941 | + const selectedMonth = Number(e.target.value); | |
| 17942 | + const month = dateLib.setMonth(dateLib.startOfMonth(date), selectedMonth); | |
| 17943 | + goToMonth(dateLib.addMonths(month, -monthOffset)); | |
| 17944 | + }, [dateLib, goToMonth]); | |
| 17945 | + const handleYearChange = (0, import_react34.useCallback)((date, monthOffset) => (e) => { | |
| 17946 | + const selectedYear = Number(e.target.value); | |
| 17947 | + const month = dateLib.setYear(dateLib.startOfMonth(date), selectedYear); | |
| 17948 | + goToMonth(dateLib.addMonths(month, -monthOffset)); | |
| 17949 | + }, [dateLib, goToMonth]); | |
| 17950 | + const { className, style } = (0, import_react34.useMemo)(() => ({ | |
| 17951 | + className: [classNames[UI.Root], props.className].filter(Boolean).join(" "), | |
| 17952 | + style: { ...styles?.[UI.Root], ...props.style } | |
| 17953 | + }), [classNames, props.className, props.style, styles]); | |
| 17954 | + const dataAttributes = getDataAttributes(props); | |
| 17955 | + const getDropdownStyle = (dropdown) => { | |
| 17956 | + const dropdownStyle = styles?.[UI.Dropdown]; | |
| 17957 | + const specificDropdownStyle = styles?.[dropdown]; | |
| 17958 | + if (!dropdownStyle && !specificDropdownStyle) { | |
| 17959 | + return void 0; | |
| 17960 | + } | |
| 17961 | + return { | |
| 17962 | + ...dropdownStyle, | |
| 17963 | + ...specificDropdownStyle | |
| 17964 | + }; | |
| 17965 | + }; | |
| 17966 | + const rootElRef = (0, import_react34.useRef)(null); | |
| 17967 | + useAnimation(rootElRef, Boolean(props.animate), { | |
| 17968 | + classNames, | |
| 17969 | + months, | |
| 17970 | + focused, | |
| 17971 | + dateLib | |
| 17972 | + }); | |
| 17973 | + const contextValue = { | |
| 17974 | + dayPickerProps: props, | |
| 17975 | + selected: selectedValue, | |
| 17976 | + select: select3, | |
| 17977 | + isSelected, | |
| 17978 | + months, | |
| 17979 | + nextMonth, | |
| 17980 | + previousMonth, | |
| 17981 | + goToMonth, | |
| 17982 | + getModifiers, | |
| 17983 | + components, | |
| 17984 | + classNames, | |
| 17985 | + styles, | |
| 17986 | + labels, | |
| 17987 | + formatters: formatters2 | |
| 17988 | + }; | |
| 17989 | + return import_react34.default.createElement( | |
| 17990 | + dayPickerContext.Provider, | |
| 17991 | + { value: contextValue }, | |
| 17992 | + import_react34.default.createElement( | |
| 17993 | + components.Root, | |
| 17994 | + { rootRef: props.animate ? rootElRef : void 0, className, style, dir: props.dir, id: props.id, lang: props.lang ?? locale.code, nonce: props.nonce, title: props.title, role: props.role, "aria-label": props["aria-label"], "aria-labelledby": props["aria-labelledby"], ...dataAttributes }, | |
| 17995 | + import_react34.default.createElement( | |
| 17996 | + components.Months, | |
| 17997 | + { className: classNames[UI.Months], style: styles?.[UI.Months] }, | |
| 17998 | + !props.hideNavigation && !navLayout && import_react34.default.createElement(components.Nav, { "data-animated-nav": props.animate ? "true" : void 0, className: classNames[UI.Nav], style: styles?.[UI.Nav], "aria-label": labelNav2(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth, nextMonth }), | |
| 17999 | + months.map((calendarMonth, displayIndex) => { | |
| 18000 | + const monthOffset = props.reverseMonths ? months.length - 1 - displayIndex : displayIndex; | |
| 18001 | + return import_react34.default.createElement( | |
| 18002 | + components.Month, | |
| 18003 | + { | |
| 18004 | + "data-animated-month": props.animate ? "true" : void 0, | |
| 18005 | + className: classNames[UI.Month], | |
| 18006 | + style: styles?.[UI.Month], | |
| 18007 | + // biome-ignore lint/suspicious/noArrayIndexKey: breaks animation | |
| 18008 | + key: displayIndex, | |
| 18009 | + displayIndex, | |
| 18010 | + calendarMonth | |
| 18011 | + }, | |
| 18012 | + navLayout === "around" && !props.hideNavigation && displayIndex === 0 && import_react34.default.createElement( | |
| 18013 | + components.PreviousMonthButton, | |
| 18014 | + { type: "button", className: classNames[UI.PreviousMonthButton], style: styles?.[UI.PreviousMonthButton], tabIndex: previousMonth ? void 0 : -1, "aria-disabled": previousMonth ? void 0 : true, "aria-label": labelPrevious2(previousMonth), onClick: handlePreviousClick, "data-animated-button": props.animate ? "true" : void 0 }, | |
| 18015 | + import_react34.default.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: props.dir === "rtl" ? "right" : "left" }) | |
| 18016 | + ), | |
| 18017 | + import_react34.default.createElement(components.MonthCaption, { "data-animated-caption": props.animate ? "true" : void 0, className: classNames[UI.MonthCaption], style: styles?.[UI.MonthCaption], calendarMonth, displayIndex }, captionLayout?.startsWith("dropdown") ? import_react34.default.createElement( | |
| 18018 | + components.DropdownNav, | |
| 18019 | + { className: classNames[UI.Dropdowns], style: styles?.[UI.Dropdowns] }, | |
| 18020 | + (() => { | |
| 18021 | + const monthControl = captionLayout === "dropdown" || captionLayout === "dropdown-months" ? import_react34.default.createElement(components.MonthsDropdown, { key: "month", className: classNames[UI.MonthsDropdown], "aria-label": labelMonthDropdown2(), disabled: Boolean(props.disableNavigation), onChange: handleMonthChange(calendarMonth.date, monthOffset), options: getMonthOptions(calendarMonth.date, navStart, navEnd, formatters2, dateLib), style: getDropdownStyle(UI.MonthsDropdown), value: dateLib.getMonth(calendarMonth.date) }) : import_react34.default.createElement("span", { key: "month" }, formatMonthDropdown2(calendarMonth.date, dateLib)); | |
| 18022 | + const yearControl = captionLayout === "dropdown" || captionLayout === "dropdown-years" ? import_react34.default.createElement(components.YearsDropdown, { key: "year", className: classNames[UI.YearsDropdown], "aria-label": labelYearDropdown2(dateLib.options), disabled: Boolean(props.disableNavigation), onChange: handleYearChange(calendarMonth.date, monthOffset), options: getYearOptions(navStart, navEnd, formatters2, dateLib, Boolean(props.reverseYears)), style: getDropdownStyle(UI.YearsDropdown), value: dateLib.getYear(calendarMonth.date) }) : import_react34.default.createElement("span", { key: "year" }, formatYearDropdown2(calendarMonth.date, dateLib)); | |
| 18023 | + const controls = dateLib.getMonthYearOrder() === "year-first" ? [yearControl, monthControl] : [monthControl, yearControl]; | |
| 18024 | + return controls; | |
| 18025 | + })(), | |
| 18026 | + import_react34.default.createElement("span", { role: "status", "aria-live": "polite", style: { | |
| 18027 | + border: 0, | |
| 18028 | + clip: "rect(0 0 0 0)", | |
| 18029 | + height: "1px", | |
| 18030 | + margin: "-1px", | |
| 18031 | + overflow: "hidden", | |
| 18032 | + padding: 0, | |
| 18033 | + position: "absolute", | |
| 18034 | + width: "1px", | |
| 18035 | + whiteSpace: "nowrap", | |
| 18036 | + wordWrap: "normal" | |
| 18037 | + } }, formatCaption2(calendarMonth.date, dateLib.options, dateLib)) | |
| 18038 | + ) : import_react34.default.createElement(components.CaptionLabel, { className: classNames[UI.CaptionLabel], style: styles?.[UI.CaptionLabel], role: "status", "aria-live": "polite" }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))), | |
| 18039 | + navLayout === "around" && !props.hideNavigation && displayIndex === numberOfMonths - 1 && import_react34.default.createElement( | |
| 18040 | + components.NextMonthButton, | |
| 18041 | + { type: "button", className: classNames[UI.NextMonthButton], style: styles?.[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick, "data-animated-button": props.animate ? "true" : void 0 }, | |
| 18042 | + import_react34.default.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" }) | |
| 18043 | + ), | |
| 18044 | + displayIndex === numberOfMonths - 1 && navLayout === "after" && !props.hideNavigation && import_react34.default.createElement(components.Nav, { "data-animated-nav": props.animate ? "true" : void 0, className: classNames[UI.Nav], style: styles?.[UI.Nav], "aria-label": labelNav2(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth, nextMonth }), | |
| 18045 | + import_react34.default.createElement( | |
| 18046 | + components.MonthGrid, | |
| 18047 | + { role: "grid", "aria-multiselectable": mode === "multiple" || mode === "range", "aria-label": labelGrid2(calendarMonth.date, dateLib.options, dateLib) || void 0, className: classNames[UI.MonthGrid], style: styles?.[UI.MonthGrid] }, | |
| 18048 | + !props.hideWeekdays && import_react34.default.createElement( | |
| 18049 | + components.Weekdays, | |
| 18050 | + { "data-animated-weekdays": props.animate ? "true" : void 0, className: classNames[UI.Weekdays], style: styles?.[UI.Weekdays] }, | |
| 18051 | + showWeekNumber && import_react34.default.createElement(components.WeekNumberHeader, { "aria-label": labelWeekNumberHeader2(dateLib.options), className: classNames[UI.WeekNumberHeader], style: styles?.[UI.WeekNumberHeader], scope: "col" }, formatWeekNumberHeader2()), | |
| 18052 | + weekdays.map((weekday) => import_react34.default.createElement(components.Weekday, { "aria-label": labelWeekday2(weekday, dateLib.options, dateLib), className: classNames[UI.Weekday], key: String(weekday), style: styles?.[UI.Weekday], scope: "col" }, formatWeekdayName2(weekday, dateLib.options, dateLib))) | |
| 18053 | + ), | |
| 18054 | + import_react34.default.createElement(components.Weeks, { "data-animated-weeks": props.animate ? "true" : void 0, className: classNames[UI.Weeks], style: styles?.[UI.Weeks] }, calendarMonth.weeks.map((week) => { | |
| 18055 | + return import_react34.default.createElement( | |
| 18056 | + components.Week, | |
| 18057 | + { className: classNames[UI.Week], key: week.weekNumber, style: styles?.[UI.Week], week }, | |
| 18058 | + showWeekNumber && import_react34.default.createElement(components.WeekNumber, { week, style: styles?.[UI.WeekNumber], "aria-label": labelWeekNumber2(week.weekNumber, { | |
| 18059 | + locale | |
| 18060 | + }), className: classNames[UI.WeekNumber], scope: "row", role: "rowheader" }, formatWeekNumber2(week.weekNumber, dateLib)), | |
| 18061 | + week.days.map((day) => { | |
| 18062 | + const { date } = day; | |
| 18063 | + const modifiers = getModifiers(day); | |
| 18064 | + modifiers[DayFlag.focused] = !modifiers.hidden && Boolean(focused?.isEqualTo(day)); | |
| 18065 | + modifiers[SelectionState.selected] = isSelected?.(date) || modifiers.selected; | |
| 18066 | + if (isDateRange(selectedValue)) { | |
| 18067 | + const { from, to } = selectedValue; | |
| 18068 | + modifiers[SelectionState.range_start] = Boolean(from && to && dateLib.isSameDay(date, from)); | |
| 18069 | + modifiers[SelectionState.range_end] = Boolean(from && to && dateLib.isSameDay(date, to)); | |
| 18070 | + modifiers[SelectionState.range_middle] = rangeIncludesDate(selectedValue, date, true, dateLib); | |
| 18071 | + } | |
| 18072 | + const style2 = getStyleForModifiers(modifiers, styles, props.modifiersStyles); | |
| 18073 | + const className2 = getClassNamesForModifiers(modifiers, classNames, props.modifiersClassNames); | |
| 18074 | + const ariaLabel = !isInteractive && !modifiers.hidden ? labelGridcell2(date, modifiers, dateLib.options, dateLib) : void 0; | |
| 18075 | + return import_react34.default.createElement(components.Day, { key: `${day.isoDate}_${day.displayMonthId}`, day, modifiers, className: className2.join(" "), style: style2, role: "gridcell", "aria-selected": modifiers.selected || void 0, "aria-label": ariaLabel, "data-day": day.isoDate, "data-month": day.outside ? day.dateMonthId : void 0, "data-selected": modifiers.selected || void 0, "data-disabled": modifiers.disabled || void 0, "data-hidden": modifiers.hidden || void 0, "data-outside": day.outside || void 0, "data-focused": modifiers.focused || void 0, "data-today": modifiers.today || void 0 }, !modifiers.hidden && isInteractive ? import_react34.default.createElement(components.DayButton, { className: classNames[UI.DayButton], style: styles?.[UI.DayButton], type: "button", day, modifiers, disabled: !modifiers.focused && modifiers.disabled || void 0, "aria-disabled": modifiers.focused && modifiers.disabled || void 0, tabIndex: isFocusTarget(day) ? 0 : -1, "aria-label": labelDayButton2(date, modifiers, dateLib.options, dateLib), onClick: handleDayClick(day, modifiers), onBlur: handleDayBlur(day, modifiers), onFocus: handleDayFocus(day, modifiers), onKeyDown: handleDayKeyDown(day, modifiers), onMouseEnter: handleDayMouseEnter(day, modifiers), onMouseLeave: handleDayMouseLeave(day, modifiers) }, formatDay2(date, dateLib.options, dateLib)) : !modifiers.hidden && formatDay2(day.date, dateLib.options, dateLib)); | |
| 18076 | + }) | |
| 18077 | + ); | |
| 18078 | + })) | |
| 18079 | + ) | |
| 18080 | + ); | |
| 18081 | + }) | |
| 18082 | + ), | |
| 18083 | + props.footer && import_react34.default.createElement(components.Footer, { className: classNames[UI.Footer], style: styles?.[UI.Footer], role: "status", "aria-live": "polite" }, props.footer) | |
| 18084 | + ) | |
| 18085 | + ); | |
| 18086 | +} | |
| 18087 | + | |
| 18088 | +// packages/ui/build-module/calendar/calendar.mjs | |
| 18089 | +var import_element26 = __toESM(require_element(), 1); | |
| 18090 | + | |
| 18091 | +// packages/ui/build-module/calendar/utils/components.mjs | |
| 18092 | +var import_element22 = __toESM(require_element(), 1); | |
| 18093 | +var import_compose = __toESM(require_compose(), 1); | |
| 18094 | +var import_i18n4 = __toESM(require_i18n(), 1); | |
| 18095 | + | |
| 18096 | +// packages/ui/build-module/icon-button/icon-button.mjs | |
| 18097 | +var import_element20 = __toESM(require_element(), 1); | |
| 18098 | +var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1); | |
| 18099 | +var STYLE_HASH_ATTRIBUTE7 = "data-wp-hash"; | |
| 18100 | +function getRuntime7() { | |
| 18101 | + const globalScope = globalThis; | |
| 18102 | + if (globalScope.__wpStyleRuntime) { | |
| 18103 | + return globalScope.__wpStyleRuntime; | |
| 18104 | + } | |
| 18105 | + globalScope.__wpStyleRuntime = { | |
| 18106 | + documents: /* @__PURE__ */ new Map(), | |
| 18107 | + styles: /* @__PURE__ */ new Map(), | |
| 18108 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 18109 | + }; | |
| 18110 | + if (typeof document !== "undefined") { | |
| 18111 | + registerDocument7(document); | |
| 18112 | + } | |
| 18113 | + return globalScope.__wpStyleRuntime; | |
| 18114 | +} | |
| 18115 | +function documentContainsStyleHash7(targetDocument, hash) { | |
| 18116 | + if (!targetDocument.head) { | |
| 18117 | + return false; | |
| 18118 | + } | |
| 18119 | + for (const style of targetDocument.head.querySelectorAll( | |
| 18120 | + `style[${STYLE_HASH_ATTRIBUTE7}]` | |
| 18121 | + )) { | |
| 18122 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE7) === hash) { | |
| 18123 | + return true; | |
| 18124 | + } | |
| 18125 | + } | |
| 18126 | + return false; | |
| 18127 | +} | |
| 18128 | +function injectStyle7(targetDocument, hash, css) { | |
| 18129 | + if (!targetDocument.head) { | |
| 18130 | + return; | |
| 18131 | + } | |
| 18132 | + const runtime = getRuntime7(); | |
| 18133 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 18134 | + if (!injectedStyles) { | |
| 18135 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 18136 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 18137 | + } | |
| 18138 | + if (injectedStyles.has(hash)) { | |
| 18139 | + return; | |
| 18140 | + } | |
| 18141 | + if (documentContainsStyleHash7(targetDocument, hash)) { | |
| 18142 | + injectedStyles.add(hash); | |
| 18143 | + return; | |
| 18144 | + } | |
| 18145 | + const style = targetDocument.createElement("style"); | |
| 18146 | + style.setAttribute(STYLE_HASH_ATTRIBUTE7, hash); | |
| 18147 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 18148 | + targetDocument.head.appendChild(style); | |
| 18149 | + injectedStyles.add(hash); | |
| 18150 | +} | |
| 18151 | +function registerDocument7(targetDocument) { | |
| 18152 | + const runtime = getRuntime7(); | |
| 18153 | + runtime.documents.set( | |
| 18154 | + targetDocument, | |
| 18155 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 18156 | + ); | |
| 18157 | + for (const [hash, css] of runtime.styles) { | |
| 18158 | + injectStyle7(targetDocument, hash, css); | |
| 18159 | + } | |
| 18160 | + return () => { | |
| 18161 | + const count = runtime.documents.get(targetDocument); | |
| 18162 | + if (count === void 0) { | |
| 18163 | + return; | |
| 18164 | + } | |
| 18165 | + if (count <= 1) { | |
| 18166 | + runtime.documents.delete(targetDocument); | |
| 18167 | + return; | |
| 18168 | + } | |
| 18169 | + runtime.documents.set(targetDocument, count - 1); | |
| 18170 | + }; | |
| 18171 | +} | |
| 18172 | +function registerStyle7(hash, css) { | |
| 18173 | + const runtime = getRuntime7(); | |
| 18174 | + runtime.styles.set(hash, css); | |
| 18175 | + for (const targetDocument of runtime.documents.keys()) { | |
| 18176 | + injectStyle7(targetDocument, hash, css); | |
| 18177 | + } | |
| 18178 | +} | |
| 18179 | +if (typeof process === "undefined" || true) { | |
| 18180 | + registerStyle7("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}}}"); | |
| 18181 | +} | |
| 18182 | +var style_default6 = { "icon-button": "_28cfdc260e755391__icon-button", "icon": "f1c70d719989a85a__icon" }; | |
| 18183 | +var IconButton = (0, import_element20.forwardRef)( | |
| 18184 | + function IconButton2({ | |
| 18185 | + label, | |
| 18186 | + className, | |
| 18187 | + // Prevent accidental forwarding of `children` | |
| 18188 | + children: _children, | |
| 18189 | + disabled: disabled2, | |
| 18190 | + focusableWhenDisabled = true, | |
| 18191 | + icon, | |
| 18192 | + size: size4, | |
| 18193 | + shortcut, | |
| 18194 | + positioner, | |
| 18195 | + "aria-describedby": ariaDescribedBy, | |
| 18196 | + "aria-keyshortcuts": ariaKeyShortcuts, | |
| 18197 | + ...restProps | |
| 18198 | + }, ref) { | |
| 18199 | + const classes = clsx_default(style_default6["icon-button"], className); | |
| 18200 | + const { descriptionId, targetProps } = useKeyboardShortcutProps({ | |
| 18201 | + "aria-describedby": ariaDescribedBy, | |
| 18202 | + "aria-keyshortcuts": ariaKeyShortcuts, | |
| 18203 | + shortcut | |
| 18204 | + }); | |
| 18205 | + return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Root, { children: [ | |
| 18206 | + /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)( | |
| 18207 | + Trigger, | |
| 18208 | + { | |
| 18209 | + ref, | |
| 18210 | + ...targetProps, | |
| 18211 | + disabled: disabled2 && !focusableWhenDisabled, | |
| 18212 | + render: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( | |
| 18213 | + Button4, | |
| 18214 | + { | |
| 18215 | + ...restProps, | |
| 18216 | + size: size4, | |
| 18217 | + "aria-label": label, | |
| 18218 | + disabled: disabled2, | |
| 18219 | + focusableWhenDisabled | |
| 18220 | + } | |
| 18221 | + ), | |
| 18222 | + className: classes, | |
| 18223 | + children: [ | |
| 18224 | + /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon, { icon, size: 24, className: style_default6.icon }), | |
| 18225 | + shortcut && descriptionId && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( | |
| 18226 | + KeyboardShortcutDescription, | |
| 18227 | + { | |
| 18228 | + descriptionId, | |
| 18229 | + shortcut | |
| 18230 | + } | |
| 18231 | + ) | |
| 18232 | + ] | |
| 18233 | + } | |
| 18234 | + ), | |
| 18235 | + /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Popup, { positioner, children: [ | |
| 18236 | + label, | |
| 18237 | + shortcut && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [ | |
| 18238 | + " ", | |
| 18239 | + /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KeyboardShortcutDisplay, { shortcut }) | |
| 18240 | + ] }) | |
| 18241 | + ] }) | |
| 18242 | + ] }); | |
| 18243 | + } | |
| 18244 | +); | |
| 18245 | + | |
| 18246 | +// packages/ui/build-module/calendar/utils/root-context.mjs | |
| 18247 | +var import_element21 = __toESM(require_element(), 1); | |
| 18248 | +var RootContext = (0, import_element21.createContext)({}); | |
| 18249 | + | |
| 18250 | +// packages/ui/build-module/calendar/utils/components.mjs | |
| 18251 | +var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1); | |
| 18252 | +var PreviewDashStartAndEnd = () => { | |
| 18253 | + return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( | |
| 18254 | + "svg", | |
| 18255 | + { | |
| 18256 | + viewBox: "0 0 32 32", | |
| 18257 | + xmlns: "http://www.w3.org/2000/svg", | |
| 18258 | + fill: "none", | |
| 18259 | + stroke: "currentColor", | |
| 18260 | + strokeDasharray: "3.7677", | |
| 18261 | + strokeDashoffset: "3.2", | |
| 18262 | + strokeWidth: "1", | |
| 18263 | + children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("path", { d: "M29.5,0.5 h-27 a2,2 0 0 0 -2,2 v27 a2,2 0 0 0 2,2 h27 a2,2 0 0 0 2,-2 v-27 a2,2 0 0 0 -2,-2" }) | |
| 18264 | + } | |
| 18265 | + ); | |
| 18266 | +}; | |
| 18267 | +var PreviewDashStart = () => { | |
| 18268 | + return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( | |
| 18269 | + "svg", | |
| 18270 | + { | |
| 18271 | + viewBox: "0 0 32 32", | |
| 18272 | + xmlns: "http://www.w3.org/2000/svg", | |
| 18273 | + fill: "none", | |
| 18274 | + stroke: "currentColor", | |
| 18275 | + strokeDasharray: "3.84516", | |
| 18276 | + strokeDashoffset: "1.9226", | |
| 18277 | + strokeWidth: "1", | |
| 18278 | + children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("path", { d: "M32,0.5 h-29.5 a2,2 0 0 0 -2,2 v27 a2,2 0 0 0 2,2 h30" }) | |
| 18279 | + } | |
| 18280 | + ); | |
| 18281 | +}; | |
| 18282 | +var PreviewDashMiddle = () => { | |
| 18283 | + return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)( | |
| 18284 | + "svg", | |
| 18285 | + { | |
| 18286 | + viewBox: "0 0 32 32", | |
| 18287 | + xmlns: "http://www.w3.org/2000/svg", | |
| 18288 | + fill: "none", | |
| 18289 | + stroke: "currentColor", | |
| 18290 | + strokeDasharray: "3.9 4", | |
| 18291 | + strokeDashoffset: "2", | |
| 18292 | + strokeWidth: "1", | |
| 18293 | + children: [ | |
| 18294 | + /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { x1: "0", y1: "0.5", x2: "100", y2: "0.5" }), | |
| 18295 | + /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { x1: "0", y1: "31.5", x2: "100", y2: "31.5" }) | |
| 18296 | + ] | |
| 18297 | + } | |
| 18298 | + ); | |
| 18299 | +}; | |
| 18300 | +var PreviewDashEnd = () => { | |
| 18301 | + return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( | |
| 18302 | + "svg", | |
| 18303 | + { | |
| 18304 | + viewBox: "0 0 32 32", | |
| 18305 | + xmlns: "http://www.w3.org/2000/svg", | |
| 18306 | + fill: "none", | |
| 18307 | + stroke: "currentColor", | |
| 18308 | + strokeDasharray: "3.84516", | |
| 18309 | + strokeDashoffset: "1.9226", | |
| 18310 | + strokeWidth: "1", | |
| 18311 | + children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("path", { d: "M0,0.5 h29.5 a2,2 0 0 1 2,2 v27 a2,2 0 0 1 -2,2 h-29.5" }) | |
| 18312 | + } | |
| 18313 | + ); | |
| 18314 | +}; | |
| 18315 | +function Day2(props) { | |
| 18316 | + const { day, modifiers, children, ...tdProps } = props; | |
| 18317 | + let PreviewDash; | |
| 18318 | + if (modifiers.preview_start && modifiers.preview_end) { | |
| 18319 | + PreviewDash = PreviewDashStartAndEnd; | |
| 18320 | + } else if (modifiers.preview_start) { | |
| 18321 | + PreviewDash = PreviewDashStart; | |
| 18322 | + } else if (modifiers.preview_end) { | |
| 18323 | + PreviewDash = PreviewDashEnd; | |
| 18324 | + } else if (modifiers.preview) { | |
| 18325 | + PreviewDash = PreviewDashMiddle; | |
| 18326 | + } | |
| 18327 | + return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("td", { ...tdProps, children: [ | |
| 18328 | + PreviewDash && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PreviewDash, {}), | |
| 18329 | + children | |
| 18330 | + ] }); | |
| 18331 | +} | |
| 18332 | +function Root3({ rootRef, ...props }) { | |
| 18333 | + const { render: render4, ref, role, defaultAriaLabel } = (0, import_element22.useContext)(RootContext); | |
| 18334 | + const { months, labels } = useDayPicker(); | |
| 18335 | + const hasExplicitLabel = props["aria-label"] !== void 0 || props["aria-labelledby"] !== void 0; | |
| 18336 | + let ariaLabel = props["aria-label"]; | |
| 18337 | + if (!hasExplicitLabel && defaultAriaLabel && role === "application") { | |
| 18338 | + const currentMonth = months[0]; | |
| 18339 | + ariaLabel = currentMonth ? (0, import_i18n4.sprintf)( | |
| 18340 | + // translators: 1: Calendar type. 2: Current month and year. | |
| 18341 | + (0, import_i18n4.__)("%1$s, %2$s"), | |
| 18342 | + defaultAriaLabel, | |
| 18343 | + labels.labelGrid(currentMonth.date) | |
| 18344 | + ) : defaultAriaLabel; | |
| 18345 | + } | |
| 18346 | + const mergedRef = (0, import_compose.useMergeRefs)([rootRef ?? null, ref ?? null]); | |
| 18347 | + return useRender({ | |
| 18348 | + render: render4, | |
| 18349 | + defaultTagName: "div", | |
| 18350 | + ref: mergedRef, | |
| 18351 | + props: { ...props, role, "aria-label": ariaLabel } | |
| 18352 | + }); | |
| 18353 | +} | |
| 18354 | +function NavButton({ | |
| 18355 | + icon, | |
| 18356 | + className, | |
| 18357 | + children: _children, | |
| 18358 | + "aria-label": label, | |
| 18359 | + "aria-disabled": ariaDisabled, | |
| 18360 | + ...props | |
| 18361 | +}) { | |
| 18362 | + return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( | |
| 18363 | + IconButton, | |
| 18364 | + { | |
| 18365 | + ...props, | |
| 18366 | + className, | |
| 18367 | + label, | |
| 18368 | + icon, | |
| 18369 | + variant: "minimal", | |
| 18370 | + tone: "neutral", | |
| 18371 | + size: "compact", | |
| 18372 | + disabled: ariaDisabled === true || ariaDisabled === "true", | |
| 18373 | + focusableWhenDisabled: true | |
| 18374 | + } | |
| 18375 | + ); | |
| 18376 | +} | |
| 18377 | +function PreviousMonthButton2(props) { | |
| 18378 | + return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(NavButton, { ...props, icon: chevron_left_default }); | |
| 18379 | +} | |
| 18380 | +function NextMonthButton2(props) { | |
| 18381 | + return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(NavButton, { ...props, icon: chevron_right_default }); | |
| 18382 | +} | |
| 18383 | + | |
| 18384 | +// packages/ui/build-module/calendar/utils/constants.mjs | |
| 18385 | +var STYLE_HASH_ATTRIBUTE8 = "data-wp-hash"; | |
| 18386 | +function getRuntime8() { | |
| 18387 | + const globalScope = globalThis; | |
| 18388 | + if (globalScope.__wpStyleRuntime) { | |
| 18389 | + return globalScope.__wpStyleRuntime; | |
| 18390 | + } | |
| 18391 | + globalScope.__wpStyleRuntime = { | |
| 18392 | + documents: /* @__PURE__ */ new Map(), | |
| 18393 | + styles: /* @__PURE__ */ new Map(), | |
| 18394 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 18395 | + }; | |
| 18396 | + if (typeof document !== "undefined") { | |
| 18397 | + registerDocument8(document); | |
| 18398 | + } | |
| 18399 | + return globalScope.__wpStyleRuntime; | |
| 18400 | +} | |
| 18401 | +function documentContainsStyleHash8(targetDocument, hash) { | |
| 18402 | + if (!targetDocument.head) { | |
| 18403 | + return false; | |
| 18404 | + } | |
| 18405 | + for (const style of targetDocument.head.querySelectorAll( | |
| 18406 | + `style[${STYLE_HASH_ATTRIBUTE8}]` | |
| 18407 | + )) { | |
| 18408 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE8) === hash) { | |
| 18409 | + return true; | |
| 18410 | + } | |
| 18411 | + } | |
| 18412 | + return false; | |
| 18413 | +} | |
| 18414 | +function injectStyle8(targetDocument, hash, css) { | |
| 18415 | + if (!targetDocument.head) { | |
| 18416 | + return; | |
| 18417 | + } | |
| 18418 | + const runtime = getRuntime8(); | |
| 18419 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 18420 | + if (!injectedStyles) { | |
| 18421 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 18422 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 18423 | + } | |
| 18424 | + if (injectedStyles.has(hash)) { | |
| 18425 | + return; | |
| 18426 | + } | |
| 18427 | + if (documentContainsStyleHash8(targetDocument, hash)) { | |
| 18428 | + injectedStyles.add(hash); | |
| 18429 | + return; | |
| 18430 | + } | |
| 18431 | + const style = targetDocument.createElement("style"); | |
| 18432 | + style.setAttribute(STYLE_HASH_ATTRIBUTE8, hash); | |
| 18433 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 18434 | + targetDocument.head.appendChild(style); | |
| 18435 | + injectedStyles.add(hash); | |
| 18436 | +} | |
| 18437 | +function registerDocument8(targetDocument) { | |
| 18438 | + const runtime = getRuntime8(); | |
| 18439 | + runtime.documents.set( | |
| 18440 | + targetDocument, | |
| 18441 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 18442 | + ); | |
| 18443 | + for (const [hash, css] of runtime.styles) { | |
| 18444 | + injectStyle8(targetDocument, hash, css); | |
| 18445 | + } | |
| 18446 | + return () => { | |
| 18447 | + const count = runtime.documents.get(targetDocument); | |
| 18448 | + if (count === void 0) { | |
| 18449 | + return; | |
| 18450 | + } | |
| 18451 | + if (count <= 1) { | |
| 18452 | + runtime.documents.delete(targetDocument); | |
| 18453 | + return; | |
| 18454 | + } | |
| 18455 | + runtime.documents.set(targetDocument, count - 1); | |
| 18456 | + }; | |
| 18457 | +} | |
| 18458 | +function registerStyle8(hash, css) { | |
| 18459 | + const runtime = getRuntime8(); | |
| 18460 | + runtime.styles.set(hash, css); | |
| 18461 | + for (const targetDocument of runtime.documents.keys()) { | |
| 18462 | + injectStyle8(targetDocument, hash, css); | |
| 18463 | + } | |
| 18464 | +} | |
| 18465 | +if (typeof process === "undefined" || true) { | |
| 18466 | + registerStyle8("9d2212290a", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._2c7ac60ba97b3411__root{--wp-ui-calendar-cell-size:var(--wpds-dimension-size-md,32px);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:inline-block;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);font-weight:var(--wpds-typography-font-weight-default,400);position:relative;z-index:0}._172c492625235710__day{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);padding:0;position:relative;&:has(._1b64226e315835f8__day-button:disabled){color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&:has(._1b64226e315835f8__day-button:focus-visible),&:has(._1b64226e315835f8__day-button:hover:not(:disabled)){color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}}._1b64226e315835f8__day-button{align-items:center;background:none;border:none;border-radius:var(--wpds-border-radius-sm,2px);color:inherit;cursor:var(--wpds-cursor-control,pointer);display:flex;font:inherit;font-variant-numeric:tabular-nums;height:var(--wp-ui-calendar-cell-size);justify-content:center;margin:0;padding:0;position:relative;width:var(--wp-ui-calendar-cell-size);&:before{background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);border:none;border-radius:var(--wpds-border-radius-sm,2px);z-index:-1}&:after,&:before{content:"";inset:0;position:absolute}&:after{pointer-events:none;z-index:1}&:disabled{cursor:revert;&:before{background-color:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000)}@media (forced-colors:active){text-decoration:line-through}}&:focus-visible:before,&:hover:not(:disabled):before{background-color:var(--wpds-color-background-interactive-neutral-weak-active,#ededed)}}._66b9a8120581fd4b__caption-label{align-items:center;border:0;display:inline-flex;position:relative;text-transform:capitalize;white-space:nowrap;z-index:1}._2c7ac60ba97b3411__root[dir=rtl] ._395a75bb1930f57e__nav-button{transform:rotate(180deg);transform-origin:50%}._337e5337d49b7f3d__month-caption{align-content:center;display:flex;height:var(--wp-ui-calendar-cell-size);justify-content:center;margin-bottom:var(--wpds-dimension-gap-md,12px)}._110e46230c68e498__months{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-lg,16px);justify-content:center;max-width:fit-content;position:relative}._92915239fedb1fea__month-grid{border-collapse:separate;border-spacing:0 var(--wpds-dimension-gap-xs,4px)}._66b1d4a7b488b496__nav{align-items:center;display:flex;height:var(--wp-ui-calendar-cell-size);inset-block-start:0;inset-inline-end:0;inset-inline-start:0;justify-content:space-between;position:absolute}._7207199709ca5776__weekday{color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-weight:var(--wpds-typography-font-weight-default,400);height:var(--wp-ui-calendar-cell-size);padding:0;text-align:center;text-transform:uppercase;width:var(--wp-ui-calendar-cell-size)}._058175f0f9c495e0__today:after{border:2px solid;border-radius:50%;content:"";height:0;inset-block-start:2px;inset-inline-end:2px;position:absolute;width:0;z-index:1}.acb642920fb0bef5__selected:not(._165d91a726feca9c__range-middle){&:has(._1b64226e315835f8__day-button,._1b64226e315835f8__day-button:hover:not(:disabled)){color:var(--wpds-color-foreground-interactive-neutral-strong,#f0f0f0)}&:has(._1b64226e315835f8__day-button:disabled){color:var(--wpds-color-foreground-interactive-neutral-strong-disabled,#8d8d8d)}._1b64226e315835f8__day-button{&:before{background-color:var(--wpds-color-background-interactive-neutral-strong,#2d2d2d);border:1px solid transparent}&:disabled:before{background-color:var(--wpds-color-background-interactive-neutral-strong-disabled,#e6e6e6)}&:hover:not(:disabled):before{background-color:var(--wpds-color-background-interactive-neutral-strong-active,#1e1e1e)}}}.c259c5c255fda10f__outside{color:var(--wpds-color-foreground-interactive-neutral-weak,#707070)}._4d8957a0ca4ec8f0__hidden{visibility:hidden}.f2523033db055ffe__range-start:not(.c04a453de7b11520__range-end) ._1b64226e315835f8__day-button{&,&:before{border-end-end-radius:0;border-start-end-radius:0}}._165d91a726feca9c__range-middle ._1b64226e315835f8__day-button{&:before{background-color:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);border-color:transparent;border-radius:0;border-style:solid;border-width:1px 0}}.c04a453de7b11520__range-end:not(.f2523033db055ffe__range-start) ._1b64226e315835f8__day-button{&,&:before{border-end-start-radius:0;border-start-start-radius:0}}._81b244e7c541d95e__preview svg{color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);inset:0;pointer-events:none;position:absolute;@media (forced-colors:active){color:inherit}}._81b244e7c541d95e__preview.acb642920fb0bef5__selected:not(._165d91a726feca9c__range-middle) svg{display:none}._2c7ac60ba97b3411__root[dir=rtl] ._81b244e7c541d95e__preview svg{transform:scaleX(-1)}._81b244e7c541d95e__preview._165d91a726feca9c__range-middle ._1b64226e315835f8__day-button:before{border:none}@keyframes _255a1a462a5377db__slide-in-left{0%{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes c21e45f616d6db39__slide-in-right{0%{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes aed80001de9ae226__slide-out-left{0%{transform:translateX(0)}to{transform:translateX(-100%)}}@keyframes _7d4779a7f29408f2__slide-out-right{0%{transform:translateX(0)}to{transform:translateX(100%)}}@keyframes _83ba6321b055d687__fade-in{0%{opacity:0}to{opacity:1}}@keyframes _96fbead71248d210__fade-out{0%{opacity:1}to{opacity:0}}._1563bccb09e39c30__caption-after-enter,._60ac2a7fc3208801__weeks-before-exit,._735dacf9052adecd__caption-before-exit,._7f73a6ab85101202__weeks-after-exit,._805d698b56ba4a29__weeks-after-enter,._9721326fbc23a5fb__weeks-before-enter,.c7a3082839155d29__caption-after-exit,.cb8a5ec82ad0885e__caption-before-enter{animation-duration:0s;animation-fill-mode:forwards;animation-timing-function:var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1));@media not (prefers-reduced-motion){animation-duration:var(--wpds-motion-duration-lg,.3s)}}._2c7ac60ba97b3411__root[dir=rtl] ._805d698b56ba4a29__weeks-after-enter,._9721326fbc23a5fb__weeks-before-enter{animation-name:_255a1a462a5377db__slide-in-left}._2c7ac60ba97b3411__root[dir=rtl] ._7f73a6ab85101202__weeks-after-exit,._60ac2a7fc3208801__weeks-before-exit{animation-name:aed80001de9ae226__slide-out-left}._2c7ac60ba97b3411__root[dir=rtl] ._9721326fbc23a5fb__weeks-before-enter,._805d698b56ba4a29__weeks-after-enter{animation-name:c21e45f616d6db39__slide-in-right}._2c7ac60ba97b3411__root[dir=rtl] ._60ac2a7fc3208801__weeks-before-exit,._7f73a6ab85101202__weeks-after-exit{animation-name:_7d4779a7f29408f2__slide-out-right}._1563bccb09e39c30__caption-after-enter,.cb8a5ec82ad0885e__caption-before-enter{animation-name:_83ba6321b055d687__fade-in}._735dacf9052adecd__caption-before-exit,.c7a3082839155d29__caption-after-exit{animation-name:_96fbead71248d210__fade-out}}}'); | |
| 18467 | +} | |
| 18468 | +var style_default7 = { "root": "_2c7ac60ba97b3411__root", "day": "_172c492625235710__day", "day-button": "_1b64226e315835f8__day-button", "caption-label": "_66b9a8120581fd4b__caption-label", "nav-button": "_395a75bb1930f57e__nav-button", "month-caption": "_337e5337d49b7f3d__month-caption", "months": "_110e46230c68e498__months", "month-grid": "_92915239fedb1fea__month-grid", "nav": "_66b1d4a7b488b496__nav", "weekday": "_7207199709ca5776__weekday", "today": "_058175f0f9c495e0__today", "selected": "acb642920fb0bef5__selected", "range-middle": "_165d91a726feca9c__range-middle", "outside": "c259c5c255fda10f__outside", "hidden": "_4d8957a0ca4ec8f0__hidden", "range-start": "f2523033db055ffe__range-start", "range-end": "c04a453de7b11520__range-end", "preview": "_81b244e7c541d95e__preview", "weeks-before-enter": "_9721326fbc23a5fb__weeks-before-enter", "weeks-before-exit": "_60ac2a7fc3208801__weeks-before-exit", "weeks-after-enter": "_805d698b56ba4a29__weeks-after-enter", "weeks-after-exit": "_7f73a6ab85101202__weeks-after-exit", "caption-after-enter": "_1563bccb09e39c30__caption-after-enter", "caption-after-exit": "c7a3082839155d29__caption-after-exit", "caption-before-enter": "cb8a5ec82ad0885e__caption-before-enter", "caption-before-exit": "_735dacf9052adecd__caption-before-exit", "slide-in-left": "_255a1a462a5377db__slide-in-left", "slide-out-left": "aed80001de9ae226__slide-out-left", "slide-in-right": "c21e45f616d6db39__slide-in-right", "slide-out-right": "_7d4779a7f29408f2__slide-out-right", "fade-in": "_83ba6321b055d687__fade-in", "fade-out": "_96fbead71248d210__fade-out" }; | |
| 18469 | +if (typeof process === "undefined" || true) { | |
| 18470 | + registerStyle8("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); | |
| 18471 | +} | |
| 18472 | +var resets_default3 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; | |
| 18473 | +if (typeof process === "undefined" || true) { | |
| 18474 | + registerStyle8("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))}}}"); | |
| 18475 | +} | |
| 18476 | +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" }; | |
| 18477 | +if (typeof process === "undefined" || true) { | |
| 18478 | + registerStyle8("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)}"); | |
| 18479 | +} | |
| 18480 | +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" }; | |
| 18481 | +var CLASSNAMES = { | |
| 18482 | + root: clsx_default(style_default7.root, resets_default3["box-sizing"]), | |
| 18483 | + day: style_default7.day, | |
| 18484 | + day_button: clsx_default( | |
| 18485 | + style_default7["day-button"], | |
| 18486 | + global_css_defense_default2.button, | |
| 18487 | + focus_module_default2["outset-ring--focus-visible"] | |
| 18488 | + ), | |
| 18489 | + outside: style_default7.outside, | |
| 18490 | + caption_label: style_default7["caption-label"], | |
| 18491 | + button_next: style_default7["nav-button"], | |
| 18492 | + button_previous: style_default7["nav-button"], | |
| 18493 | + nav: style_default7.nav, | |
| 18494 | + month_caption: style_default7["month-caption"], | |
| 18495 | + months: style_default7.months, | |
| 18496 | + month_grid: style_default7["month-grid"], | |
| 18497 | + weekday: style_default7.weekday, | |
| 18498 | + today: style_default7.today, | |
| 18499 | + selected: style_default7.selected, | |
| 18500 | + /* | |
| 18501 | + * Disabled days are styled through `:has(.day-button:disabled)` rather than | |
| 18502 | + * a modifier class on the cell, because the two are not equivalent: the | |
| 18503 | + * focused day keeps its button enabled so it stays reachable. Mapped to | |
| 18504 | + * `undefined` on purpose, so `@daypicker/react` doesn't fall back to its | |
| 18505 | + * own `rdp-disabled` class for a modifier we don't style. | |
| 18506 | + */ | |
| 18507 | + disabled: void 0, | |
| 18508 | + hidden: style_default7.hidden, | |
| 18509 | + range_start: style_default7["range-start"], | |
| 18510 | + range_end: style_default7["range-end"], | |
| 18511 | + range_middle: style_default7["range-middle"], | |
| 18512 | + weeks_before_enter: style_default7["weeks-before-enter"], | |
| 18513 | + weeks_before_exit: style_default7["weeks-before-exit"], | |
| 18514 | + weeks_after_enter: style_default7["weeks-after-enter"], | |
| 18515 | + weeks_after_exit: style_default7["weeks-after-exit"], | |
| 18516 | + caption_after_enter: style_default7["caption-after-enter"], | |
| 18517 | + caption_after_exit: style_default7["caption-after-exit"], | |
| 18518 | + caption_before_enter: style_default7["caption-before-enter"], | |
| 18519 | + caption_before_exit: style_default7["caption-before-exit"] | |
| 18520 | +}; | |
| 18521 | +var MODIFIER_CLASSNAMES = { | |
| 18522 | + preview: style_default7.preview | |
| 18523 | +}; | |
| 18524 | +var COMMON_PROPS = { | |
| 18525 | + animate: true, | |
| 18526 | + // Only show days in the current month | |
| 18527 | + showOutsideDays: false, | |
| 18528 | + // Hide week number column | |
| 18529 | + showWeekNumber: false, | |
| 18530 | + // Show weekdays row | |
| 18531 | + hideWeekdays: false, | |
| 18532 | + // Month and year caption are not interactive | |
| 18533 | + captionLayout: "label", | |
| 18534 | + // Show a variable number of weeks depending on the month | |
| 18535 | + fixedWeeks: false, | |
| 18536 | + // Show navigation buttons | |
| 18537 | + hideNavigation: false, | |
| 18538 | + // Class names | |
| 18539 | + classNames: CLASSNAMES, | |
| 18540 | + components: { | |
| 18541 | + Day: Day2, | |
| 18542 | + Root: Root3, | |
| 18543 | + PreviousMonthButton: PreviousMonthButton2, | |
| 18544 | + NextMonthButton: NextMonthButton2 | |
| 18545 | + } | |
| 18546 | +}; | |
| 18547 | + | |
| 18548 | +// packages/ui/build-module/calendar/utils/misc.mjs | |
| 18549 | +function clampNumberOfMonths(numberOfMonths) { | |
| 18550 | + return Math.min(3, Math.max(1, numberOfMonths)); | |
| 18551 | +} | |
| 18552 | + | |
| 18553 | +// packages/ui/build-module/calendar/utils/use-controlled-value.mjs | |
| 18554 | +var import_element23 = __toESM(require_element(), 1); | |
| 18555 | +function useControlledValue2({ | |
| 18556 | + defaultValue, | |
| 18557 | + onChange, | |
| 18558 | + value: valueProp | |
| 18559 | +}) { | |
| 18560 | + const hasValue = typeof valueProp !== "undefined"; | |
| 18561 | + const initialValue = hasValue ? valueProp : defaultValue; | |
| 18562 | + const [state, setState] = (0, import_element23.useState)(initialValue); | |
| 18563 | + const value = hasValue ? valueProp : state; | |
| 18564 | + const uncontrolledSetValue = (0, import_element23.useCallback)( | |
| 18565 | + (nextValue, ...args) => { | |
| 18566 | + setState(nextValue); | |
| 18567 | + onChange?.(nextValue, ...args); | |
| 18568 | + }, | |
| 18569 | + [onChange] | |
| 18570 | + ); | |
| 18571 | + let setValue; | |
| 18572 | + if (hasValue && typeof onChange === "function") { | |
| 18573 | + setValue = onChange; | |
| 18574 | + } else if (!hasValue && typeof onChange === "function") { | |
| 18575 | + setValue = uncontrolledSetValue; | |
| 18576 | + } else { | |
| 18577 | + setValue = setState; | |
| 18578 | + } | |
| 18579 | + return [value, setValue]; | |
| 18580 | +} | |
| 18581 | + | |
| 18582 | +// packages/ui/build-module/calendar/utils/use-localization-props.mjs | |
| 18583 | +var import_i18n5 = __toESM(require_i18n(), 1); | |
| 18584 | +var import_element24 = __toESM(require_element(), 1); | |
| 18585 | +function isLocaleRTL(locale) { | |
| 18586 | + const direction = (locale.getTextInfo?.() ?? locale.textInfo)?.direction; | |
| 18587 | + if (direction) { | |
| 18588 | + return direction === "rtl"; | |
| 18589 | + } | |
| 18590 | + return [ | |
| 18591 | + "ar", | |
| 18592 | + // Arabic | |
| 18593 | + "he", | |
| 18594 | + // Hebrew | |
| 18595 | + "fa", | |
| 18596 | + // Persian (Farsi) | |
| 18597 | + "ur", | |
| 18598 | + // Urdu | |
| 18599 | + "ps", | |
| 18600 | + // Pashto | |
| 18601 | + "syr", | |
| 18602 | + // Syriac | |
| 18603 | + "dv", | |
| 18604 | + // Divehi | |
| 18605 | + "ku", | |
| 18606 | + // Kurdish (Sorani) | |
| 18607 | + "ckb", | |
| 18608 | + // Central Kurdish (Sorani) | |
| 18609 | + "ug", | |
| 18610 | + // Uyghur | |
| 18611 | + "yi" | |
| 18612 | + // Yiddish | |
| 18613 | + ].includes(locale.language); | |
| 18614 | +} | |
| 18615 | +function getSupportedLocaleCode(localeCode) { | |
| 18616 | + if (!localeCode) { | |
| 18617 | + return; | |
| 18618 | + } | |
| 18619 | + let supportedLocaleCode; | |
| 18620 | + try { | |
| 18621 | + supportedLocaleCode = Intl.DateTimeFormat.supportedLocalesOf([ | |
| 18622 | + localeCode | |
| 18623 | + ])[0]; | |
| 18624 | + } catch { | |
| 18625 | + } | |
| 18626 | + return supportedLocaleCode; | |
| 18627 | +} | |
| 18628 | +function getWeekStartsOn(locale) { | |
| 18629 | + const firstDay = (locale.getWeekInfo?.() ?? locale.weekInfo)?.firstDay; | |
| 18630 | + if (firstDay === void 0 || firstDay < 1 || firstDay > 7) { | |
| 18631 | + return; | |
| 18632 | + } | |
| 18633 | + return firstDay % 7; | |
| 18634 | +} | |
| 18635 | +var useLocalizationProps = ({ | |
| 18636 | + locale, | |
| 18637 | + timeZone, | |
| 18638 | + mode | |
| 18639 | +}) => { | |
| 18640 | + return (0, import_element24.useMemo)(() => { | |
| 18641 | + const isLocaleString = typeof locale === "string"; | |
| 18642 | + const dateFnsLocale = isLocaleString || locale === void 0 ? enUS : locale; | |
| 18643 | + const supportedLocaleCode = getSupportedLocaleCode( | |
| 18644 | + isLocaleString ? locale : locale?.code | |
| 18645 | + ); | |
| 18646 | + const localeCode = supportedLocaleCode ?? "en-US"; | |
| 18647 | + const intlLocale = new Intl.Locale(localeCode); | |
| 18648 | + const isRightToLeft = supportedLocaleCode !== void 0 ? isLocaleRTL(intlLocale) : (0, import_i18n5.isRTL)(); | |
| 18649 | + const weekStartsOn = isLocaleString || supportedLocaleCode !== void 0 ? getWeekStartsOn(intlLocale) : void 0; | |
| 18650 | + const monthNameFormatter = new Intl.DateTimeFormat(localeCode, { | |
| 18651 | + calendar: "gregory", | |
| 18652 | + year: "numeric", | |
| 18653 | + month: "long", | |
| 18654 | + timeZone | |
| 18655 | + }); | |
| 18656 | + const weekdayNarrowFormatter = new Intl.DateTimeFormat(localeCode, { | |
| 18657 | + calendar: "gregory", | |
| 18658 | + weekday: "narrow", | |
| 18659 | + timeZone | |
| 18660 | + }); | |
| 18661 | + const weekdayLongFormatter = new Intl.DateTimeFormat(localeCode, { | |
| 18662 | + calendar: "gregory", | |
| 18663 | + weekday: "long", | |
| 18664 | + timeZone | |
| 18665 | + }); | |
| 18666 | + const fullDateFormatter = new Intl.DateTimeFormat(localeCode, { | |
| 18667 | + calendar: "gregory", | |
| 18668 | + weekday: "long", | |
| 18669 | + year: "numeric", | |
| 18670 | + month: "long", | |
| 18671 | + day: "numeric", | |
| 18672 | + timeZone | |
| 18673 | + }); | |
| 18674 | + const dayNumberFormatter = new Intl.DateTimeFormat(localeCode, { | |
| 18675 | + calendar: "gregory", | |
| 18676 | + day: "numeric", | |
| 18677 | + timeZone | |
| 18678 | + }); | |
| 18679 | + return { | |
| 18680 | + "aria-label": mode === "single" ? (0, import_i18n5.__)("Date calendar") : (0, import_i18n5.__)("Date range calendar"), | |
| 18681 | + labels: { | |
| 18682 | + /** The label for the navigation toolbar. */ | |
| 18683 | + labelNav: () => (0, import_i18n5.__)("Navigation bar"), | |
| 18684 | + /** | |
| 18685 | + * The label for the month grid. | |
| 18686 | + * @param date | |
| 18687 | + */ | |
| 18688 | + labelGrid: monthNameFormatter.format, | |
| 18689 | + /** | |
| 18690 | + * The label for the gridcell, when the calendar is not interactive. | |
| 18691 | + * @param date | |
| 18692 | + * @param modifiers | |
| 18693 | + */ | |
| 18694 | + labelGridcell: (date, modifiers) => { | |
| 18695 | + const formattedDate = fullDateFormatter.format(date); | |
| 18696 | + let label = formattedDate; | |
| 18697 | + if (modifiers?.today) { | |
| 18698 | + label = (0, import_i18n5.sprintf)( | |
| 18699 | + // translators: %s is the full date (e.g. "Monday, April 29, 2025") | |
| 18700 | + (0, import_i18n5.__)("Today, %s"), | |
| 18701 | + formattedDate | |
| 18702 | + ); | |
| 18703 | + } | |
| 18704 | + return label; | |
| 18705 | + }, | |
| 18706 | + /** The label for the "next month" button. */ | |
| 18707 | + labelNext: () => (0, import_i18n5.__)("Next month"), | |
| 18708 | + /** The label for the "previous month" button. */ | |
| 18709 | + labelPrevious: () => (0, import_i18n5.__)("Previous month"), | |
| 18710 | + /** | |
| 18711 | + * The label for the day button. | |
| 18712 | + * @param date | |
| 18713 | + * @param modifiers | |
| 18714 | + */ | |
| 18715 | + labelDayButton: (date, modifiers) => { | |
| 18716 | + const formattedDate = fullDateFormatter.format(date); | |
| 18717 | + let label = formattedDate; | |
| 18718 | + if (modifiers?.today && modifiers?.selected) { | |
| 18719 | + return (0, import_i18n5.sprintf)( | |
| 18720 | + // translators: %s is the full date (e.g. "Monday, April 29, 2025") | |
| 18721 | + (0, import_i18n5.__)("Today, %s, selected"), | |
| 18722 | + formattedDate | |
| 18723 | + ); | |
| 18724 | + } | |
| 18725 | + if (modifiers?.today) { | |
| 18726 | + label = (0, import_i18n5.sprintf)( | |
| 18727 | + // translators: %s is the full date (e.g. "Monday, April 29, 2025") | |
| 18728 | + (0, import_i18n5.__)("Today, %s"), | |
| 18729 | + formattedDate | |
| 18730 | + ); | |
| 18731 | + } | |
| 18732 | + if (modifiers?.selected) { | |
| 18733 | + label = (0, import_i18n5.sprintf)( | |
| 18734 | + // translators: %s is the full date (e.g. "Monday, April 29, 2025") | |
| 18735 | + (0, import_i18n5.__)("%s, selected"), | |
| 18736 | + formattedDate | |
| 18737 | + ); | |
| 18738 | + } | |
| 18739 | + return label; | |
| 18740 | + }, | |
| 18741 | + /** | |
| 18742 | + * The label for the weekday. | |
| 18743 | + * @param date | |
| 18744 | + */ | |
| 18745 | + labelWeekday: weekdayLongFormatter.format | |
| 18746 | + }, | |
| 18747 | + locale: dateFnsLocale, | |
| 18748 | + lang: localeCode, | |
| 18749 | + dir: isRightToLeft ? "rtl" : "ltr", | |
| 18750 | + ...weekStartsOn === void 0 ? {} : { weekStartsOn }, | |
| 18751 | + formatters: { | |
| 18752 | + formatDay: dayNumberFormatter.format, | |
| 18753 | + formatWeekdayName: weekdayNarrowFormatter.format, | |
| 18754 | + formatCaption: monthNameFormatter.format | |
| 18755 | + }, | |
| 18756 | + timeZone | |
| 18757 | + }; | |
| 18758 | + }, [locale, timeZone, mode]); | |
| 18759 | +}; | |
| 18760 | + | |
| 18761 | +// packages/ui/build-module/calendar/utils/use-preserve-day-focus.mjs | |
| 18762 | +var import_compose2 = __toESM(require_compose(), 1); | |
| 18763 | +var import_element25 = __toESM(require_element(), 1); | |
| 18764 | +function usePreserveDayFocus(forwardedRef, month) { | |
| 18765 | + const rootRef = (0, import_element25.useRef)(null); | |
| 18766 | + const hadDayFocusRef = (0, import_element25.useRef)(false); | |
| 18767 | + const mergedRef = (0, import_compose2.useMergeRefs)([rootRef, forwardedRef]); | |
| 18768 | + const monthIndex = month ? month.getFullYear() * 12 + month.getMonth() : void 0; | |
| 18769 | + const onDayFocus = (0, import_element25.useCallback)(() => { | |
| 18770 | + hadDayFocusRef.current = true; | |
| 18771 | + }, []); | |
| 18772 | + const onDayBlur = (0, import_element25.useCallback)(() => { | |
| 18773 | + hadDayFocusRef.current = false; | |
| 18774 | + }, []); | |
| 18775 | + (0, import_element25.useEffect)(() => { | |
| 18776 | + if (!hadDayFocusRef.current) { | |
| 18777 | + return; | |
| 18778 | + } | |
| 18779 | + const root = rootRef.current; | |
| 18780 | + if (!root) { | |
| 18781 | + return; | |
| 18782 | + } | |
| 18783 | + const { activeElement: activeElement2, body } = root.ownerDocument; | |
| 18784 | + if (activeElement2 !== body) { | |
| 18785 | + const grid = activeElement2?.closest('[role="grid"]'); | |
| 18786 | + hadDayFocusRef.current = !!grid && root.contains(grid); | |
| 18787 | + return; | |
| 18788 | + } | |
| 18789 | + hadDayFocusRef.current = false; | |
| 18790 | + const focusTarget = root.querySelector( | |
| 18791 | + '[role="grid"] button[tabindex="0"]:not(:disabled)' | |
| 18792 | + ); | |
| 18793 | + const enabledControl = root.querySelector( | |
| 18794 | + 'button:not(:disabled):not([aria-disabled="true"])' | |
| 18795 | + ); | |
| 18796 | + const focusableControl = root.querySelector( | |
| 18797 | + "button:not(:disabled)" | |
| 18798 | + ); | |
| 18799 | + (focusTarget ?? enabledControl ?? focusableControl)?.focus(); | |
| 18800 | + }, [monthIndex]); | |
| 18801 | + return { ref: mergedRef, onDayFocus, onDayBlur }; | |
| 18802 | +} | |
| 18803 | + | |
| 18804 | +// packages/ui/build-module/calendar/calendar.mjs | |
| 18805 | +var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1); | |
| 18806 | +var Calendar = (0, import_element26.forwardRef)( | |
| 18807 | + function Calendar2({ | |
| 18808 | + defaultValue, | |
| 18809 | + value: valueProp, | |
| 18810 | + onValueChange, | |
| 18811 | + numberOfMonths = 1, | |
| 18812 | + locale, | |
| 18813 | + timeZone, | |
| 18814 | + month, | |
| 18815 | + render: render4, | |
| 18816 | + role = "application", | |
| 18817 | + "aria-label": ariaLabel, | |
| 18818 | + labels: customLabels, | |
| 18819 | + ...props | |
| 18820 | + }, ref) { | |
| 18821 | + const { "aria-label": defaultAriaLabel, ...localizationProps } = useLocalizationProps({ | |
| 18822 | + locale, | |
| 18823 | + timeZone, | |
| 18824 | + mode: "single" | |
| 18825 | + }); | |
| 18826 | + const labels = (0, import_element26.useMemo)( | |
| 18827 | + () => customLabels ? { ...localizationProps.labels, ...customLabels } : localizationProps.labels, | |
| 18828 | + [localizationProps.labels, customLabels] | |
| 18829 | + ); | |
| 18830 | + const onChange = (0, import_element26.useCallback)( | |
| 18831 | + (selected2, triggerDate, modifiers, e) => { | |
| 18832 | + onValueChange?.( | |
| 18833 | + selected2 ?? null, | |
| 18834 | + triggerDate, | |
| 18835 | + modifiers, | |
| 18836 | + e | |
| 18837 | + ); | |
| 18838 | + }, | |
| 18839 | + [onValueChange] | |
| 18840 | + ); | |
| 18841 | + const [selected, setSelected] = useControlledValue2({ | |
| 18842 | + defaultValue, | |
| 18843 | + value: valueProp, | |
| 18844 | + onChange | |
| 18845 | + }); | |
| 18846 | + const dayFocusProps = usePreserveDayFocus(ref, month); | |
| 18847 | + const rootContextValue = (0, import_element26.useMemo)( | |
| 18848 | + () => ({ | |
| 18849 | + render: render4, | |
| 18850 | + ref: dayFocusProps.ref, | |
| 18851 | + role, | |
| 18852 | + defaultAriaLabel | |
| 18853 | + }), | |
| 18854 | + [render4, dayFocusProps.ref, role, defaultAriaLabel] | |
| 18855 | + ); | |
| 18856 | + return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(RootContext.Provider, { value: rootContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)( | |
| 18857 | + DayPicker, | |
| 211 | 18858 | { |
| 212 | - field: "author", | |
| 213 | - operator: "isAny", | |
| 214 | - value: [activeView] | |
| 18859 | + ...COMMON_PROPS, | |
| 18860 | + ...localizationProps, | |
| 18861 | + ...props, | |
| 18862 | + "aria-label": ariaLabel, | |
| 18863 | + mode: "single", | |
| 18864 | + month, | |
| 18865 | + numberOfMonths: clampNumberOfMonths(numberOfMonths), | |
| 18866 | + labels, | |
| 18867 | + selected: selected ?? void 0, | |
| 18868 | + onSelect: setSelected, | |
| 18869 | + onDayFocus: dayFocusProps.onDayFocus, | |
| 18870 | + onDayBlur: dayFocusProps.onDayBlur | |
| 215 | 18871 | } |
| 216 | - ] | |
| 18872 | + ) }); | |
| 18873 | + } | |
| 18874 | +); | |
| 18875 | + | |
| 18876 | +// packages/ui/build-module/calendar/range-calendar.mjs | |
| 18877 | +var import_element27 = __toESM(require_element(), 1); | |
| 18878 | +var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1); | |
| 18879 | +function usePreviewRange({ | |
| 18880 | + value, | |
| 18881 | + hoveredDate, | |
| 18882 | + excludeDisabled, | |
| 18883 | + resetOnSelect, | |
| 18884 | + min: min3, | |
| 18885 | + max: max3, | |
| 18886 | + disabled: disabled2 | |
| 18887 | +}) { | |
| 18888 | + return (0, import_element27.useMemo)(() => { | |
| 18889 | + if (!hoveredDate || !value?.from) { | |
| 18890 | + return; | |
| 18891 | + } | |
| 18892 | + if (resetOnSelect && value.to) { | |
| 18893 | + return { | |
| 18894 | + from: hoveredDate, | |
| 18895 | + to: hoveredDate | |
| 18896 | + }; | |
| 18897 | + } | |
| 18898 | + let previewHighlight; | |
| 18899 | + let potentialNewRange; | |
| 18900 | + if (hoveredDate < value.from) { | |
| 18901 | + previewHighlight = { | |
| 18902 | + from: hoveredDate, | |
| 18903 | + to: value.from | |
| 18904 | + }; | |
| 18905 | + potentialNewRange = { | |
| 18906 | + from: hoveredDate, | |
| 18907 | + to: value.to ?? value.from | |
| 18908 | + }; | |
| 18909 | + } else if (value.to && hoveredDate > value.from && hoveredDate < value.to) { | |
| 18910 | + previewHighlight = { | |
| 18911 | + from: value.from, | |
| 18912 | + to: hoveredDate | |
| 18913 | + }; | |
| 18914 | + potentialNewRange = { | |
| 18915 | + from: value.from, | |
| 18916 | + to: hoveredDate | |
| 18917 | + }; | |
| 18918 | + } else if (hoveredDate > value.from) { | |
| 18919 | + previewHighlight = { | |
| 18920 | + from: value.to ?? value.from, | |
| 18921 | + to: hoveredDate | |
| 18922 | + }; | |
| 18923 | + potentialNewRange = { | |
| 18924 | + from: value.from, | |
| 18925 | + to: hoveredDate | |
| 18926 | + }; | |
| 18927 | + } | |
| 18928 | + if (min3 !== void 0 && min3 > 0 && potentialNewRange && differenceInCalendarDays( | |
| 18929 | + potentialNewRange.to, | |
| 18930 | + potentialNewRange.from | |
| 18931 | + ) < min3) { | |
| 18932 | + previewHighlight = { | |
| 18933 | + from: hoveredDate, | |
| 18934 | + to: hoveredDate | |
| 18935 | + }; | |
| 18936 | + } | |
| 18937 | + if (max3 !== void 0 && max3 > 0 && potentialNewRange && differenceInCalendarDays( | |
| 18938 | + potentialNewRange.to, | |
| 18939 | + potentialNewRange.from | |
| 18940 | + ) > max3) { | |
| 18941 | + previewHighlight = { | |
| 18942 | + from: hoveredDate, | |
| 18943 | + to: hoveredDate | |
| 18944 | + }; | |
| 18945 | + } | |
| 18946 | + if (excludeDisabled && disabled2 && potentialNewRange && rangeContainsModifiers(potentialNewRange, disabled2)) { | |
| 18947 | + previewHighlight = { | |
| 18948 | + from: hoveredDate, | |
| 18949 | + to: hoveredDate | |
| 18950 | + }; | |
| 18951 | + } | |
| 18952 | + return previewHighlight; | |
| 18953 | + }, [ | |
| 18954 | + value, | |
| 18955 | + hoveredDate, | |
| 18956 | + excludeDisabled, | |
| 18957 | + resetOnSelect, | |
| 18958 | + min3, | |
| 18959 | + max3, | |
| 18960 | + disabled2 | |
| 18961 | + ]); | |
| 18962 | +} | |
| 18963 | +var RangeCalendar = (0, import_element27.forwardRef)( | |
| 18964 | + function RangeCalendar2({ | |
| 18965 | + defaultValue, | |
| 18966 | + value: valueProp, | |
| 18967 | + onValueChange, | |
| 18968 | + numberOfMonths = 1, | |
| 18969 | + excludeDisabled, | |
| 18970 | + resetOnSelect = true, | |
| 18971 | + min: min3, | |
| 18972 | + max: max3, | |
| 18973 | + disabled: disabled2, | |
| 18974 | + locale, | |
| 18975 | + timeZone, | |
| 18976 | + month, | |
| 18977 | + render: render4, | |
| 18978 | + role = "application", | |
| 18979 | + "aria-label": ariaLabel, | |
| 18980 | + labels: customLabels, | |
| 18981 | + ...props | |
| 18982 | + }, ref) { | |
| 18983 | + const { "aria-label": defaultAriaLabel, ...localizationProps } = useLocalizationProps({ | |
| 18984 | + locale, | |
| 18985 | + timeZone, | |
| 18986 | + mode: "range" | |
| 18987 | + }); | |
| 18988 | + const labels = (0, import_element27.useMemo)( | |
| 18989 | + () => customLabels ? { ...localizationProps.labels, ...customLabels } : localizationProps.labels, | |
| 18990 | + [localizationProps.labels, customLabels] | |
| 18991 | + ); | |
| 18992 | + const onChange = (0, import_element27.useCallback)( | |
| 18993 | + (selected2, triggerDate, modifiers2, e) => { | |
| 18994 | + onValueChange?.( | |
| 18995 | + selected2 ?? null, | |
| 18996 | + triggerDate, | |
| 18997 | + modifiers2, | |
| 18998 | + e | |
| 18999 | + ); | |
| 19000 | + }, | |
| 19001 | + [onValueChange] | |
| 19002 | + ); | |
| 19003 | + const [selected, setSelected] = useControlledValue2({ | |
| 19004 | + defaultValue, | |
| 19005 | + value: valueProp, | |
| 19006 | + onChange | |
| 19007 | + }); | |
| 19008 | + const dayFocusProps = usePreserveDayFocus(ref, month); | |
| 19009 | + const [hoveredDate, setHoveredDate] = (0, import_element27.useState)( | |
| 19010 | + void 0 | |
| 19011 | + ); | |
| 19012 | + const previewRange = usePreviewRange({ | |
| 19013 | + value: selected, | |
| 19014 | + hoveredDate, | |
| 19015 | + excludeDisabled, | |
| 19016 | + resetOnSelect, | |
| 19017 | + min: min3, | |
| 19018 | + max: max3, | |
| 19019 | + disabled: disabled2 | |
| 19020 | + }); | |
| 19021 | + const modifiers = (0, import_element27.useMemo)(() => { | |
| 19022 | + return { | |
| 19023 | + preview: previewRange, | |
| 19024 | + preview_start: previewRange?.from, | |
| 19025 | + preview_end: previewRange?.to | |
| 19026 | + }; | |
| 19027 | + }, [previewRange]); | |
| 19028 | + const rootContextValue = (0, import_element27.useMemo)( | |
| 19029 | + () => ({ | |
| 19030 | + render: render4, | |
| 19031 | + ref: dayFocusProps.ref, | |
| 19032 | + role, | |
| 19033 | + defaultAriaLabel | |
| 19034 | + }), | |
| 19035 | + [render4, dayFocusProps.ref, role, defaultAriaLabel] | |
| 19036 | + ); | |
| 19037 | + return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(RootContext.Provider, { value: rootContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)( | |
| 19038 | + DayPicker, | |
| 19039 | + { | |
| 19040 | + ...COMMON_PROPS, | |
| 19041 | + ...localizationProps, | |
| 19042 | + ...props, | |
| 19043 | + "aria-label": ariaLabel, | |
| 19044 | + mode: "range", | |
| 19045 | + month, | |
| 19046 | + numberOfMonths: clampNumberOfMonths(numberOfMonths), | |
| 19047 | + disabled: disabled2, | |
| 19048 | + excludeDisabled, | |
| 19049 | + resetOnSelect, | |
| 19050 | + min: min3, | |
| 19051 | + max: max3, | |
| 19052 | + labels, | |
| 19053 | + selected: selected ?? void 0, | |
| 19054 | + onSelect: setSelected, | |
| 19055 | + onDayFocus: dayFocusProps.onDayFocus, | |
| 19056 | + onDayBlur: dayFocusProps.onDayBlur, | |
| 19057 | + onDayMouseEnter: (date) => setHoveredDate(date), | |
| 19058 | + onDayMouseLeave: () => setHoveredDate(void 0), | |
| 19059 | + modifiers, | |
| 19060 | + modifiersClassNames: MODIFIER_CLASSNAMES | |
| 19061 | + } | |
| 19062 | + ) }); | |
| 19063 | + } | |
| 19064 | +); | |
| 19065 | + | |
| 19066 | +// packages/ui/build-module/stack/stack.mjs | |
| 19067 | +var import_element28 = __toESM(require_element(), 1); | |
| 19068 | +var STYLE_HASH_ATTRIBUTE9 = "data-wp-hash"; | |
| 19069 | +function getRuntime9() { | |
| 19070 | + const globalScope = globalThis; | |
| 19071 | + if (globalScope.__wpStyleRuntime) { | |
| 19072 | + return globalScope.__wpStyleRuntime; | |
| 19073 | + } | |
| 19074 | + globalScope.__wpStyleRuntime = { | |
| 19075 | + documents: /* @__PURE__ */ new Map(), | |
| 19076 | + styles: /* @__PURE__ */ new Map(), | |
| 19077 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 217 | 19078 | }; |
| 19079 | + if (typeof document !== "undefined") { | |
| 19080 | + registerDocument9(document); | |
| 19081 | + } | |
| 19082 | + return globalScope.__wpStyleRuntime; | |
| 218 | 19083 | } |
| 219 | -async function ensureView(activeView, search) { | |
| 220 | - return loadView({ | |
| 221 | - kind: "postType", | |
| 222 | - name: "wp_template", | |
| 223 | - slug: "default-new", | |
| 224 | - defaultView: DEFAULT_VIEW, | |
| 225 | - activeViewOverrides: getActiveViewOverridesForTab( | |
| 226 | - activeView ?? "active" | |
| 19084 | +function documentContainsStyleHash9(targetDocument, hash) { | |
| 19085 | + if (!targetDocument.head) { | |
| 19086 | + return false; | |
| 19087 | + } | |
| 19088 | + for (const style of targetDocument.head.querySelectorAll( | |
| 19089 | + `style[${STYLE_HASH_ATTRIBUTE9}]` | |
| 19090 | + )) { | |
| 19091 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE9) === hash) { | |
| 19092 | + return true; | |
| 19093 | + } | |
| 19094 | + } | |
| 19095 | + return false; | |
| 19096 | +} | |
| 19097 | +function injectStyle9(targetDocument, hash, css) { | |
| 19098 | + if (!targetDocument.head) { | |
| 19099 | + return; | |
| 19100 | + } | |
| 19101 | + const runtime = getRuntime9(); | |
| 19102 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 19103 | + if (!injectedStyles) { | |
| 19104 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 19105 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 19106 | + } | |
| 19107 | + if (injectedStyles.has(hash)) { | |
| 19108 | + return; | |
| 19109 | + } | |
| 19110 | + if (documentContainsStyleHash9(targetDocument, hash)) { | |
| 19111 | + injectedStyles.add(hash); | |
| 19112 | + return; | |
| 19113 | + } | |
| 19114 | + const style = targetDocument.createElement("style"); | |
| 19115 | + style.setAttribute(STYLE_HASH_ATTRIBUTE9, hash); | |
| 19116 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 19117 | + targetDocument.head.appendChild(style); | |
| 19118 | + injectedStyles.add(hash); | |
| 19119 | +} | |
| 19120 | +function registerDocument9(targetDocument) { | |
| 19121 | + const runtime = getRuntime9(); | |
| 19122 | + runtime.documents.set( | |
| 19123 | + targetDocument, | |
| 19124 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 19125 | + ); | |
| 19126 | + for (const [hash, css] of runtime.styles) { | |
| 19127 | + injectStyle9(targetDocument, hash, css); | |
| 19128 | + } | |
| 19129 | + return () => { | |
| 19130 | + const count = runtime.documents.get(targetDocument); | |
| 19131 | + if (count === void 0) { | |
| 19132 | + return; | |
| 19133 | + } | |
| 19134 | + if (count <= 1) { | |
| 19135 | + runtime.documents.delete(targetDocument); | |
| 19136 | + return; | |
| 19137 | + } | |
| 19138 | + runtime.documents.set(targetDocument, count - 1); | |
| 19139 | + }; | |
| 19140 | +} | |
| 19141 | +function registerStyle9(hash, css) { | |
| 19142 | + const runtime = getRuntime9(); | |
| 19143 | + runtime.styles.set(hash, css); | |
| 19144 | + for (const targetDocument of runtime.documents.keys()) { | |
| 19145 | + injectStyle9(targetDocument, hash, css); | |
| 19146 | + } | |
| 19147 | +} | |
| 19148 | +if (typeof process === "undefined" || true) { | |
| 19149 | + registerStyle9("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}"); | |
| 19150 | +} | |
| 19151 | +var style_default8 = { "stack": "_19ce0419607e1896__stack" }; | |
| 19152 | +var gapTokens = { | |
| 19153 | + xs: "var(--wpds-dimension-gap-xs, 4px)", | |
| 19154 | + sm: "var(--wpds-dimension-gap-sm, 8px)", | |
| 19155 | + md: "var(--wpds-dimension-gap-md, 12px)", | |
| 19156 | + lg: "var(--wpds-dimension-gap-lg, 16px)", | |
| 19157 | + xl: "var(--wpds-dimension-gap-xl, 24px)", | |
| 19158 | + "2xl": "var(--wpds-dimension-gap-2xl, 32px)", | |
| 19159 | + "3xl": "var(--wpds-dimension-gap-3xl, 40px)" | |
| 19160 | +}; | |
| 19161 | +var Stack = (0, import_element28.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render: render4, ...props }, ref) { | |
| 19162 | + const style = { | |
| 19163 | + gap: gap && gapTokens[gap], | |
| 19164 | + alignItems: align, | |
| 19165 | + justifyContent: justify, | |
| 19166 | + flexDirection: direction, | |
| 19167 | + flexWrap: wrap | |
| 19168 | + }; | |
| 19169 | + const element = useRender({ | |
| 19170 | + render: render4, | |
| 19171 | + ref, | |
| 19172 | + props: mergeProps(props, { style, className: style_default8.stack }) | |
| 19173 | + }); | |
| 19174 | + return element; | |
| 19175 | +}); | |
| 19176 | + | |
| 19177 | +// packages/ui/build-module/form/primitives/input/input.mjs | |
| 19178 | +var import_element31 = __toESM(require_element(), 1); | |
| 19179 | + | |
| 19180 | +// packages/ui/build-module/form/primitives/input-layout/input-layout.mjs | |
| 19181 | +var import_element29 = __toESM(require_element(), 1); | |
| 19182 | +var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1); | |
| 19183 | +var STYLE_HASH_ATTRIBUTE10 = "data-wp-hash"; | |
| 19184 | +function getRuntime10() { | |
| 19185 | + const globalScope = globalThis; | |
| 19186 | + if (globalScope.__wpStyleRuntime) { | |
| 19187 | + return globalScope.__wpStyleRuntime; | |
| 19188 | + } | |
| 19189 | + globalScope.__wpStyleRuntime = { | |
| 19190 | + documents: /* @__PURE__ */ new Map(), | |
| 19191 | + styles: /* @__PURE__ */ new Map(), | |
| 19192 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 19193 | + }; | |
| 19194 | + if (typeof document !== "undefined") { | |
| 19195 | + registerDocument10(document); | |
| 19196 | + } | |
| 19197 | + return globalScope.__wpStyleRuntime; | |
| 19198 | +} | |
| 19199 | +function documentContainsStyleHash10(targetDocument, hash) { | |
| 19200 | + if (!targetDocument.head) { | |
| 19201 | + return false; | |
| 19202 | + } | |
| 19203 | + for (const style of targetDocument.head.querySelectorAll( | |
| 19204 | + `style[${STYLE_HASH_ATTRIBUTE10}]` | |
| 19205 | + )) { | |
| 19206 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE10) === hash) { | |
| 19207 | + return true; | |
| 19208 | + } | |
| 19209 | + } | |
| 19210 | + return false; | |
| 19211 | +} | |
| 19212 | +function injectStyle10(targetDocument, hash, css) { | |
| 19213 | + if (!targetDocument.head) { | |
| 19214 | + return; | |
| 19215 | + } | |
| 19216 | + const runtime = getRuntime10(); | |
| 19217 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 19218 | + if (!injectedStyles) { | |
| 19219 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 19220 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 19221 | + } | |
| 19222 | + if (injectedStyles.has(hash)) { | |
| 19223 | + return; | |
| 19224 | + } | |
| 19225 | + if (documentContainsStyleHash10(targetDocument, hash)) { | |
| 19226 | + injectedStyles.add(hash); | |
| 19227 | + return; | |
| 19228 | + } | |
| 19229 | + const style = targetDocument.createElement("style"); | |
| 19230 | + style.setAttribute(STYLE_HASH_ATTRIBUTE10, hash); | |
| 19231 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 19232 | + targetDocument.head.appendChild(style); | |
| 19233 | + injectedStyles.add(hash); | |
| 19234 | +} | |
| 19235 | +function registerDocument10(targetDocument) { | |
| 19236 | + const runtime = getRuntime10(); | |
| 19237 | + runtime.documents.set( | |
| 19238 | + targetDocument, | |
| 19239 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 19240 | + ); | |
| 19241 | + for (const [hash, css] of runtime.styles) { | |
| 19242 | + injectStyle10(targetDocument, hash, css); | |
| 19243 | + } | |
| 19244 | + return () => { | |
| 19245 | + const count = runtime.documents.get(targetDocument); | |
| 19246 | + if (count === void 0) { | |
| 19247 | + return; | |
| 19248 | + } | |
| 19249 | + if (count <= 1) { | |
| 19250 | + runtime.documents.delete(targetDocument); | |
| 19251 | + return; | |
| 19252 | + } | |
| 19253 | + runtime.documents.set(targetDocument, count - 1); | |
| 19254 | + }; | |
| 19255 | +} | |
| 19256 | +function registerStyle10(hash, css) { | |
| 19257 | + const runtime = getRuntime10(); | |
| 19258 | + runtime.styles.set(hash, css); | |
| 19259 | + for (const targetDocument of runtime.documents.keys()) { | |
| 19260 | + injectStyle10(targetDocument, hash, css); | |
| 19261 | + } | |
| 19262 | +} | |
| 19263 | +if (typeof process === "undefined" || true) { | |
| 19264 | + registerStyle10("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)}"); | |
| 19265 | +} | |
| 19266 | +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" }; | |
| 19267 | +if (typeof process === "undefined" || true) { | |
| 19268 | + registerStyle10("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); | |
| 19269 | +} | |
| 19270 | +var resets_default4 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; | |
| 19271 | +if (typeof process === "undefined" || true) { | |
| 19272 | + registerStyle10("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))}}}}'); | |
| 19273 | +} | |
| 19274 | +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" }; | |
| 19275 | +var InputLayout = (0, import_element29.forwardRef)( | |
| 19276 | + function InputLayout2({ | |
| 19277 | + className, | |
| 19278 | + children, | |
| 19279 | + visuallyDisabled, | |
| 19280 | + size: size4 = "default", | |
| 19281 | + isBorderless, | |
| 19282 | + prefix, | |
| 19283 | + suffix, | |
| 19284 | + ...restProps | |
| 19285 | + }, ref) { | |
| 19286 | + return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)( | |
| 19287 | + "div", | |
| 19288 | + { | |
| 19289 | + ref, | |
| 19290 | + className: clsx_default( | |
| 19291 | + global_css_defense_default3.div, | |
| 19292 | + resets_default4["box-sizing"], | |
| 19293 | + style_default9["input-layout"], | |
| 19294 | + style_default9[`is-size-${size4}`], | |
| 19295 | + visuallyDisabled && style_default9["is-disabled"], | |
| 19296 | + isBorderless && style_default9["is-borderless"], | |
| 19297 | + className | |
| 19298 | + ), | |
| 19299 | + ...restProps, | |
| 19300 | + children: [ | |
| 19301 | + import_element29.Children.count(prefix) > 0 && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)( | |
| 19302 | + "div", | |
| 19303 | + { | |
| 19304 | + className: style_default9["slot-wrapper"], | |
| 19305 | + "data-slot-type": "prefix", | |
| 19306 | + children: prefix | |
| 19307 | + } | |
| 19308 | + ), | |
| 19309 | + children, | |
| 19310 | + import_element29.Children.count(suffix) > 0 && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)( | |
| 19311 | + "div", | |
| 19312 | + { | |
| 19313 | + className: style_default9["slot-wrapper"], | |
| 19314 | + "data-slot-type": "suffix", | |
| 19315 | + children: suffix | |
| 19316 | + } | |
| 19317 | + ) | |
| 19318 | + ] | |
| 19319 | + } | |
| 19320 | + ); | |
| 19321 | + } | |
| 19322 | +); | |
| 19323 | + | |
| 19324 | +// packages/ui/build-module/form/primitives/input-layout/slot.mjs | |
| 19325 | +var import_element30 = __toESM(require_element(), 1); | |
| 19326 | +var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1); | |
| 19327 | +var STYLE_HASH_ATTRIBUTE11 = "data-wp-hash"; | |
| 19328 | +function getRuntime11() { | |
| 19329 | + const globalScope = globalThis; | |
| 19330 | + if (globalScope.__wpStyleRuntime) { | |
| 19331 | + return globalScope.__wpStyleRuntime; | |
| 19332 | + } | |
| 19333 | + globalScope.__wpStyleRuntime = { | |
| 19334 | + documents: /* @__PURE__ */ new Map(), | |
| 19335 | + styles: /* @__PURE__ */ new Map(), | |
| 19336 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 19337 | + }; | |
| 19338 | + if (typeof document !== "undefined") { | |
| 19339 | + registerDocument11(document); | |
| 19340 | + } | |
| 19341 | + return globalScope.__wpStyleRuntime; | |
| 19342 | +} | |
| 19343 | +function documentContainsStyleHash11(targetDocument, hash) { | |
| 19344 | + if (!targetDocument.head) { | |
| 19345 | + return false; | |
| 19346 | + } | |
| 19347 | + for (const style of targetDocument.head.querySelectorAll( | |
| 19348 | + `style[${STYLE_HASH_ATTRIBUTE11}]` | |
| 19349 | + )) { | |
| 19350 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE11) === hash) { | |
| 19351 | + return true; | |
| 19352 | + } | |
| 19353 | + } | |
| 19354 | + return false; | |
| 19355 | +} | |
| 19356 | +function injectStyle11(targetDocument, hash, css) { | |
| 19357 | + if (!targetDocument.head) { | |
| 19358 | + return; | |
| 19359 | + } | |
| 19360 | + const runtime = getRuntime11(); | |
| 19361 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 19362 | + if (!injectedStyles) { | |
| 19363 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 19364 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 19365 | + } | |
| 19366 | + if (injectedStyles.has(hash)) { | |
| 19367 | + return; | |
| 19368 | + } | |
| 19369 | + if (documentContainsStyleHash11(targetDocument, hash)) { | |
| 19370 | + injectedStyles.add(hash); | |
| 19371 | + return; | |
| 19372 | + } | |
| 19373 | + const style = targetDocument.createElement("style"); | |
| 19374 | + style.setAttribute(STYLE_HASH_ATTRIBUTE11, hash); | |
| 19375 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 19376 | + targetDocument.head.appendChild(style); | |
| 19377 | + injectedStyles.add(hash); | |
| 19378 | +} | |
| 19379 | +function registerDocument11(targetDocument) { | |
| 19380 | + const runtime = getRuntime11(); | |
| 19381 | + runtime.documents.set( | |
| 19382 | + targetDocument, | |
| 19383 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 19384 | + ); | |
| 19385 | + for (const [hash, css] of runtime.styles) { | |
| 19386 | + injectStyle11(targetDocument, hash, css); | |
| 19387 | + } | |
| 19388 | + return () => { | |
| 19389 | + const count = runtime.documents.get(targetDocument); | |
| 19390 | + if (count === void 0) { | |
| 19391 | + return; | |
| 19392 | + } | |
| 19393 | + if (count <= 1) { | |
| 19394 | + runtime.documents.delete(targetDocument); | |
| 19395 | + return; | |
| 19396 | + } | |
| 19397 | + runtime.documents.set(targetDocument, count - 1); | |
| 19398 | + }; | |
| 19399 | +} | |
| 19400 | +function registerStyle11(hash, css) { | |
| 19401 | + const runtime = getRuntime11(); | |
| 19402 | + runtime.styles.set(hash, css); | |
| 19403 | + for (const targetDocument of runtime.documents.keys()) { | |
| 19404 | + injectStyle11(targetDocument, hash, css); | |
| 19405 | + } | |
| 19406 | +} | |
| 19407 | +if (typeof process === "undefined" || true) { | |
| 19408 | + registerStyle11("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))}}}}'); | |
| 19409 | +} | |
| 19410 | +var style_default10 = { "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" }; | |
| 19411 | +var InputLayoutSlot = (0, import_element30.forwardRef)(function InputLayoutSlot2({ padding = "default", className, ...restProps }, ref) { | |
| 19412 | + return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)( | |
| 19413 | + "div", | |
| 19414 | + { | |
| 19415 | + ref, | |
| 19416 | + className: clsx_default( | |
| 19417 | + style_default10["input-layout-slot"], | |
| 19418 | + style_default10[`is-padding-${padding}`], | |
| 19419 | + className | |
| 19420 | + ), | |
| 19421 | + ...restProps | |
| 19422 | + } | |
| 19423 | + ); | |
| 19424 | +}); | |
| 19425 | +InputLayoutSlot.displayName = "InputLayout.Slot"; | |
| 19426 | + | |
| 19427 | +// packages/ui/build-module/form/primitives/input-layout/index.mjs | |
| 19428 | +var InputLayout3 = Object.assign(InputLayout, { | |
| 19429 | + Slot: InputLayoutSlot | |
| 19430 | +}); | |
| 19431 | + | |
| 19432 | +// packages/ui/build-module/form/primitives/input/input.mjs | |
| 19433 | +var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1); | |
| 19434 | +var STYLE_HASH_ATTRIBUTE12 = "data-wp-hash"; | |
| 19435 | +function getRuntime12() { | |
| 19436 | + const globalScope = globalThis; | |
| 19437 | + if (globalScope.__wpStyleRuntime) { | |
| 19438 | + return globalScope.__wpStyleRuntime; | |
| 19439 | + } | |
| 19440 | + globalScope.__wpStyleRuntime = { | |
| 19441 | + documents: /* @__PURE__ */ new Map(), | |
| 19442 | + styles: /* @__PURE__ */ new Map(), | |
| 19443 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 19444 | + }; | |
| 19445 | + if (typeof document !== "undefined") { | |
| 19446 | + registerDocument12(document); | |
| 19447 | + } | |
| 19448 | + return globalScope.__wpStyleRuntime; | |
| 19449 | +} | |
| 19450 | +function documentContainsStyleHash12(targetDocument, hash) { | |
| 19451 | + if (!targetDocument.head) { | |
| 19452 | + return false; | |
| 19453 | + } | |
| 19454 | + for (const style of targetDocument.head.querySelectorAll( | |
| 19455 | + `style[${STYLE_HASH_ATTRIBUTE12}]` | |
| 19456 | + )) { | |
| 19457 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE12) === hash) { | |
| 19458 | + return true; | |
| 19459 | + } | |
| 19460 | + } | |
| 19461 | + return false; | |
| 19462 | +} | |
| 19463 | +function injectStyle12(targetDocument, hash, css) { | |
| 19464 | + if (!targetDocument.head) { | |
| 19465 | + return; | |
| 19466 | + } | |
| 19467 | + const runtime = getRuntime12(); | |
| 19468 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 19469 | + if (!injectedStyles) { | |
| 19470 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 19471 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 19472 | + } | |
| 19473 | + if (injectedStyles.has(hash)) { | |
| 19474 | + return; | |
| 19475 | + } | |
| 19476 | + if (documentContainsStyleHash12(targetDocument, hash)) { | |
| 19477 | + injectedStyles.add(hash); | |
| 19478 | + return; | |
| 19479 | + } | |
| 19480 | + const style = targetDocument.createElement("style"); | |
| 19481 | + style.setAttribute(STYLE_HASH_ATTRIBUTE12, hash); | |
| 19482 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 19483 | + targetDocument.head.appendChild(style); | |
| 19484 | + injectedStyles.add(hash); | |
| 19485 | +} | |
| 19486 | +function registerDocument12(targetDocument) { | |
| 19487 | + const runtime = getRuntime12(); | |
| 19488 | + runtime.documents.set( | |
| 19489 | + targetDocument, | |
| 19490 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 19491 | + ); | |
| 19492 | + for (const [hash, css] of runtime.styles) { | |
| 19493 | + injectStyle12(targetDocument, hash, css); | |
| 19494 | + } | |
| 19495 | + return () => { | |
| 19496 | + const count = runtime.documents.get(targetDocument); | |
| 19497 | + if (count === void 0) { | |
| 19498 | + return; | |
| 19499 | + } | |
| 19500 | + if (count <= 1) { | |
| 19501 | + runtime.documents.delete(targetDocument); | |
| 19502 | + return; | |
| 19503 | + } | |
| 19504 | + runtime.documents.set(targetDocument, count - 1); | |
| 19505 | + }; | |
| 19506 | +} | |
| 19507 | +function registerStyle12(hash, css) { | |
| 19508 | + const runtime = getRuntime12(); | |
| 19509 | + runtime.styles.set(hash, css); | |
| 19510 | + for (const targetDocument of runtime.documents.keys()) { | |
| 19511 | + injectStyle12(targetDocument, hash, css); | |
| 19512 | + } | |
| 19513 | +} | |
| 19514 | +if (typeof process === "undefined" || true) { | |
| 19515 | + 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)}"); | |
| 19516 | +} | |
| 19517 | +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" }; | |
| 19518 | +if (typeof process === "undefined" || true) { | |
| 19519 | + registerStyle12("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))}}}"); | |
| 19520 | +} | |
| 19521 | +var focus_module_default3 = { "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" }; | |
| 19522 | +if (typeof process === "undefined" || true) { | |
| 19523 | + registerStyle12("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}}}}}"); | |
| 19524 | +} | |
| 19525 | +var style_default11 = { "input": "_2ae7be2fc1bb17a3__input" }; | |
| 19526 | +var Input3 = (0, import_element31.forwardRef)(function Input22({ className, size: size4 = "default", prefix, suffix, style, ...restProps }, ref) { | |
| 19527 | + return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)( | |
| 19528 | + InputLayout3, | |
| 19529 | + { | |
| 19530 | + className: clsx_default( | |
| 19531 | + focus_module_default3["outset-ring--focus-within"], | |
| 19532 | + className | |
| 19533 | + ), | |
| 19534 | + style, | |
| 19535 | + size: size4, | |
| 19536 | + visuallyDisabled: restProps.disabled, | |
| 19537 | + prefix, | |
| 19538 | + suffix, | |
| 19539 | + children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)( | |
| 19540 | + Input, | |
| 19541 | + { | |
| 19542 | + ref, | |
| 19543 | + className: clsx_default(global_css_defense_default4.input, style_default11.input), | |
| 19544 | + ...restProps | |
| 19545 | + } | |
| 19546 | + ) | |
| 19547 | + } | |
| 19548 | + ); | |
| 19549 | +}); | |
| 19550 | + | |
| 19551 | +// packages/ui/build-module/form/primitives/control-with-error/control-with-error.mjs | |
| 19552 | +var import_i18n6 = __toESM(require_i18n(), 1); | |
| 19553 | +var import_element33 = __toESM(require_element(), 1); | |
| 19554 | + | |
| 19555 | +// packages/ui/build-module/spinner/spinner.mjs | |
| 19556 | +var import_element32 = __toESM(require_element(), 1); | |
| 19557 | +var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1); | |
| 19558 | +var STYLE_HASH_ATTRIBUTE13 = "data-wp-hash"; | |
| 19559 | +function getRuntime13() { | |
| 19560 | + const globalScope = globalThis; | |
| 19561 | + if (globalScope.__wpStyleRuntime) { | |
| 19562 | + return globalScope.__wpStyleRuntime; | |
| 19563 | + } | |
| 19564 | + globalScope.__wpStyleRuntime = { | |
| 19565 | + documents: /* @__PURE__ */ new Map(), | |
| 19566 | + styles: /* @__PURE__ */ new Map(), | |
| 19567 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 19568 | + }; | |
| 19569 | + if (typeof document !== "undefined") { | |
| 19570 | + registerDocument13(document); | |
| 19571 | + } | |
| 19572 | + return globalScope.__wpStyleRuntime; | |
| 19573 | +} | |
| 19574 | +function documentContainsStyleHash13(targetDocument, hash) { | |
| 19575 | + if (!targetDocument.head) { | |
| 19576 | + return false; | |
| 19577 | + } | |
| 19578 | + for (const style of targetDocument.head.querySelectorAll( | |
| 19579 | + `style[${STYLE_HASH_ATTRIBUTE13}]` | |
| 19580 | + )) { | |
| 19581 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE13) === hash) { | |
| 19582 | + return true; | |
| 19583 | + } | |
| 19584 | + } | |
| 19585 | + return false; | |
| 19586 | +} | |
| 19587 | +function injectStyle13(targetDocument, hash, css) { | |
| 19588 | + if (!targetDocument.head) { | |
| 19589 | + return; | |
| 19590 | + } | |
| 19591 | + const runtime = getRuntime13(); | |
| 19592 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 19593 | + if (!injectedStyles) { | |
| 19594 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 19595 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 19596 | + } | |
| 19597 | + if (injectedStyles.has(hash)) { | |
| 19598 | + return; | |
| 19599 | + } | |
| 19600 | + if (documentContainsStyleHash13(targetDocument, hash)) { | |
| 19601 | + injectedStyles.add(hash); | |
| 19602 | + return; | |
| 19603 | + } | |
| 19604 | + const style = targetDocument.createElement("style"); | |
| 19605 | + style.setAttribute(STYLE_HASH_ATTRIBUTE13, hash); | |
| 19606 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 19607 | + targetDocument.head.appendChild(style); | |
| 19608 | + injectedStyles.add(hash); | |
| 19609 | +} | |
| 19610 | +function registerDocument13(targetDocument) { | |
| 19611 | + const runtime = getRuntime13(); | |
| 19612 | + runtime.documents.set( | |
| 19613 | + targetDocument, | |
| 19614 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 19615 | + ); | |
| 19616 | + for (const [hash, css] of runtime.styles) { | |
| 19617 | + injectStyle13(targetDocument, hash, css); | |
| 19618 | + } | |
| 19619 | + return () => { | |
| 19620 | + const count = runtime.documents.get(targetDocument); | |
| 19621 | + if (count === void 0) { | |
| 19622 | + return; | |
| 19623 | + } | |
| 19624 | + if (count <= 1) { | |
| 19625 | + runtime.documents.delete(targetDocument); | |
| 19626 | + return; | |
| 19627 | + } | |
| 19628 | + runtime.documents.set(targetDocument, count - 1); | |
| 19629 | + }; | |
| 19630 | +} | |
| 19631 | +function registerStyle13(hash, css) { | |
| 19632 | + const runtime = getRuntime13(); | |
| 19633 | + runtime.styles.set(hash, css); | |
| 19634 | + for (const targetDocument of runtime.documents.keys()) { | |
| 19635 | + injectStyle13(targetDocument, hash, css); | |
| 19636 | + } | |
| 19637 | +} | |
| 19638 | +if (typeof process === "undefined" || true) { | |
| 19639 | + registerStyle13("bbbecfe373", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.ab4d64c07c0ba587__spinner{background-color:transparent;display:inline-block;height:var(--wpds-dimension-size-2xs,16px);opacity:1;overflow:visible;position:relative;width:var(--wpds-dimension-size-2xs,16px)}.a7654e10245bb7d2__indicator,.dc51f80c84b35fe2__track{fill:transparent;stroke-width:1.5px}.dc51f80c84b35fe2__track{stroke:var(--wpds-color-background-track-neutral,#dbdbdb)}.a7654e10245bb7d2__indicator{stroke:var(--wpds-color-background-thumb-brand,var(--wp-admin-theme-color,#3858e9));stroke-linecap:round;animation:_02322d973909703c__spinner-spin 1.4s linear infinite both;transform-origin:50% 50%}@keyframes _02322d973909703c__spinner-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}}}"); | |
| 19640 | +} | |
| 19641 | +var style_default12 = { "spinner": "ab4d64c07c0ba587__spinner", "track": "dc51f80c84b35fe2__track", "indicator": "a7654e10245bb7d2__indicator", "spinner-spin": "_02322d973909703c__spinner-spin" }; | |
| 19642 | +var Spinner = (0, import_element32.forwardRef)( | |
| 19643 | + function Spinner2({ className, ...props }, ref) { | |
| 19644 | + return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)( | |
| 19645 | + "svg", | |
| 19646 | + { | |
| 19647 | + className: clsx_default(style_default12.spinner, className), | |
| 19648 | + viewBox: "0 0 100 100", | |
| 19649 | + xmlns: "http://www.w3.org/2000/svg", | |
| 19650 | + role: "presentation", | |
| 19651 | + focusable: "false", | |
| 19652 | + ...props, | |
| 19653 | + ref, | |
| 19654 | + children: [ | |
| 19655 | + /* @__PURE__ */ (0, import_jsx_runtime44.jsx)( | |
| 19656 | + "circle", | |
| 19657 | + { | |
| 19658 | + className: style_default12.track, | |
| 19659 | + cx: "50", | |
| 19660 | + cy: "50", | |
| 19661 | + r: "50", | |
| 19662 | + vectorEffect: "non-scaling-stroke" | |
| 19663 | + } | |
| 19664 | + ), | |
| 19665 | + /* @__PURE__ */ (0, import_jsx_runtime44.jsx)( | |
| 19666 | + "path", | |
| 19667 | + { | |
| 19668 | + className: style_default12.indicator, | |
| 19669 | + d: "m 50 0 a 50 50 0 0 1 50 50", | |
| 19670 | + vectorEffect: "non-scaling-stroke" | |
| 19671 | + } | |
| 19672 | + ) | |
| 19673 | + ] | |
| 19674 | + } | |
| 19675 | + ); | |
| 19676 | + } | |
| 19677 | +); | |
| 19678 | + | |
| 19679 | +// packages/ui/build-module/form/primitives/validity-indicator/validity-indicator.mjs | |
| 19680 | +var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1); | |
| 19681 | +var STYLE_HASH_ATTRIBUTE14 = "data-wp-hash"; | |
| 19682 | +function getRuntime14() { | |
| 19683 | + const globalScope = globalThis; | |
| 19684 | + if (globalScope.__wpStyleRuntime) { | |
| 19685 | + return globalScope.__wpStyleRuntime; | |
| 19686 | + } | |
| 19687 | + globalScope.__wpStyleRuntime = { | |
| 19688 | + documents: /* @__PURE__ */ new Map(), | |
| 19689 | + styles: /* @__PURE__ */ new Map(), | |
| 19690 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 19691 | + }; | |
| 19692 | + if (typeof document !== "undefined") { | |
| 19693 | + registerDocument14(document); | |
| 19694 | + } | |
| 19695 | + return globalScope.__wpStyleRuntime; | |
| 19696 | +} | |
| 19697 | +function documentContainsStyleHash14(targetDocument, hash) { | |
| 19698 | + if (!targetDocument.head) { | |
| 19699 | + return false; | |
| 19700 | + } | |
| 19701 | + for (const style of targetDocument.head.querySelectorAll( | |
| 19702 | + `style[${STYLE_HASH_ATTRIBUTE14}]` | |
| 19703 | + )) { | |
| 19704 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE14) === hash) { | |
| 19705 | + return true; | |
| 19706 | + } | |
| 19707 | + } | |
| 19708 | + return false; | |
| 19709 | +} | |
| 19710 | +function injectStyle14(targetDocument, hash, css) { | |
| 19711 | + if (!targetDocument.head) { | |
| 19712 | + return; | |
| 19713 | + } | |
| 19714 | + const runtime = getRuntime14(); | |
| 19715 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 19716 | + if (!injectedStyles) { | |
| 19717 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 19718 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 19719 | + } | |
| 19720 | + if (injectedStyles.has(hash)) { | |
| 19721 | + return; | |
| 19722 | + } | |
| 19723 | + if (documentContainsStyleHash14(targetDocument, hash)) { | |
| 19724 | + injectedStyles.add(hash); | |
| 19725 | + return; | |
| 19726 | + } | |
| 19727 | + const style = targetDocument.createElement("style"); | |
| 19728 | + style.setAttribute(STYLE_HASH_ATTRIBUTE14, hash); | |
| 19729 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 19730 | + targetDocument.head.appendChild(style); | |
| 19731 | + injectedStyles.add(hash); | |
| 19732 | +} | |
| 19733 | +function registerDocument14(targetDocument) { | |
| 19734 | + const runtime = getRuntime14(); | |
| 19735 | + runtime.documents.set( | |
| 19736 | + targetDocument, | |
| 19737 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 19738 | + ); | |
| 19739 | + for (const [hash, css] of runtime.styles) { | |
| 19740 | + injectStyle14(targetDocument, hash, css); | |
| 19741 | + } | |
| 19742 | + return () => { | |
| 19743 | + const count = runtime.documents.get(targetDocument); | |
| 19744 | + if (count === void 0) { | |
| 19745 | + return; | |
| 19746 | + } | |
| 19747 | + if (count <= 1) { | |
| 19748 | + runtime.documents.delete(targetDocument); | |
| 19749 | + return; | |
| 19750 | + } | |
| 19751 | + runtime.documents.set(targetDocument, count - 1); | |
| 19752 | + }; | |
| 19753 | +} | |
| 19754 | +function registerStyle14(hash, css) { | |
| 19755 | + const runtime = getRuntime14(); | |
| 19756 | + runtime.styles.set(hash, css); | |
| 19757 | + for (const targetDocument of runtime.documents.keys()) { | |
| 19758 | + injectStyle14(targetDocument, hash, css); | |
| 19759 | + } | |
| 19760 | +} | |
| 19761 | +if (typeof process === "undefined" || true) { | |
| 19762 | + 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)}"); | |
| 19763 | +} | |
| 19764 | +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" }; | |
| 19765 | +if (typeof process === "undefined" || true) { | |
| 19766 | + registerStyle14("d11816833c", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._7a7ac88e306348e7__indicator{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);align-items:flex-start;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-sm,12px);gap:var(--wpds-dimension-gap-xs,4px);line-height:var(--wpds-typography-line-height-xs,16px);@media not (prefers-reduced-motion){animation:_48722cc5dd090ce4__indicator-jump var(--wpds-motion-duration-md,.2s) cubic-bezier(.68,-.55,.27,1.55)}}._57a3bbbfbe38a5c6__is-invalid{color:var(--wpds-color-foreground-content-error-weak,#cc1818)}._9e944dc198aac10b__is-valid{color:var(--wpds-color-foreground-content-success-weak,#008030)}.e482806667437c6a__indicator-icon{flex-shrink:0}._6e46434cc23019d2__indicator-spinner{height:var(--wpds-dimension-size-3xs,12px);margin:2px;width:var(--wpds-dimension-size-3xs,12px)}@keyframes _48722cc5dd090ce4__indicator-jump{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}}}'); | |
| 19767 | +} | |
| 19768 | +var style_default13 = { "indicator": "_7a7ac88e306348e7__indicator", "indicator-jump": "_48722cc5dd090ce4__indicator-jump", "is-invalid": "_57a3bbbfbe38a5c6__is-invalid", "is-valid": "_9e944dc198aac10b__is-valid", "indicator-icon": "e482806667437c6a__indicator-icon", "indicator-spinner": "_6e46434cc23019d2__indicator-spinner" }; | |
| 19769 | +var ICON = { | |
| 19770 | + valid: published_default, | |
| 19771 | + invalid: error_default | |
| 19772 | +}; | |
| 19773 | +function ValidityIndicator({ | |
| 19774 | + id, | |
| 19775 | + type, | |
| 19776 | + message: message2 | |
| 19777 | +}) { | |
| 19778 | + return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)( | |
| 19779 | + "p", | |
| 19780 | + { | |
| 19781 | + id, | |
| 19782 | + className: clsx_default( | |
| 19783 | + global_css_defense_default5.p, | |
| 19784 | + style_default13.indicator, | |
| 19785 | + style_default13[`is-${type}`] | |
| 19786 | + ), | |
| 19787 | + children: [ | |
| 19788 | + type === "validating" ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Spinner, { className: style_default13["indicator-spinner"] }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( | |
| 19789 | + Icon, | |
| 19790 | + { | |
| 19791 | + className: style_default13["indicator-icon"], | |
| 19792 | + icon: ICON[type], | |
| 19793 | + size: 16, | |
| 19794 | + fill: "currentColor" | |
| 19795 | + } | |
| 19796 | + ), | |
| 19797 | + message2 | |
| 19798 | + ] | |
| 19799 | + } | |
| 19800 | + ); | |
| 19801 | +} | |
| 19802 | + | |
| 19803 | +// packages/ui/build-module/form/primitives/control-with-error/control-with-error.mjs | |
| 19804 | +var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1); | |
| 19805 | +var DEFAULT_RENDER = (props) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Stack, { ...props, direction: "column", gap: "sm" }); | |
| 19806 | +function appendRequiredIndicator(label, required, markWhenOptional) { | |
| 19807 | + let suffix; | |
| 19808 | + if (required && !markWhenOptional) { | |
| 19809 | + suffix = `(${(0, import_i18n6.__)("Required")})`; | |
| 19810 | + } else if (!required && markWhenOptional) { | |
| 19811 | + suffix = `(${(0, import_i18n6.__)("Optional")})`; | |
| 19812 | + } | |
| 19813 | + if (!suffix) { | |
| 19814 | + return label; | |
| 19815 | + } | |
| 19816 | + if (typeof label === "string") { | |
| 19817 | + return `${label} ${suffix}`; | |
| 19818 | + } | |
| 19819 | + return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [ | |
| 19820 | + label, | |
| 19821 | + " ", | |
| 19822 | + suffix | |
| 19823 | + ] }); | |
| 19824 | +} | |
| 19825 | +var VALIDITY_VISIBLE_ATTRIBUTE = "data-validity-visible"; | |
| 19826 | +var ControlWithError = (0, import_element33.forwardRef)(function ControlWithError2({ | |
| 19827 | + required, | |
| 19828 | + markWhenOptional, | |
| 19829 | + customValidity, | |
| 19830 | + getValidityTarget, | |
| 19831 | + children, | |
| 19832 | + render: render4 = DEFAULT_RENDER, | |
| 19833 | + ...restProps | |
| 19834 | +}, forwardedRef) { | |
| 19835 | + const [errorMessage, setErrorMessage] = (0, import_element33.useState)(); | |
| 19836 | + const [statusMessage, setStatusMessage] = (0, import_element33.useState)(); | |
| 19837 | + const [showMessage, setShowMessage] = (0, import_element33.useState)(false); | |
| 19838 | + const [isTouched, setIsTouched] = (0, import_element33.useState)(false); | |
| 19839 | + const wrapperRef = (0, import_element33.useRef)(null); | |
| 19840 | + (0, import_element33.useEffect)(() => { | |
| 19841 | + const validityTarget = getValidityTarget(); | |
| 19842 | + const handler = () => { | |
| 19843 | + if (customValidity?.type !== "validating") { | |
| 19844 | + setErrorMessage(validityTarget?.validationMessage); | |
| 19845 | + } | |
| 19846 | + setShowMessage(true); | |
| 19847 | + validityTarget?.setAttribute(VALIDITY_VISIBLE_ATTRIBUTE, ""); | |
| 19848 | + }; | |
| 19849 | + validityTarget?.addEventListener("invalid", handler); | |
| 19850 | + return () => validityTarget?.removeEventListener("invalid", handler); | |
| 19851 | + }, [customValidity?.type, getValidityTarget]); | |
| 19852 | + (0, import_element33.useEffect)(() => { | |
| 19853 | + const validityTarget = getValidityTarget(); | |
| 19854 | + const suppressNativePopover = (event) => { | |
| 19855 | + event.preventDefault(); | |
| 19856 | + if (!event.isTrusted) { | |
| 19857 | + return; | |
| 19858 | + } | |
| 19859 | + const target = event.target; | |
| 19860 | + const firstErrorInForm = Array.from( | |
| 19861 | + target.form?.elements ?? [] | |
| 19862 | + ).find((el) => !el.validity.valid); | |
| 19863 | + if (!target.form || firstErrorInForm === target) { | |
| 19864 | + target.focus(); | |
| 19865 | + } | |
| 19866 | + }; | |
| 19867 | + const radioSiblings = validityTarget?.type === "radio" && validityTarget?.name ? Array.from( | |
| 19868 | + wrapperRef.current?.querySelectorAll( | |
| 19869 | + `input[type="radio"][name="${validityTarget?.name}"]` | |
| 19870 | + ) ?? [] | |
| 19871 | + ).filter((sibling) => sibling !== validityTarget) : []; | |
| 19872 | + validityTarget?.addEventListener("invalid", suppressNativePopover); | |
| 19873 | + radioSiblings.forEach( | |
| 19874 | + (sibling) => sibling.addEventListener("invalid", suppressNativePopover) | |
| 19875 | + ); | |
| 19876 | + return () => { | |
| 19877 | + validityTarget?.removeEventListener( | |
| 19878 | + "invalid", | |
| 19879 | + suppressNativePopover | |
| 19880 | + ); | |
| 19881 | + radioSiblings.forEach( | |
| 19882 | + (sibling) => sibling.removeEventListener("invalid", suppressNativePopover) | |
| 19883 | + ); | |
| 19884 | + }; | |
| 19885 | + }, [getValidityTarget]); | |
| 19886 | + (0, import_element33.useEffect)(() => { | |
| 19887 | + const validityTarget = getValidityTarget(); | |
| 19888 | + if (!customValidity?.type) { | |
| 19889 | + validityTarget?.setCustomValidity(""); | |
| 19890 | + setErrorMessage(validityTarget?.validationMessage); | |
| 19891 | + setStatusMessage(void 0); | |
| 19892 | + return; | |
| 19893 | + } | |
| 19894 | + switch (customValidity.type) { | |
| 19895 | + case "validating": { | |
| 19896 | + validityTarget?.setCustomValidity(""); | |
| 19897 | + setErrorMessage(void 0); | |
| 19898 | + setStatusMessage({ | |
| 19899 | + type: "validating", | |
| 19900 | + message: customValidity.message | |
| 19901 | + }); | |
| 19902 | + break; | |
| 19903 | + } | |
| 19904 | + case "valid": { | |
| 19905 | + validityTarget?.setCustomValidity(""); | |
| 19906 | + setErrorMessage(validityTarget?.validationMessage); | |
| 19907 | + setStatusMessage({ | |
| 19908 | + type: "valid", | |
| 19909 | + message: customValidity.message | |
| 19910 | + }); | |
| 19911 | + break; | |
| 19912 | + } | |
| 19913 | + case "invalid": { | |
| 19914 | + validityTarget?.setCustomValidity( | |
| 19915 | + customValidity.message ?? "" | |
| 19916 | + ); | |
| 19917 | + setErrorMessage(validityTarget?.validationMessage); | |
| 19918 | + setStatusMessage(void 0); | |
| 19919 | + break; | |
| 19920 | + } | |
| 19921 | + } | |
| 19922 | + }, [customValidity, getValidityTarget]); | |
| 19923 | + (0, import_element33.useEffect)(() => { | |
| 19924 | + if (!isTouched || showMessage) { | |
| 19925 | + return; | |
| 19926 | + } | |
| 19927 | + if (customValidity?.type === "validating") { | |
| 19928 | + const timer = setTimeout(() => { | |
| 19929 | + setShowMessage(true); | |
| 19930 | + }, 1e3); | |
| 19931 | + return () => clearTimeout(timer); | |
| 19932 | + } | |
| 19933 | + setShowMessage(true); | |
| 19934 | + }, [isTouched, customValidity?.type, showMessage]); | |
| 19935 | + const onBlur = (event) => { | |
| 19936 | + if (event.relatedTarget && event.currentTarget.contains(event.relatedTarget)) { | |
| 19937 | + return; | |
| 19938 | + } | |
| 19939 | + if (!isTouched) { | |
| 19940 | + setIsTouched(true); | |
| 19941 | + getValidityTarget()?.setAttribute(VALIDITY_VISIBLE_ATTRIBUTE, ""); | |
| 19942 | + } | |
| 19943 | + const validityTarget = getValidityTarget(); | |
| 19944 | + const isValidating = customValidity?.type === "validating"; | |
| 19945 | + window.queueMicrotask(() => { | |
| 19946 | + if (!isValidating) { | |
| 19947 | + setErrorMessage(validityTarget?.validationMessage); | |
| 19948 | + } | |
| 19949 | + }); | |
| 19950 | + }; | |
| 19951 | + const messageId = (0, import_element33.useId)(); | |
| 19952 | + const message2 = (() => { | |
| 19953 | + if (errorMessage) { | |
| 19954 | + return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)( | |
| 19955 | + ValidityIndicator, | |
| 19956 | + { | |
| 19957 | + id: messageId, | |
| 19958 | + type: "invalid", | |
| 19959 | + message: errorMessage | |
| 19960 | + } | |
| 19961 | + ); | |
| 19962 | + } | |
| 19963 | + if (statusMessage?.type) { | |
| 19964 | + return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)( | |
| 19965 | + ValidityIndicator, | |
| 19966 | + { | |
| 19967 | + id: messageId, | |
| 19968 | + type: statusMessage.type, | |
| 19969 | + message: statusMessage.message | |
| 19970 | + } | |
| 19971 | + ); | |
| 19972 | + } | |
| 19973 | + return null; | |
| 19974 | + })(); | |
| 19975 | + const visibleMessage = showMessage ? message2 : null; | |
| 19976 | + (0, import_element33.useEffect)(() => { | |
| 19977 | + const target = getValidityTarget(); | |
| 19978 | + if (!target) { | |
| 19979 | + return; | |
| 19980 | + } | |
| 19981 | + function setDescribedBy(el, shouldAdd) { | |
| 19982 | + const ids = (el.getAttribute("aria-describedby") ?? "").split(" ").filter((id) => id && id !== messageId); | |
| 19983 | + if (shouldAdd) { | |
| 19984 | + ids.push(messageId); | |
| 19985 | + } | |
| 19986 | + if (ids.length) { | |
| 19987 | + el.setAttribute("aria-describedby", ids.join(" ")); | |
| 19988 | + } else { | |
| 19989 | + el.removeAttribute("aria-describedby"); | |
| 19990 | + } | |
| 19991 | + } | |
| 19992 | + setDescribedBy(target, !!visibleMessage); | |
| 19993 | + return () => setDescribedBy(target, false); | |
| 19994 | + }, [visibleMessage, messageId, getValidityTarget]); | |
| 19995 | + return useRender({ | |
| 19996 | + render: render4, | |
| 19997 | + ref: [forwardedRef, wrapperRef], | |
| 19998 | + props: mergeProps(restProps, { | |
| 19999 | + onBlur, | |
| 20000 | + children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [ | |
| 20001 | + (0, import_element33.cloneElement)(children, { | |
| 20002 | + label: appendRequiredIndicator( | |
| 20003 | + children.props.label, | |
| 20004 | + required, | |
| 20005 | + markWhenOptional | |
| 20006 | + ), | |
| 20007 | + required | |
| 20008 | + }), | |
| 20009 | + visibleMessage | |
| 20010 | + ] }) | |
| 20011 | + }) | |
| 20012 | + }); | |
| 20013 | +}); | |
| 20014 | + | |
| 20015 | +// packages/ui/build-module/form/primitives/field/index.mjs | |
| 20016 | +var field_exports = {}; | |
| 20017 | +__export(field_exports, { | |
| 20018 | + Control: () => Control, | |
| 20019 | + Description: () => Description, | |
| 20020 | + Details: () => Details, | |
| 20021 | + Item: () => Item, | |
| 20022 | + Label: () => Label, | |
| 20023 | + Root: () => Root4, | |
| 20024 | + VisualLabel: () => VisualLabel | |
| 20025 | +}); | |
| 20026 | + | |
| 20027 | +// packages/ui/build-module/form/primitives/field/root.mjs | |
| 20028 | +var import_element34 = __toESM(require_element(), 1); | |
| 20029 | +var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1); | |
| 20030 | +var STYLE_HASH_ATTRIBUTE15 = "data-wp-hash"; | |
| 20031 | +function getRuntime15() { | |
| 20032 | + const globalScope = globalThis; | |
| 20033 | + if (globalScope.__wpStyleRuntime) { | |
| 20034 | + return globalScope.__wpStyleRuntime; | |
| 20035 | + } | |
| 20036 | + globalScope.__wpStyleRuntime = { | |
| 20037 | + documents: /* @__PURE__ */ new Map(), | |
| 20038 | + styles: /* @__PURE__ */ new Map(), | |
| 20039 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 20040 | + }; | |
| 20041 | + if (typeof document !== "undefined") { | |
| 20042 | + registerDocument15(document); | |
| 20043 | + } | |
| 20044 | + return globalScope.__wpStyleRuntime; | |
| 20045 | +} | |
| 20046 | +function documentContainsStyleHash15(targetDocument, hash) { | |
| 20047 | + if (!targetDocument.head) { | |
| 20048 | + return false; | |
| 20049 | + } | |
| 20050 | + for (const style of targetDocument.head.querySelectorAll( | |
| 20051 | + `style[${STYLE_HASH_ATTRIBUTE15}]` | |
| 20052 | + )) { | |
| 20053 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE15) === hash) { | |
| 20054 | + return true; | |
| 20055 | + } | |
| 20056 | + } | |
| 20057 | + return false; | |
| 20058 | +} | |
| 20059 | +function injectStyle15(targetDocument, hash, css) { | |
| 20060 | + if (!targetDocument.head) { | |
| 20061 | + return; | |
| 20062 | + } | |
| 20063 | + const runtime = getRuntime15(); | |
| 20064 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 20065 | + if (!injectedStyles) { | |
| 20066 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 20067 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 20068 | + } | |
| 20069 | + if (injectedStyles.has(hash)) { | |
| 20070 | + return; | |
| 20071 | + } | |
| 20072 | + if (documentContainsStyleHash15(targetDocument, hash)) { | |
| 20073 | + injectedStyles.add(hash); | |
| 20074 | + return; | |
| 20075 | + } | |
| 20076 | + const style = targetDocument.createElement("style"); | |
| 20077 | + style.setAttribute(STYLE_HASH_ATTRIBUTE15, hash); | |
| 20078 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 20079 | + targetDocument.head.appendChild(style); | |
| 20080 | + injectedStyles.add(hash); | |
| 20081 | +} | |
| 20082 | +function registerDocument15(targetDocument) { | |
| 20083 | + const runtime = getRuntime15(); | |
| 20084 | + runtime.documents.set( | |
| 20085 | + targetDocument, | |
| 20086 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 20087 | + ); | |
| 20088 | + for (const [hash, css] of runtime.styles) { | |
| 20089 | + injectStyle15(targetDocument, hash, css); | |
| 20090 | + } | |
| 20091 | + return () => { | |
| 20092 | + const count = runtime.documents.get(targetDocument); | |
| 20093 | + if (count === void 0) { | |
| 20094 | + return; | |
| 20095 | + } | |
| 20096 | + if (count <= 1) { | |
| 20097 | + runtime.documents.delete(targetDocument); | |
| 20098 | + return; | |
| 20099 | + } | |
| 20100 | + runtime.documents.set(targetDocument, count - 1); | |
| 20101 | + }; | |
| 20102 | +} | |
| 20103 | +function registerStyle15(hash, css) { | |
| 20104 | + const runtime = getRuntime15(); | |
| 20105 | + runtime.styles.set(hash, css); | |
| 20106 | + for (const targetDocument of runtime.documents.keys()) { | |
| 20107 | + injectStyle15(targetDocument, hash, css); | |
| 20108 | + } | |
| 20109 | +} | |
| 20110 | +if (typeof process === "undefined" || true) { | |
| 20111 | + registerStyle15("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); | |
| 20112 | +} | |
| 20113 | +var resets_default5 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; | |
| 20114 | +var DEFAULT_RENDER2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Stack, { ...props, direction: "column", gap: "sm" }); | |
| 20115 | +var Root4 = (0, import_element34.forwardRef)(function Root22({ className, render: render4 = DEFAULT_RENDER2, ...restProps }, ref) { | |
| 20116 | + return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)( | |
| 20117 | + index_parts_exports.Root, | |
| 20118 | + { | |
| 20119 | + ref, | |
| 20120 | + className: clsx_default(resets_default5["box-sizing"], className), | |
| 20121 | + render: render4, | |
| 20122 | + ...restProps | |
| 20123 | + } | |
| 20124 | + ); | |
| 20125 | +}); | |
| 20126 | + | |
| 20127 | +// packages/ui/build-module/form/primitives/field/item.mjs | |
| 20128 | +var import_element35 = __toESM(require_element(), 1); | |
| 20129 | +var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1); | |
| 20130 | +var Item = (0, import_element35.forwardRef)(function Item2(props, ref) { | |
| 20131 | + return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(index_parts_exports.Item, { ref, ...props }); | |
| 20132 | +}); | |
| 20133 | + | |
| 20134 | +// packages/ui/build-module/form/primitives/field/label.mjs | |
| 20135 | +var import_element36 = __toESM(require_element(), 1); | |
| 20136 | +var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1); | |
| 20137 | +var STYLE_HASH_ATTRIBUTE16 = "data-wp-hash"; | |
| 20138 | +function getRuntime16() { | |
| 20139 | + const globalScope = globalThis; | |
| 20140 | + if (globalScope.__wpStyleRuntime) { | |
| 20141 | + return globalScope.__wpStyleRuntime; | |
| 20142 | + } | |
| 20143 | + globalScope.__wpStyleRuntime = { | |
| 20144 | + documents: /* @__PURE__ */ new Map(), | |
| 20145 | + styles: /* @__PURE__ */ new Map(), | |
| 20146 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 20147 | + }; | |
| 20148 | + if (typeof document !== "undefined") { | |
| 20149 | + registerDocument16(document); | |
| 20150 | + } | |
| 20151 | + return globalScope.__wpStyleRuntime; | |
| 20152 | +} | |
| 20153 | +function documentContainsStyleHash16(targetDocument, hash) { | |
| 20154 | + if (!targetDocument.head) { | |
| 20155 | + return false; | |
| 20156 | + } | |
| 20157 | + for (const style of targetDocument.head.querySelectorAll( | |
| 20158 | + `style[${STYLE_HASH_ATTRIBUTE16}]` | |
| 20159 | + )) { | |
| 20160 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE16) === hash) { | |
| 20161 | + return true; | |
| 20162 | + } | |
| 20163 | + } | |
| 20164 | + return false; | |
| 20165 | +} | |
| 20166 | +function injectStyle16(targetDocument, hash, css) { | |
| 20167 | + if (!targetDocument.head) { | |
| 20168 | + return; | |
| 20169 | + } | |
| 20170 | + const runtime = getRuntime16(); | |
| 20171 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 20172 | + if (!injectedStyles) { | |
| 20173 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 20174 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 20175 | + } | |
| 20176 | + if (injectedStyles.has(hash)) { | |
| 20177 | + return; | |
| 20178 | + } | |
| 20179 | + if (documentContainsStyleHash16(targetDocument, hash)) { | |
| 20180 | + injectedStyles.add(hash); | |
| 20181 | + return; | |
| 20182 | + } | |
| 20183 | + const style = targetDocument.createElement("style"); | |
| 20184 | + style.setAttribute(STYLE_HASH_ATTRIBUTE16, hash); | |
| 20185 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 20186 | + targetDocument.head.appendChild(style); | |
| 20187 | + injectedStyles.add(hash); | |
| 20188 | +} | |
| 20189 | +function registerDocument16(targetDocument) { | |
| 20190 | + const runtime = getRuntime16(); | |
| 20191 | + runtime.documents.set( | |
| 20192 | + targetDocument, | |
| 20193 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 20194 | + ); | |
| 20195 | + for (const [hash, css] of runtime.styles) { | |
| 20196 | + injectStyle16(targetDocument, hash, css); | |
| 20197 | + } | |
| 20198 | + return () => { | |
| 20199 | + const count = runtime.documents.get(targetDocument); | |
| 20200 | + if (count === void 0) { | |
| 20201 | + return; | |
| 20202 | + } | |
| 20203 | + if (count <= 1) { | |
| 20204 | + runtime.documents.delete(targetDocument); | |
| 20205 | + return; | |
| 20206 | + } | |
| 20207 | + runtime.documents.set(targetDocument, count - 1); | |
| 20208 | + }; | |
| 20209 | +} | |
| 20210 | +function registerStyle16(hash, css) { | |
| 20211 | + const runtime = getRuntime16(); | |
| 20212 | + runtime.styles.set(hash, css); | |
| 20213 | + for (const targetDocument of runtime.documents.keys()) { | |
| 20214 | + injectStyle16(targetDocument, hash, css); | |
| 20215 | + } | |
| 20216 | +} | |
| 20217 | +if (typeof process === "undefined" || true) { | |
| 20218 | + registerStyle16("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);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:var(--wpds-typography-line-height-xs,16px)}}}'); | |
| 20219 | +} | |
| 20220 | +var field_default = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" }; | |
| 20221 | +var Label = (0, import_element36.forwardRef)( | |
| 20222 | + function Label2({ className, hideFromVision, variant, ...restProps }, ref) { | |
| 20223 | + const label = /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( | |
| 20224 | + index_parts_exports.Label, | |
| 20225 | + { | |
| 20226 | + ref, | |
| 20227 | + className: clsx_default( | |
| 20228 | + field_default.label, | |
| 20229 | + variant && field_default[`is-${variant}`], | |
| 20230 | + className | |
| 20231 | + ), | |
| 20232 | + ...restProps | |
| 20233 | + } | |
| 20234 | + ); | |
| 20235 | + if (hideFromVision) { | |
| 20236 | + return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(VisuallyHidden, { render: label }); | |
| 20237 | + } | |
| 20238 | + return label; | |
| 20239 | + } | |
| 20240 | +); | |
| 20241 | + | |
| 20242 | +// packages/ui/build-module/form/primitives/field/description.mjs | |
| 20243 | +var import_element37 = __toESM(require_element(), 1); | |
| 20244 | +var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1); | |
| 20245 | +var STYLE_HASH_ATTRIBUTE17 = "data-wp-hash"; | |
| 20246 | +function getRuntime17() { | |
| 20247 | + const globalScope = globalThis; | |
| 20248 | + if (globalScope.__wpStyleRuntime) { | |
| 20249 | + return globalScope.__wpStyleRuntime; | |
| 20250 | + } | |
| 20251 | + globalScope.__wpStyleRuntime = { | |
| 20252 | + documents: /* @__PURE__ */ new Map(), | |
| 20253 | + styles: /* @__PURE__ */ new Map(), | |
| 20254 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 20255 | + }; | |
| 20256 | + if (typeof document !== "undefined") { | |
| 20257 | + registerDocument17(document); | |
| 20258 | + } | |
| 20259 | + return globalScope.__wpStyleRuntime; | |
| 20260 | +} | |
| 20261 | +function documentContainsStyleHash17(targetDocument, hash) { | |
| 20262 | + if (!targetDocument.head) { | |
| 20263 | + return false; | |
| 20264 | + } | |
| 20265 | + for (const style of targetDocument.head.querySelectorAll( | |
| 20266 | + `style[${STYLE_HASH_ATTRIBUTE17}]` | |
| 20267 | + )) { | |
| 20268 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE17) === hash) { | |
| 20269 | + return true; | |
| 20270 | + } | |
| 20271 | + } | |
| 20272 | + return false; | |
| 20273 | +} | |
| 20274 | +function injectStyle17(targetDocument, hash, css) { | |
| 20275 | + if (!targetDocument.head) { | |
| 20276 | + return; | |
| 20277 | + } | |
| 20278 | + const runtime = getRuntime17(); | |
| 20279 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 20280 | + if (!injectedStyles) { | |
| 20281 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 20282 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 20283 | + } | |
| 20284 | + if (injectedStyles.has(hash)) { | |
| 20285 | + return; | |
| 20286 | + } | |
| 20287 | + if (documentContainsStyleHash17(targetDocument, hash)) { | |
| 20288 | + injectedStyles.add(hash); | |
| 20289 | + return; | |
| 20290 | + } | |
| 20291 | + const style = targetDocument.createElement("style"); | |
| 20292 | + style.setAttribute(STYLE_HASH_ATTRIBUTE17, hash); | |
| 20293 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 20294 | + targetDocument.head.appendChild(style); | |
| 20295 | + injectedStyles.add(hash); | |
| 20296 | +} | |
| 20297 | +function registerDocument17(targetDocument) { | |
| 20298 | + const runtime = getRuntime17(); | |
| 20299 | + runtime.documents.set( | |
| 20300 | + targetDocument, | |
| 20301 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 20302 | + ); | |
| 20303 | + for (const [hash, css] of runtime.styles) { | |
| 20304 | + injectStyle17(targetDocument, hash, css); | |
| 20305 | + } | |
| 20306 | + return () => { | |
| 20307 | + const count = runtime.documents.get(targetDocument); | |
| 20308 | + if (count === void 0) { | |
| 20309 | + return; | |
| 20310 | + } | |
| 20311 | + if (count <= 1) { | |
| 20312 | + runtime.documents.delete(targetDocument); | |
| 20313 | + return; | |
| 20314 | + } | |
| 20315 | + runtime.documents.set(targetDocument, count - 1); | |
| 20316 | + }; | |
| 20317 | +} | |
| 20318 | +function registerStyle17(hash, css) { | |
| 20319 | + const runtime = getRuntime17(); | |
| 20320 | + runtime.styles.set(hash, css); | |
| 20321 | + for (const targetDocument of runtime.documents.keys()) { | |
| 20322 | + injectStyle17(targetDocument, hash, css); | |
| 20323 | + } | |
| 20324 | +} | |
| 20325 | +if (typeof process === "undefined" || true) { | |
| 20326 | + registerStyle17("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)}"); | |
| 20327 | +} | |
| 20328 | +var global_css_defense_default6 = { "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" }; | |
| 20329 | +if (typeof process === "undefined" || true) { | |
| 20330 | + registerStyle17("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);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:var(--wpds-typography-line-height-xs,16px)}}}'); | |
| 20331 | +} | |
| 20332 | +var field_default2 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" }; | |
| 20333 | +var Description = (0, import_element37.forwardRef)(function Description2({ className, ...restProps }, ref) { | |
| 20334 | + return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)( | |
| 20335 | + index_parts_exports.Description, | |
| 20336 | + { | |
| 20337 | + ref, | |
| 20338 | + className: clsx_default( | |
| 20339 | + global_css_defense_default6.p, | |
| 20340 | + field_default2.description, | |
| 20341 | + className | |
| 20342 | + ), | |
| 20343 | + ...restProps | |
| 20344 | + } | |
| 20345 | + ); | |
| 20346 | +}); | |
| 20347 | + | |
| 20348 | +// packages/ui/build-module/form/primitives/field/details.mjs | |
| 20349 | +var import_element38 = __toESM(require_element(), 1); | |
| 20350 | +var import_i18n7 = __toESM(require_i18n(), 1); | |
| 20351 | +var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1); | |
| 20352 | +var STYLE_HASH_ATTRIBUTE18 = "data-wp-hash"; | |
| 20353 | +function getRuntime18() { | |
| 20354 | + const globalScope = globalThis; | |
| 20355 | + if (globalScope.__wpStyleRuntime) { | |
| 20356 | + return globalScope.__wpStyleRuntime; | |
| 20357 | + } | |
| 20358 | + globalScope.__wpStyleRuntime = { | |
| 20359 | + documents: /* @__PURE__ */ new Map(), | |
| 20360 | + styles: /* @__PURE__ */ new Map(), | |
| 20361 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 20362 | + }; | |
| 20363 | + if (typeof document !== "undefined") { | |
| 20364 | + registerDocument18(document); | |
| 20365 | + } | |
| 20366 | + return globalScope.__wpStyleRuntime; | |
| 20367 | +} | |
| 20368 | +function documentContainsStyleHash18(targetDocument, hash) { | |
| 20369 | + if (!targetDocument.head) { | |
| 20370 | + return false; | |
| 20371 | + } | |
| 20372 | + for (const style of targetDocument.head.querySelectorAll( | |
| 20373 | + `style[${STYLE_HASH_ATTRIBUTE18}]` | |
| 20374 | + )) { | |
| 20375 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE18) === hash) { | |
| 20376 | + return true; | |
| 20377 | + } | |
| 20378 | + } | |
| 20379 | + return false; | |
| 20380 | +} | |
| 20381 | +function injectStyle18(targetDocument, hash, css) { | |
| 20382 | + if (!targetDocument.head) { | |
| 20383 | + return; | |
| 20384 | + } | |
| 20385 | + const runtime = getRuntime18(); | |
| 20386 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 20387 | + if (!injectedStyles) { | |
| 20388 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 20389 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 20390 | + } | |
| 20391 | + if (injectedStyles.has(hash)) { | |
| 20392 | + return; | |
| 20393 | + } | |
| 20394 | + if (documentContainsStyleHash18(targetDocument, hash)) { | |
| 20395 | + injectedStyles.add(hash); | |
| 20396 | + return; | |
| 20397 | + } | |
| 20398 | + const style = targetDocument.createElement("style"); | |
| 20399 | + style.setAttribute(STYLE_HASH_ATTRIBUTE18, hash); | |
| 20400 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 20401 | + targetDocument.head.appendChild(style); | |
| 20402 | + injectedStyles.add(hash); | |
| 20403 | +} | |
| 20404 | +function registerDocument18(targetDocument) { | |
| 20405 | + const runtime = getRuntime18(); | |
| 20406 | + runtime.documents.set( | |
| 20407 | + targetDocument, | |
| 20408 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 20409 | + ); | |
| 20410 | + for (const [hash, css] of runtime.styles) { | |
| 20411 | + injectStyle18(targetDocument, hash, css); | |
| 20412 | + } | |
| 20413 | + return () => { | |
| 20414 | + const count = runtime.documents.get(targetDocument); | |
| 20415 | + if (count === void 0) { | |
| 20416 | + return; | |
| 20417 | + } | |
| 20418 | + if (count <= 1) { | |
| 20419 | + runtime.documents.delete(targetDocument); | |
| 20420 | + return; | |
| 20421 | + } | |
| 20422 | + runtime.documents.set(targetDocument, count - 1); | |
| 20423 | + }; | |
| 20424 | +} | |
| 20425 | +function registerStyle18(hash, css) { | |
| 20426 | + const runtime = getRuntime18(); | |
| 20427 | + runtime.styles.set(hash, css); | |
| 20428 | + for (const targetDocument of runtime.documents.keys()) { | |
| 20429 | + injectStyle18(targetDocument, hash, css); | |
| 20430 | + } | |
| 20431 | +} | |
| 20432 | +if (typeof process === "undefined" || true) { | |
| 20433 | + registerStyle18("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);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:var(--wpds-typography-line-height-xs,16px)}}}'); | |
| 20434 | +} | |
| 20435 | +var field_default3 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" }; | |
| 20436 | +var Details = (0, import_element38.forwardRef)( | |
| 20437 | + function Details2({ className, ...restProps }, ref) { | |
| 20438 | + return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [ | |
| 20439 | + /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(index_parts_exports.Description, {}), children: (0, import_i18n7.__)("More details follow the field.") }), | |
| 20440 | + /* @__PURE__ */ (0, import_jsx_runtime51.jsx)( | |
| 20441 | + "div", | |
| 20442 | + { | |
| 20443 | + ref, | |
| 20444 | + className: clsx_default(field_default3.description, className), | |
| 20445 | + ...restProps | |
| 20446 | + } | |
| 20447 | + ) | |
| 20448 | + ] }); | |
| 20449 | + } | |
| 20450 | +); | |
| 20451 | + | |
| 20452 | +// packages/ui/build-module/form/primitives/field/control.mjs | |
| 20453 | +var import_element39 = __toESM(require_element(), 1); | |
| 20454 | +var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1); | |
| 20455 | +var Control = (0, import_element39.forwardRef)( | |
| 20456 | + function Control2(props, ref) { | |
| 20457 | + return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(index_parts_exports.Control, { ref, ...props }); | |
| 20458 | + } | |
| 20459 | +); | |
| 20460 | + | |
| 20461 | +// packages/ui/build-module/form/primitives/field/visual-label.mjs | |
| 20462 | +var import_element40 = __toESM(require_element(), 1); | |
| 20463 | +var STYLE_HASH_ATTRIBUTE19 = "data-wp-hash"; | |
| 20464 | +function getRuntime19() { | |
| 20465 | + const globalScope = globalThis; | |
| 20466 | + if (globalScope.__wpStyleRuntime) { | |
| 20467 | + return globalScope.__wpStyleRuntime; | |
| 20468 | + } | |
| 20469 | + globalScope.__wpStyleRuntime = { | |
| 20470 | + documents: /* @__PURE__ */ new Map(), | |
| 20471 | + styles: /* @__PURE__ */ new Map(), | |
| 20472 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 20473 | + }; | |
| 20474 | + if (typeof document !== "undefined") { | |
| 20475 | + registerDocument19(document); | |
| 20476 | + } | |
| 20477 | + return globalScope.__wpStyleRuntime; | |
| 20478 | +} | |
| 20479 | +function documentContainsStyleHash19(targetDocument, hash) { | |
| 20480 | + if (!targetDocument.head) { | |
| 20481 | + return false; | |
| 20482 | + } | |
| 20483 | + for (const style of targetDocument.head.querySelectorAll( | |
| 20484 | + `style[${STYLE_HASH_ATTRIBUTE19}]` | |
| 20485 | + )) { | |
| 20486 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE19) === hash) { | |
| 20487 | + return true; | |
| 20488 | + } | |
| 20489 | + } | |
| 20490 | + return false; | |
| 20491 | +} | |
| 20492 | +function injectStyle19(targetDocument, hash, css) { | |
| 20493 | + if (!targetDocument.head) { | |
| 20494 | + return; | |
| 20495 | + } | |
| 20496 | + const runtime = getRuntime19(); | |
| 20497 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 20498 | + if (!injectedStyles) { | |
| 20499 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 20500 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 20501 | + } | |
| 20502 | + if (injectedStyles.has(hash)) { | |
| 20503 | + return; | |
| 20504 | + } | |
| 20505 | + if (documentContainsStyleHash19(targetDocument, hash)) { | |
| 20506 | + injectedStyles.add(hash); | |
| 20507 | + return; | |
| 20508 | + } | |
| 20509 | + const style = targetDocument.createElement("style"); | |
| 20510 | + style.setAttribute(STYLE_HASH_ATTRIBUTE19, hash); | |
| 20511 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 20512 | + targetDocument.head.appendChild(style); | |
| 20513 | + injectedStyles.add(hash); | |
| 20514 | +} | |
| 20515 | +function registerDocument19(targetDocument) { | |
| 20516 | + const runtime = getRuntime19(); | |
| 20517 | + runtime.documents.set( | |
| 20518 | + targetDocument, | |
| 20519 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 20520 | + ); | |
| 20521 | + for (const [hash, css] of runtime.styles) { | |
| 20522 | + injectStyle19(targetDocument, hash, css); | |
| 20523 | + } | |
| 20524 | + return () => { | |
| 20525 | + const count = runtime.documents.get(targetDocument); | |
| 20526 | + if (count === void 0) { | |
| 20527 | + return; | |
| 20528 | + } | |
| 20529 | + if (count <= 1) { | |
| 20530 | + runtime.documents.delete(targetDocument); | |
| 20531 | + return; | |
| 20532 | + } | |
| 20533 | + runtime.documents.set(targetDocument, count - 1); | |
| 20534 | + }; | |
| 20535 | +} | |
| 20536 | +function registerStyle19(hash, css) { | |
| 20537 | + const runtime = getRuntime19(); | |
| 20538 | + runtime.styles.set(hash, css); | |
| 20539 | + for (const targetDocument of runtime.documents.keys()) { | |
| 20540 | + injectStyle19(targetDocument, hash, css); | |
| 20541 | + } | |
| 20542 | +} | |
| 20543 | +if (typeof process === "undefined" || true) { | |
| 20544 | + registerStyle19("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);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:var(--wpds-typography-line-height-xs,16px)}}}'); | |
| 20545 | +} | |
| 20546 | +var field_default4 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" }; | |
| 20547 | +var VisualLabel = (0, import_element40.forwardRef)( | |
| 20548 | + function VisualLabel2({ className, render: render4, variant, ...restProps }, ref) { | |
| 20549 | + return useRender({ | |
| 20550 | + defaultTagName: "span", | |
| 20551 | + render: render4, | |
| 20552 | + ref, | |
| 20553 | + props: mergeProps(restProps, { | |
| 20554 | + className: clsx_default( | |
| 20555 | + field_default4.label, | |
| 20556 | + variant && field_default4[`is-${variant}`], | |
| 20557 | + className | |
| 20558 | + ) | |
| 20559 | + }) | |
| 20560 | + }); | |
| 20561 | + } | |
| 20562 | +); | |
| 20563 | +VisualLabel.displayName = "Field.VisualLabel"; | |
| 20564 | + | |
| 20565 | +// packages/ui/build-module/form/primitives/textarea/textarea.mjs | |
| 20566 | +var import_element41 = __toESM(require_element(), 1); | |
| 20567 | +var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1); | |
| 20568 | +var STYLE_HASH_ATTRIBUTE20 = "data-wp-hash"; | |
| 20569 | +function getRuntime20() { | |
| 20570 | + const globalScope = globalThis; | |
| 20571 | + if (globalScope.__wpStyleRuntime) { | |
| 20572 | + return globalScope.__wpStyleRuntime; | |
| 20573 | + } | |
| 20574 | + globalScope.__wpStyleRuntime = { | |
| 20575 | + documents: /* @__PURE__ */ new Map(), | |
| 20576 | + styles: /* @__PURE__ */ new Map(), | |
| 20577 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 20578 | + }; | |
| 20579 | + if (typeof document !== "undefined") { | |
| 20580 | + registerDocument20(document); | |
| 20581 | + } | |
| 20582 | + return globalScope.__wpStyleRuntime; | |
| 20583 | +} | |
| 20584 | +function documentContainsStyleHash20(targetDocument, hash) { | |
| 20585 | + if (!targetDocument.head) { | |
| 20586 | + return false; | |
| 20587 | + } | |
| 20588 | + for (const style of targetDocument.head.querySelectorAll( | |
| 20589 | + `style[${STYLE_HASH_ATTRIBUTE20}]` | |
| 20590 | + )) { | |
| 20591 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE20) === hash) { | |
| 20592 | + return true; | |
| 20593 | + } | |
| 20594 | + } | |
| 20595 | + return false; | |
| 20596 | +} | |
| 20597 | +function injectStyle20(targetDocument, hash, css) { | |
| 20598 | + if (!targetDocument.head) { | |
| 20599 | + return; | |
| 20600 | + } | |
| 20601 | + const runtime = getRuntime20(); | |
| 20602 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 20603 | + if (!injectedStyles) { | |
| 20604 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 20605 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 20606 | + } | |
| 20607 | + if (injectedStyles.has(hash)) { | |
| 20608 | + return; | |
| 20609 | + } | |
| 20610 | + if (documentContainsStyleHash20(targetDocument, hash)) { | |
| 20611 | + injectedStyles.add(hash); | |
| 20612 | + return; | |
| 20613 | + } | |
| 20614 | + const style = targetDocument.createElement("style"); | |
| 20615 | + style.setAttribute(STYLE_HASH_ATTRIBUTE20, hash); | |
| 20616 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 20617 | + targetDocument.head.appendChild(style); | |
| 20618 | + injectedStyles.add(hash); | |
| 20619 | +} | |
| 20620 | +function registerDocument20(targetDocument) { | |
| 20621 | + const runtime = getRuntime20(); | |
| 20622 | + runtime.documents.set( | |
| 20623 | + targetDocument, | |
| 20624 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 20625 | + ); | |
| 20626 | + for (const [hash, css] of runtime.styles) { | |
| 20627 | + injectStyle20(targetDocument, hash, css); | |
| 20628 | + } | |
| 20629 | + return () => { | |
| 20630 | + const count = runtime.documents.get(targetDocument); | |
| 20631 | + if (count === void 0) { | |
| 20632 | + return; | |
| 20633 | + } | |
| 20634 | + if (count <= 1) { | |
| 20635 | + runtime.documents.delete(targetDocument); | |
| 20636 | + return; | |
| 20637 | + } | |
| 20638 | + runtime.documents.set(targetDocument, count - 1); | |
| 20639 | + }; | |
| 20640 | +} | |
| 20641 | +function registerStyle20(hash, css) { | |
| 20642 | + const runtime = getRuntime20(); | |
| 20643 | + runtime.styles.set(hash, css); | |
| 20644 | + for (const targetDocument of runtime.documents.keys()) { | |
| 20645 | + injectStyle20(targetDocument, hash, css); | |
| 20646 | + } | |
| 20647 | +} | |
| 20648 | +if (typeof process === "undefined" || true) { | |
| 20649 | + registerStyle20("1540cbc709", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._1e441c22c9dc5d28__wrapper{--wp-ui-textarea-min-height:var(--wpds-dimension-size-lg,40px)}._414844876c32ecee__textarea{min-height:calc(var(--wp-ui-textarea-min-height) - 2px);resize:block}}@layer compositions{._1e441c22c9dc5d28__wrapper{--wp-ui-input-padding-block:9.9px;height:auto;line-height:1.4}}}"); | |
| 20650 | +} | |
| 20651 | +var style_default14 = { "wrapper": "_1e441c22c9dc5d28__wrapper", "textarea": "_414844876c32ecee__textarea" }; | |
| 20652 | +if (typeof process === "undefined" || true) { | |
| 20653 | + registerStyle20("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)}"); | |
| 20654 | +} | |
| 20655 | +var global_css_defense_default7 = { "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" }; | |
| 20656 | +var wrappedRender = (render4, restProps) => { | |
| 20657 | + return function textareaRender(props) { | |
| 20658 | + return typeof render4 === "function" ? render4(mergeProps(props, restProps)) : (0, import_element41.cloneElement)(render4, mergeProps(props, restProps)); | |
| 20659 | + }; | |
| 20660 | +}; | |
| 20661 | +var Textarea = (0, import_element41.forwardRef)( | |
| 20662 | + function Textarea2({ | |
| 20663 | + className, | |
| 20664 | + defaultValue, | |
| 20665 | + disabled: disabled2, | |
| 20666 | + onValueChange, | |
| 20667 | + render: render4, | |
| 20668 | + rows = 4, | |
| 20669 | + style, | |
| 20670 | + value, | |
| 20671 | + ...restProps | |
| 20672 | + }, ref) { | |
| 20673 | + return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)( | |
| 20674 | + Input3, | |
| 20675 | + { | |
| 20676 | + className: clsx_default(style_default14.wrapper, className), | |
| 20677 | + style, | |
| 20678 | + render: wrappedRender( | |
| 20679 | + render4 || ((props) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("textarea", { ...props })), | |
| 20680 | + { | |
| 20681 | + className: clsx_default( | |
| 20682 | + global_css_defense_default7.textarea, | |
| 20683 | + style_default14.textarea | |
| 20684 | + ), | |
| 20685 | + ref, | |
| 20686 | + rows, | |
| 20687 | + ...restProps | |
| 20688 | + } | |
| 20689 | + ), | |
| 20690 | + value, | |
| 20691 | + defaultValue, | |
| 20692 | + onValueChange, | |
| 20693 | + disabled: disabled2 | |
| 20694 | + } | |
| 20695 | + ); | |
| 20696 | + } | |
| 20697 | +); | |
| 20698 | + | |
| 20699 | +// packages/ui/build-module/form/input-control/input-control.mjs | |
| 20700 | +var import_element42 = __toESM(require_element(), 1); | |
| 20701 | +var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1); | |
| 20702 | +var STYLE_HASH_ATTRIBUTE21 = "data-wp-hash"; | |
| 20703 | +function getRuntime21() { | |
| 20704 | + const globalScope = globalThis; | |
| 20705 | + if (globalScope.__wpStyleRuntime) { | |
| 20706 | + return globalScope.__wpStyleRuntime; | |
| 20707 | + } | |
| 20708 | + globalScope.__wpStyleRuntime = { | |
| 20709 | + documents: /* @__PURE__ */ new Map(), | |
| 20710 | + styles: /* @__PURE__ */ new Map(), | |
| 20711 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 20712 | + }; | |
| 20713 | + if (typeof document !== "undefined") { | |
| 20714 | + registerDocument21(document); | |
| 20715 | + } | |
| 20716 | + return globalScope.__wpStyleRuntime; | |
| 20717 | +} | |
| 20718 | +function documentContainsStyleHash21(targetDocument, hash) { | |
| 20719 | + if (!targetDocument.head) { | |
| 20720 | + return false; | |
| 20721 | + } | |
| 20722 | + for (const style of targetDocument.head.querySelectorAll( | |
| 20723 | + `style[${STYLE_HASH_ATTRIBUTE21}]` | |
| 20724 | + )) { | |
| 20725 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE21) === hash) { | |
| 20726 | + return true; | |
| 20727 | + } | |
| 20728 | + } | |
| 20729 | + return false; | |
| 20730 | +} | |
| 20731 | +function injectStyle21(targetDocument, hash, css) { | |
| 20732 | + if (!targetDocument.head) { | |
| 20733 | + return; | |
| 20734 | + } | |
| 20735 | + const runtime = getRuntime21(); | |
| 20736 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 20737 | + if (!injectedStyles) { | |
| 20738 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 20739 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 20740 | + } | |
| 20741 | + if (injectedStyles.has(hash)) { | |
| 20742 | + return; | |
| 20743 | + } | |
| 20744 | + if (documentContainsStyleHash21(targetDocument, hash)) { | |
| 20745 | + injectedStyles.add(hash); | |
| 20746 | + return; | |
| 20747 | + } | |
| 20748 | + const style = targetDocument.createElement("style"); | |
| 20749 | + style.setAttribute(STYLE_HASH_ATTRIBUTE21, hash); | |
| 20750 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 20751 | + targetDocument.head.appendChild(style); | |
| 20752 | + injectedStyles.add(hash); | |
| 20753 | +} | |
| 20754 | +function registerDocument21(targetDocument) { | |
| 20755 | + const runtime = getRuntime21(); | |
| 20756 | + runtime.documents.set( | |
| 20757 | + targetDocument, | |
| 20758 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 20759 | + ); | |
| 20760 | + for (const [hash, css] of runtime.styles) { | |
| 20761 | + injectStyle21(targetDocument, hash, css); | |
| 20762 | + } | |
| 20763 | + return () => { | |
| 20764 | + const count = runtime.documents.get(targetDocument); | |
| 20765 | + if (count === void 0) { | |
| 20766 | + return; | |
| 20767 | + } | |
| 20768 | + if (count <= 1) { | |
| 20769 | + runtime.documents.delete(targetDocument); | |
| 20770 | + return; | |
| 20771 | + } | |
| 20772 | + runtime.documents.set(targetDocument, count - 1); | |
| 20773 | + }; | |
| 20774 | +} | |
| 20775 | +function registerStyle21(hash, css) { | |
| 20776 | + const runtime = getRuntime21(); | |
| 20777 | + runtime.styles.set(hash, css); | |
| 20778 | + for (const targetDocument of runtime.documents.keys()) { | |
| 20779 | + injectStyle21(targetDocument, hash, css); | |
| 20780 | + } | |
| 20781 | +} | |
| 20782 | +if (typeof process === "undefined" || true) { | |
| 20783 | + registerStyle21("0c752c3d08", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer compositions{@supports (-webkit-hyphens:none) and (not (-moz-appearance:none)){.a9211a7e6af24bed__root input[type=date]:not([data-filled]):not(:focus),.a9211a7e6af24bed__root input[type=datetime-local]:not([data-filled]):not(:focus),.a9211a7e6af24bed__root input[type=time]:not([data-filled]):not(:focus){--_gcd-input-color:transparent;--_gcd-input-color-disabled:transparent;color:transparent;&:disabled::-webkit-datetime-edit-text{color:transparent}}}}}"); | |
| 20784 | +} | |
| 20785 | +var style_default15 = { "root": "a9211a7e6af24bed__root" }; | |
| 20786 | +var InputControl = (0, import_element42.forwardRef)( | |
| 20787 | + function InputControl2({ | |
| 20788 | + className, | |
| 20789 | + label, | |
| 20790 | + description, | |
| 20791 | + details, | |
| 20792 | + hideLabelFromVision, | |
| 20793 | + ...restProps | |
| 20794 | + }, ref) { | |
| 20795 | + return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(field_exports.Root, { className: clsx_default(style_default15.root, className), children: [ | |
| 20796 | + /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(field_exports.Label, { hideFromVision: hideLabelFromVision, children: label }), | |
| 20797 | + /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Input3, { ref, ...restProps }), | |
| 20798 | + description && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(field_exports.Description, { children: description }), | |
| 20799 | + details && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(field_exports.Details, { children: details }) | |
| 20800 | + ] }); | |
| 20801 | + } | |
| 20802 | +); | |
| 20803 | + | |
| 20804 | +// packages/ui/build-module/form/textarea-control/textarea-control.mjs | |
| 20805 | +var import_element43 = __toESM(require_element(), 1); | |
| 20806 | +var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1); | |
| 20807 | +var TextareaControl = (0, import_element43.forwardRef)(function TextareaControl2({ | |
| 20808 | + className, | |
| 20809 | + label, | |
| 20810 | + description, | |
| 20811 | + details, | |
| 20812 | + hideLabelFromVision, | |
| 20813 | + ...restProps | |
| 20814 | +}, ref) { | |
| 20815 | + return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(field_exports.Root, { className, children: [ | |
| 20816 | + /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(field_exports.Label, { hideFromVision: hideLabelFromVision, children: label }), | |
| 20817 | + /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Textarea, { ref, ...restProps }), | |
| 20818 | + description && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(field_exports.Description, { children: description }), | |
| 20819 | + details && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(field_exports.Details, { children: details }) | |
| 20820 | + ] }); | |
| 20821 | +}); | |
| 20822 | + | |
| 20823 | +// packages/ui/build-module/form/with-validation/validated-input-control/validated-input-control.mjs | |
| 20824 | +var import_element44 = __toESM(require_element(), 1); | |
| 20825 | +var import_compose3 = __toESM(require_compose(), 1); | |
| 20826 | +var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1); | |
| 20827 | +var ValidatedInputControl = (0, import_element44.forwardRef)(function ValidatedInputControl2({ required, markWhenOptional, customValidity, ...restProps }, forwardedRef) { | |
| 20828 | + const validityTargetRef = (0, import_element44.useRef)(null); | |
| 20829 | + const mergedRefs = (0, import_compose3.useMergeRefs)([forwardedRef, validityTargetRef]); | |
| 20830 | + return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)( | |
| 20831 | + ControlWithError, | |
| 20832 | + { | |
| 20833 | + required, | |
| 20834 | + markWhenOptional, | |
| 20835 | + customValidity, | |
| 20836 | + getValidityTarget: () => validityTargetRef.current, | |
| 20837 | + children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(InputControl, { ref: mergedRefs, ...restProps }) | |
| 20838 | + } | |
| 20839 | + ); | |
| 20840 | +}); | |
| 20841 | + | |
| 20842 | +// packages/ui/build-module/form/with-validation/validated-textarea-control/validated-textarea-control.mjs | |
| 20843 | +var import_element45 = __toESM(require_element(), 1); | |
| 20844 | +var import_compose4 = __toESM(require_compose(), 1); | |
| 20845 | +var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1); | |
| 20846 | +var ValidatedTextareaControl = (0, import_element45.forwardRef)(function ValidatedTextareaControl2({ required, markWhenOptional, customValidity, ...restProps }, forwardedRef) { | |
| 20847 | + const validityTargetRef = (0, import_element45.useRef)(null); | |
| 20848 | + const mergedRefs = (0, import_compose4.useMergeRefs)([forwardedRef, validityTargetRef]); | |
| 20849 | + return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)( | |
| 20850 | + ControlWithError, | |
| 20851 | + { | |
| 20852 | + required, | |
| 20853 | + markWhenOptional, | |
| 20854 | + customValidity, | |
| 20855 | + getValidityTarget: () => validityTargetRef.current, | |
| 20856 | + children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TextareaControl, { ref: mergedRefs, ...restProps }) | |
| 20857 | + } | |
| 20858 | + ); | |
| 20859 | +}); | |
| 20860 | + | |
| 20861 | +// packages/dataviews/build-module/constants.mjs | |
| 20862 | +var import_i18n8 = __toESM(require_i18n(), 1); | |
| 20863 | +var OPERATOR_IS_ANY = "isAny"; | |
| 20864 | +var OPERATOR_IS_NONE = "isNone"; | |
| 20865 | +var OPERATOR_IS_ALL = "isAll"; | |
| 20866 | +var OPERATOR_IS_NOT_ALL = "isNotAll"; | |
| 20867 | +var OPERATOR_BETWEEN = "between"; | |
| 20868 | +var OPERATOR_IN_THE_PAST = "inThePast"; | |
| 20869 | +var OPERATOR_OVER = "over"; | |
| 20870 | +var OPERATOR_IS = "is"; | |
| 20871 | +var OPERATOR_IS_NOT = "isNot"; | |
| 20872 | +var OPERATOR_LESS_THAN = "lessThan"; | |
| 20873 | +var OPERATOR_GREATER_THAN = "greaterThan"; | |
| 20874 | +var OPERATOR_LESS_THAN_OR_EQUAL = "lessThanOrEqual"; | |
| 20875 | +var OPERATOR_GREATER_THAN_OR_EQUAL = "greaterThanOrEqual"; | |
| 20876 | +var OPERATOR_BEFORE = "before"; | |
| 20877 | +var OPERATOR_AFTER = "after"; | |
| 20878 | +var OPERATOR_BEFORE_INC = "beforeInc"; | |
| 20879 | +var OPERATOR_AFTER_INC = "afterInc"; | |
| 20880 | +var OPERATOR_CONTAINS = "contains"; | |
| 20881 | +var OPERATOR_NOT_CONTAINS = "notContains"; | |
| 20882 | +var OPERATOR_STARTS_WITH = "startsWith"; | |
| 20883 | +var OPERATOR_ON = "on"; | |
| 20884 | +var OPERATOR_NOT_ON = "notOn"; | |
| 20885 | +var sortLabels = { | |
| 20886 | + asc: (0, import_i18n8.__)("Sort ascending"), | |
| 20887 | + desc: (0, import_i18n8.__)("Sort descending") | |
| 20888 | +}; | |
| 20889 | + | |
| 20890 | +// packages/dataviews/build-module/hooks/use-elements.mjs | |
| 20891 | +var import_element46 = __toESM(require_element(), 1); | |
| 20892 | +var EMPTY_ARRAY2 = []; | |
| 20893 | +function useElements({ | |
| 20894 | + elements, | |
| 20895 | + getElements | |
| 20896 | +}) { | |
| 20897 | + const staticElements = Array.isArray(elements) && elements.length > 0 ? elements : EMPTY_ARRAY2; | |
| 20898 | + const [records, setRecords] = (0, import_element46.useState)(staticElements); | |
| 20899 | + const [isLoading, setIsLoading] = (0, import_element46.useState)(false); | |
| 20900 | + (0, import_element46.useEffect)(() => { | |
| 20901 | + if (!getElements) { | |
| 20902 | + setRecords(staticElements); | |
| 20903 | + return; | |
| 20904 | + } | |
| 20905 | + let cancelled = false; | |
| 20906 | + setIsLoading(true); | |
| 20907 | + getElements().then((fetchedElements) => { | |
| 20908 | + if (!cancelled) { | |
| 20909 | + const dynamicElements = Array.isArray(fetchedElements) && fetchedElements.length > 0 ? fetchedElements : staticElements; | |
| 20910 | + setRecords(dynamicElements); | |
| 20911 | + } | |
| 20912 | + }).catch(() => { | |
| 20913 | + if (!cancelled) { | |
| 20914 | + setRecords(staticElements); | |
| 20915 | + } | |
| 20916 | + }).finally(() => { | |
| 20917 | + if (!cancelled) { | |
| 20918 | + setIsLoading(false); | |
| 20919 | + } | |
| 20920 | + }); | |
| 20921 | + return () => { | |
| 20922 | + cancelled = true; | |
| 20923 | + }; | |
| 20924 | + }, [getElements, staticElements]); | |
| 20925 | + return { | |
| 20926 | + elements: records, | |
| 20927 | + isLoading | |
| 20928 | + }; | |
| 20929 | +} | |
| 20930 | + | |
| 20931 | +// packages/dataviews/build-module/utils/operators.mjs | |
| 20932 | +var import_i18n9 = __toESM(require_i18n(), 1); | |
| 20933 | +var import_element47 = __toESM(require_element(), 1); | |
| 20934 | +var import_date2 = __toESM(require_date(), 1); | |
| 20935 | + | |
| 20936 | +// packages/dataviews/build-module/field-types/utils/parse-time.mjs | |
| 20937 | +var ZONE_DESIGNATOR = /(?:[Zz]|[+-](?:[01]\d|2[0-3]):?[0-5]\d)$/; | |
| 20938 | +var TIME_FORMATS = ["HH:mm", "HH:mm:ss"]; | |
| 20939 | +var REFERENCE_DATE = new Date(2e3, 0, 1); | |
| 20940 | +function parseTime2(value) { | |
| 20941 | + if (typeof value !== "string") { | |
| 20942 | + return null; | |
| 20943 | + } | |
| 20944 | + const time = value.trim().replace(ZONE_DESIGNATOR, ""); | |
| 20945 | + for (const timeFormat of TIME_FORMATS) { | |
| 20946 | + const parsed = parse(time, timeFormat, REFERENCE_DATE); | |
| 20947 | + if (isValid(parsed)) { | |
| 20948 | + return parsed.getHours() * 3600 + parsed.getMinutes() * 60 + parsed.getSeconds(); | |
| 20949 | + } | |
| 20950 | + } | |
| 20951 | + return null; | |
| 20952 | +} | |
| 20953 | + | |
| 20954 | +// packages/dataviews/build-module/utils/operators.mjs | |
| 20955 | +var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1); | |
| 20956 | +var filterTextWrappers = { | |
| 20957 | + Name: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "dataviews-filters__summary-filter-text-name" }), | |
| 20958 | + Value: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "dataviews-filters__summary-filter-text-value" }) | |
| 20959 | +}; | |
| 20960 | +function toComparableTemporals(fieldValue, filterValue) { | |
| 20961 | + const filterTime = parseTime2(filterValue); | |
| 20962 | + if (filterTime !== null) { | |
| 20963 | + return [parseTime2(fieldValue) ?? NaN, filterTime]; | |
| 20964 | + } | |
| 20965 | + return [ | |
| 20966 | + (0, import_date2.getDate)(fieldValue).getTime(), | |
| 20967 | + (0, import_date2.getDate)(filterValue).getTime() | |
| 20968 | + ]; | |
| 20969 | +} | |
| 20970 | +function getRelativeDate(value, unit) { | |
| 20971 | + switch (unit) { | |
| 20972 | + case "days": | |
| 20973 | + return subDays(/* @__PURE__ */ new Date(), value); | |
| 20974 | + case "weeks": | |
| 20975 | + return subWeeks(/* @__PURE__ */ new Date(), value); | |
| 20976 | + case "months": | |
| 20977 | + return subMonths(/* @__PURE__ */ new Date(), value); | |
| 20978 | + case "years": | |
| 20979 | + return subYears(/* @__PURE__ */ new Date(), value); | |
| 20980 | + default: | |
| 20981 | + return /* @__PURE__ */ new Date(); | |
| 20982 | + } | |
| 20983 | +} | |
| 20984 | +var isNoneOperatorDefinition = { | |
| 20985 | + /* translators: DataViews operator name */ | |
| 20986 | + label: (0, import_i18n9.__)("Is none of"), | |
| 20987 | + filterText: (filter, activeElements) => (0, import_element47.createInterpolateElement)( | |
| 20988 | + (0, import_i18n9.sprintf)( | |
| 20989 | + /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is none of: Admin, Editor". */ | |
| 20990 | + (0, import_i18n9.__)("<Name>%1$s is none of: </Name><Value>%2$s</Value>"), | |
| 20991 | + filter.name, | |
| 20992 | + activeElements.map((element) => element.label).join(", ") | |
| 227 | 20993 | ), |
| 228 | - queryParams: search | |
| 20994 | + filterTextWrappers | |
| 20995 | + ), | |
| 20996 | + filter: ((item, field, filterValue) => { | |
| 20997 | + if (!filterValue?.length) { | |
| 20998 | + return true; | |
| 20999 | + } | |
| 21000 | + const fieldValue = field.getValue({ item }); | |
| 21001 | + if (Array.isArray(fieldValue)) { | |
| 21002 | + return !filterValue.some( | |
| 21003 | + (fv) => fieldValue.includes(fv) | |
| 21004 | + ); | |
| 21005 | + } else if (typeof fieldValue === "string" || typeof fieldValue === "number") { | |
| 21006 | + return !filterValue.includes(fieldValue); | |
| 21007 | + } | |
| 21008 | + return false; | |
| 21009 | + }), | |
| 21010 | + selection: "multi" | |
| 21011 | +}; | |
| 21012 | +var OPERATORS = [ | |
| 21013 | + { | |
| 21014 | + name: OPERATOR_IS_ANY, | |
| 21015 | + /* translators: DataViews operator name */ | |
| 21016 | + label: (0, import_i18n9.__)("Includes"), | |
| 21017 | + filterText: (filter, activeElements) => (0, import_element47.createInterpolateElement)( | |
| 21018 | + (0, import_i18n9.sprintf)( | |
| 21019 | + /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is any: Admin, Editor". */ | |
| 21020 | + (0, import_i18n9.__)("<Name>%1$s includes: </Name><Value>%2$s</Value>"), | |
| 21021 | + filter.name, | |
| 21022 | + activeElements.map((element) => element.label).join(", ") | |
| 21023 | + ), | |
| 21024 | + filterTextWrappers | |
| 21025 | + ), | |
| 21026 | + filter(item, field, filterValue) { | |
| 21027 | + if (!filterValue?.length) { | |
| 21028 | + return true; | |
| 21029 | + } | |
| 21030 | + const fieldValue = field.getValue({ item }); | |
| 21031 | + if (Array.isArray(fieldValue)) { | |
| 21032 | + return filterValue.some( | |
| 21033 | + (fv) => fieldValue.includes(fv) | |
| 21034 | + ); | |
| 21035 | + } else if (typeof fieldValue === "string" || typeof fieldValue === "number") { | |
| 21036 | + return filterValue.includes(fieldValue); | |
| 21037 | + } | |
| 21038 | + return false; | |
| 21039 | + }, | |
| 21040 | + selection: "multi" | |
| 21041 | + }, | |
| 21042 | + { | |
| 21043 | + name: OPERATOR_IS_NONE, | |
| 21044 | + ...isNoneOperatorDefinition | |
| 21045 | + }, | |
| 21046 | + { | |
| 21047 | + name: OPERATOR_IS_ALL, | |
| 21048 | + /* translators: DataViews operator name */ | |
| 21049 | + label: (0, import_i18n9.__)("Includes all"), | |
| 21050 | + filterText: (filter, activeElements) => (0, import_element47.createInterpolateElement)( | |
| 21051 | + (0, import_i18n9.sprintf)( | |
| 21052 | + /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author includes all: Admin, Editor". */ | |
| 21053 | + (0, import_i18n9.__)("<Name>%1$s includes all: </Name><Value>%2$s</Value>"), | |
| 21054 | + filter.name, | |
| 21055 | + activeElements.map((element) => element.label).join(", ") | |
| 21056 | + ), | |
| 21057 | + filterTextWrappers | |
| 21058 | + ), | |
| 21059 | + filter(item, field, filterValue) { | |
| 21060 | + if (!filterValue?.length) { | |
| 21061 | + return true; | |
| 21062 | + } | |
| 21063 | + const fieldValue = field.getValue({ item }); | |
| 21064 | + if (!Array.isArray(fieldValue)) { | |
| 21065 | + return false; | |
| 21066 | + } | |
| 21067 | + return filterValue.every( | |
| 21068 | + (value) => fieldValue.includes(value) | |
| 21069 | + ); | |
| 21070 | + }, | |
| 21071 | + selection: "multi" | |
| 21072 | + }, | |
| 21073 | + { | |
| 21074 | + name: OPERATOR_IS_NOT_ALL, | |
| 21075 | + ...isNoneOperatorDefinition | |
| 21076 | + }, | |
| 21077 | + { | |
| 21078 | + name: OPERATOR_BETWEEN, | |
| 21079 | + /* translators: DataViews operator name */ | |
| 21080 | + label: (0, import_i18n9.__)("Between (inc)"), | |
| 21081 | + filterText: (filter, activeElements) => (0, import_element47.createInterpolateElement)( | |
| 21082 | + (0, import_i18n9.sprintf)( | |
| 21083 | + /* translators: 1: Filter name (e.g. "Item count"). 2: Filter value min. 3: Filter value max. e.g.: "Item count between (inc): 10 and 180". */ | |
| 21084 | + (0, import_i18n9.__)( | |
| 21085 | + "<Name>%1$s between (inc): </Name><Value>%2$s and %3$s</Value>" | |
| 21086 | + ), | |
| 21087 | + filter.name, | |
| 21088 | + activeElements[0].label[0], | |
| 21089 | + activeElements[0].label[1] | |
| 21090 | + ), | |
| 21091 | + filterTextWrappers | |
| 21092 | + ), | |
| 21093 | + filter(item, field, filterValue) { | |
| 21094 | + if (!Array.isArray(filterValue) || filterValue.length !== 2 || // An unfilled bound is `undefined` from the controls, `''` | |
| 21095 | + // when it arrives from a persisted view, or `null` once | |
| 21096 | + // `undefined` round-trips through JSON persistence. | |
| 21097 | + filterValue.includes(void 0) || filterValue.includes("") || filterValue.includes(null)) { | |
| 21098 | + return true; | |
| 21099 | + } | |
| 21100 | + const fieldValue = field.getValue({ item }); | |
| 21101 | + const [min3, max3] = filterValue.map(parseTime2); | |
| 21102 | + if (min3 !== null && max3 !== null) { | |
| 21103 | + const value = parseTime2(fieldValue); | |
| 21104 | + return value !== null && value >= min3 && value <= max3; | |
| 21105 | + } | |
| 21106 | + if (typeof fieldValue === "number" || fieldValue instanceof Date || typeof fieldValue === "string") { | |
| 21107 | + return fieldValue >= filterValue[0] && fieldValue <= filterValue[1]; | |
| 21108 | + } | |
| 21109 | + return false; | |
| 21110 | + }, | |
| 21111 | + selection: "custom" | |
| 21112 | + }, | |
| 21113 | + { | |
| 21114 | + name: OPERATOR_IN_THE_PAST, | |
| 21115 | + /* translators: DataViews operator name */ | |
| 21116 | + label: (0, import_i18n9.__)("In the past"), | |
| 21117 | + filterText: (filter, activeElements) => (0, import_element47.createInterpolateElement)( | |
| 21118 | + (0, import_i18n9.sprintf)( | |
| 21119 | + /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is in the past: 7 days". */ | |
| 21120 | + (0, import_i18n9.__)( | |
| 21121 | + "<Name>%1$s is in the past: </Name><Value>%2$s</Value>" | |
| 21122 | + ), | |
| 21123 | + filter.name, | |
| 21124 | + `${activeElements[0].value.value} ${activeElements[0].value.unit}` | |
| 21125 | + ), | |
| 21126 | + filterTextWrappers | |
| 21127 | + ), | |
| 21128 | + filter(item, field, filterValue) { | |
| 21129 | + if (filterValue?.value === void 0 || filterValue?.unit === void 0) { | |
| 21130 | + return true; | |
| 21131 | + } | |
| 21132 | + const targetDate = getRelativeDate( | |
| 21133 | + filterValue.value, | |
| 21134 | + filterValue.unit | |
| 21135 | + ); | |
| 21136 | + const fieldValue = (0, import_date2.getDate)(field.getValue({ item })); | |
| 21137 | + return fieldValue >= targetDate && fieldValue <= /* @__PURE__ */ new Date(); | |
| 21138 | + }, | |
| 21139 | + selection: "custom" | |
| 21140 | + }, | |
| 21141 | + { | |
| 21142 | + name: OPERATOR_OVER, | |
| 21143 | + /* translators: DataViews operator name */ | |
| 21144 | + label: (0, import_i18n9.__)("Over"), | |
| 21145 | + filterText: (filter, activeElements) => (0, import_element47.createInterpolateElement)( | |
| 21146 | + (0, import_i18n9.sprintf)( | |
| 21147 | + /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is over: 7 days". */ | |
| 21148 | + (0, import_i18n9.__)("<Name>%1$s is over: </Name><Value>%2$s</Value>"), | |
| 21149 | + filter.name, | |
| 21150 | + `${activeElements[0].value.value} ${activeElements[0].value.unit}` | |
| 21151 | + ), | |
| 21152 | + filterTextWrappers | |
| 21153 | + ), | |
| 21154 | + filter(item, field, filterValue) { | |
| 21155 | + if (filterValue?.value === void 0 || filterValue?.unit === void 0) { | |
| 21156 | + return true; | |
| 21157 | + } | |
| 21158 | + const targetDate = getRelativeDate( | |
| 21159 | + filterValue.value, | |
| 21160 | + filterValue.unit | |
| 21161 | + ); | |
| 21162 | + const fieldValue = (0, import_date2.getDate)(field.getValue({ item })); | |
| 21163 | + return fieldValue < targetDate; | |
| 21164 | + }, | |
| 21165 | + selection: "custom" | |
| 21166 | + }, | |
| 21167 | + { | |
| 21168 | + name: OPERATOR_IS, | |
| 21169 | + /* translators: DataViews operator name */ | |
| 21170 | + label: (0, import_i18n9.__)("Is"), | |
| 21171 | + filterText: (filter, activeElements) => (0, import_element47.createInterpolateElement)( | |
| 21172 | + (0, import_i18n9.sprintf)( | |
| 21173 | + /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is: Admin". */ | |
| 21174 | + (0, import_i18n9.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"), | |
| 21175 | + filter.name, | |
| 21176 | + activeElements[0].label | |
| 21177 | + ), | |
| 21178 | + filterTextWrappers | |
| 21179 | + ), | |
| 21180 | + filter(item, field, filterValue) { | |
| 21181 | + return filterValue === field.getValue({ item }) || filterValue === void 0; | |
| 21182 | + }, | |
| 21183 | + selection: "single" | |
| 21184 | + }, | |
| 21185 | + { | |
| 21186 | + name: OPERATOR_IS_NOT, | |
| 21187 | + /* translators: DataViews operator name */ | |
| 21188 | + label: (0, import_i18n9.__)("Is not"), | |
| 21189 | + filterText: (filter, activeElements) => (0, import_element47.createInterpolateElement)( | |
| 21190 | + (0, import_i18n9.sprintf)( | |
| 21191 | + /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is not: Admin". */ | |
| 21192 | + (0, import_i18n9.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"), | |
| 21193 | + filter.name, | |
| 21194 | + activeElements[0].label | |
| 21195 | + ), | |
| 21196 | + filterTextWrappers | |
| 21197 | + ), | |
| 21198 | + filter(item, field, filterValue) { | |
| 21199 | + return filterValue !== field.getValue({ item }); | |
| 21200 | + }, | |
| 21201 | + selection: "single" | |
| 21202 | + }, | |
| 21203 | + { | |
| 21204 | + name: OPERATOR_LESS_THAN, | |
| 21205 | + /* translators: DataViews operator name */ | |
| 21206 | + label: (0, import_i18n9.__)("Less than"), | |
| 21207 | + filterText: (filter, activeElements) => (0, import_element47.createInterpolateElement)( | |
| 21208 | + (0, import_i18n9.sprintf)( | |
| 21209 | + /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than: 10". */ | |
| 21210 | + (0, import_i18n9.__)("<Name>%1$s is less than: </Name><Value>%2$s</Value>"), | |
| 21211 | + filter.name, | |
| 21212 | + activeElements[0].label | |
| 21213 | + ), | |
| 21214 | + filterTextWrappers | |
| 21215 | + ), | |
| 21216 | + filter(item, field, filterValue) { | |
| 21217 | + if (filterValue === void 0) { | |
| 21218 | + return true; | |
| 21219 | + } | |
| 21220 | + const fieldValue = field.getValue({ item }); | |
| 21221 | + return fieldValue < filterValue; | |
| 21222 | + }, | |
| 21223 | + selection: "single" | |
| 21224 | + }, | |
| 21225 | + { | |
| 21226 | + name: OPERATOR_GREATER_THAN, | |
| 21227 | + /* translators: DataViews operator name */ | |
| 21228 | + label: (0, import_i18n9.__)("Greater than"), | |
| 21229 | + filterText: (filter, activeElements) => (0, import_element47.createInterpolateElement)( | |
| 21230 | + (0, import_i18n9.sprintf)( | |
| 21231 | + /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than: 10". */ | |
| 21232 | + (0, import_i18n9.__)( | |
| 21233 | + "<Name>%1$s is greater than: </Name><Value>%2$s</Value>" | |
| 21234 | + ), | |
| 21235 | + filter.name, | |
| 21236 | + activeElements[0].label | |
| 21237 | + ), | |
| 21238 | + filterTextWrappers | |
| 21239 | + ), | |
| 21240 | + filter(item, field, filterValue) { | |
| 21241 | + if (filterValue === void 0) { | |
| 21242 | + return true; | |
| 21243 | + } | |
| 21244 | + const fieldValue = field.getValue({ item }); | |
| 21245 | + return fieldValue > filterValue; | |
| 21246 | + }, | |
| 21247 | + selection: "single" | |
| 21248 | + }, | |
| 21249 | + { | |
| 21250 | + name: OPERATOR_LESS_THAN_OR_EQUAL, | |
| 21251 | + /* translators: DataViews operator name */ | |
| 21252 | + label: (0, import_i18n9.__)("Less than or equal"), | |
| 21253 | + filterText: (filter, activeElements) => (0, import_element47.createInterpolateElement)( | |
| 21254 | + (0, import_i18n9.sprintf)( | |
| 21255 | + /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than or equal to: 10". */ | |
| 21256 | + (0, import_i18n9.__)( | |
| 21257 | + "<Name>%1$s is less than or equal to: </Name><Value>%2$s</Value>" | |
| 21258 | + ), | |
| 21259 | + filter.name, | |
| 21260 | + activeElements[0].label | |
| 21261 | + ), | |
| 21262 | + filterTextWrappers | |
| 21263 | + ), | |
| 21264 | + filter(item, field, filterValue) { | |
| 21265 | + if (filterValue === void 0) { | |
| 21266 | + return true; | |
| 21267 | + } | |
| 21268 | + const fieldValue = field.getValue({ item }); | |
| 21269 | + return fieldValue <= filterValue; | |
| 21270 | + }, | |
| 21271 | + selection: "single" | |
| 21272 | + }, | |
| 21273 | + { | |
| 21274 | + name: OPERATOR_GREATER_THAN_OR_EQUAL, | |
| 21275 | + /* translators: DataViews operator name */ | |
| 21276 | + label: (0, import_i18n9.__)("Greater than or equal"), | |
| 21277 | + filterText: (filter, activeElements) => (0, import_element47.createInterpolateElement)( | |
| 21278 | + (0, import_i18n9.sprintf)( | |
| 21279 | + /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than or equal to: 10". */ | |
| 21280 | + (0, import_i18n9.__)( | |
| 21281 | + "<Name>%1$s is greater than or equal to: </Name><Value>%2$s</Value>" | |
| 21282 | + ), | |
| 21283 | + filter.name, | |
| 21284 | + activeElements[0].label | |
| 21285 | + ), | |
| 21286 | + filterTextWrappers | |
| 21287 | + ), | |
| 21288 | + filter(item, field, filterValue) { | |
| 21289 | + if (filterValue === void 0) { | |
| 21290 | + return true; | |
| 21291 | + } | |
| 21292 | + const fieldValue = field.getValue({ item }); | |
| 21293 | + return fieldValue >= filterValue; | |
| 21294 | + }, | |
| 21295 | + selection: "single" | |
| 21296 | + }, | |
| 21297 | + { | |
| 21298 | + name: OPERATOR_BEFORE, | |
| 21299 | + /* translators: DataViews operator name */ | |
| 21300 | + label: (0, import_i18n9.__)("Before"), | |
| 21301 | + filterText: (filter, activeElements) => (0, import_element47.createInterpolateElement)( | |
| 21302 | + (0, import_i18n9.sprintf)( | |
| 21303 | + /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is before: 2024-01-01". */ | |
| 21304 | + (0, import_i18n9.__)("<Name>%1$s is before: </Name><Value>%2$s</Value>"), | |
| 21305 | + filter.name, | |
| 21306 | + activeElements[0].label | |
| 21307 | + ), | |
| 21308 | + filterTextWrappers | |
| 21309 | + ), | |
| 21310 | + filter(item, field, filterValue) { | |
| 21311 | + if (filterValue === void 0) { | |
| 21312 | + return true; | |
| 21313 | + } | |
| 21314 | + const [fieldTemporal, filterTemporal] = toComparableTemporals( | |
| 21315 | + field.getValue({ item }), | |
| 21316 | + filterValue | |
| 21317 | + ); | |
| 21318 | + return fieldTemporal < filterTemporal; | |
| 21319 | + }, | |
| 21320 | + selection: "single" | |
| 21321 | + }, | |
| 21322 | + { | |
| 21323 | + name: OPERATOR_AFTER, | |
| 21324 | + /* translators: DataViews operator name */ | |
| 21325 | + label: (0, import_i18n9.__)("After"), | |
| 21326 | + filterText: (filter, activeElements) => (0, import_element47.createInterpolateElement)( | |
| 21327 | + (0, import_i18n9.sprintf)( | |
| 21328 | + /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is after: 2024-01-01". */ | |
| 21329 | + (0, import_i18n9.__)("<Name>%1$s is after: </Name><Value>%2$s</Value>"), | |
| 21330 | + filter.name, | |
| 21331 | + activeElements[0].label | |
| 21332 | + ), | |
| 21333 | + filterTextWrappers | |
| 21334 | + ), | |
| 21335 | + filter(item, field, filterValue) { | |
| 21336 | + if (filterValue === void 0) { | |
| 21337 | + return true; | |
| 21338 | + } | |
| 21339 | + const [fieldTemporal, filterTemporal] = toComparableTemporals( | |
| 21340 | + field.getValue({ item }), | |
| 21341 | + filterValue | |
| 21342 | + ); | |
| 21343 | + return fieldTemporal > filterTemporal; | |
| 21344 | + }, | |
| 21345 | + selection: "single" | |
| 21346 | + }, | |
| 21347 | + { | |
| 21348 | + name: OPERATOR_BEFORE_INC, | |
| 21349 | + /* translators: DataViews operator name */ | |
| 21350 | + label: (0, import_i18n9.__)("Before (inc)"), | |
| 21351 | + filterText: (filter, activeElements) => (0, import_element47.createInterpolateElement)( | |
| 21352 | + (0, import_i18n9.sprintf)( | |
| 21353 | + /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or before: 2024-01-01". */ | |
| 21354 | + (0, import_i18n9.__)( | |
| 21355 | + "<Name>%1$s is on or before: </Name><Value>%2$s</Value>" | |
| 21356 | + ), | |
| 21357 | + filter.name, | |
| 21358 | + activeElements[0].label | |
| 21359 | + ), | |
| 21360 | + filterTextWrappers | |
| 21361 | + ), | |
| 21362 | + filter(item, field, filterValue) { | |
| 21363 | + if (filterValue === void 0) { | |
| 21364 | + return true; | |
| 21365 | + } | |
| 21366 | + const [fieldTemporal, filterTemporal] = toComparableTemporals( | |
| 21367 | + field.getValue({ item }), | |
| 21368 | + filterValue | |
| 21369 | + ); | |
| 21370 | + return fieldTemporal <= filterTemporal; | |
| 21371 | + }, | |
| 21372 | + selection: "single" | |
| 21373 | + }, | |
| 21374 | + { | |
| 21375 | + name: OPERATOR_AFTER_INC, | |
| 21376 | + /* translators: DataViews operator name */ | |
| 21377 | + label: (0, import_i18n9.__)("After (inc)"), | |
| 21378 | + filterText: (filter, activeElements) => (0, import_element47.createInterpolateElement)( | |
| 21379 | + (0, import_i18n9.sprintf)( | |
| 21380 | + /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or after: 2024-01-01". */ | |
| 21381 | + (0, import_i18n9.__)( | |
| 21382 | + "<Name>%1$s is on or after: </Name><Value>%2$s</Value>" | |
| 21383 | + ), | |
| 21384 | + filter.name, | |
| 21385 | + activeElements[0].label | |
| 21386 | + ), | |
| 21387 | + filterTextWrappers | |
| 21388 | + ), | |
| 21389 | + filter(item, field, filterValue) { | |
| 21390 | + if (filterValue === void 0) { | |
| 21391 | + return true; | |
| 21392 | + } | |
| 21393 | + const [fieldTemporal, filterTemporal] = toComparableTemporals( | |
| 21394 | + field.getValue({ item }), | |
| 21395 | + filterValue | |
| 21396 | + ); | |
| 21397 | + return fieldTemporal >= filterTemporal; | |
| 21398 | + }, | |
| 21399 | + selection: "single" | |
| 21400 | + }, | |
| 21401 | + { | |
| 21402 | + name: OPERATOR_CONTAINS, | |
| 21403 | + /* translators: DataViews operator name */ | |
| 21404 | + label: (0, import_i18n9.__)("Contains"), | |
| 21405 | + filterText: (filter, activeElements) => (0, import_element47.createInterpolateElement)( | |
| 21406 | + (0, import_i18n9.sprintf)( | |
| 21407 | + /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title contains: Hello". */ | |
| 21408 | + (0, import_i18n9.__)("<Name>%1$s contains: </Name><Value>%2$s</Value>"), | |
| 21409 | + filter.name, | |
| 21410 | + activeElements[0].label | |
| 21411 | + ), | |
| 21412 | + filterTextWrappers | |
| 21413 | + ), | |
| 21414 | + filter(item, field, filterValue) { | |
| 21415 | + if (filterValue === void 0) { | |
| 21416 | + return true; | |
| 21417 | + } | |
| 21418 | + const fieldValue = field.getValue({ item }); | |
| 21419 | + return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().includes(String(filterValue).toLowerCase()); | |
| 21420 | + }, | |
| 21421 | + selection: "single" | |
| 21422 | + }, | |
| 21423 | + { | |
| 21424 | + name: OPERATOR_NOT_CONTAINS, | |
| 21425 | + /* translators: DataViews operator name */ | |
| 21426 | + label: (0, import_i18n9.__)("Doesn't contain"), | |
| 21427 | + filterText: (filter, activeElements) => (0, import_element47.createInterpolateElement)( | |
| 21428 | + (0, import_i18n9.sprintf)( | |
| 21429 | + /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title doesn't contain: Hello". */ | |
| 21430 | + (0, import_i18n9.__)( | |
| 21431 | + "<Name>%1$s doesn't contain: </Name><Value>%2$s</Value>" | |
| 21432 | + ), | |
| 21433 | + filter.name, | |
| 21434 | + activeElements[0].label | |
| 21435 | + ), | |
| 21436 | + filterTextWrappers | |
| 21437 | + ), | |
| 21438 | + filter(item, field, filterValue) { | |
| 21439 | + if (filterValue === void 0) { | |
| 21440 | + return true; | |
| 21441 | + } | |
| 21442 | + const fieldValue = field.getValue({ item }); | |
| 21443 | + return typeof fieldValue === "string" && filterValue && !fieldValue.toLowerCase().includes(String(filterValue).toLowerCase()); | |
| 21444 | + }, | |
| 21445 | + selection: "single" | |
| 21446 | + }, | |
| 21447 | + { | |
| 21448 | + name: OPERATOR_STARTS_WITH, | |
| 21449 | + /* translators: DataViews operator name */ | |
| 21450 | + label: (0, import_i18n9.__)("Starts with"), | |
| 21451 | + filterText: (filter, activeElements) => (0, import_element47.createInterpolateElement)( | |
| 21452 | + (0, import_i18n9.sprintf)( | |
| 21453 | + /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title starts with: Hello". */ | |
| 21454 | + (0, import_i18n9.__)("<Name>%1$s starts with: </Name><Value>%2$s</Value>"), | |
| 21455 | + filter.name, | |
| 21456 | + activeElements[0].label | |
| 21457 | + ), | |
| 21458 | + filterTextWrappers | |
| 21459 | + ), | |
| 21460 | + filter(item, field, filterValue) { | |
| 21461 | + if (filterValue === void 0) { | |
| 21462 | + return true; | |
| 21463 | + } | |
| 21464 | + const fieldValue = field.getValue({ item }); | |
| 21465 | + return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().startsWith(String(filterValue).toLowerCase()); | |
| 21466 | + }, | |
| 21467 | + selection: "single" | |
| 21468 | + }, | |
| 21469 | + { | |
| 21470 | + name: OPERATOR_ON, | |
| 21471 | + /* translators: DataViews operator name */ | |
| 21472 | + label: (0, import_i18n9.__)("On"), | |
| 21473 | + filterText: (filter, activeElements) => (0, import_element47.createInterpolateElement)( | |
| 21474 | + (0, import_i18n9.sprintf)( | |
| 21475 | + /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is: 2024-01-01". */ | |
| 21476 | + (0, import_i18n9.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"), | |
| 21477 | + filter.name, | |
| 21478 | + activeElements[0].label | |
| 21479 | + ), | |
| 21480 | + filterTextWrappers | |
| 21481 | + ), | |
| 21482 | + filter(item, field, filterValue) { | |
| 21483 | + if (filterValue === void 0) { | |
| 21484 | + return true; | |
| 21485 | + } | |
| 21486 | + const [fieldTemporal, filterTemporal] = toComparableTemporals( | |
| 21487 | + field.getValue({ item }), | |
| 21488 | + filterValue | |
| 21489 | + ); | |
| 21490 | + return fieldTemporal === filterTemporal; | |
| 21491 | + }, | |
| 21492 | + selection: "single" | |
| 21493 | + }, | |
| 21494 | + { | |
| 21495 | + name: OPERATOR_NOT_ON, | |
| 21496 | + /* translators: DataViews operator name */ | |
| 21497 | + label: (0, import_i18n9.__)("Not on"), | |
| 21498 | + filterText: (filter, activeElements) => (0, import_element47.createInterpolateElement)( | |
| 21499 | + (0, import_i18n9.sprintf)( | |
| 21500 | + /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is not: 2024-01-01". */ | |
| 21501 | + (0, import_i18n9.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"), | |
| 21502 | + filter.name, | |
| 21503 | + activeElements[0].label | |
| 21504 | + ), | |
| 21505 | + filterTextWrappers | |
| 21506 | + ), | |
| 21507 | + filter(item, field, filterValue) { | |
| 21508 | + if (filterValue === void 0) { | |
| 21509 | + return true; | |
| 21510 | + } | |
| 21511 | + const [fieldTemporal, filterTemporal] = toComparableTemporals( | |
| 21512 | + field.getValue({ item }), | |
| 21513 | + filterValue | |
| 21514 | + ); | |
| 21515 | + return fieldTemporal !== filterTemporal; | |
| 21516 | + }, | |
| 21517 | + selection: "single" | |
| 21518 | + } | |
| 21519 | +]; | |
| 21520 | +var getOperatorByName = (name) => OPERATORS.find((op) => op.name === name); | |
| 21521 | +var getAllOperatorNames = () => OPERATORS.map((op) => op.name); | |
| 21522 | + | |
| 21523 | +// packages/dataviews/build-module/components/dataform-controls/checkbox.mjs | |
| 21524 | +var import_element56 = __toESM(require_element(), 1); | |
| 21525 | + | |
| 21526 | +// packages/dataviews/build-module/components/validated-form-controls/checkbox-control.mjs | |
| 21527 | +var import_element48 = __toESM(require_element(), 1); | |
| 21528 | +var import_compose5 = __toESM(require_compose(), 1); | |
| 21529 | +var import_components2 = __toESM(require_components(), 1); | |
| 21530 | +var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1); | |
| 21531 | +var UnforwardedValidatedCheckboxControl = ({ | |
| 21532 | + required, | |
| 21533 | + customValidity, | |
| 21534 | + markWhenOptional, | |
| 21535 | + ...restProps | |
| 21536 | +}, forwardedRef) => { | |
| 21537 | + const validityTargetRef = (0, import_element48.useRef)(null); | |
| 21538 | + const mergedRefs = (0, import_compose5.useMergeRefs)([forwardedRef, validityTargetRef]); | |
| 21539 | + return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)( | |
| 21540 | + ControlWithError, | |
| 21541 | + { | |
| 21542 | + className: "dataviews-validated-control", | |
| 21543 | + required, | |
| 21544 | + markWhenOptional, | |
| 21545 | + ref: mergedRefs, | |
| 21546 | + customValidity, | |
| 21547 | + getValidityTarget: () => validityTargetRef.current?.querySelector( | |
| 21548 | + 'input[type="checkbox"]' | |
| 21549 | + ), | |
| 21550 | + children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)( | |
| 21551 | + import_components2.CheckboxControl, | |
| 21552 | + { | |
| 21553 | + ...restProps | |
| 21554 | + } | |
| 21555 | + ) | |
| 21556 | + } | |
| 21557 | + ); | |
| 21558 | +}; | |
| 21559 | +var ValidatedCheckboxControl = (0, import_element48.forwardRef)(UnforwardedValidatedCheckboxControl); | |
| 21560 | +ValidatedCheckboxControl.displayName = "ValidatedCheckboxControl"; | |
| 21561 | + | |
| 21562 | +// packages/dataviews/build-module/components/validated-form-controls/combobox-control.mjs | |
| 21563 | +var import_element49 = __toESM(require_element(), 1); | |
| 21564 | +var import_compose6 = __toESM(require_compose(), 1); | |
| 21565 | +var import_components3 = __toESM(require_components(), 1); | |
| 21566 | +var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1); | |
| 21567 | +var UnforwardedValidatedComboboxControl = ({ | |
| 21568 | + required, | |
| 21569 | + customValidity, | |
| 21570 | + markWhenOptional, | |
| 21571 | + ...restProps | |
| 21572 | +}, forwardedRef) => { | |
| 21573 | + const validityTargetRef = (0, import_element49.useRef)(null); | |
| 21574 | + const mergedRefs = (0, import_compose6.useMergeRefs)([forwardedRef, validityTargetRef]); | |
| 21575 | + (0, import_element49.useEffect)(() => { | |
| 21576 | + const input = validityTargetRef.current?.querySelector( | |
| 21577 | + 'input[role="combobox"]' | |
| 21578 | + ); | |
| 21579 | + if (input) { | |
| 21580 | + input.required = required ?? false; | |
| 21581 | + } | |
| 21582 | + }, [required]); | |
| 21583 | + return ( | |
| 21584 | + // TODO: Bug - Missing value error is not cleared immediately on change, waits for blur. | |
| 21585 | + /* @__PURE__ */ (0, import_jsx_runtime60.jsx)( | |
| 21586 | + ControlWithError, | |
| 21587 | + { | |
| 21588 | + className: "dataviews-validated-control", | |
| 21589 | + required, | |
| 21590 | + markWhenOptional, | |
| 21591 | + ref: mergedRefs, | |
| 21592 | + customValidity, | |
| 21593 | + getValidityTarget: () => validityTargetRef.current?.querySelector( | |
| 21594 | + 'input[role="combobox"]' | |
| 21595 | + ), | |
| 21596 | + children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_components3.ComboboxControl, { ...restProps }) | |
| 21597 | + } | |
| 21598 | + ) | |
| 21599 | + ); | |
| 21600 | +}; | |
| 21601 | +var ValidatedComboboxControl = (0, import_element49.forwardRef)(UnforwardedValidatedComboboxControl); | |
| 21602 | +ValidatedComboboxControl.displayName = "ValidatedComboboxControl"; | |
| 21603 | + | |
| 21604 | +// packages/dataviews/build-module/components/validated-form-controls/form-token-field.mjs | |
| 21605 | +var import_element50 = __toESM(require_element(), 1); | |
| 21606 | +var import_components4 = __toESM(require_components(), 1); | |
| 21607 | +var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1); | |
| 21608 | +var UnforwardedValidatedFormTokenField = ({ | |
| 21609 | + required, | |
| 21610 | + customValidity, | |
| 21611 | + markWhenOptional, | |
| 21612 | + ...restProps | |
| 21613 | +}, forwardedRef) => { | |
| 21614 | + const validityTargetRef = (0, import_element50.useRef)(null); | |
| 21615 | + return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)( | |
| 21616 | + "div", | |
| 21617 | + { | |
| 21618 | + className: "dataviews-validated-control__wrapper-with-error-delegate", | |
| 21619 | + ref: forwardedRef, | |
| 21620 | + children: [ | |
| 21621 | + /* @__PURE__ */ (0, import_jsx_runtime61.jsx)( | |
| 21622 | + ControlWithError, | |
| 21623 | + { | |
| 21624 | + className: "dataviews-validated-control", | |
| 21625 | + required, | |
| 21626 | + markWhenOptional, | |
| 21627 | + customValidity, | |
| 21628 | + getValidityTarget: () => validityTargetRef.current, | |
| 21629 | + children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_components4.FormTokenField, { ...restProps }) | |
| 21630 | + } | |
| 21631 | + ), | |
| 21632 | + /* @__PURE__ */ (0, import_jsx_runtime61.jsx)( | |
| 21633 | + "input", | |
| 21634 | + { | |
| 21635 | + className: "dataviews-validated-control__error-delegate", | |
| 21636 | + type: "text", | |
| 21637 | + ref: validityTargetRef, | |
| 21638 | + required, | |
| 21639 | + value: restProps.value && restProps.value.length > 0 ? "hasvalue" : "", | |
| 21640 | + tabIndex: -1, | |
| 21641 | + onChange: () => { | |
| 21642 | + }, | |
| 21643 | + onFocus: (e) => { | |
| 21644 | + e.target.previousElementSibling?.querySelector( | |
| 21645 | + 'input[type="text"]' | |
| 21646 | + )?.focus(); | |
| 21647 | + } | |
| 21648 | + } | |
| 21649 | + ) | |
| 21650 | + ] | |
| 21651 | + } | |
| 21652 | + ); | |
| 21653 | +}; | |
| 21654 | +var ValidatedFormTokenField = (0, import_element50.forwardRef)(UnforwardedValidatedFormTokenField); | |
| 21655 | +ValidatedFormTokenField.displayName = "ValidatedFormTokenField"; | |
| 21656 | + | |
| 21657 | +// packages/dataviews/build-module/components/validated-form-controls/number-control.mjs | |
| 21658 | +var import_element51 = __toESM(require_element(), 1); | |
| 21659 | +var import_compose7 = __toESM(require_compose(), 1); | |
| 21660 | +var import_components5 = __toESM(require_components(), 1); | |
| 21661 | +var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1); | |
| 21662 | +var UnforwardedValidatedNumberControl = ({ | |
| 21663 | + required, | |
| 21664 | + customValidity, | |
| 21665 | + markWhenOptional, | |
| 21666 | + ...restProps | |
| 21667 | +}, forwardedRef) => { | |
| 21668 | + const validityTargetRef = (0, import_element51.useRef)(null); | |
| 21669 | + const mergedRefs = (0, import_compose7.useMergeRefs)([forwardedRef, validityTargetRef]); | |
| 21670 | + return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)( | |
| 21671 | + ControlWithError, | |
| 21672 | + { | |
| 21673 | + className: "dataviews-validated-control", | |
| 21674 | + required, | |
| 21675 | + markWhenOptional, | |
| 21676 | + customValidity, | |
| 21677 | + getValidityTarget: () => validityTargetRef.current, | |
| 21678 | + children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_components5.__experimentalNumberControl, { ref: mergedRefs, ...restProps }) | |
| 21679 | + } | |
| 21680 | + ); | |
| 21681 | +}; | |
| 21682 | +var ValidatedNumberControl = (0, import_element51.forwardRef)(UnforwardedValidatedNumberControl); | |
| 21683 | +ValidatedNumberControl.displayName = "ValidatedNumberControl"; | |
| 21684 | + | |
| 21685 | +// packages/dataviews/build-module/components/validated-form-controls/radio-control.mjs | |
| 21686 | +var import_element52 = __toESM(require_element(), 1); | |
| 21687 | +var import_compose8 = __toESM(require_compose(), 1); | |
| 21688 | +var import_components6 = __toESM(require_components(), 1); | |
| 21689 | +var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1); | |
| 21690 | +var UnforwardedValidatedRadioControl = ({ | |
| 21691 | + required, | |
| 21692 | + customValidity, | |
| 21693 | + markWhenOptional, | |
| 21694 | + ...restProps | |
| 21695 | +}, forwardedRef) => { | |
| 21696 | + const validityTargetRef = (0, import_element52.useRef)(null); | |
| 21697 | + const mergedRefs = (0, import_compose8.useMergeRefs)([forwardedRef, validityTargetRef]); | |
| 21698 | + return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)( | |
| 21699 | + ControlWithError, | |
| 21700 | + { | |
| 21701 | + className: "dataviews-validated-control", | |
| 21702 | + required, | |
| 21703 | + markWhenOptional, | |
| 21704 | + ref: mergedRefs, | |
| 21705 | + customValidity, | |
| 21706 | + getValidityTarget: () => validityTargetRef.current?.querySelector( | |
| 21707 | + 'input[type="radio"]' | |
| 21708 | + ), | |
| 21709 | + children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_components6.RadioControl, { ...restProps }) | |
| 21710 | + } | |
| 21711 | + ); | |
| 21712 | +}; | |
| 21713 | +var ValidatedRadioControl = (0, import_element52.forwardRef)(UnforwardedValidatedRadioControl); | |
| 21714 | +ValidatedRadioControl.displayName = "ValidatedRadioControl"; | |
| 21715 | + | |
| 21716 | +// packages/dataviews/build-module/components/validated-form-controls/select-control.mjs | |
| 21717 | +var import_element53 = __toESM(require_element(), 1); | |
| 21718 | +var import_compose9 = __toESM(require_compose(), 1); | |
| 21719 | +var import_components7 = __toESM(require_components(), 1); | |
| 21720 | +var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1); | |
| 21721 | +var UnforwardedValidatedSelectControl = ({ | |
| 21722 | + required, | |
| 21723 | + customValidity, | |
| 21724 | + markWhenOptional, | |
| 21725 | + ...restProps | |
| 21726 | +}, forwardedRef) => { | |
| 21727 | + const validityTargetRef = (0, import_element53.useRef)(null); | |
| 21728 | + const mergedRefs = (0, import_compose9.useMergeRefs)([forwardedRef, validityTargetRef]); | |
| 21729 | + return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)( | |
| 21730 | + ControlWithError, | |
| 21731 | + { | |
| 21732 | + className: "dataviews-validated-control", | |
| 21733 | + required, | |
| 21734 | + markWhenOptional, | |
| 21735 | + customValidity, | |
| 21736 | + getValidityTarget: () => validityTargetRef.current, | |
| 21737 | + children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)( | |
| 21738 | + import_components7.SelectControl, | |
| 21739 | + { | |
| 21740 | + ref: mergedRefs, | |
| 21741 | + // A runtime boolean cannot statically discriminate | |
| 21742 | + // SelectControl's single/multiple props union. | |
| 21743 | + ...restProps | |
| 21744 | + } | |
| 21745 | + ) | |
| 21746 | + } | |
| 21747 | + ); | |
| 21748 | +}; | |
| 21749 | +var ValidatedSelectControl = (0, import_element53.forwardRef)(UnforwardedValidatedSelectControl); | |
| 21750 | +ValidatedSelectControl.displayName = "ValidatedSelectControl"; | |
| 21751 | + | |
| 21752 | +// packages/dataviews/build-module/components/validated-form-controls/toggle-control.mjs | |
| 21753 | +var import_element54 = __toESM(require_element(), 1); | |
| 21754 | +var import_compose10 = __toESM(require_compose(), 1); | |
| 21755 | +var import_components8 = __toESM(require_components(), 1); | |
| 21756 | +var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1); | |
| 21757 | +var UnforwardedValidatedToggleControl = ({ | |
| 21758 | + required, | |
| 21759 | + customValidity, | |
| 21760 | + markWhenOptional, | |
| 21761 | + ...restProps | |
| 21762 | +}, forwardedRef) => { | |
| 21763 | + const validityTargetRef = (0, import_element54.useRef)(null); | |
| 21764 | + const mergedRefs = (0, import_compose10.useMergeRefs)([forwardedRef, validityTargetRef]); | |
| 21765 | + return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)( | |
| 21766 | + ControlWithError, | |
| 21767 | + { | |
| 21768 | + className: "dataviews-validated-control", | |
| 21769 | + required, | |
| 21770 | + markWhenOptional, | |
| 21771 | + customValidity, | |
| 21772 | + getValidityTarget: () => validityTargetRef.current, | |
| 21773 | + children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)( | |
| 21774 | + import_components8.ToggleControl, | |
| 21775 | + { | |
| 21776 | + ref: mergedRefs, | |
| 21777 | + required, | |
| 21778 | + ...restProps | |
| 21779 | + } | |
| 21780 | + ) | |
| 21781 | + } | |
| 21782 | + ); | |
| 21783 | +}; | |
| 21784 | +var ValidatedToggleControl = (0, import_element54.forwardRef)(UnforwardedValidatedToggleControl); | |
| 21785 | +ValidatedToggleControl.displayName = "ValidatedToggleControl"; | |
| 21786 | + | |
| 21787 | +// packages/dataviews/build-module/components/validated-form-controls/toggle-group-control.mjs | |
| 21788 | +var import_element55 = __toESM(require_element(), 1); | |
| 21789 | +var import_components9 = __toESM(require_components(), 1); | |
| 21790 | +var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1); | |
| 21791 | +var UnforwardedValidatedToggleGroupControl = ({ | |
| 21792 | + required, | |
| 21793 | + customValidity, | |
| 21794 | + markWhenOptional, | |
| 21795 | + ...restProps | |
| 21796 | +}, forwardedRef) => { | |
| 21797 | + const validityTargetRef = (0, import_element55.useRef)(null); | |
| 21798 | + const nameAttr = (0, import_element55.useId)(); | |
| 21799 | + return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "dataviews-validated-control__wrapper-with-error-delegate", children: [ | |
| 21800 | + /* @__PURE__ */ (0, import_jsx_runtime66.jsx)( | |
| 21801 | + ControlWithError, | |
| 21802 | + { | |
| 21803 | + className: "dataviews-validated-control", | |
| 21804 | + required, | |
| 21805 | + markWhenOptional, | |
| 21806 | + customValidity, | |
| 21807 | + getValidityTarget: () => validityTargetRef.current, | |
| 21808 | + children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_components9.__experimentalToggleGroupControl, { ref: forwardedRef, ...restProps }) | |
| 21809 | + } | |
| 21810 | + ), | |
| 21811 | + /* @__PURE__ */ (0, import_jsx_runtime66.jsx)( | |
| 21812 | + "input", | |
| 21813 | + { | |
| 21814 | + className: "dataviews-validated-control__error-delegate", | |
| 21815 | + type: "radio", | |
| 21816 | + ref: validityTargetRef, | |
| 21817 | + required, | |
| 21818 | + checked: restProps.value !== void 0, | |
| 21819 | + tabIndex: -1, | |
| 21820 | + name: nameAttr, | |
| 21821 | + onChange: () => { | |
| 21822 | + }, | |
| 21823 | + onFocus: (e) => { | |
| 21824 | + e.target.previousElementSibling?.querySelector( | |
| 21825 | + '[data-active-item="true"]' | |
| 21826 | + )?.focus(); | |
| 21827 | + } | |
| 21828 | + } | |
| 21829 | + ) | |
| 21830 | + ] }); | |
| 21831 | +}; | |
| 21832 | +var ValidatedToggleGroupControl = (0, import_element55.forwardRef)(UnforwardedValidatedToggleGroupControl); | |
| 21833 | +ValidatedToggleGroupControl.displayName = "ValidatedToggleGroupControl"; | |
| 21834 | + | |
| 21835 | +// packages/dataviews/build-module/components/dataform-controls/utils/get-custom-validity.mjs | |
| 21836 | +function getCustomValidity(isValid2, validity) { | |
| 21837 | + let customValidity; | |
| 21838 | + if (isValid2?.required && validity?.required) { | |
| 21839 | + customValidity = validity.required.message ? { | |
| 21840 | + type: validity.required.type, | |
| 21841 | + message: validity.required.message | |
| 21842 | + } : void 0; | |
| 21843 | + } else if (isValid2?.pattern && validity?.pattern) { | |
| 21844 | + customValidity = validity.pattern; | |
| 21845 | + } else if (isValid2?.min && validity?.min) { | |
| 21846 | + customValidity = validity.min; | |
| 21847 | + } else if (isValid2?.max && validity?.max) { | |
| 21848 | + customValidity = validity.max; | |
| 21849 | + } else if (isValid2?.minLength && validity?.minLength) { | |
| 21850 | + customValidity = validity.minLength; | |
| 21851 | + } else if (isValid2?.maxLength && validity?.maxLength) { | |
| 21852 | + customValidity = validity.maxLength; | |
| 21853 | + } else if (isValid2?.elements && validity?.elements) { | |
| 21854 | + customValidity = validity.elements; | |
| 21855 | + } else if (validity?.custom) { | |
| 21856 | + customValidity = validity.custom; | |
| 21857 | + } | |
| 21858 | + return customValidity; | |
| 21859 | +} | |
| 21860 | + | |
| 21861 | +// packages/dataviews/build-module/components/dataform-controls/checkbox.mjs | |
| 21862 | +var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1); | |
| 21863 | +function Checkbox({ | |
| 21864 | + field, | |
| 21865 | + onChange, | |
| 21866 | + data, | |
| 21867 | + hideLabelFromVision, | |
| 21868 | + markWhenOptional, | |
| 21869 | + validity | |
| 21870 | +}) { | |
| 21871 | + const { getValue, setValue, label, description, isValid: isValid2 } = field; | |
| 21872 | + const disabled2 = field.isDisabled({ item: data, field }); | |
| 21873 | + const onChangeControl = (0, import_element56.useCallback)(() => { | |
| 21874 | + onChange( | |
| 21875 | + setValue({ item: data, value: !getValue({ item: data }) }) | |
| 21876 | + ); | |
| 21877 | + }, [data, getValue, onChange, setValue]); | |
| 21878 | + return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)( | |
| 21879 | + ValidatedCheckboxControl, | |
| 21880 | + { | |
| 21881 | + required: !!field.isValid?.required, | |
| 21882 | + markWhenOptional, | |
| 21883 | + customValidity: getCustomValidity(isValid2, validity), | |
| 21884 | + hidden: hideLabelFromVision, | |
| 21885 | + label, | |
| 21886 | + help: description, | |
| 21887 | + checked: getValue({ item: data }), | |
| 21888 | + onChange: onChangeControl, | |
| 21889 | + disabled: disabled2 | |
| 21890 | + } | |
| 21891 | + ); | |
| 21892 | +} | |
| 21893 | + | |
| 21894 | +// packages/dataviews/build-module/components/dataform-controls/combobox.mjs | |
| 21895 | +var import_components10 = __toESM(require_components(), 1); | |
| 21896 | +var import_element57 = __toESM(require_element(), 1); | |
| 21897 | +var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1); | |
| 21898 | +function Combobox({ | |
| 21899 | + data, | |
| 21900 | + field, | |
| 21901 | + onChange, | |
| 21902 | + hideLabelFromVision, | |
| 21903 | + validity | |
| 21904 | +}) { | |
| 21905 | + const { label, description, placeholder, getValue, setValue, isValid: isValid2 } = field; | |
| 21906 | + const value = getValue({ item: data }) ?? ""; | |
| 21907 | + const onChangeControl = (0, import_element57.useCallback)( | |
| 21908 | + (newValue) => onChange(setValue({ item: data, value: newValue ?? "" })), | |
| 21909 | + [data, onChange, setValue] | |
| 21910 | + ); | |
| 21911 | + const { elements, isLoading } = useElements({ | |
| 21912 | + elements: field.elements, | |
| 21913 | + getElements: field.getElements | |
| 229 | 21914 | }); |
| 21915 | + if (isLoading) { | |
| 21916 | + return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_components10.Spinner, {}); | |
| 21917 | + } | |
| 21918 | + return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( | |
| 21919 | + ValidatedComboboxControl, | |
| 21920 | + { | |
| 21921 | + required: !!field.isValid?.required, | |
| 21922 | + customValidity: getCustomValidity(isValid2, validity), | |
| 21923 | + label, | |
| 21924 | + value, | |
| 21925 | + help: description, | |
| 21926 | + placeholder, | |
| 21927 | + options: elements, | |
| 21928 | + onChange: onChangeControl, | |
| 21929 | + hideLabelFromVision, | |
| 21930 | + allowReset: true, | |
| 21931 | + expandOnFocus: true | |
| 21932 | + } | |
| 21933 | + ); | |
| 230 | 21934 | } |
| 231 | -function viewToQuery(view) { | |
| 21935 | + | |
| 21936 | +// packages/dataviews/build-module/components/dataform-controls/datetime.mjs | |
| 21937 | +var import_components12 = __toESM(require_components(), 1); | |
| 21938 | +var import_element60 = __toESM(require_element(), 1); | |
| 21939 | +var import_i18n12 = __toESM(require_i18n(), 1); | |
| 21940 | +var import_date5 = __toESM(require_date(), 1); | |
| 21941 | +import { speak as speak2 } from "@wordpress/a11y"; | |
| 21942 | + | |
| 21943 | +// packages/dataviews/build-module/components/dataform-controls/utils/relative-date-control.mjs | |
| 21944 | +var import_components11 = __toESM(require_components(), 1); | |
| 21945 | +var import_element58 = __toESM(require_element(), 1); | |
| 21946 | +var import_i18n10 = __toESM(require_i18n(), 1); | |
| 21947 | +var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1); | |
| 21948 | +var TIME_UNITS_OPTIONS = { | |
| 21949 | + [OPERATOR_IN_THE_PAST]: [ | |
| 21950 | + { value: "days", label: (0, import_i18n10.__)("Days") }, | |
| 21951 | + { value: "weeks", label: (0, import_i18n10.__)("Weeks") }, | |
| 21952 | + { value: "months", label: (0, import_i18n10.__)("Months") }, | |
| 21953 | + { value: "years", label: (0, import_i18n10.__)("Years") } | |
| 21954 | + ], | |
| 21955 | + [OPERATOR_OVER]: [ | |
| 21956 | + { value: "days", label: (0, import_i18n10.__)("Days ago") }, | |
| 21957 | + { value: "weeks", label: (0, import_i18n10.__)("Weeks ago") }, | |
| 21958 | + { value: "months", label: (0, import_i18n10.__)("Months ago") }, | |
| 21959 | + { value: "years", label: (0, import_i18n10.__)("Years ago") } | |
| 21960 | + ] | |
| 21961 | +}; | |
| 21962 | +function RelativeDateControl({ | |
| 21963 | + className, | |
| 21964 | + data, | |
| 21965 | + field, | |
| 21966 | + onChange, | |
| 21967 | + hideLabelFromVision, | |
| 21968 | + operator | |
| 21969 | +}) { | |
| 21970 | + const options = TIME_UNITS_OPTIONS[operator === OPERATOR_IN_THE_PAST ? "inThePast" : "over"]; | |
| 21971 | + const { id, label, description, getValue, setValue } = field; | |
| 21972 | + const disabled2 = field.isDisabled({ item: data, field }); | |
| 21973 | + const fieldValue = getValue({ item: data }); | |
| 21974 | + const { value: relValue = "", unit = options[0].value } = fieldValue && typeof fieldValue === "object" ? fieldValue : {}; | |
| 21975 | + const onChangeValue = (0, import_element58.useCallback)( | |
| 21976 | + (newValue) => onChange( | |
| 21977 | + setValue({ | |
| 21978 | + item: data, | |
| 21979 | + value: { value: Number(newValue), unit } | |
| 21980 | + }) | |
| 21981 | + ), | |
| 21982 | + [onChange, setValue, data, unit] | |
| 21983 | + ); | |
| 21984 | + const onChangeUnit = (0, import_element58.useCallback)( | |
| 21985 | + (newUnit) => onChange( | |
| 21986 | + setValue({ | |
| 21987 | + item: data, | |
| 21988 | + value: { value: relValue, unit: newUnit } | |
| 21989 | + }) | |
| 21990 | + ), | |
| 21991 | + [onChange, setValue, data, relValue] | |
| 21992 | + ); | |
| 21993 | + return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)( | |
| 21994 | + import_components11.BaseControl, | |
| 21995 | + { | |
| 21996 | + id, | |
| 21997 | + className: clsx_default(className, "dataviews-controls__relative-date"), | |
| 21998 | + label, | |
| 21999 | + hideLabelFromVision, | |
| 22000 | + help: description, | |
| 22001 | + children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(Stack, { direction: "row", gap: "sm", children: [ | |
| 22002 | + /* @__PURE__ */ (0, import_jsx_runtime69.jsx)( | |
| 22003 | + import_components11.__experimentalNumberControl, | |
| 22004 | + { | |
| 22005 | + className: "dataviews-controls__relative-date-number", | |
| 22006 | + spinControls: "none", | |
| 22007 | + min: 1, | |
| 22008 | + step: 1, | |
| 22009 | + value: relValue, | |
| 22010 | + onChange: onChangeValue, | |
| 22011 | + disabled: disabled2 | |
| 22012 | + } | |
| 22013 | + ), | |
| 22014 | + /* @__PURE__ */ (0, import_jsx_runtime69.jsx)( | |
| 22015 | + import_components11.SelectControl, | |
| 22016 | + { | |
| 22017 | + className: "dataviews-controls__relative-date-unit", | |
| 22018 | + label: (0, import_i18n10.__)("Unit"), | |
| 22019 | + value: unit, | |
| 22020 | + options, | |
| 22021 | + onChange: onChangeUnit, | |
| 22022 | + hideLabelFromVision: true, | |
| 22023 | + disabled: disabled2 | |
| 22024 | + } | |
| 22025 | + ) | |
| 22026 | + ] }) | |
| 22027 | + } | |
| 22028 | + ); | |
| 22029 | +} | |
| 22030 | + | |
| 22031 | +// packages/dataviews/build-module/components/dataform-controls/utils/to-calendar-date.mjs | |
| 22032 | +function toCalendarDate(date, timeZone) { | |
| 22033 | + return timeZone ? new TZDate(date, timeZone) : date; | |
| 22034 | +} | |
| 22035 | + | |
| 22036 | +// packages/dataviews/build-module/components/dataform-controls/utils/use-disabled-date-matchers.mjs | |
| 22037 | +var import_element59 = __toESM(require_element(), 1); | |
| 22038 | +function useDisabledDateMatchers(isValid2, parseDateFn) { | |
| 22039 | + const minConstraint = typeof isValid2.min?.constraint === "string" ? isValid2.min.constraint : void 0; | |
| 22040 | + const maxConstraint = typeof isValid2.max?.constraint === "string" ? isValid2.max.constraint : void 0; | |
| 22041 | + const disabledMatchers = (0, import_element59.useMemo)(() => { | |
| 22042 | + const matchers = []; | |
| 22043 | + if (minConstraint) { | |
| 22044 | + const minDate = parseDateFn(minConstraint); | |
| 22045 | + if (minDate) { | |
| 22046 | + matchers.push({ before: minDate }); | |
| 22047 | + } | |
| 22048 | + } | |
| 22049 | + if (maxConstraint) { | |
| 22050 | + const maxDate = parseDateFn(maxConstraint); | |
| 22051 | + if (maxDate) { | |
| 22052 | + matchers.push({ after: maxDate }); | |
| 22053 | + } | |
| 22054 | + } | |
| 22055 | + return matchers.length > 0 ? matchers : void 0; | |
| 22056 | + }, [minConstraint, maxConstraint, parseDateFn]); | |
| 22057 | + return { minConstraint, maxConstraint, disabledMatchers }; | |
| 22058 | +} | |
| 22059 | + | |
| 22060 | +// packages/dataviews/build-module/components/dataform-controls/utils/get-calendar-locale.mjs | |
| 22061 | +var LANGUAGE_ALIASES = { | |
| 22062 | + ary: "ar-MA", | |
| 22063 | + // Moroccan Arabic. | |
| 22064 | + haz: "fa" | |
| 22065 | + // Hazaragi, a variety of Persian. | |
| 22066 | +}; | |
| 22067 | +function getCalendarLocale(wpLocale) { | |
| 22068 | + const subtags = wpLocale?.trim().split(/[_-]/) ?? []; | |
| 22069 | + const language = subtags.shift()?.toLowerCase(); | |
| 22070 | + if (!language) { | |
| 22071 | + return void 0; | |
| 22072 | + } | |
| 22073 | + const normalized = [LANGUAGE_ALIASES[language] ?? language]; | |
| 22074 | + for (const subtag of subtags) { | |
| 22075 | + if (/^[a-z]{4}$/i.test(subtag) || /^([a-z]{2}|\d{3})$/i.test(subtag)) { | |
| 22076 | + normalized.push(subtag); | |
| 22077 | + } | |
| 22078 | + } | |
| 22079 | + return normalized.join("-"); | |
| 22080 | +} | |
| 22081 | + | |
| 22082 | +// packages/dataviews/build-module/components/dataform-controls/utils/get-timezone-description.mjs | |
| 22083 | +var import_date3 = __toESM(require_date(), 1); | |
| 22084 | +var import_i18n11 = __toESM(require_i18n(), 1); | |
| 22085 | +function getTimezoneDescription() { | |
| 22086 | + const { timezone } = (0, import_date3.getSettings)(); | |
| 22087 | + const userTimezoneOffset = -1 * ((/* @__PURE__ */ new Date()).getTimezoneOffset() / 60); | |
| 22088 | + if (Number(timezone.offset) === userTimezoneOffset) { | |
| 22089 | + return void 0; | |
| 22090 | + } | |
| 22091 | + const offsetSymbol = Number(timezone.offset) >= 0 ? "+" : ""; | |
| 22092 | + const zoneAbbr = "" !== timezone.abbr && isNaN(Number(timezone.abbr)) ? timezone.abbr : `UTC${offsetSymbol}${timezone.offsetFormatted}`; | |
| 22093 | + const prettyTimezoneString = timezone.string.replaceAll("_", " "); | |
| 22094 | + let timezoneDetail = zoneAbbr; | |
| 22095 | + if ("UTC" === timezone.string) { | |
| 22096 | + timezoneDetail = (0, import_i18n11.__)("Coordinated Universal Time"); | |
| 22097 | + } else if (prettyTimezoneString.trim().length > 0) { | |
| 22098 | + timezoneDetail = `(${zoneAbbr}) ${prettyTimezoneString}`; | |
| 22099 | + } | |
| 22100 | + return (0, import_i18n11.sprintf)( | |
| 22101 | + /* translators: %s: timezone detail, e.g. "(CEST) Europe/Madrid" or "UTC+3". */ | |
| 22102 | + (0, import_i18n11.__)("Timezone: %s"), | |
| 22103 | + timezoneDetail | |
| 22104 | + ); | |
| 22105 | +} | |
| 22106 | + | |
| 22107 | +// packages/dataviews/build-module/field-types/utils/parse-date-time.mjs | |
| 22108 | +var import_date4 = __toESM(require_date(), 1); | |
| 22109 | +function parseDateTime(dateTimeString) { | |
| 22110 | + if (!dateTimeString) { | |
| 22111 | + return null; | |
| 22112 | + } | |
| 22113 | + const parsed = (0, import_date4.getDate)(dateTimeString); | |
| 22114 | + return parsed && isValid(parsed) ? parsed : null; | |
| 22115 | +} | |
| 22116 | + | |
| 22117 | +// packages/dataviews/build-module/components/dataform-controls/datetime.mjs | |
| 22118 | +var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1); | |
| 22119 | +var formatDateTime = (value) => { | |
| 22120 | + if (!value) { | |
| 22121 | + return ""; | |
| 22122 | + } | |
| 22123 | + return (0, import_date5.dateI18n)("Y-m-d\\TH:i", (0, import_date5.getDate)(value)); | |
| 22124 | +}; | |
| 22125 | +function CalendarDateTimeControl({ | |
| 22126 | + data, | |
| 22127 | + field, | |
| 22128 | + onChange, | |
| 22129 | + hideLabelFromVision, | |
| 22130 | + markWhenOptional, | |
| 22131 | + validity, | |
| 22132 | + config | |
| 22133 | +}) { | |
| 22134 | + const { compact } = config || {}; | |
| 22135 | + const { id, label, description, setValue, getValue, isValid: isValid2 } = field; | |
| 22136 | + const disabled2 = field.isDisabled({ item: data, field }); | |
| 22137 | + const fieldValue = getValue({ item: data }); | |
| 22138 | + const value = typeof fieldValue === "string" ? fieldValue : void 0; | |
| 22139 | + const { timezone } = (0, import_date5.getSettings)(); | |
| 22140 | + const timeZone = timezone.string || (0, import_date5.dateI18n)("P"); | |
| 22141 | + const [calendarMonth, setCalendarMonth] = (0, import_element60.useState)(() => { | |
| 22142 | + const parsedDate = parseDateTime(value); | |
| 22143 | + return toCalendarDate(parsedDate || /* @__PURE__ */ new Date(), timeZone); | |
| 22144 | + }); | |
| 22145 | + (0, import_element60.useEffect)(() => { | |
| 22146 | + const parsedDate = parseDateTime(value); | |
| 22147 | + if (parsedDate) { | |
| 22148 | + const targetMonth = toCalendarDate(parsedDate, timeZone); | |
| 22149 | + setCalendarMonth( | |
| 22150 | + (currentMonth) => isSameMonth( | |
| 22151 | + targetMonth, | |
| 22152 | + toCalendarDate(currentMonth, timeZone) | |
| 22153 | + ) ? currentMonth : targetMonth | |
| 22154 | + ); | |
| 22155 | + } | |
| 22156 | + }, [timeZone, value]); | |
| 22157 | + const inputControlRef = (0, import_element60.useRef)(null); | |
| 22158 | + const validationTimeoutRef = (0, import_element60.useRef)(void 0); | |
| 22159 | + const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDateTime); | |
| 22160 | + const onChangeCallback = (0, import_element60.useCallback)( | |
| 22161 | + (newValue) => onChange(setValue({ item: data, value: newValue })), | |
| 22162 | + [data, onChange, setValue] | |
| 22163 | + ); | |
| 22164 | + (0, import_element60.useEffect)(() => { | |
| 22165 | + return () => clearTimeout(validationTimeoutRef.current); | |
| 22166 | + }, []); | |
| 22167 | + const onSelectDate = (0, import_element60.useCallback)( | |
| 22168 | + (newDate) => { | |
| 22169 | + if (newDate) { | |
| 22170 | + const wpDate = (0, import_date5.dateI18n)("Y-m-d", newDate); | |
| 22171 | + const wpTime = value ? (0, import_date5.dateI18n)("H:i", (0, import_date5.getDate)(value)) : "00:00"; | |
| 22172 | + const finalDateTime = (0, import_date5.getDate)(`${wpDate}T${wpTime}`); | |
| 22173 | + onChangeCallback(finalDateTime.toISOString()); | |
| 22174 | + } else { | |
| 22175 | + onChangeCallback(void 0); | |
| 22176 | + } | |
| 22177 | + clearTimeout(validationTimeoutRef.current); | |
| 22178 | + validationTimeoutRef.current = setTimeout(() => { | |
| 22179 | + const input = inputControlRef.current; | |
| 22180 | + if (!input) { | |
| 22181 | + return; | |
| 22182 | + } | |
| 22183 | + input.dispatchEvent( | |
| 22184 | + new Event("invalid", { cancelable: true }) | |
| 22185 | + ); | |
| 22186 | + if (input.validationMessage) { | |
| 22187 | + speak2(input.validationMessage); | |
| 22188 | + } | |
| 22189 | + }, 0); | |
| 22190 | + }, | |
| 22191 | + [onChangeCallback, value] | |
| 22192 | + ); | |
| 22193 | + const handleManualDateTimeChange = (0, import_element60.useCallback)( | |
| 22194 | + (newValue) => { | |
| 22195 | + if (newValue) { | |
| 22196 | + const dateTime = (0, import_date5.getDate)(newValue); | |
| 22197 | + onChangeCallback(dateTime.toISOString()); | |
| 22198 | + const parsedDate = parseDateTime(dateTime.toISOString()); | |
| 22199 | + if (parsedDate) { | |
| 22200 | + setCalendarMonth(toCalendarDate(parsedDate, timeZone)); | |
| 22201 | + } | |
| 22202 | + } else { | |
| 22203 | + onChangeCallback(void 0); | |
| 22204 | + } | |
| 22205 | + }, | |
| 22206 | + [onChangeCallback, timeZone] | |
| 22207 | + ); | |
| 22208 | + const { format: fieldFormat } = field; | |
| 22209 | + const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date5.getSettings)().l10n.startOfWeek; | |
| 22210 | + const locale = getCalendarLocale((0, import_date5.getSettings)().l10n.locale); | |
| 22211 | + let displayLabel = label; | |
| 22212 | + if (isValid2?.required && !markWhenOptional && !hideLabelFromVision) { | |
| 22213 | + displayLabel = `${label} (${(0, import_i18n12.__)("Required")})`; | |
| 22214 | + } else if (!isValid2?.required && markWhenOptional && !hideLabelFromVision) { | |
| 22215 | + displayLabel = `${label} (${(0, import_i18n12.__)("Optional")})`; | |
| 22216 | + } | |
| 22217 | + return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)( | |
| 22218 | + import_components12.BaseControl, | |
| 22219 | + { | |
| 22220 | + id, | |
| 22221 | + label: displayLabel, | |
| 22222 | + help: description, | |
| 22223 | + hideLabelFromVision, | |
| 22224 | + children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Stack, { direction: "column", gap: "lg", children: [ | |
| 22225 | + /* @__PURE__ */ (0, import_jsx_runtime70.jsx)( | |
| 22226 | + ValidatedInputControl, | |
| 22227 | + { | |
| 22228 | + ref: inputControlRef, | |
| 22229 | + required: !!isValid2?.required, | |
| 22230 | + customValidity: getCustomValidity(isValid2, validity), | |
| 22231 | + type: "datetime-local", | |
| 22232 | + label: (0, import_i18n12.__)("Date time"), | |
| 22233 | + hideLabelFromVision: true, | |
| 22234 | + value: formatDateTime(value), | |
| 22235 | + onValueChange: handleManualDateTimeChange, | |
| 22236 | + disabled: disabled2, | |
| 22237 | + description: getTimezoneDescription(), | |
| 22238 | + min: minConstraint ? formatDateTime(minConstraint) : void 0, | |
| 22239 | + max: maxConstraint ? formatDateTime(maxConstraint) : void 0 | |
| 22240 | + } | |
| 22241 | + ), | |
| 22242 | + !compact && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)( | |
| 22243 | + Calendar, | |
| 22244 | + { | |
| 22245 | + style: { width: "100%" }, | |
| 22246 | + value: value ? parseDateTime(value) : null, | |
| 22247 | + onValueChange: onSelectDate, | |
| 22248 | + month: calendarMonth, | |
| 22249 | + onMonthChange: setCalendarMonth, | |
| 22250 | + timeZone, | |
| 22251 | + locale, | |
| 22252 | + dir: (0, import_i18n12.isRTL)() ? "rtl" : "ltr", | |
| 22253 | + weekStartsOn, | |
| 22254 | + disabled: disabled2 || disabledMatchers | |
| 22255 | + } | |
| 22256 | + ) | |
| 22257 | + ] }) | |
| 22258 | + } | |
| 22259 | + ); | |
| 22260 | +} | |
| 22261 | +function DateTime({ | |
| 22262 | + data, | |
| 22263 | + field, | |
| 22264 | + onChange, | |
| 22265 | + hideLabelFromVision, | |
| 22266 | + markWhenOptional, | |
| 22267 | + operator, | |
| 22268 | + validity, | |
| 22269 | + config | |
| 22270 | +}) { | |
| 22271 | + if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) { | |
| 22272 | + return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)( | |
| 22273 | + RelativeDateControl, | |
| 22274 | + { | |
| 22275 | + className: "dataviews-controls__datetime", | |
| 22276 | + data, | |
| 22277 | + field, | |
| 22278 | + onChange, | |
| 22279 | + hideLabelFromVision, | |
| 22280 | + operator | |
| 22281 | + } | |
| 22282 | + ); | |
| 22283 | + } | |
| 22284 | + return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)( | |
| 22285 | + CalendarDateTimeControl, | |
| 22286 | + { | |
| 22287 | + data, | |
| 22288 | + field, | |
| 22289 | + onChange, | |
| 22290 | + hideLabelFromVision, | |
| 22291 | + markWhenOptional, | |
| 22292 | + validity, | |
| 22293 | + config | |
| 22294 | + } | |
| 22295 | + ); | |
| 22296 | +} | |
| 22297 | + | |
| 22298 | +// packages/dataviews/build-module/components/dataform-controls/date.mjs | |
| 22299 | +var import_components13 = __toESM(require_components(), 1); | |
| 22300 | +var import_element61 = __toESM(require_element(), 1); | |
| 22301 | +var import_i18n13 = __toESM(require_i18n(), 1); | |
| 22302 | +var import_date6 = __toESM(require_date(), 1); | |
| 22303 | +import { speak as speak3 } from "@wordpress/a11y"; | |
| 22304 | +var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1); | |
| 22305 | +var DATE_PRESETS = [ | |
| 22306 | + { | |
| 22307 | + id: "today", | |
| 22308 | + label: (0, import_i18n13.__)("Today"), | |
| 22309 | + getValue: () => (0, import_date6.getDate)(null) | |
| 22310 | + }, | |
| 22311 | + { | |
| 22312 | + id: "yesterday", | |
| 22313 | + label: (0, import_i18n13.__)("Yesterday"), | |
| 22314 | + getValue: () => { | |
| 22315 | + const today = (0, import_date6.getDate)(null); | |
| 22316 | + return subDays(today, 1); | |
| 22317 | + } | |
| 22318 | + }, | |
| 22319 | + { | |
| 22320 | + id: "past-week", | |
| 22321 | + label: (0, import_i18n13.__)("Past week"), | |
| 22322 | + getValue: () => { | |
| 22323 | + const today = (0, import_date6.getDate)(null); | |
| 22324 | + return subDays(today, 7); | |
| 22325 | + } | |
| 22326 | + }, | |
| 22327 | + { | |
| 22328 | + id: "past-month", | |
| 22329 | + label: (0, import_i18n13.__)("Past month"), | |
| 22330 | + getValue: () => { | |
| 22331 | + const today = (0, import_date6.getDate)(null); | |
| 22332 | + return subMonths(today, 1); | |
| 22333 | + } | |
| 22334 | + } | |
| 22335 | +]; | |
| 22336 | +var DATE_RANGE_PRESETS = [ | |
| 22337 | + { | |
| 22338 | + id: "last-7-days", | |
| 22339 | + label: (0, import_i18n13.__)("Last 7 days"), | |
| 22340 | + getValue: () => { | |
| 22341 | + const today = (0, import_date6.getDate)(null); | |
| 22342 | + return [subDays(today, 7), today]; | |
| 22343 | + } | |
| 22344 | + }, | |
| 22345 | + { | |
| 22346 | + id: "last-30-days", | |
| 22347 | + label: (0, import_i18n13.__)("Last 30 days"), | |
| 22348 | + getValue: () => { | |
| 22349 | + const today = (0, import_date6.getDate)(null); | |
| 22350 | + return [subDays(today, 30), today]; | |
| 22351 | + } | |
| 22352 | + }, | |
| 22353 | + { | |
| 22354 | + id: "month-to-date", | |
| 22355 | + label: (0, import_i18n13.__)("Month to date"), | |
| 22356 | + getValue: () => { | |
| 22357 | + const today = (0, import_date6.getDate)(null); | |
| 22358 | + return [startOfMonth(today), today]; | |
| 22359 | + } | |
| 22360 | + }, | |
| 22361 | + { | |
| 22362 | + id: "last-year", | |
| 22363 | + label: (0, import_i18n13.__)("Last year"), | |
| 22364 | + getValue: () => { | |
| 22365 | + const today = (0, import_date6.getDate)(null); | |
| 22366 | + return [subYears(today, 1), today]; | |
| 22367 | + } | |
| 22368 | + }, | |
| 22369 | + { | |
| 22370 | + id: "year-to-date", | |
| 22371 | + label: (0, import_i18n13.__)("Year to date"), | |
| 22372 | + getValue: () => { | |
| 22373 | + const today = (0, import_date6.getDate)(null); | |
| 22374 | + return [startOfYear(today), today]; | |
| 22375 | + } | |
| 22376 | + } | |
| 22377 | +]; | |
| 22378 | +var parseDate2 = (dateString) => { | |
| 22379 | + if (!dateString) { | |
| 22380 | + return null; | |
| 22381 | + } | |
| 22382 | + const parsed = parseISO(dateString); | |
| 22383 | + return isValid(parsed) ? parsed : null; | |
| 22384 | +}; | |
| 22385 | +var formatDate = (date) => { | |
| 22386 | + if (!date) { | |
| 22387 | + return ""; | |
| 22388 | + } | |
| 22389 | + return typeof date === "string" ? date : format(date, "yyyy-MM-dd"); | |
| 22390 | +}; | |
| 22391 | +function ValidatedDateControl({ | |
| 22392 | + field, | |
| 22393 | + validity, | |
| 22394 | + inputRefs, | |
| 22395 | + isTouched, | |
| 22396 | + setIsTouched, | |
| 22397 | + children | |
| 22398 | +}) { | |
| 22399 | + const { isValid: isValid2 } = field; | |
| 22400 | + const [customValidity, setCustomValidity] = (0, import_element61.useState)(void 0); | |
| 22401 | + const validateRefs = (0, import_element61.useCallback)(() => { | |
| 22402 | + const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs]; | |
| 22403 | + for (const ref of refs) { | |
| 22404 | + const input = ref.current; | |
| 22405 | + if (input && !input.validity.valid) { | |
| 22406 | + setCustomValidity({ | |
| 22407 | + type: "invalid", | |
| 22408 | + message: input.validationMessage | |
| 22409 | + }); | |
| 22410 | + return; | |
| 22411 | + } | |
| 22412 | + } | |
| 22413 | + setCustomValidity(void 0); | |
| 22414 | + }, [inputRefs]); | |
| 22415 | + (0, import_element61.useEffect)(() => { | |
| 22416 | + const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs]; | |
| 22417 | + const result = validity ? getCustomValidity(isValid2, validity) : void 0; | |
| 22418 | + for (const ref of refs) { | |
| 22419 | + const input = ref.current; | |
| 22420 | + if (input) { | |
| 22421 | + input.setCustomValidity( | |
| 22422 | + result?.type === "invalid" && result.message ? result.message : "" | |
| 22423 | + ); | |
| 22424 | + } | |
| 22425 | + } | |
| 22426 | + }, [inputRefs, isValid2, validity]); | |
| 22427 | + (0, import_element61.useEffect)(() => { | |
| 22428 | + const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs]; | |
| 22429 | + const handleInvalid = (event) => { | |
| 22430 | + event.preventDefault(); | |
| 22431 | + setIsTouched(true); | |
| 22432 | + }; | |
| 22433 | + for (const ref of refs) { | |
| 22434 | + ref.current?.addEventListener("invalid", handleInvalid); | |
| 22435 | + } | |
| 22436 | + return () => { | |
| 22437 | + for (const ref of refs) { | |
| 22438 | + ref.current?.removeEventListener("invalid", handleInvalid); | |
| 22439 | + } | |
| 22440 | + }; | |
| 22441 | + }, [inputRefs, setIsTouched]); | |
| 22442 | + (0, import_element61.useEffect)(() => { | |
| 22443 | + if (!isTouched) { | |
| 22444 | + return; | |
| 22445 | + } | |
| 22446 | + const result = validity ? getCustomValidity(isValid2, validity) : void 0; | |
| 22447 | + if (result) { | |
| 22448 | + setCustomValidity(result); | |
| 22449 | + } else { | |
| 22450 | + validateRefs(); | |
| 22451 | + } | |
| 22452 | + }, [isTouched, isValid2, validity, validateRefs]); | |
| 22453 | + (0, import_element61.useEffect)(() => { | |
| 22454 | + if (isTouched && customValidity?.message) { | |
| 22455 | + speak3(customValidity.message); | |
| 22456 | + } | |
| 22457 | + }, [isTouched, customValidity?.message]); | |
| 22458 | + const onBlur = (event) => { | |
| 22459 | + if (isTouched) { | |
| 22460 | + return; | |
| 22461 | + } | |
| 22462 | + if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) { | |
| 22463 | + setIsTouched(true); | |
| 22464 | + } | |
| 22465 | + }; | |
| 22466 | + return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Stack, { direction: "column", gap: "sm", onBlur, children: [ | |
| 22467 | + children, | |
| 22468 | + customValidity && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( | |
| 22469 | + ValidityIndicator, | |
| 22470 | + { | |
| 22471 | + type: customValidity.type, | |
| 22472 | + message: customValidity.message | |
| 22473 | + } | |
| 22474 | + ) | |
| 22475 | + ] }); | |
| 22476 | +} | |
| 22477 | +function CalendarDateControl({ | |
| 22478 | + data, | |
| 22479 | + field, | |
| 22480 | + onChange, | |
| 22481 | + hideLabelFromVision, | |
| 22482 | + markWhenOptional, | |
| 22483 | + validity | |
| 22484 | +}) { | |
| 22485 | + const { | |
| 22486 | + id, | |
| 22487 | + label, | |
| 22488 | + description, | |
| 22489 | + setValue, | |
| 22490 | + getValue, | |
| 22491 | + isValid: isValid2, | |
| 22492 | + format: fieldFormat | |
| 22493 | + } = field; | |
| 22494 | + const disabled2 = field.isDisabled({ item: data, field }); | |
| 22495 | + const [selectedPresetId, setSelectedPresetId] = (0, import_element61.useState)( | |
| 22496 | + null | |
| 22497 | + ); | |
| 22498 | + const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date6.getSettings)().l10n.startOfWeek; | |
| 22499 | + const locale = getCalendarLocale((0, import_date6.getSettings)().l10n.locale); | |
| 22500 | + const fieldValue = getValue({ item: data }); | |
| 22501 | + const value = typeof fieldValue === "string" ? fieldValue : void 0; | |
| 22502 | + const [calendarMonth, setCalendarMonth] = (0, import_element61.useState)(() => { | |
| 22503 | + const parsedDate = parseDate2(value); | |
| 22504 | + return parsedDate || /* @__PURE__ */ new Date(); | |
| 22505 | + }); | |
| 22506 | + (0, import_element61.useEffect)(() => { | |
| 22507 | + const parsedDate = parseDate2(value); | |
| 22508 | + if (parsedDate) { | |
| 22509 | + setCalendarMonth( | |
| 22510 | + (currentMonth) => isSameMonth(parsedDate, currentMonth) ? currentMonth : parsedDate | |
| 22511 | + ); | |
| 22512 | + } | |
| 22513 | + }, [value]); | |
| 22514 | + const [isTouched, setIsTouched] = (0, import_element61.useState)(false); | |
| 22515 | + const validityTargetRef = (0, import_element61.useRef)(null); | |
| 22516 | + const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDate2); | |
| 22517 | + const onChangeCallback = (0, import_element61.useCallback)( | |
| 22518 | + (newValue) => onChange(setValue({ item: data, value: newValue })), | |
| 22519 | + [data, onChange, setValue] | |
| 22520 | + ); | |
| 22521 | + const onSelectDate = (0, import_element61.useCallback)( | |
| 22522 | + (newDate) => { | |
| 22523 | + const dateValue = newDate ? formatDate(newDate) : void 0; | |
| 22524 | + onChangeCallback(dateValue); | |
| 22525 | + setSelectedPresetId(null); | |
| 22526 | + setIsTouched(true); | |
| 22527 | + }, | |
| 22528 | + [onChangeCallback] | |
| 22529 | + ); | |
| 22530 | + const handlePresetClick = (0, import_element61.useCallback)( | |
| 22531 | + (preset) => { | |
| 22532 | + const presetDate = preset.getValue(); | |
| 22533 | + const dateValue = formatDate(presetDate); | |
| 22534 | + setCalendarMonth(presetDate); | |
| 22535 | + onChangeCallback(dateValue); | |
| 22536 | + setSelectedPresetId(preset.id); | |
| 22537 | + setIsTouched(true); | |
| 22538 | + }, | |
| 22539 | + [onChangeCallback] | |
| 22540 | + ); | |
| 22541 | + const handleManualDateChange = (0, import_element61.useCallback)( | |
| 22542 | + (newValue) => { | |
| 22543 | + onChangeCallback(newValue); | |
| 22544 | + if (newValue) { | |
| 22545 | + const parsedDate = parseDate2(newValue); | |
| 22546 | + if (parsedDate) { | |
| 22547 | + setCalendarMonth(parsedDate); | |
| 22548 | + } | |
| 22549 | + } | |
| 22550 | + setSelectedPresetId(null); | |
| 22551 | + setIsTouched(true); | |
| 22552 | + }, | |
| 22553 | + [onChangeCallback] | |
| 22554 | + ); | |
| 22555 | + let displayLabel = label; | |
| 22556 | + if (isValid2?.required && !markWhenOptional) { | |
| 22557 | + displayLabel = `${label} (${(0, import_i18n13.__)("Required")})`; | |
| 22558 | + } else if (!isValid2?.required && markWhenOptional) { | |
| 22559 | + displayLabel = `${label} (${(0, import_i18n13.__)("Optional")})`; | |
| 22560 | + } | |
| 22561 | + return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( | |
| 22562 | + ValidatedDateControl, | |
| 22563 | + { | |
| 22564 | + field, | |
| 22565 | + validity, | |
| 22566 | + inputRefs: validityTargetRef, | |
| 22567 | + isTouched, | |
| 22568 | + setIsTouched, | |
| 22569 | + children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( | |
| 22570 | + import_components13.BaseControl, | |
| 22571 | + { | |
| 22572 | + id, | |
| 22573 | + className: "dataviews-controls__date", | |
| 22574 | + label: displayLabel, | |
| 22575 | + help: description, | |
| 22576 | + hideLabelFromVision, | |
| 22577 | + children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Stack, { direction: "column", gap: "lg", children: [ | |
| 22578 | + /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)( | |
| 22579 | + Stack, | |
| 22580 | + { | |
| 22581 | + direction: "row", | |
| 22582 | + gap: "sm", | |
| 22583 | + wrap: "wrap", | |
| 22584 | + justify: "flex-start", | |
| 22585 | + children: [ | |
| 22586 | + DATE_PRESETS.map((preset) => { | |
| 22587 | + const isSelected = selectedPresetId === preset.id; | |
| 22588 | + return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( | |
| 22589 | + import_components13.Button, | |
| 22590 | + { | |
| 22591 | + className: "dataviews-controls__date-preset", | |
| 22592 | + variant: "tertiary", | |
| 22593 | + isPressed: isSelected, | |
| 22594 | + size: "small", | |
| 22595 | + disabled: disabled2, | |
| 22596 | + accessibleWhenDisabled: true, | |
| 22597 | + onClick: () => handlePresetClick(preset), | |
| 22598 | + children: preset.label | |
| 22599 | + }, | |
| 22600 | + preset.id | |
| 22601 | + ); | |
| 22602 | + }), | |
| 22603 | + /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( | |
| 22604 | + import_components13.Button, | |
| 22605 | + { | |
| 22606 | + className: "dataviews-controls__date-preset", | |
| 22607 | + variant: "tertiary", | |
| 22608 | + isPressed: !selectedPresetId, | |
| 22609 | + size: "small", | |
| 22610 | + disabled: !!selectedPresetId || disabled2, | |
| 22611 | + accessibleWhenDisabled: true, | |
| 22612 | + children: (0, import_i18n13.__)("Custom") | |
| 22613 | + } | |
| 22614 | + ) | |
| 22615 | + ] | |
| 22616 | + } | |
| 22617 | + ), | |
| 22618 | + /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( | |
| 22619 | + import_components13.__experimentalInputControl, | |
| 22620 | + { | |
| 22621 | + ref: validityTargetRef, | |
| 22622 | + type: "date", | |
| 22623 | + label: (0, import_i18n13.__)("Date"), | |
| 22624 | + hideLabelFromVision: true, | |
| 22625 | + value, | |
| 22626 | + onChange: handleManualDateChange, | |
| 22627 | + required: !!field.isValid?.required, | |
| 22628 | + disabled: disabled2, | |
| 22629 | + min: minConstraint, | |
| 22630 | + max: maxConstraint | |
| 22631 | + } | |
| 22632 | + ), | |
| 22633 | + /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( | |
| 22634 | + Calendar, | |
| 22635 | + { | |
| 22636 | + style: { width: "100%" }, | |
| 22637 | + value: value ? parseDate2(value) : null, | |
| 22638 | + onValueChange: onSelectDate, | |
| 22639 | + month: calendarMonth, | |
| 22640 | + onMonthChange: setCalendarMonth, | |
| 22641 | + locale, | |
| 22642 | + dir: (0, import_i18n13.isRTL)() ? "rtl" : "ltr", | |
| 22643 | + weekStartsOn, | |
| 22644 | + disabled: disabled2 || disabledMatchers, | |
| 22645 | + disableNavigation: disabled2 | |
| 22646 | + } | |
| 22647 | + ) | |
| 22648 | + ] }) | |
| 22649 | + } | |
| 22650 | + ) | |
| 22651 | + } | |
| 22652 | + ); | |
| 22653 | +} | |
| 22654 | +function CalendarDateRangeControl({ | |
| 22655 | + data, | |
| 22656 | + field, | |
| 22657 | + onChange, | |
| 22658 | + hideLabelFromVision, | |
| 22659 | + markWhenOptional, | |
| 22660 | + validity | |
| 22661 | +}) { | |
| 22662 | + const { | |
| 22663 | + id, | |
| 22664 | + label, | |
| 22665 | + description, | |
| 22666 | + getValue, | |
| 22667 | + setValue, | |
| 22668 | + isValid: isValid2, | |
| 22669 | + format: fieldFormat | |
| 22670 | + } = field; | |
| 22671 | + const disabled2 = field.isDisabled({ item: data, field }); | |
| 22672 | + let value; | |
| 22673 | + const fieldValue = getValue({ item: data }); | |
| 22674 | + if (Array.isArray(fieldValue) && fieldValue.length === 2 && fieldValue.every((date) => typeof date === "string")) { | |
| 22675 | + value = fieldValue; | |
| 22676 | + } | |
| 22677 | + const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date6.getSettings)().l10n.startOfWeek; | |
| 22678 | + const locale = getCalendarLocale((0, import_date6.getSettings)().l10n.locale); | |
| 22679 | + const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDate2); | |
| 22680 | + const onChangeCallback = (0, import_element61.useCallback)( | |
| 22681 | + (newValue) => { | |
| 22682 | + onChange( | |
| 22683 | + setValue({ | |
| 22684 | + item: data, | |
| 22685 | + value: newValue | |
| 22686 | + }) | |
| 22687 | + ); | |
| 22688 | + }, | |
| 22689 | + [data, onChange, setValue] | |
| 22690 | + ); | |
| 22691 | + const [selectedPresetId, setSelectedPresetId] = (0, import_element61.useState)( | |
| 22692 | + null | |
| 22693 | + ); | |
| 22694 | + const selectedRange = (0, import_element61.useMemo)(() => { | |
| 22695 | + if (!value) { | |
| 22696 | + return null; | |
| 22697 | + } | |
| 22698 | + const [from, to] = value; | |
| 22699 | + return { | |
| 22700 | + from: parseDate2(from) || void 0, | |
| 22701 | + to: parseDate2(to) || void 0 | |
| 22702 | + }; | |
| 22703 | + }, [value]); | |
| 22704 | + const [calendarMonth, setCalendarMonth] = (0, import_element61.useState)(() => { | |
| 22705 | + return selectedRange?.from || /* @__PURE__ */ new Date(); | |
| 22706 | + }); | |
| 22707 | + const [fromValue, toValue] = value ?? []; | |
| 22708 | + (0, import_element61.useEffect)(() => { | |
| 22709 | + setCalendarMonth((currentMonth) => { | |
| 22710 | + const from = parseDate2(fromValue); | |
| 22711 | + const to = parseDate2(toValue); | |
| 22712 | + const targetMonth = from ?? to; | |
| 22713 | + const isRangeVisible = from && to ? areIntervalsOverlapping( | |
| 22714 | + { start: from, end: to }, | |
| 22715 | + { | |
| 22716 | + start: startOfMonth(currentMonth), | |
| 22717 | + end: endOfMonth(currentMonth) | |
| 22718 | + }, | |
| 22719 | + { inclusive: true } | |
| 22720 | + ) : [from, to].some( | |
| 22721 | + (date) => date && isSameMonth(date, currentMonth) | |
| 22722 | + ); | |
| 22723 | + return targetMonth && !isRangeVisible ? targetMonth : currentMonth; | |
| 22724 | + }); | |
| 22725 | + }, [fromValue, toValue]); | |
| 22726 | + const [isTouched, setIsTouched] = (0, import_element61.useState)(false); | |
| 22727 | + const fromInputRef = (0, import_element61.useRef)(null); | |
| 22728 | + const toInputRef = (0, import_element61.useRef)(null); | |
| 22729 | + const updateDateRange = (0, import_element61.useCallback)( | |
| 22730 | + (fromDate, toDate2) => { | |
| 22731 | + if (!fromDate && !toDate2) { | |
| 22732 | + onChangeCallback(void 0); | |
| 22733 | + return; | |
| 22734 | + } | |
| 22735 | + onChangeCallback([ | |
| 22736 | + formatDate(fromDate), | |
| 22737 | + formatDate(toDate2) | |
| 22738 | + ]); | |
| 22739 | + }, | |
| 22740 | + [onChangeCallback] | |
| 22741 | + ); | |
| 22742 | + const onSelectCalendarRange = (0, import_element61.useCallback)( | |
| 22743 | + (newRange) => { | |
| 22744 | + updateDateRange(newRange?.from, newRange?.to); | |
| 22745 | + setSelectedPresetId(null); | |
| 22746 | + setIsTouched(true); | |
| 22747 | + }, | |
| 22748 | + [updateDateRange] | |
| 22749 | + ); | |
| 22750 | + const handlePresetClick = (0, import_element61.useCallback)( | |
| 22751 | + (preset) => { | |
| 22752 | + const [startDate, endDate] = preset.getValue(); | |
| 22753 | + setCalendarMonth(startDate); | |
| 22754 | + updateDateRange(startDate, endDate); | |
| 22755 | + setSelectedPresetId(preset.id); | |
| 22756 | + setIsTouched(true); | |
| 22757 | + }, | |
| 22758 | + [updateDateRange] | |
| 22759 | + ); | |
| 22760 | + const handleManualDateChange = (0, import_element61.useCallback)( | |
| 22761 | + (fromOrTo, newValue) => { | |
| 22762 | + const [currentFrom, currentTo] = value || [ | |
| 22763 | + void 0, | |
| 22764 | + void 0 | |
| 22765 | + ]; | |
| 22766 | + const updatedFrom = fromOrTo === "from" ? newValue : currentFrom; | |
| 22767 | + const updatedTo = fromOrTo === "to" ? newValue : currentTo; | |
| 22768 | + updateDateRange(updatedFrom, updatedTo); | |
| 22769 | + if (newValue) { | |
| 22770 | + const parsedDate = parseDate2(newValue); | |
| 22771 | + if (parsedDate) { | |
| 22772 | + setCalendarMonth(parsedDate); | |
| 22773 | + } | |
| 22774 | + } | |
| 22775 | + setSelectedPresetId(null); | |
| 22776 | + setIsTouched(true); | |
| 22777 | + }, | |
| 22778 | + [value, updateDateRange] | |
| 22779 | + ); | |
| 22780 | + let displayLabel = label; | |
| 22781 | + if (field.isValid?.required && !markWhenOptional) { | |
| 22782 | + displayLabel = `${label} (${(0, import_i18n13.__)("Required")})`; | |
| 22783 | + } else if (!field.isValid?.required && markWhenOptional) { | |
| 22784 | + displayLabel = `${label} (${(0, import_i18n13.__)("Optional")})`; | |
| 22785 | + } | |
| 22786 | + return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( | |
| 22787 | + ValidatedDateControl, | |
| 22788 | + { | |
| 22789 | + field, | |
| 22790 | + validity, | |
| 22791 | + inputRefs: [fromInputRef, toInputRef], | |
| 22792 | + isTouched, | |
| 22793 | + setIsTouched, | |
| 22794 | + children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( | |
| 22795 | + import_components13.BaseControl, | |
| 22796 | + { | |
| 22797 | + id, | |
| 22798 | + className: "dataviews-controls__date", | |
| 22799 | + label: displayLabel, | |
| 22800 | + help: description, | |
| 22801 | + hideLabelFromVision, | |
| 22802 | + children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Stack, { direction: "column", gap: "lg", children: [ | |
| 22803 | + /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)( | |
| 22804 | + Stack, | |
| 22805 | + { | |
| 22806 | + direction: "row", | |
| 22807 | + gap: "sm", | |
| 22808 | + wrap: "wrap", | |
| 22809 | + justify: "flex-start", | |
| 22810 | + children: [ | |
| 22811 | + DATE_RANGE_PRESETS.map((preset) => { | |
| 22812 | + const isSelected = selectedPresetId === preset.id; | |
| 22813 | + return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( | |
| 22814 | + import_components13.Button, | |
| 22815 | + { | |
| 22816 | + className: "dataviews-controls__date-preset", | |
| 22817 | + variant: "tertiary", | |
| 22818 | + isPressed: isSelected, | |
| 22819 | + size: "small", | |
| 22820 | + disabled: disabled2, | |
| 22821 | + accessibleWhenDisabled: true, | |
| 22822 | + onClick: () => handlePresetClick(preset), | |
| 22823 | + children: preset.label | |
| 22824 | + }, | |
| 22825 | + preset.id | |
| 22826 | + ); | |
| 22827 | + }), | |
| 22828 | + /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( | |
| 22829 | + import_components13.Button, | |
| 22830 | + { | |
| 22831 | + className: "dataviews-controls__date-preset", | |
| 22832 | + variant: "tertiary", | |
| 22833 | + isPressed: !selectedPresetId, | |
| 22834 | + size: "small", | |
| 22835 | + accessibleWhenDisabled: true, | |
| 22836 | + disabled: !!selectedPresetId || disabled2, | |
| 22837 | + children: (0, import_i18n13.__)("Custom") | |
| 22838 | + } | |
| 22839 | + ) | |
| 22840 | + ] | |
| 22841 | + } | |
| 22842 | + ), | |
| 22843 | + /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)( | |
| 22844 | + Stack, | |
| 22845 | + { | |
| 22846 | + direction: "row", | |
| 22847 | + gap: "sm", | |
| 22848 | + justify: "space-between", | |
| 22849 | + className: "dataviews-controls__date-range-inputs", | |
| 22850 | + children: [ | |
| 22851 | + /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( | |
| 22852 | + import_components13.__experimentalInputControl, | |
| 22853 | + { | |
| 22854 | + ref: fromInputRef, | |
| 22855 | + type: "date", | |
| 22856 | + label: (0, import_i18n13.__)("From"), | |
| 22857 | + hideLabelFromVision: true, | |
| 22858 | + value: value?.[0], | |
| 22859 | + onChange: (newValue) => handleManualDateChange("from", newValue), | |
| 22860 | + required: !!field.isValid?.required, | |
| 22861 | + disabled: disabled2, | |
| 22862 | + min: minConstraint, | |
| 22863 | + max: maxConstraint | |
| 22864 | + } | |
| 22865 | + ), | |
| 22866 | + /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( | |
| 22867 | + import_components13.__experimentalInputControl, | |
| 22868 | + { | |
| 22869 | + ref: toInputRef, | |
| 22870 | + type: "date", | |
| 22871 | + label: (0, import_i18n13.__)("To"), | |
| 22872 | + hideLabelFromVision: true, | |
| 22873 | + value: value?.[1], | |
| 22874 | + onChange: (newValue) => handleManualDateChange("to", newValue), | |
| 22875 | + required: !!field.isValid?.required, | |
| 22876 | + disabled: disabled2, | |
| 22877 | + min: minConstraint, | |
| 22878 | + max: maxConstraint | |
| 22879 | + } | |
| 22880 | + ) | |
| 22881 | + ] | |
| 22882 | + } | |
| 22883 | + ), | |
| 22884 | + /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( | |
| 22885 | + RangeCalendar, | |
| 22886 | + { | |
| 22887 | + style: { width: "100%" }, | |
| 22888 | + value: selectedRange, | |
| 22889 | + onValueChange: onSelectCalendarRange, | |
| 22890 | + month: calendarMonth, | |
| 22891 | + onMonthChange: setCalendarMonth, | |
| 22892 | + locale, | |
| 22893 | + dir: (0, import_i18n13.isRTL)() ? "rtl" : "ltr", | |
| 22894 | + weekStartsOn, | |
| 22895 | + disabled: disabled2 || disabledMatchers | |
| 22896 | + } | |
| 22897 | + ) | |
| 22898 | + ] }) | |
| 22899 | + } | |
| 22900 | + ) | |
| 22901 | + } | |
| 22902 | + ); | |
| 22903 | +} | |
| 22904 | +function DateControl({ | |
| 22905 | + data, | |
| 22906 | + field, | |
| 22907 | + onChange, | |
| 22908 | + hideLabelFromVision, | |
| 22909 | + markWhenOptional, | |
| 22910 | + operator, | |
| 22911 | + validity | |
| 22912 | +}) { | |
| 22913 | + if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) { | |
| 22914 | + return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( | |
| 22915 | + RelativeDateControl, | |
| 22916 | + { | |
| 22917 | + className: "dataviews-controls__date", | |
| 22918 | + data, | |
| 22919 | + field, | |
| 22920 | + onChange, | |
| 22921 | + hideLabelFromVision, | |
| 22922 | + operator | |
| 22923 | + } | |
| 22924 | + ); | |
| 22925 | + } | |
| 22926 | + if (operator === OPERATOR_BETWEEN) { | |
| 22927 | + return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( | |
| 22928 | + CalendarDateRangeControl, | |
| 22929 | + { | |
| 22930 | + data, | |
| 22931 | + field, | |
| 22932 | + onChange, | |
| 22933 | + hideLabelFromVision, | |
| 22934 | + markWhenOptional, | |
| 22935 | + validity | |
| 22936 | + } | |
| 22937 | + ); | |
| 22938 | + } | |
| 22939 | + return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( | |
| 22940 | + CalendarDateControl, | |
| 22941 | + { | |
| 22942 | + data, | |
| 22943 | + field, | |
| 22944 | + onChange, | |
| 22945 | + hideLabelFromVision, | |
| 22946 | + markWhenOptional, | |
| 22947 | + validity | |
| 22948 | + } | |
| 22949 | + ); | |
| 22950 | +} | |
| 22951 | + | |
| 22952 | +// packages/dataviews/build-module/components/dataform-controls/select.mjs | |
| 22953 | +var import_components14 = __toESM(require_components(), 1); | |
| 22954 | +var import_element62 = __toESM(require_element(), 1); | |
| 22955 | +var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1); | |
| 22956 | +function Select2({ | |
| 22957 | + data, | |
| 22958 | + field, | |
| 22959 | + onChange, | |
| 22960 | + hideLabelFromVision, | |
| 22961 | + markWhenOptional, | |
| 22962 | + validity | |
| 22963 | +}) { | |
| 22964 | + const { type, label, description, getValue, setValue, isValid: isValid2 } = field; | |
| 22965 | + const disabled2 = field.isDisabled({ item: data, field }); | |
| 22966 | + const isMultiple = type === "array"; | |
| 22967 | + const value = getValue({ item: data }) ?? (isMultiple ? [] : ""); | |
| 22968 | + const onChangeControl = (0, import_element62.useCallback)( | |
| 22969 | + (newValue) => onChange(setValue({ item: data, value: newValue })), | |
| 22970 | + [data, onChange, setValue] | |
| 22971 | + ); | |
| 22972 | + const { elements, isLoading } = useElements({ | |
| 22973 | + elements: field.elements, | |
| 22974 | + getElements: field.getElements | |
| 22975 | + }); | |
| 22976 | + if (isLoading) { | |
| 22977 | + return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_components14.Spinner, {}); | |
| 22978 | + } | |
| 22979 | + return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)( | |
| 22980 | + ValidatedSelectControl, | |
| 22981 | + { | |
| 22982 | + required: !!field.isValid?.required, | |
| 22983 | + markWhenOptional, | |
| 22984 | + customValidity: getCustomValidity(isValid2, validity), | |
| 22985 | + label, | |
| 22986 | + value, | |
| 22987 | + help: description, | |
| 22988 | + options: elements, | |
| 22989 | + onChange: onChangeControl, | |
| 22990 | + hideLabelFromVision, | |
| 22991 | + multiple: isMultiple, | |
| 22992 | + disabled: disabled2 | |
| 22993 | + } | |
| 22994 | + ); | |
| 22995 | +} | |
| 22996 | + | |
| 22997 | +// packages/dataviews/build-module/components/dataform-controls/adaptive-select.mjs | |
| 22998 | +var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1); | |
| 22999 | +var ELEMENTS_THRESHOLD = 10; | |
| 23000 | +function AdaptiveSelect(props) { | |
| 23001 | + const { field } = props; | |
| 23002 | + const { elements } = useElements({ | |
| 23003 | + elements: field.elements, | |
| 23004 | + getElements: field.getElements | |
| 23005 | + }); | |
| 23006 | + if (elements.length >= ELEMENTS_THRESHOLD) { | |
| 23007 | + return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Combobox, { ...props }); | |
| 23008 | + } | |
| 23009 | + return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Select2, { ...props }); | |
| 23010 | +} | |
| 23011 | + | |
| 23012 | +// packages/dataviews/build-module/components/dataform-controls/utils/validated-input.mjs | |
| 23013 | +var import_element63 = __toESM(require_element(), 1); | |
| 23014 | +var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1); | |
| 23015 | +function ValidatedText({ | |
| 23016 | + data, | |
| 23017 | + field, | |
| 23018 | + onChange, | |
| 23019 | + hideLabelFromVision, | |
| 23020 | + markWhenOptional, | |
| 23021 | + type, | |
| 23022 | + prefix, | |
| 23023 | + suffix, | |
| 23024 | + validity | |
| 23025 | +}) { | |
| 23026 | + const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field; | |
| 23027 | + const value = getValue({ item: data }); | |
| 23028 | + const disabled2 = field.isDisabled({ item: data, field }); | |
| 23029 | + const onValueChangeControl = (0, import_element63.useCallback)( | |
| 23030 | + (newValue) => onChange( | |
| 23031 | + setValue({ | |
| 23032 | + item: data, | |
| 23033 | + value: newValue | |
| 23034 | + }) | |
| 23035 | + ), | |
| 23036 | + [data, setValue, onChange] | |
| 23037 | + ); | |
| 23038 | + return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)( | |
| 23039 | + ValidatedInputControl, | |
| 23040 | + { | |
| 23041 | + required: !!isValid2.required, | |
| 23042 | + markWhenOptional, | |
| 23043 | + customValidity: getCustomValidity(isValid2, validity), | |
| 23044 | + label, | |
| 23045 | + placeholder, | |
| 23046 | + value: value ?? "", | |
| 23047 | + description: typeof description === "string" ? description : void 0, | |
| 23048 | + details: typeof description === "string" ? void 0 : description, | |
| 23049 | + onValueChange: onValueChangeControl, | |
| 23050 | + hideLabelFromVision, | |
| 23051 | + type, | |
| 23052 | + prefix, | |
| 23053 | + suffix, | |
| 23054 | + disabled: disabled2, | |
| 23055 | + pattern: isValid2.pattern ? isValid2.pattern.constraint : void 0, | |
| 23056 | + minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0, | |
| 23057 | + maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0 | |
| 23058 | + } | |
| 23059 | + ); | |
| 23060 | +} | |
| 23061 | + | |
| 23062 | +// packages/dataviews/build-module/components/dataform-controls/email.mjs | |
| 23063 | +var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1); | |
| 23064 | +function Email({ | |
| 23065 | + data, | |
| 23066 | + field, | |
| 23067 | + onChange, | |
| 23068 | + hideLabelFromVision, | |
| 23069 | + markWhenOptional, | |
| 23070 | + validity | |
| 23071 | +}) { | |
| 23072 | + return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)( | |
| 23073 | + ValidatedText, | |
| 23074 | + { | |
| 23075 | + ...{ | |
| 23076 | + data, | |
| 23077 | + field, | |
| 23078 | + onChange, | |
| 23079 | + hideLabelFromVision, | |
| 23080 | + markWhenOptional, | |
| 23081 | + validity, | |
| 23082 | + type: "email", | |
| 23083 | + prefix: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Icon, { icon: envelope_default }) }) | |
| 23084 | + } | |
| 23085 | + } | |
| 23086 | + ); | |
| 23087 | +} | |
| 23088 | + | |
| 23089 | +// packages/dataviews/build-module/components/dataform-controls/telephone.mjs | |
| 23090 | +var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1); | |
| 23091 | +function Telephone({ | |
| 23092 | + data, | |
| 23093 | + field, | |
| 23094 | + onChange, | |
| 23095 | + hideLabelFromVision, | |
| 23096 | + markWhenOptional, | |
| 23097 | + validity | |
| 23098 | +}) { | |
| 23099 | + return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)( | |
| 23100 | + ValidatedText, | |
| 23101 | + { | |
| 23102 | + ...{ | |
| 23103 | + data, | |
| 23104 | + field, | |
| 23105 | + onChange, | |
| 23106 | + hideLabelFromVision, | |
| 23107 | + markWhenOptional, | |
| 23108 | + validity, | |
| 23109 | + type: "tel", | |
| 23110 | + prefix: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Icon, { icon: mobile_default }) }) | |
| 23111 | + } | |
| 23112 | + } | |
| 23113 | + ); | |
| 23114 | +} | |
| 23115 | + | |
| 23116 | +// packages/dataviews/build-module/components/dataform-controls/url.mjs | |
| 23117 | +var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1); | |
| 23118 | +function Url({ | |
| 23119 | + data, | |
| 23120 | + field, | |
| 23121 | + onChange, | |
| 23122 | + hideLabelFromVision, | |
| 23123 | + markWhenOptional, | |
| 23124 | + validity | |
| 23125 | +}) { | |
| 23126 | + return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)( | |
| 23127 | + ValidatedText, | |
| 23128 | + { | |
| 23129 | + ...{ | |
| 23130 | + data, | |
| 23131 | + field, | |
| 23132 | + onChange, | |
| 23133 | + hideLabelFromVision, | |
| 23134 | + markWhenOptional, | |
| 23135 | + validity, | |
| 23136 | + type: "url", | |
| 23137 | + prefix: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Icon, { icon: link_default }) }) | |
| 23138 | + } | |
| 23139 | + } | |
| 23140 | + ); | |
| 23141 | +} | |
| 23142 | + | |
| 23143 | +// packages/dataviews/build-module/components/dataform-controls/utils/validated-number.mjs | |
| 23144 | +var import_components15 = __toESM(require_components(), 1); | |
| 23145 | +var import_element64 = __toESM(require_element(), 1); | |
| 23146 | +var import_i18n14 = __toESM(require_i18n(), 1); | |
| 23147 | +var import_jsx_runtime78 = __toESM(require_jsx_runtime(), 1); | |
| 23148 | +function toNumberOrEmpty(value) { | |
| 23149 | + if (value === "" || value === void 0) { | |
| 23150 | + return ""; | |
| 23151 | + } | |
| 23152 | + const number = Number(value); | |
| 23153 | + return Number.isFinite(number) ? number : ""; | |
| 23154 | +} | |
| 23155 | +function BetweenControls({ | |
| 23156 | + value, | |
| 23157 | + onChange, | |
| 23158 | + hideLabelFromVision, | |
| 23159 | + step | |
| 23160 | +}) { | |
| 23161 | + const [min3 = "", max3 = ""] = value; | |
| 23162 | + const onChangeMin = (0, import_element64.useCallback)( | |
| 23163 | + (newValue) => onChange([toNumberOrEmpty(newValue), max3]), | |
| 23164 | + [onChange, max3] | |
| 23165 | + ); | |
| 23166 | + const onChangeMax = (0, import_element64.useCallback)( | |
| 23167 | + (newValue) => onChange([min3, toNumberOrEmpty(newValue)]), | |
| 23168 | + [onChange, min3] | |
| 23169 | + ); | |
| 23170 | + return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)( | |
| 23171 | + import_components15.BaseControl, | |
| 23172 | + { | |
| 23173 | + help: (0, import_i18n14.__)("The max. value must be greater than the min. value."), | |
| 23174 | + children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_components15.Flex, { direction: "row", gap: 4, children: [ | |
| 23175 | + /* @__PURE__ */ (0, import_jsx_runtime78.jsx)( | |
| 23176 | + import_components15.__experimentalNumberControl, | |
| 23177 | + { | |
| 23178 | + label: (0, import_i18n14.__)("Min."), | |
| 23179 | + value: min3, | |
| 23180 | + max: max3 ? Number(max3) - step : void 0, | |
| 23181 | + onChange: onChangeMin, | |
| 23182 | + hideLabelFromVision, | |
| 23183 | + step | |
| 23184 | + } | |
| 23185 | + ), | |
| 23186 | + /* @__PURE__ */ (0, import_jsx_runtime78.jsx)( | |
| 23187 | + import_components15.__experimentalNumberControl, | |
| 23188 | + { | |
| 23189 | + label: (0, import_i18n14.__)("Max."), | |
| 23190 | + value: max3, | |
| 23191 | + min: min3 ? Number(min3) + step : void 0, | |
| 23192 | + onChange: onChangeMax, | |
| 23193 | + hideLabelFromVision, | |
| 23194 | + step | |
| 23195 | + } | |
| 23196 | + ) | |
| 23197 | + ] }) | |
| 23198 | + } | |
| 23199 | + ); | |
| 23200 | +} | |
| 23201 | +function ValidatedNumber({ | |
| 23202 | + data, | |
| 23203 | + field, | |
| 23204 | + onChange, | |
| 23205 | + hideLabelFromVision, | |
| 23206 | + markWhenOptional, | |
| 23207 | + operator, | |
| 23208 | + validity | |
| 23209 | +}) { | |
| 23210 | + const decimals = field.format?.decimals ?? 0; | |
| 23211 | + const step = Math.pow(10, Math.abs(decimals) * -1); | |
| 23212 | + const { label, description, getValue, setValue, isValid: isValid2 } = field; | |
| 23213 | + const value = getValue({ item: data }) ?? ""; | |
| 23214 | + const disabled2 = field.isDisabled({ item: data, field }); | |
| 23215 | + const onChangeControl = (0, import_element64.useCallback)( | |
| 23216 | + (newValue) => { | |
| 23217 | + onChange( | |
| 23218 | + setValue({ | |
| 23219 | + item: data, | |
| 23220 | + // Do not convert an empty string or undefined to a number, | |
| 23221 | + // otherwise there's a mismatch between the UI control (empty) | |
| 23222 | + // and the data relied by onChange (0). | |
| 23223 | + value: ["", void 0].includes(newValue) ? void 0 : Number(newValue) | |
| 23224 | + }) | |
| 23225 | + ); | |
| 23226 | + }, | |
| 23227 | + [data, onChange, setValue] | |
| 23228 | + ); | |
| 23229 | + const onChangeBetweenControls = (0, import_element64.useCallback)( | |
| 23230 | + (newValue) => { | |
| 23231 | + onChange( | |
| 23232 | + setValue({ | |
| 23233 | + item: data, | |
| 23234 | + value: newValue | |
| 23235 | + }) | |
| 23236 | + ); | |
| 23237 | + }, | |
| 23238 | + [data, onChange, setValue] | |
| 23239 | + ); | |
| 23240 | + if (operator === OPERATOR_BETWEEN) { | |
| 23241 | + let valueBetween = ["", ""]; | |
| 23242 | + if (Array.isArray(value) && value.length === 2 && value.every( | |
| 23243 | + (element) => typeof element === "number" || element === "" | |
| 23244 | + )) { | |
| 23245 | + valueBetween = value; | |
| 23246 | + } | |
| 23247 | + return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)( | |
| 23248 | + BetweenControls, | |
| 23249 | + { | |
| 23250 | + value: valueBetween, | |
| 23251 | + onChange: onChangeBetweenControls, | |
| 23252 | + hideLabelFromVision, | |
| 23253 | + step | |
| 23254 | + } | |
| 23255 | + ); | |
| 23256 | + } | |
| 23257 | + return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)( | |
| 23258 | + ValidatedNumberControl, | |
| 23259 | + { | |
| 23260 | + required: !!isValid2.required, | |
| 23261 | + markWhenOptional, | |
| 23262 | + customValidity: getCustomValidity(isValid2, validity), | |
| 23263 | + label, | |
| 23264 | + help: description, | |
| 23265 | + value, | |
| 23266 | + onChange: onChangeControl, | |
| 23267 | + hideLabelFromVision, | |
| 23268 | + step, | |
| 23269 | + min: typeof isValid2.min?.constraint === "number" ? isValid2.min.constraint : void 0, | |
| 23270 | + max: typeof isValid2.max?.constraint === "number" ? isValid2.max.constraint : void 0, | |
| 23271 | + disabled: disabled2 | |
| 23272 | + } | |
| 23273 | + ); | |
| 23274 | +} | |
| 23275 | + | |
| 23276 | +// packages/dataviews/build-module/components/dataform-controls/integer.mjs | |
| 23277 | +var import_jsx_runtime79 = __toESM(require_jsx_runtime(), 1); | |
| 23278 | +function Integer(props) { | |
| 23279 | + return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(ValidatedNumber, { ...props }); | |
| 23280 | +} | |
| 23281 | + | |
| 23282 | +// packages/dataviews/build-module/components/dataform-controls/number.mjs | |
| 23283 | +var import_jsx_runtime80 = __toESM(require_jsx_runtime(), 1); | |
| 23284 | +function Number2(props) { | |
| 23285 | + return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ValidatedNumber, { ...props }); | |
| 23286 | +} | |
| 23287 | + | |
| 23288 | +// packages/dataviews/build-module/components/dataform-controls/radio.mjs | |
| 23289 | +var import_components16 = __toESM(require_components(), 1); | |
| 23290 | +var import_element65 = __toESM(require_element(), 1); | |
| 23291 | +var import_jsx_runtime81 = __toESM(require_jsx_runtime(), 1); | |
| 23292 | +function Radio({ | |
| 23293 | + data, | |
| 23294 | + field, | |
| 23295 | + onChange, | |
| 23296 | + hideLabelFromVision, | |
| 23297 | + markWhenOptional, | |
| 23298 | + validity | |
| 23299 | +}) { | |
| 23300 | + const { label, description, getValue, setValue, isValid: isValid2 } = field; | |
| 23301 | + const disabled2 = field.isDisabled({ item: data, field }); | |
| 23302 | + const { elements, isLoading } = useElements({ | |
| 23303 | + elements: field.elements, | |
| 23304 | + getElements: field.getElements | |
| 23305 | + }); | |
| 23306 | + const value = getValue({ item: data }); | |
| 23307 | + const onChangeControl = (0, import_element65.useCallback)( | |
| 23308 | + (newValue) => onChange(setValue({ item: data, value: newValue })), | |
| 23309 | + [data, onChange, setValue] | |
| 23310 | + ); | |
| 23311 | + if (isLoading) { | |
| 23312 | + return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_components16.Spinner, {}); | |
| 23313 | + } | |
| 23314 | + return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( | |
| 23315 | + ValidatedRadioControl, | |
| 23316 | + { | |
| 23317 | + required: !!field.isValid?.required, | |
| 23318 | + markWhenOptional, | |
| 23319 | + customValidity: getCustomValidity(isValid2, validity), | |
| 23320 | + label, | |
| 23321 | + help: description, | |
| 23322 | + onChange: onChangeControl, | |
| 23323 | + options: elements, | |
| 23324 | + selected: value, | |
| 23325 | + hideLabelFromVision, | |
| 23326 | + disabled: disabled2 | |
| 23327 | + } | |
| 23328 | + ); | |
| 23329 | +} | |
| 23330 | + | |
| 23331 | +// packages/dataviews/build-module/components/dataform-controls/text.mjs | |
| 23332 | +var import_element66 = __toESM(require_element(), 1); | |
| 23333 | +var import_jsx_runtime82 = __toESM(require_jsx_runtime(), 1); | |
| 23334 | +function Text({ | |
| 23335 | + data, | |
| 23336 | + field, | |
| 23337 | + onChange, | |
| 23338 | + hideLabelFromVision, | |
| 23339 | + markWhenOptional, | |
| 23340 | + config, | |
| 23341 | + validity | |
| 23342 | +}) { | |
| 23343 | + const { prefix, suffix } = config || {}; | |
| 23344 | + return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)( | |
| 23345 | + ValidatedText, | |
| 23346 | + { | |
| 23347 | + ...{ | |
| 23348 | + data, | |
| 23349 | + field, | |
| 23350 | + onChange, | |
| 23351 | + hideLabelFromVision, | |
| 23352 | + markWhenOptional, | |
| 23353 | + validity, | |
| 23354 | + prefix: prefix ? (0, import_element66.createElement)(prefix) : void 0, | |
| 23355 | + suffix: suffix ? (0, import_element66.createElement)(suffix) : void 0 | |
| 23356 | + } | |
| 23357 | + } | |
| 23358 | + ); | |
| 23359 | +} | |
| 23360 | + | |
| 23361 | +// packages/dataviews/build-module/components/dataform-controls/time.mjs | |
| 23362 | +var import_components17 = __toESM(require_components(), 1); | |
| 23363 | +var import_element67 = __toESM(require_element(), 1); | |
| 23364 | +var import_i18n15 = __toESM(require_i18n(), 1); | |
| 23365 | +var import_jsx_runtime83 = __toESM(require_jsx_runtime(), 1); | |
| 23366 | +function getStep(timeFormat, values) { | |
| 23367 | + const tokens = (timeFormat ?? "").replace(/\\./g, ""); | |
| 23368 | + const hasSeconds = tokens.includes("s") || values.some((value) => (parseTime2(value) ?? 0) % 60 !== 0); | |
| 23369 | + return hasSeconds ? 1 : void 0; | |
| 23370 | +} | |
| 23371 | +function toInputValue(value) { | |
| 23372 | + const seconds = parseTime2(value); | |
| 23373 | + if (seconds === null) { | |
| 23374 | + return ""; | |
| 23375 | + } | |
| 23376 | + const parts = [ | |
| 23377 | + Math.floor(seconds / 3600), | |
| 23378 | + Math.floor(seconds % 3600 / 60) | |
| 23379 | + ]; | |
| 23380 | + if (seconds % 60 !== 0) { | |
| 23381 | + parts.push(seconds % 60); | |
| 23382 | + } | |
| 23383 | + return parts.map((part) => String(part).padStart(2, "0")).join(":"); | |
| 23384 | +} | |
| 23385 | +function BetweenControls2({ | |
| 23386 | + value, | |
| 23387 | + onChange, | |
| 23388 | + hideLabelFromVision, | |
| 23389 | + disabled: disabled2, | |
| 23390 | + step, | |
| 23391 | + min: min3, | |
| 23392 | + max: max3 | |
| 23393 | +}) { | |
| 23394 | + const [from = "", to = ""] = value; | |
| 23395 | + const onChangeFrom = (0, import_element67.useCallback)( | |
| 23396 | + (newValue) => onChange([newValue ?? "", to]), | |
| 23397 | + [onChange, to] | |
| 23398 | + ); | |
| 23399 | + const onChangeTo = (0, import_element67.useCallback)( | |
| 23400 | + (newValue) => onChange([from, newValue ?? ""]), | |
| 23401 | + [onChange, from] | |
| 23402 | + ); | |
| 23403 | + return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)( | |
| 23404 | + import_components17.BaseControl, | |
| 23405 | + { | |
| 23406 | + help: (0, import_i18n15.__)("The end time must be later than the start time."), | |
| 23407 | + children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Stack, { direction: "row", gap: "sm", justify: "space-between", children: [ | |
| 23408 | + /* @__PURE__ */ (0, import_jsx_runtime83.jsx)( | |
| 23409 | + ValidatedInputControl, | |
| 23410 | + { | |
| 23411 | + type: "time", | |
| 23412 | + label: (0, import_i18n15.__)("From"), | |
| 23413 | + value: from, | |
| 23414 | + onValueChange: onChangeFrom, | |
| 23415 | + hideLabelFromVision, | |
| 23416 | + disabled: disabled2, | |
| 23417 | + step, | |
| 23418 | + min: min3, | |
| 23419 | + max: to || max3 | |
| 23420 | + } | |
| 23421 | + ), | |
| 23422 | + /* @__PURE__ */ (0, import_jsx_runtime83.jsx)( | |
| 23423 | + ValidatedInputControl, | |
| 23424 | + { | |
| 23425 | + type: "time", | |
| 23426 | + label: (0, import_i18n15.__)("To"), | |
| 23427 | + value: to, | |
| 23428 | + onValueChange: onChangeTo, | |
| 23429 | + hideLabelFromVision, | |
| 23430 | + disabled: disabled2, | |
| 23431 | + step, | |
| 23432 | + min: from || min3, | |
| 23433 | + max: max3 | |
| 23434 | + } | |
| 23435 | + ) | |
| 23436 | + ] }) | |
| 23437 | + } | |
| 23438 | + ); | |
| 23439 | +} | |
| 23440 | +function Time({ | |
| 23441 | + data, | |
| 23442 | + field, | |
| 23443 | + onChange, | |
| 23444 | + hideLabelFromVision, | |
| 23445 | + markWhenOptional, | |
| 23446 | + operator, | |
| 23447 | + validity | |
| 23448 | +}) { | |
| 23449 | + const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field; | |
| 23450 | + const value = getValue({ item: data }); | |
| 23451 | + const disabled2 = field.isDisabled({ item: data, field }); | |
| 23452 | + const timeFormat = field.format?.time; | |
| 23453 | + const min3 = typeof isValid2.min?.constraint === "string" ? isValid2.min.constraint : void 0; | |
| 23454 | + const max3 = typeof isValid2.max?.constraint === "string" ? isValid2.max.constraint : void 0; | |
| 23455 | + const onChangeControl = (0, import_element67.useCallback)( | |
| 23456 | + (newValue) => onChange( | |
| 23457 | + setValue({ | |
| 23458 | + item: data, | |
| 23459 | + value: newValue === "" ? void 0 : newValue | |
| 23460 | + }) | |
| 23461 | + ), | |
| 23462 | + [data, onChange, setValue] | |
| 23463 | + ); | |
| 23464 | + const onChangeBetweenControls = (0, import_element67.useCallback)( | |
| 23465 | + ([from, to]) => onChange( | |
| 23466 | + setValue({ | |
| 23467 | + item: data, | |
| 23468 | + // An unfilled bound is stored as `undefined`, which the | |
| 23469 | + // `between` operator reads as "do not apply the filter". | |
| 23470 | + value: [from || void 0, to || void 0] | |
| 23471 | + }) | |
| 23472 | + ), | |
| 23473 | + [data, onChange, setValue] | |
| 23474 | + ); | |
| 23475 | + if (operator === OPERATOR_BETWEEN) { | |
| 23476 | + let valueBetween = ["", ""]; | |
| 23477 | + if (Array.isArray(value) && value.length === 2) { | |
| 23478 | + valueBetween = [ | |
| 23479 | + toInputValue(value[0]), | |
| 23480 | + toInputValue(value[1]) | |
| 23481 | + ]; | |
| 23482 | + } | |
| 23483 | + return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)( | |
| 23484 | + BetweenControls2, | |
| 23485 | + { | |
| 23486 | + value: valueBetween, | |
| 23487 | + onChange: onChangeBetweenControls, | |
| 23488 | + hideLabelFromVision, | |
| 23489 | + disabled: disabled2, | |
| 23490 | + step: getStep(timeFormat, valueBetween), | |
| 23491 | + min: min3, | |
| 23492 | + max: max3 | |
| 23493 | + } | |
| 23494 | + ); | |
| 23495 | + } | |
| 23496 | + return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)( | |
| 23497 | + ValidatedInputControl, | |
| 23498 | + { | |
| 23499 | + required: !!isValid2.required, | |
| 23500 | + markWhenOptional, | |
| 23501 | + customValidity: getCustomValidity(isValid2, validity), | |
| 23502 | + type: "time", | |
| 23503 | + label, | |
| 23504 | + placeholder, | |
| 23505 | + description: typeof description === "string" ? description : void 0, | |
| 23506 | + details: typeof description === "string" ? void 0 : description, | |
| 23507 | + value: toInputValue(value), | |
| 23508 | + onValueChange: onChangeControl, | |
| 23509 | + hideLabelFromVision, | |
| 23510 | + disabled: disabled2, | |
| 23511 | + step: getStep(timeFormat, [value]), | |
| 23512 | + min: min3, | |
| 23513 | + max: max3 | |
| 23514 | + } | |
| 23515 | + ); | |
| 23516 | +} | |
| 23517 | + | |
| 23518 | +// packages/dataviews/build-module/components/dataform-controls/toggle.mjs | |
| 23519 | +var import_element68 = __toESM(require_element(), 1); | |
| 23520 | +var import_jsx_runtime84 = __toESM(require_jsx_runtime(), 1); | |
| 23521 | +function Toggle({ | |
| 23522 | + field, | |
| 23523 | + onChange, | |
| 23524 | + data, | |
| 23525 | + hideLabelFromVision, | |
| 23526 | + markWhenOptional, | |
| 23527 | + validity | |
| 23528 | +}) { | |
| 23529 | + const { label, description, getValue, setValue, isValid: isValid2 } = field; | |
| 23530 | + const disabled2 = field.isDisabled({ item: data, field }); | |
| 23531 | + const onChangeControl = (0, import_element68.useCallback)(() => { | |
| 23532 | + onChange( | |
| 23533 | + setValue({ item: data, value: !getValue({ item: data }) }) | |
| 23534 | + ); | |
| 23535 | + }, [onChange, setValue, data, getValue]); | |
| 23536 | + return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)( | |
| 23537 | + ValidatedToggleControl, | |
| 23538 | + { | |
| 23539 | + required: !!isValid2.required, | |
| 23540 | + markWhenOptional, | |
| 23541 | + customValidity: getCustomValidity(isValid2, validity), | |
| 23542 | + hidden: hideLabelFromVision, | |
| 23543 | + label, | |
| 23544 | + help: description, | |
| 23545 | + checked: getValue({ item: data }), | |
| 23546 | + onChange: onChangeControl, | |
| 23547 | + disabled: disabled2 | |
| 23548 | + } | |
| 23549 | + ); | |
| 23550 | +} | |
| 23551 | + | |
| 23552 | +// packages/dataviews/build-module/components/dataform-controls/textarea.mjs | |
| 23553 | +var import_element69 = __toESM(require_element(), 1); | |
| 23554 | +var import_jsx_runtime85 = __toESM(require_jsx_runtime(), 1); | |
| 23555 | +function Textarea3({ | |
| 23556 | + data, | |
| 23557 | + field, | |
| 23558 | + onChange, | |
| 23559 | + hideLabelFromVision, | |
| 23560 | + markWhenOptional, | |
| 23561 | + config, | |
| 23562 | + validity | |
| 23563 | +}) { | |
| 23564 | + const { rows = 4 } = config || {}; | |
| 23565 | + const disabled2 = field.isDisabled({ item: data, field }); | |
| 23566 | + const { label, placeholder, description, setValue, isValid: isValid2 } = field; | |
| 23567 | + const value = field.getValue({ item: data }); | |
| 23568 | + const onValueChangeControl = (0, import_element69.useCallback)( | |
| 23569 | + (newValue) => onChange(setValue({ item: data, value: newValue })), | |
| 23570 | + [data, onChange, setValue] | |
| 23571 | + ); | |
| 23572 | + return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)( | |
| 23573 | + ValidatedTextareaControl, | |
| 23574 | + { | |
| 23575 | + required: !!isValid2.required, | |
| 23576 | + markWhenOptional, | |
| 23577 | + customValidity: getCustomValidity(isValid2, validity), | |
| 23578 | + label, | |
| 23579 | + placeholder, | |
| 23580 | + value: value ?? "", | |
| 23581 | + description: typeof description === "string" ? description : void 0, | |
| 23582 | + details: typeof description === "string" ? void 0 : description, | |
| 23583 | + onValueChange: onValueChangeControl, | |
| 23584 | + rows, | |
| 23585 | + disabled: disabled2, | |
| 23586 | + minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0, | |
| 23587 | + maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0, | |
| 23588 | + hideLabelFromVision | |
| 23589 | + } | |
| 23590 | + ); | |
| 23591 | +} | |
| 23592 | + | |
| 23593 | +// packages/dataviews/build-module/components/dataform-controls/toggle-group.mjs | |
| 23594 | +var import_components18 = __toESM(require_components(), 1); | |
| 23595 | +var import_element70 = __toESM(require_element(), 1); | |
| 23596 | +var import_jsx_runtime86 = __toESM(require_jsx_runtime(), 1); | |
| 23597 | +function ToggleGroup({ | |
| 23598 | + data, | |
| 23599 | + field, | |
| 23600 | + onChange, | |
| 23601 | + hideLabelFromVision, | |
| 23602 | + markWhenOptional, | |
| 23603 | + validity | |
| 23604 | +}) { | |
| 23605 | + const { getValue, setValue, isValid: isValid2 } = field; | |
| 23606 | + const disabled2 = field.isDisabled({ item: data, field }); | |
| 23607 | + const value = getValue({ item: data }); | |
| 23608 | + const onChangeControl = (0, import_element70.useCallback)( | |
| 23609 | + (newValue) => onChange(setValue({ item: data, value: newValue })), | |
| 23610 | + [data, onChange, setValue] | |
| 23611 | + ); | |
| 23612 | + const { elements, isLoading } = useElements({ | |
| 23613 | + elements: field.elements, | |
| 23614 | + getElements: field.getElements | |
| 23615 | + }); | |
| 23616 | + if (isLoading) { | |
| 23617 | + return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_components18.Spinner, {}); | |
| 23618 | + } | |
| 23619 | + if (elements.length === 0) { | |
| 23620 | + return null; | |
| 23621 | + } | |
| 23622 | + const selectedOption = elements.find((el) => el.value === value); | |
| 23623 | + return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)( | |
| 23624 | + ValidatedToggleGroupControl, | |
| 23625 | + { | |
| 23626 | + required: !!field.isValid?.required, | |
| 23627 | + markWhenOptional, | |
| 23628 | + customValidity: getCustomValidity(isValid2, validity), | |
| 23629 | + isBlock: true, | |
| 23630 | + label: field.label, | |
| 23631 | + help: selectedOption?.description || field.description, | |
| 23632 | + onChange: onChangeControl, | |
| 23633 | + value, | |
| 23634 | + hideLabelFromVision, | |
| 23635 | + children: elements.map((el) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)( | |
| 23636 | + import_components18.__experimentalToggleGroupControlOption, | |
| 23637 | + { | |
| 23638 | + label: el.label, | |
| 23639 | + value: el.value, | |
| 23640 | + disabled: disabled2 | |
| 23641 | + }, | |
| 23642 | + el.value | |
| 23643 | + )) | |
| 23644 | + } | |
| 23645 | + ); | |
| 23646 | +} | |
| 23647 | + | |
| 23648 | +// packages/dataviews/build-module/components/dataform-controls/array.mjs | |
| 23649 | +var import_components19 = __toESM(require_components(), 1); | |
| 23650 | +var import_element71 = __toESM(require_element(), 1); | |
| 23651 | +var import_jsx_runtime87 = __toESM(require_jsx_runtime(), 1); | |
| 23652 | +function ArrayControl({ | |
| 23653 | + data, | |
| 23654 | + field, | |
| 23655 | + onChange, | |
| 23656 | + hideLabelFromVision, | |
| 23657 | + markWhenOptional, | |
| 23658 | + validity | |
| 23659 | +}) { | |
| 23660 | + const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field; | |
| 23661 | + const value = getValue({ item: data }); | |
| 23662 | + const disabled2 = field.isDisabled({ item: data, field }); | |
| 23663 | + const { elements, isLoading } = useElements({ | |
| 23664 | + elements: field.elements, | |
| 23665 | + getElements: field.getElements | |
| 23666 | + }); | |
| 23667 | + const arrayValueAsElements = (0, import_element71.useMemo)( | |
| 23668 | + () => Array.isArray(value) ? value.map((token) => { | |
| 23669 | + const element = elements?.find( | |
| 23670 | + (suggestion) => suggestion.value === token | |
| 23671 | + ); | |
| 23672 | + return element || { value: token, label: token }; | |
| 23673 | + }) : [], | |
| 23674 | + [value, elements] | |
| 23675 | + ); | |
| 23676 | + const onChangeControl = (0, import_element71.useCallback)( | |
| 23677 | + (tokens) => { | |
| 23678 | + const valueTokens = tokens.map((token) => { | |
| 23679 | + if (typeof token === "object" && "value" in token) { | |
| 23680 | + return token.value; | |
| 23681 | + } | |
| 23682 | + return token; | |
| 23683 | + }); | |
| 23684 | + onChange(setValue({ item: data, value: valueTokens })); | |
| 23685 | + }, | |
| 23686 | + [onChange, setValue, data] | |
| 23687 | + ); | |
| 23688 | + if (isLoading) { | |
| 23689 | + return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_components19.Spinner, {}); | |
| 23690 | + } | |
| 23691 | + return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)( | |
| 23692 | + ValidatedFormTokenField, | |
| 23693 | + { | |
| 23694 | + required: !!isValid2?.required, | |
| 23695 | + markWhenOptional, | |
| 23696 | + customValidity: getCustomValidity(isValid2, validity), | |
| 23697 | + label: hideLabelFromVision ? void 0 : label, | |
| 23698 | + value: arrayValueAsElements, | |
| 23699 | + onChange: onChangeControl, | |
| 23700 | + placeholder, | |
| 23701 | + suggestions: elements?.map((element) => element.value), | |
| 23702 | + disabled: disabled2, | |
| 23703 | + __experimentalValidateInput: (token) => { | |
| 23704 | + if (field.isValid?.elements && elements) { | |
| 23705 | + return elements.some( | |
| 23706 | + (element) => element.value === token || element.label === token | |
| 23707 | + ); | |
| 23708 | + } | |
| 23709 | + return true; | |
| 23710 | + }, | |
| 23711 | + __experimentalExpandOnFocus: elements && elements.length > 0, | |
| 23712 | + help: description ?? (field.isValid?.elements ? "" : void 0), | |
| 23713 | + displayTransform: (token) => { | |
| 23714 | + if (typeof token === "object" && "label" in token) { | |
| 23715 | + return token.label; | |
| 23716 | + } | |
| 23717 | + if (typeof token === "string" && elements) { | |
| 23718 | + const element = elements.find( | |
| 23719 | + (el) => el.value === token | |
| 23720 | + ); | |
| 23721 | + return element?.label || token; | |
| 23722 | + } | |
| 23723 | + return token; | |
| 23724 | + }, | |
| 23725 | + __experimentalRenderItem: ({ item }) => { | |
| 23726 | + if (typeof item === "string" && elements) { | |
| 23727 | + const element = elements.find( | |
| 23728 | + (el) => el.value === item | |
| 23729 | + ); | |
| 23730 | + return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { children: element?.label || item }); | |
| 23731 | + } | |
| 23732 | + return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { children: item }); | |
| 23733 | + } | |
| 23734 | + } | |
| 23735 | + ); | |
| 23736 | +} | |
| 23737 | + | |
| 23738 | +// node_modules/colord/index.mjs | |
| 23739 | +for (r2 = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, t = function(r3) { | |
| 23740 | + return "string" == typeof r3 ? r3.length > 0 : "number" == typeof r3; | |
| 23741 | +}, n = function(r3, t2, n2) { | |
| 23742 | + return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = Math.pow(10, t2)), Math.round(n2 * r3) / n2 + 0; | |
| 23743 | +}, u = function(r3, t2, n2) { | |
| 23744 | + return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = 1), r3 > n2 ? n2 : r3 > t2 ? r3 : t2; | |
| 23745 | +}, e = function(r3) { | |
| 23746 | + return (r3 = isFinite(r3) ? r3 % 360 : 0) < 0 ? r3 + 360 : r3; | |
| 23747 | +}, o = function(r3, t2) { | |
| 23748 | + return void 0 === t2 && (t2 = 0), n(r3, t2) % 360; | |
| 23749 | +}, a = function(r3) { | |
| 23750 | + return { r: u(r3.r, 0, 255), g: u(r3.g, 0, 255), b: u(r3.b, 0, 255), a: u(r3.a) }; | |
| 23751 | +}, i = function(r3) { | |
| 23752 | + return { r: n(r3.r), g: n(r3.g), b: n(r3.b), a: n(r3.a, 3) }; | |
| 23753 | +}, s = /^#([0-9a-f]{3,8})$/i, d = function(r3, t2) { | |
| 23754 | + var n2 = r3.charCodeAt(t2); | |
| 23755 | + return (15 & n2) + 9 * (n2 >> 6); | |
| 23756 | +}, h = function(r3, t2) { | |
| 23757 | + return d(r3, t2) << 4 | d(r3, t2 + 1); | |
| 23758 | +}, b = [], f = 0; f < 256; f++) b.push((f < 16 ? "0" : "") + f.toString(16)); | |
| 23759 | +var r2; | |
| 23760 | +var t; | |
| 23761 | +var n; | |
| 23762 | +var u; | |
| 23763 | +var e; | |
| 23764 | +var o; | |
| 23765 | +var a; | |
| 23766 | +var i; | |
| 23767 | +var s; | |
| 23768 | +var d; | |
| 23769 | +var h; | |
| 23770 | +var b; | |
| 23771 | +var f; | |
| 23772 | +var g = function(r2) { | |
| 23773 | + return b[u(r2, 0, 255)]; | |
| 23774 | +}; | |
| 23775 | +var c = function(r2) { | |
| 23776 | + var t = r2.r, n = r2.g, u = r2.b, e = r2.a, o = Math.max(t, n, u), a = o - Math.min(t, n, u), i = a ? o === t ? (n - u) / a : o === n ? 2 + (u - t) / a : 4 + (t - n) / a : 0; | |
| 23777 | + return { h: 60 * (i < 0 ? i + 6 : i), s: o ? a / o * 100 : 0, v: o / 255 * 100, a: e }; | |
| 23778 | +}; | |
| 23779 | +var v = function(r2) { | |
| 23780 | + var t = r2.h, n = r2.s, u = r2.v, e = r2.a; | |
| 23781 | + t = t / 360 * 6, n /= 100, u /= 100; | |
| 23782 | + var o = Math.floor(t), a = u * (1 - n), i = u * (1 - (t - o) * n), s = u * (1 - (1 - t + o) * n), d = o % 6; | |
| 23783 | + return { r: 255 * [u, i, a, a, s, u][d], g: 255 * [s, u, u, i, a, a][d], b: 255 * [a, a, s, u, u, i][d], a: e }; | |
| 23784 | +}; | |
| 23785 | +var l = function(r2) { | |
| 23786 | + return { h: e(r2.h), s: u(r2.s, 0, 100), l: u(r2.l, 0, 100), a: u(r2.a) }; | |
| 23787 | +}; | |
| 23788 | +var p = function(r2) { | |
| 23789 | + return { h: o(r2.h), s: n(r2.s), l: n(r2.l), a: n(r2.a, 3) }; | |
| 23790 | +}; | |
| 23791 | +var m = function(r2) { | |
| 23792 | + return v((n = (t = r2).s, { h: t.h, s: (n *= ((u = t.l) < 50 ? u : 100 - u) / 100) > 0 ? 2 * n / (u + n) * 100 : 0, v: u + n, a: t.a })); | |
| 23793 | + var t, n, u; | |
| 23794 | +}; | |
| 23795 | +var y = function(r2) { | |
| 23796 | + return { h: (t = c(r2)).h, s: (e = (200 - (n = t.s)) * (u = t.v) / 100) > 0 && e < 200 ? n * u / 100 / (e <= 100 ? e : 200 - e) * 100 : 0, l: e / 2, a: t.a }; | |
| 23797 | + var t, n, u, e; | |
| 23798 | +}; | |
| 23799 | +var N = /^hsla?\(\s*([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))%\s*,\s*([+-]?(?:\d*\.\d+|\d+))%\s*(?:,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i; | |
| 23800 | +var x = /^hsla?\(\s*([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s+([+-]?(?:\d*\.\d+|\d+))%\s+([+-]?(?:\d*\.\d+|\d+))%\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i; | |
| 23801 | +var M = /^rgba?\(\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*(?:,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i; | |
| 23802 | +var H = /^rgba?\(\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s+([+-]?(?:\d*\.\d+|\d+))(%)?\s+([+-]?(?:\d*\.\d+|\d+))(%)?\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i; | |
| 23803 | +var $ = { string: [[function(r2) { | |
| 23804 | + if (!s.test(r2)) return null; | |
| 23805 | + var t = r2.length; | |
| 23806 | + return t <= 5 ? { r: 17 * d(r2, 1), g: 17 * d(r2, 2), b: 17 * d(r2, 3), a: 5 === t ? n(17 * d(r2, 4) / 255, 2) : 1 } : 7 === t || 9 === t ? { r: h(r2, 1), g: h(r2, 3), b: h(r2, 5), a: 9 === t ? n(h(r2, 7) / 255, 2) : 1 } : null; | |
| 23807 | +}, "hex"], [function(r2) { | |
| 23808 | + var t = M.exec(r2) || H.exec(r2); | |
| 23809 | + return t ? t[2] !== t[4] || t[4] !== t[6] ? null : a({ r: Number(t[1]) / (t[2] ? 100 / 255 : 1), g: Number(t[3]) / (t[4] ? 100 / 255 : 1), b: Number(t[5]) / (t[6] ? 100 / 255 : 1), a: void 0 === t[7] ? 1 : Number(t[7]) / (t[8] ? 100 : 1) }) : null; | |
| 23810 | +}, "rgb"], [function(t) { | |
| 23811 | + var n = N.exec(t) || x.exec(t); | |
| 23812 | + if (!n) return null; | |
| 23813 | + var u, e, o = l({ h: (u = n[1], e = n[2], void 0 === e && (e = "deg"), Number(u) * (r2[e] || 1)), s: Number(n[3]), l: Number(n[4]), a: void 0 === n[5] ? 1 : Number(n[5]) / (n[6] ? 100 : 1) }); | |
| 23814 | + return m(o); | |
| 23815 | +}, "hsl"]], object: [[function(r2) { | |
| 23816 | + var n = r2.r, u = r2.g, e = r2.b, o = r2.a, i = void 0 === o ? 1 : o; | |
| 23817 | + return t(n) && t(u) && t(e) ? a({ r: Number(n), g: Number(u), b: Number(e), a: Number(i) }) : null; | |
| 23818 | +}, "rgb"], [function(r2) { | |
| 23819 | + var n = r2.h, u = r2.s, e = r2.l, o = r2.a, a = void 0 === o ? 1 : o; | |
| 23820 | + if (!t(n) || !t(u) || !t(e)) return null; | |
| 23821 | + var i = l({ h: Number(n), s: Number(u), l: Number(e), a: Number(a) }); | |
| 23822 | + return m(i); | |
| 23823 | +}, "hsl"], [function(r2) { | |
| 23824 | + var n = r2.h, o = r2.s, a = r2.v, i = r2.a, s = void 0 === i ? 1 : i; | |
| 23825 | + if (!t(n) || !t(o) || !t(a)) return null; | |
| 23826 | + var d = (function(r3) { | |
| 23827 | + return { h: e(r3.h), s: u(r3.s, 0, 100), v: u(r3.v, 0, 100), a: u(r3.a) }; | |
| 23828 | + })({ h: Number(n), s: Number(o), v: Number(a), a: Number(s) }); | |
| 23829 | + return v(d); | |
| 23830 | +}, "hsv"]] }; | |
| 23831 | +var j = function(r2, t) { | |
| 23832 | + for (var n = 0; n < t.length; n++) { | |
| 23833 | + var u = t[n][0](r2); | |
| 23834 | + if (u) return [u, t[n][1]]; | |
| 23835 | + } | |
| 23836 | + return [null, void 0]; | |
| 23837 | +}; | |
| 23838 | +var w = function(r2) { | |
| 23839 | + return "string" == typeof r2 ? j(r2.trim(), $.string) : "object" == typeof r2 && null !== r2 ? j(r2, $.object) : [null, void 0]; | |
| 23840 | +}; | |
| 23841 | +var k = function(r2, t) { | |
| 23842 | + var n = y(r2); | |
| 23843 | + return { h: n.h, s: u(n.s + 100 * t, 0, 100), l: n.l, a: n.a }; | |
| 23844 | +}; | |
| 23845 | +var E = function(r2) { | |
| 23846 | + return (299 * r2.r + 587 * r2.g + 114 * r2.b) / 1e3 / 255; | |
| 23847 | +}; | |
| 23848 | +var R = function(r2, t) { | |
| 23849 | + var n = y(r2); | |
| 23850 | + return { h: n.h, s: n.s, l: u(n.l + 100 * t, 0, 100), a: n.a }; | |
| 23851 | +}; | |
| 23852 | +var q = (function() { | |
| 23853 | + function r2(r3) { | |
| 23854 | + this.parsed = w(r3)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 }; | |
| 23855 | + } | |
| 23856 | + return r2.prototype.isValid = function() { | |
| 23857 | + return null !== this.parsed; | |
| 23858 | + }, r2.prototype.brightness = function() { | |
| 23859 | + return n(E(this.rgba), 2); | |
| 23860 | + }, r2.prototype.isDark = function() { | |
| 23861 | + return E(this.rgba) < 0.5; | |
| 23862 | + }, r2.prototype.isLight = function() { | |
| 23863 | + return E(this.rgba) >= 0.5; | |
| 23864 | + }, r2.prototype.toHex = function() { | |
| 23865 | + return r3 = i(this.rgba), t = r3.r, u = r3.g, e = r3.b, a = (o = r3.a) < 1 ? g(n(255 * o)) : "", "#" + g(t) + g(u) + g(e) + a; | |
| 23866 | + var r3, t, u, e, o, a; | |
| 23867 | + }, r2.prototype.toRgb = function() { | |
| 23868 | + return i(this.rgba); | |
| 23869 | + }, r2.prototype.toRgbString = function() { | |
| 23870 | + return r3 = i(this.rgba), t = r3.r, n = r3.g, u = r3.b, (e = r3.a) < 1 ? "rgba(" + t + ", " + n + ", " + u + ", " + e + ")" : "rgb(" + t + ", " + n + ", " + u + ")"; | |
| 23871 | + var r3, t, n, u, e; | |
| 23872 | + }, r2.prototype.toHsl = function() { | |
| 23873 | + return p(y(this.rgba)); | |
| 23874 | + }, r2.prototype.toHslString = function() { | |
| 23875 | + return r3 = p(y(this.rgba)), t = r3.h, n = r3.s, u = r3.l, (e = r3.a) < 1 ? "hsla(" + t + ", " + n + "%, " + u + "%, " + e + ")" : "hsl(" + t + ", " + n + "%, " + u + "%)"; | |
| 23876 | + var r3, t, n, u, e; | |
| 23877 | + }, r2.prototype.toHsv = function() { | |
| 23878 | + return r3 = c(this.rgba), { h: o(r3.h), s: n(r3.s), v: n(r3.v), a: n(r3.a, 3) }; | |
| 23879 | + var r3; | |
| 23880 | + }, r2.prototype.invert = function() { | |
| 23881 | + return A({ r: 255 - (r3 = this.rgba).r, g: 255 - r3.g, b: 255 - r3.b, a: r3.a }); | |
| 23882 | + var r3; | |
| 23883 | + }, r2.prototype.saturate = function(r3) { | |
| 23884 | + return void 0 === r3 && (r3 = 0.1), A(k(this.rgba, r3)); | |
| 23885 | + }, r2.prototype.desaturate = function(r3) { | |
| 23886 | + return void 0 === r3 && (r3 = 0.1), A(k(this.rgba, -r3)); | |
| 23887 | + }, r2.prototype.grayscale = function() { | |
| 23888 | + return A(k(this.rgba, -1)); | |
| 23889 | + }, r2.prototype.lighten = function(r3) { | |
| 23890 | + return void 0 === r3 && (r3 = 0.1), A(R(this.rgba, r3)); | |
| 23891 | + }, r2.prototype.darken = function(r3) { | |
| 23892 | + return void 0 === r3 && (r3 = 0.1), A(R(this.rgba, -r3)); | |
| 23893 | + }, r2.prototype.rotate = function(r3) { | |
| 23894 | + return void 0 === r3 && (r3 = 15), this.hue(y(this.rgba).h + r3); | |
| 23895 | + }, r2.prototype.alpha = function(r3) { | |
| 23896 | + return "number" == typeof r3 ? A({ r: (t = this.rgba).r, g: t.g, b: t.b, a: r3 }) : n(this.rgba.a, 3); | |
| 23897 | + var t; | |
| 23898 | + }, r2.prototype.hue = function(r3) { | |
| 23899 | + var t = y(this.rgba); | |
| 23900 | + return "number" == typeof r3 ? A({ h: r3, s: t.s, l: t.l, a: t.a }) : o(t.h); | |
| 23901 | + }, r2.prototype.isEqual = function(r3) { | |
| 23902 | + return this.toHex() === A(r3).toHex(); | |
| 23903 | + }, r2; | |
| 23904 | +})(); | |
| 23905 | +var A = function(r2) { | |
| 23906 | + return r2 instanceof q ? r2 : new q(r2); | |
| 23907 | +}; | |
| 23908 | + | |
| 23909 | +// packages/dataviews/build-module/components/dataform-controls/color.mjs | |
| 23910 | +var import_components20 = __toESM(require_components(), 1); | |
| 23911 | +var import_element72 = __toESM(require_element(), 1); | |
| 23912 | +var import_i18n16 = __toESM(require_i18n(), 1); | |
| 23913 | +var import_jsx_runtime88 = __toESM(require_jsx_runtime(), 1); | |
| 23914 | +var ColorPickerDropdown = ({ | |
| 23915 | + color, | |
| 23916 | + onColorChange, | |
| 23917 | + disabled: disabled2 | |
| 23918 | +}) => { | |
| 23919 | + const validColor = color && A(color).isValid() ? color : "#ffffff"; | |
| 23920 | + return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)( | |
| 23921 | + import_components20.Dropdown, | |
| 23922 | + { | |
| 23923 | + className: "dataviews-controls__color-picker-dropdown", | |
| 23924 | + popoverProps: { resize: false }, | |
| 23925 | + renderToggle: ({ onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)( | |
| 23926 | + import_components20.Button, | |
| 23927 | + { | |
| 23928 | + onClick: onToggle, | |
| 23929 | + "aria-label": (0, import_i18n16.__)("Open color picker"), | |
| 23930 | + size: "small", | |
| 23931 | + disabled: disabled2, | |
| 23932 | + accessibleWhenDisabled: true, | |
| 23933 | + icon: () => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_components20.ColorIndicator, { colorValue: validColor }) | |
| 23934 | + } | |
| 23935 | + ), | |
| 23936 | + renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_components20.__experimentalDropdownContentWrapper, { paddingSize: "none", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)( | |
| 23937 | + import_components20.ColorPicker, | |
| 23938 | + { | |
| 23939 | + color: validColor, | |
| 23940 | + onChange: onColorChange, | |
| 23941 | + enableAlpha: true | |
| 23942 | + } | |
| 23943 | + ) }) | |
| 23944 | + } | |
| 23945 | + ); | |
| 23946 | +}; | |
| 23947 | +function Color({ | |
| 23948 | + data, | |
| 23949 | + field, | |
| 23950 | + onChange, | |
| 23951 | + hideLabelFromVision, | |
| 23952 | + markWhenOptional, | |
| 23953 | + validity | |
| 23954 | +}) { | |
| 23955 | + const { label, placeholder, description, setValue, isValid: isValid2 } = field; | |
| 23956 | + const disabled2 = field.isDisabled({ item: data, field }); | |
| 23957 | + const value = field.getValue({ item: data }) || ""; | |
| 23958 | + const handleColorChange = (0, import_element72.useCallback)( | |
| 23959 | + (newColor) => { | |
| 23960 | + onChange(setValue({ item: data, value: newColor })); | |
| 23961 | + }, | |
| 23962 | + [data, onChange, setValue] | |
| 23963 | + ); | |
| 23964 | + const handleInputChange = (0, import_element72.useCallback)( | |
| 23965 | + (newValue) => { | |
| 23966 | + onChange(setValue({ item: data, value: newValue || "" })); | |
| 23967 | + }, | |
| 23968 | + [data, onChange, setValue] | |
| 23969 | + ); | |
| 23970 | + return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)( | |
| 23971 | + ValidatedInputControl, | |
| 23972 | + { | |
| 23973 | + required: !!field.isValid?.required, | |
| 23974 | + markWhenOptional, | |
| 23975 | + customValidity: getCustomValidity(isValid2, validity), | |
| 23976 | + label, | |
| 23977 | + placeholder, | |
| 23978 | + value, | |
| 23979 | + description: typeof description === "string" ? description : void 0, | |
| 23980 | + details: typeof description === "string" ? void 0 : description, | |
| 23981 | + onValueChange: handleInputChange, | |
| 23982 | + hideLabelFromVision, | |
| 23983 | + type: "text", | |
| 23984 | + disabled: disabled2, | |
| 23985 | + prefix: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)( | |
| 23986 | + ColorPickerDropdown, | |
| 23987 | + { | |
| 23988 | + color: value, | |
| 23989 | + onColorChange: handleColorChange, | |
| 23990 | + disabled: disabled2 | |
| 23991 | + } | |
| 23992 | + ) }) | |
| 23993 | + } | |
| 23994 | + ); | |
| 23995 | +} | |
| 23996 | + | |
| 23997 | +// packages/dataviews/build-module/components/dataform-controls/password.mjs | |
| 23998 | +var import_components21 = __toESM(require_components(), 1); | |
| 23999 | +var import_element73 = __toESM(require_element(), 1); | |
| 24000 | +var import_i18n17 = __toESM(require_i18n(), 1); | |
| 24001 | +var import_jsx_runtime89 = __toESM(require_jsx_runtime(), 1); | |
| 24002 | +function Password({ | |
| 24003 | + data, | |
| 24004 | + field, | |
| 24005 | + onChange, | |
| 24006 | + hideLabelFromVision, | |
| 24007 | + markWhenOptional, | |
| 24008 | + validity | |
| 24009 | +}) { | |
| 24010 | + const [isVisible, setIsVisible] = (0, import_element73.useState)(false); | |
| 24011 | + const disabled2 = field.isDisabled({ item: data, field }); | |
| 24012 | + const toggleVisibility = (0, import_element73.useCallback)(() => { | |
| 24013 | + setIsVisible((prev) => !prev); | |
| 24014 | + }, []); | |
| 24015 | + return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)( | |
| 24016 | + ValidatedText, | |
| 24017 | + { | |
| 24018 | + ...{ | |
| 24019 | + data, | |
| 24020 | + field, | |
| 24021 | + onChange, | |
| 24022 | + hideLabelFromVision, | |
| 24023 | + markWhenOptional, | |
| 24024 | + validity, | |
| 24025 | + type: isVisible ? "text" : "password", | |
| 24026 | + suffix: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)( | |
| 24027 | + import_components21.Button, | |
| 24028 | + { | |
| 24029 | + icon: isVisible ? unseen_default : seen_default, | |
| 24030 | + onClick: toggleVisibility, | |
| 24031 | + size: "small", | |
| 24032 | + label: isVisible ? (0, import_i18n17.__)("Hide password") : (0, import_i18n17.__)("Show password"), | |
| 24033 | + disabled: disabled2, | |
| 24034 | + accessibleWhenDisabled: true | |
| 24035 | + } | |
| 24036 | + ) }) | |
| 24037 | + } | |
| 24038 | + } | |
| 24039 | + ); | |
| 24040 | +} | |
| 24041 | + | |
| 24042 | +// packages/dataviews/build-module/field-types/utils/has-elements.mjs | |
| 24043 | +function hasElements(field) { | |
| 24044 | + return Array.isArray(field.elements) && field.elements.length > 0 || typeof field.getElements === "function"; | |
| 24045 | +} | |
| 24046 | + | |
| 24047 | +// packages/dataviews/build-module/components/dataform-controls/index.mjs | |
| 24048 | +var import_jsx_runtime90 = __toESM(require_jsx_runtime(), 1); | |
| 24049 | +var FORM_CONTROLS = { | |
| 24050 | + adaptiveSelect: AdaptiveSelect, | |
| 24051 | + array: ArrayControl, | |
| 24052 | + checkbox: Checkbox, | |
| 24053 | + color: Color, | |
| 24054 | + combobox: Combobox, | |
| 24055 | + datetime: DateTime, | |
| 24056 | + date: DateControl, | |
| 24057 | + email: Email, | |
| 24058 | + telephone: Telephone, | |
| 24059 | + url: Url, | |
| 24060 | + integer: Integer, | |
| 24061 | + number: Number2, | |
| 24062 | + password: Password, | |
| 24063 | + radio: Radio, | |
| 24064 | + select: Select2, | |
| 24065 | + text: Text, | |
| 24066 | + time: Time, | |
| 24067 | + toggle: Toggle, | |
| 24068 | + textarea: Textarea3, | |
| 24069 | + toggleGroup: ToggleGroup | |
| 24070 | +}; | |
| 24071 | +function isEditConfig(value) { | |
| 24072 | + return value && typeof value === "object" && typeof value.control === "string"; | |
| 24073 | +} | |
| 24074 | +function createConfiguredControl(config) { | |
| 24075 | + const { control, ...controlConfig } = config; | |
| 24076 | + const BaseControlType = getControlByType(control); | |
| 24077 | + if (BaseControlType === null) { | |
| 24078 | + return null; | |
| 24079 | + } | |
| 24080 | + return function ConfiguredControl(props) { | |
| 24081 | + return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(BaseControlType, { ...props, config: controlConfig }); | |
| 24082 | + }; | |
| 24083 | +} | |
| 24084 | +function getControl(field, fallback) { | |
| 24085 | + if (typeof field.Edit === "function") { | |
| 24086 | + return field.Edit; | |
| 24087 | + } | |
| 24088 | + if (typeof field.Edit === "string") { | |
| 24089 | + return getControlByType(field.Edit); | |
| 24090 | + } | |
| 24091 | + if (isEditConfig(field.Edit)) { | |
| 24092 | + return createConfiguredControl(field.Edit); | |
| 24093 | + } | |
| 24094 | + if (hasElements(field) && field.type !== "array") { | |
| 24095 | + return getControlByType("adaptiveSelect"); | |
| 24096 | + } | |
| 24097 | + if (fallback === null) { | |
| 24098 | + return null; | |
| 24099 | + } | |
| 24100 | + return getControlByType(fallback); | |
| 24101 | +} | |
| 24102 | +function getControlByType(type) { | |
| 24103 | + if (Object.keys(FORM_CONTROLS).includes(type)) { | |
| 24104 | + return FORM_CONTROLS[type]; | |
| 24105 | + } | |
| 24106 | + return null; | |
| 24107 | +} | |
| 24108 | + | |
| 24109 | +// packages/dataviews/build-module/field-types/utils/get-filter-by.mjs | |
| 24110 | +function getFilterBy(field, defaultOperators, validOperators) { | |
| 24111 | + if (field.filterBy === false) { | |
| 24112 | + return false; | |
| 24113 | + } | |
| 24114 | + const operators = field.filterBy?.operators?.filter( | |
| 24115 | + (op) => validOperators.includes(op) | |
| 24116 | + ) ?? defaultOperators; | |
| 24117 | + if (operators.length === 0) { | |
| 24118 | + return false; | |
| 24119 | + } | |
| 24120 | + return { | |
| 24121 | + isPrimary: !!field.filterBy?.isPrimary, | |
| 24122 | + operators | |
| 24123 | + }; | |
| 24124 | +} | |
| 24125 | +var get_filter_by_default = getFilterBy; | |
| 24126 | + | |
| 24127 | +// packages/dataviews/build-module/field-types/utils/get-value-from-id.mjs | |
| 24128 | +var getValueFromId = (id) => ({ item }) => { | |
| 24129 | + const path = id.split("."); | |
| 24130 | + let value = item; | |
| 24131 | + for (const segment of path) { | |
| 24132 | + if (value.hasOwnProperty(segment)) { | |
| 24133 | + value = value[segment]; | |
| 24134 | + } else { | |
| 24135 | + value = void 0; | |
| 24136 | + } | |
| 24137 | + } | |
| 24138 | + return value; | |
| 24139 | +}; | |
| 24140 | +var get_value_from_id_default = getValueFromId; | |
| 24141 | + | |
| 24142 | +// packages/dataviews/build-module/field-types/utils/set-value-from-id.mjs | |
| 24143 | +var setValueFromId = (id) => ({ value }) => { | |
| 24144 | + const path = id.split("."); | |
| 232 | 24145 | const result = {}; |
| 233 | - if (void 0 !== view.perPage) { | |
| 234 | - result.per_page = view.perPage; | |
| 24146 | + let current = result; | |
| 24147 | + for (const segment of path.slice(0, -1)) { | |
| 24148 | + current[segment] = {}; | |
| 24149 | + current = current[segment]; | |
| 235 | 24150 | } |
| 236 | - if (void 0 !== view.page) { | |
| 237 | - result.page = view.page; | |
| 24151 | + current[path.at(-1)] = value; | |
| 24152 | + return result; | |
| 24153 | +}; | |
| 24154 | +var set_value_from_id_default = setValueFromId; | |
| 24155 | + | |
| 24156 | +// packages/dataviews/build-module/field-types/email.mjs | |
| 24157 | +var import_i18n18 = __toESM(require_i18n(), 1); | |
| 24158 | + | |
| 24159 | +// packages/dataviews/build-module/field-types/utils/render-from-elements.mjs | |
| 24160 | +function RenderFromElements({ | |
| 24161 | + item, | |
| 24162 | + field | |
| 24163 | +}) { | |
| 24164 | + const { elements, isLoading } = useElements({ | |
| 24165 | + elements: field.elements, | |
| 24166 | + getElements: field.getElements | |
| 24167 | + }); | |
| 24168 | + const value = field.getValue({ item }); | |
| 24169 | + if (isLoading) { | |
| 24170 | + return value; | |
| 238 | 24171 | } |
| 239 | - if (![void 0, ""].includes(view.search)) { | |
| 240 | - result.search = view.search; | |
| 24172 | + if (elements.length === 0) { | |
| 24173 | + return value; | |
| 241 | 24174 | } |
| 242 | - if (void 0 !== view.sort?.field) { | |
| 243 | - result.orderby = view.sort.field; | |
| 24175 | + return elements?.find((element) => element.value === value)?.label || field.getValue({ item }); | |
| 24176 | +} | |
| 24177 | + | |
| 24178 | +// packages/dataviews/build-module/field-types/utils/render-default.mjs | |
| 24179 | +var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1); | |
| 24180 | +function render({ | |
| 24181 | + item, | |
| 24182 | + field | |
| 24183 | +}) { | |
| 24184 | + if (field.hasElements) { | |
| 24185 | + return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(RenderFromElements, { item, field }); | |
| 244 | 24186 | } |
| 245 | - if (void 0 !== view.sort?.direction) { | |
| 246 | - result.order = view.sort.direction; | |
| 24187 | + return field.getValueFormatted({ item, field }); | |
| 24188 | +} | |
| 24189 | + | |
| 24190 | +// packages/dataviews/build-module/field-types/utils/sort-text.mjs | |
| 24191 | +var sort_text_default = (a, b, direction) => { | |
| 24192 | + return direction === "asc" ? a.localeCompare(b) : b.localeCompare(a); | |
| 24193 | +}; | |
| 24194 | + | |
| 24195 | +// packages/dataviews/build-module/field-types/utils/is-valid-required.mjs | |
| 24196 | +function isValidRequired(item, field) { | |
| 24197 | + const value = field.getValue({ item }); | |
| 24198 | + return ![void 0, "", null].includes(value); | |
| 24199 | +} | |
| 24200 | + | |
| 24201 | +// packages/dataviews/build-module/field-types/utils/is-valid-min-length.mjs | |
| 24202 | +function isValidMinLength(item, field) { | |
| 24203 | + if (typeof field.isValid.minLength?.constraint !== "number") { | |
| 24204 | + return false; | |
| 247 | 24205 | } |
| 24206 | + const value = field.getValue({ item }); | |
| 24207 | + if ([void 0, "", null].includes(value)) { | |
| 24208 | + return true; | |
| 24209 | + } | |
| 24210 | + return String(value).length >= field.isValid.minLength.constraint; | |
| 24211 | +} | |
| 24212 | + | |
| 24213 | +// packages/dataviews/build-module/field-types/utils/is-valid-max-length.mjs | |
| 24214 | +function isValidMaxLength(item, field) { | |
| 24215 | + if (typeof field.isValid.maxLength?.constraint !== "number") { | |
| 24216 | + return false; | |
| 24217 | + } | |
| 24218 | + const value = field.getValue({ item }); | |
| 24219 | + if ([void 0, "", null].includes(value)) { | |
| 24220 | + return true; | |
| 24221 | + } | |
| 24222 | + return String(value).length <= field.isValid.maxLength.constraint; | |
| 24223 | +} | |
| 24224 | + | |
| 24225 | +// packages/dataviews/build-module/field-types/utils/is-valid-pattern.mjs | |
| 24226 | +function isValidPattern(item, field) { | |
| 24227 | + if (field.isValid.pattern?.constraint === void 0) { | |
| 24228 | + return true; | |
| 24229 | + } | |
| 24230 | + try { | |
| 24231 | + const regexp = new RegExp(field.isValid.pattern.constraint); | |
| 24232 | + const value = field.getValue({ item }); | |
| 24233 | + if ([void 0, "", null].includes(value)) { | |
| 24234 | + return true; | |
| 24235 | + } | |
| 24236 | + return regexp.test(String(value)); | |
| 24237 | + } catch { | |
| 24238 | + return false; | |
| 24239 | + } | |
| 24240 | +} | |
| 24241 | + | |
| 24242 | +// packages/dataviews/build-module/field-types/utils/is-valid-elements.mjs | |
| 24243 | +function isValidElements(item, field) { | |
| 24244 | + const elements = field.elements ?? []; | |
| 24245 | + const validValues = elements.map((el) => el.value); | |
| 24246 | + if (validValues.length === 0) { | |
| 24247 | + return true; | |
| 24248 | + } | |
| 24249 | + const value = field.getValue({ item }); | |
| 24250 | + return [].concat(value).every((v2) => validValues.includes(v2)); | |
| 24251 | +} | |
| 24252 | + | |
| 24253 | +// packages/dataviews/build-module/field-types/utils/get-value-formatted-default.mjs | |
| 24254 | +function getValueFormatted({ | |
| 24255 | + item, | |
| 24256 | + field | |
| 24257 | +}) { | |
| 24258 | + return field.getValue({ item }); | |
| 24259 | +} | |
| 24260 | +var get_value_formatted_default_default = getValueFormatted; | |
| 24261 | + | |
| 24262 | +// packages/dataviews/build-module/field-types/email.mjs | |
| 24263 | +var emailRegex = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/; | |
| 24264 | +function isValidCustom(item, field) { | |
| 24265 | + const value = field.getValue({ item }); | |
| 24266 | + if (![void 0, "", null].includes(value) && !emailRegex.test(value)) { | |
| 24267 | + return (0, import_i18n18.__)("Value must be a valid email address."); | |
| 24268 | + } | |
| 24269 | + return null; | |
| 24270 | +} | |
| 24271 | +var email_default = { | |
| 24272 | + type: "email", | |
| 24273 | + render, | |
| 24274 | + Edit: "email", | |
| 24275 | + sort: sort_text_default, | |
| 24276 | + enableSorting: true, | |
| 24277 | + enableGlobalSearch: false, | |
| 24278 | + defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], | |
| 24279 | + validOperators: [ | |
| 24280 | + OPERATOR_IS, | |
| 24281 | + OPERATOR_IS_NOT, | |
| 24282 | + OPERATOR_CONTAINS, | |
| 24283 | + OPERATOR_NOT_CONTAINS, | |
| 24284 | + OPERATOR_STARTS_WITH, | |
| 24285 | + // Multiple selection | |
| 24286 | + OPERATOR_IS_ANY, | |
| 24287 | + OPERATOR_IS_NONE, | |
| 24288 | + OPERATOR_IS_NOT_ALL | |
| 24289 | + ], | |
| 24290 | + format: {}, | |
| 24291 | + getValueFormatted: get_value_formatted_default_default, | |
| 24292 | + validate: { | |
| 24293 | + required: isValidRequired, | |
| 24294 | + pattern: isValidPattern, | |
| 24295 | + minLength: isValidMinLength, | |
| 24296 | + maxLength: isValidMaxLength, | |
| 24297 | + elements: isValidElements, | |
| 24298 | + custom: isValidCustom | |
| 24299 | + } | |
| 24300 | +}; | |
| 24301 | + | |
| 24302 | +// packages/dataviews/build-module/field-types/integer.mjs | |
| 24303 | +var import_i18n19 = __toESM(require_i18n(), 1); | |
| 24304 | + | |
| 24305 | +// packages/dataviews/build-module/field-types/utils/sort-number.mjs | |
| 24306 | +var sort_number_default = (a, b, direction) => { | |
| 24307 | + return direction === "asc" ? a - b : b - a; | |
| 24308 | +}; | |
| 24309 | + | |
| 24310 | +// packages/dataviews/build-module/field-types/utils/is-valid-min.mjs | |
| 24311 | +function isValidMin(item, field) { | |
| 24312 | + if (typeof field.isValid.min?.constraint !== "number") { | |
| 24313 | + return false; | |
| 24314 | + } | |
| 24315 | + const value = field.getValue({ item }); | |
| 24316 | + if ([void 0, "", null].includes(value)) { | |
| 24317 | + return true; | |
| 24318 | + } | |
| 24319 | + return Number(value) >= field.isValid.min.constraint; | |
| 24320 | +} | |
| 24321 | + | |
| 24322 | +// packages/dataviews/build-module/field-types/utils/is-valid-max.mjs | |
| 24323 | +function isValidMax(item, field) { | |
| 24324 | + if (typeof field.isValid.max?.constraint !== "number") { | |
| 24325 | + return false; | |
| 24326 | + } | |
| 24327 | + const value = field.getValue({ item }); | |
| 24328 | + if ([void 0, "", null].includes(value)) { | |
| 24329 | + return true; | |
| 24330 | + } | |
| 24331 | + return Number(value) <= field.isValid.max.constraint; | |
| 24332 | +} | |
| 24333 | + | |
| 24334 | +// packages/dataviews/build-module/field-types/integer.mjs | |
| 24335 | +var format2 = { | |
| 24336 | + separatorThousand: "," | |
| 24337 | +}; | |
| 24338 | +function getValueFormatted2({ | |
| 24339 | + item, | |
| 24340 | + field | |
| 24341 | +}) { | |
| 24342 | + let value = field.getValue({ item }); | |
| 24343 | + if (value === null || value === void 0) { | |
| 24344 | + return ""; | |
| 24345 | + } | |
| 24346 | + value = Number(value); | |
| 24347 | + if (!Number.isFinite(value)) { | |
| 24348 | + return String(value); | |
| 24349 | + } | |
| 24350 | + let formatInteger; | |
| 24351 | + if (field.type !== "integer") { | |
| 24352 | + formatInteger = format2; | |
| 24353 | + } else { | |
| 24354 | + formatInteger = field.format; | |
| 24355 | + } | |
| 24356 | + const { separatorThousand } = formatInteger; | |
| 24357 | + const integerValue = Math.trunc(value); | |
| 24358 | + if (!separatorThousand) { | |
| 24359 | + return String(integerValue); | |
| 24360 | + } | |
| 24361 | + return String(integerValue).replace( | |
| 24362 | + /\B(?=(\d{3})+(?!\d))/g, | |
| 24363 | + separatorThousand | |
| 24364 | + ); | |
| 24365 | +} | |
| 24366 | +function isValidCustom2(item, field) { | |
| 24367 | + const value = field.getValue({ item }); | |
| 24368 | + if (![void 0, "", null].includes(value) && !Number.isInteger(value)) { | |
| 24369 | + return (0, import_i18n19.__)("Value must be an integer."); | |
| 24370 | + } | |
| 24371 | + return null; | |
| 24372 | +} | |
| 24373 | +var integer_default = { | |
| 24374 | + type: "integer", | |
| 24375 | + render, | |
| 24376 | + Edit: "integer", | |
| 24377 | + sort: sort_number_default, | |
| 24378 | + enableSorting: true, | |
| 24379 | + enableGlobalSearch: false, | |
| 24380 | + defaultOperators: [ | |
| 24381 | + OPERATOR_IS, | |
| 24382 | + OPERATOR_IS_NOT, | |
| 24383 | + OPERATOR_LESS_THAN, | |
| 24384 | + OPERATOR_GREATER_THAN, | |
| 24385 | + OPERATOR_LESS_THAN_OR_EQUAL, | |
| 24386 | + OPERATOR_GREATER_THAN_OR_EQUAL, | |
| 24387 | + OPERATOR_BETWEEN | |
| 24388 | + ], | |
| 24389 | + validOperators: [ | |
| 24390 | + // Single-selection | |
| 24391 | + OPERATOR_IS, | |
| 24392 | + OPERATOR_IS_NOT, | |
| 24393 | + OPERATOR_LESS_THAN, | |
| 24394 | + OPERATOR_GREATER_THAN, | |
| 24395 | + OPERATOR_LESS_THAN_OR_EQUAL, | |
| 24396 | + OPERATOR_GREATER_THAN_OR_EQUAL, | |
| 24397 | + OPERATOR_BETWEEN, | |
| 24398 | + // Multiple-selection | |
| 24399 | + OPERATOR_IS_ANY, | |
| 24400 | + OPERATOR_IS_NONE, | |
| 24401 | + OPERATOR_IS_NOT_ALL | |
| 24402 | + ], | |
| 24403 | + format: format2, | |
| 24404 | + getValueFormatted: getValueFormatted2, | |
| 24405 | + validate: { | |
| 24406 | + required: isValidRequired, | |
| 24407 | + min: isValidMin, | |
| 24408 | + max: isValidMax, | |
| 24409 | + elements: isValidElements, | |
| 24410 | + custom: isValidCustom2 | |
| 24411 | + } | |
| 24412 | +}; | |
| 24413 | + | |
| 24414 | +// packages/dataviews/build-module/field-types/number.mjs | |
| 24415 | +var import_i18n20 = __toESM(require_i18n(), 1); | |
| 24416 | +var format3 = { | |
| 24417 | + separatorThousand: ",", | |
| 24418 | + separatorDecimal: ".", | |
| 24419 | + decimals: 2 | |
| 24420 | +}; | |
| 24421 | +function getValueFormatted3({ | |
| 24422 | + item, | |
| 24423 | + field | |
| 24424 | +}) { | |
| 24425 | + let value = field.getValue({ item }); | |
| 24426 | + if (value === null || value === void 0) { | |
| 24427 | + return ""; | |
| 24428 | + } | |
| 24429 | + value = Number(value); | |
| 24430 | + if (!Number.isFinite(value)) { | |
| 24431 | + return String(value); | |
| 24432 | + } | |
| 24433 | + let formatNumber; | |
| 24434 | + if (field.type !== "number") { | |
| 24435 | + formatNumber = format3; | |
| 24436 | + } else { | |
| 24437 | + formatNumber = field.format; | |
| 24438 | + } | |
| 24439 | + const { separatorThousand, separatorDecimal, decimals } = formatNumber; | |
| 24440 | + const fixedValue = value.toFixed(decimals); | |
| 24441 | + const [integerPart, decimalPart] = fixedValue.split("."); | |
| 24442 | + const formattedInteger = separatorThousand ? integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, separatorThousand) : integerPart; | |
| 24443 | + return decimals === 0 ? formattedInteger : formattedInteger + separatorDecimal + decimalPart; | |
| 24444 | +} | |
| 24445 | +function isEmpty(value) { | |
| 24446 | + return value === "" || value === void 0 || value === null; | |
| 24447 | +} | |
| 24448 | +function isValidCustom3(item, field) { | |
| 24449 | + const value = field.getValue({ item }); | |
| 24450 | + if (!isEmpty(value) && !Number.isFinite(value)) { | |
| 24451 | + return (0, import_i18n20.__)("Value must be a number."); | |
| 24452 | + } | |
| 24453 | + return null; | |
| 24454 | +} | |
| 24455 | +var number_default = { | |
| 24456 | + type: "number", | |
| 24457 | + render, | |
| 24458 | + Edit: "number", | |
| 24459 | + sort: sort_number_default, | |
| 24460 | + enableSorting: true, | |
| 24461 | + enableGlobalSearch: false, | |
| 24462 | + defaultOperators: [ | |
| 24463 | + OPERATOR_IS, | |
| 24464 | + OPERATOR_IS_NOT, | |
| 24465 | + OPERATOR_LESS_THAN, | |
| 24466 | + OPERATOR_GREATER_THAN, | |
| 24467 | + OPERATOR_LESS_THAN_OR_EQUAL, | |
| 24468 | + OPERATOR_GREATER_THAN_OR_EQUAL, | |
| 24469 | + OPERATOR_BETWEEN | |
| 24470 | + ], | |
| 24471 | + validOperators: [ | |
| 24472 | + // Single-selection | |
| 24473 | + OPERATOR_IS, | |
| 24474 | + OPERATOR_IS_NOT, | |
| 24475 | + OPERATOR_LESS_THAN, | |
| 24476 | + OPERATOR_GREATER_THAN, | |
| 24477 | + OPERATOR_LESS_THAN_OR_EQUAL, | |
| 24478 | + OPERATOR_GREATER_THAN_OR_EQUAL, | |
| 24479 | + OPERATOR_BETWEEN, | |
| 24480 | + // Multiple-selection | |
| 24481 | + OPERATOR_IS_ANY, | |
| 24482 | + OPERATOR_IS_NONE, | |
| 24483 | + OPERATOR_IS_NOT_ALL | |
| 24484 | + ], | |
| 24485 | + format: format3, | |
| 24486 | + getValueFormatted: getValueFormatted3, | |
| 24487 | + validate: { | |
| 24488 | + required: isValidRequired, | |
| 24489 | + min: isValidMin, | |
| 24490 | + max: isValidMax, | |
| 24491 | + elements: isValidElements, | |
| 24492 | + custom: isValidCustom3 | |
| 24493 | + } | |
| 24494 | +}; | |
| 24495 | + | |
| 24496 | +// packages/dataviews/build-module/field-types/text.mjs | |
| 24497 | +var text_default = { | |
| 24498 | + type: "text", | |
| 24499 | + render, | |
| 24500 | + Edit: "text", | |
| 24501 | + sort: sort_text_default, | |
| 24502 | + enableSorting: true, | |
| 24503 | + enableGlobalSearch: false, | |
| 24504 | + defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], | |
| 24505 | + validOperators: [ | |
| 24506 | + // Single selection | |
| 24507 | + OPERATOR_IS, | |
| 24508 | + OPERATOR_IS_NOT, | |
| 24509 | + OPERATOR_CONTAINS, | |
| 24510 | + OPERATOR_NOT_CONTAINS, | |
| 24511 | + OPERATOR_STARTS_WITH, | |
| 24512 | + // Multiple selection | |
| 24513 | + OPERATOR_IS_ANY, | |
| 24514 | + OPERATOR_IS_NONE, | |
| 24515 | + OPERATOR_IS_NOT_ALL | |
| 24516 | + ], | |
| 24517 | + format: {}, | |
| 24518 | + getValueFormatted: get_value_formatted_default_default, | |
| 24519 | + validate: { | |
| 24520 | + required: isValidRequired, | |
| 24521 | + pattern: isValidPattern, | |
| 24522 | + minLength: isValidMinLength, | |
| 24523 | + maxLength: isValidMaxLength, | |
| 24524 | + elements: isValidElements | |
| 24525 | + } | |
| 24526 | +}; | |
| 24527 | + | |
| 24528 | +// packages/dataviews/build-module/field-types/datetime.mjs | |
| 24529 | +var import_date9 = __toESM(require_date(), 1); | |
| 24530 | + | |
| 24531 | +// packages/dataviews/build-module/field-types/utils/is-valid-boundary.mjs | |
| 24532 | +var import_date8 = __toESM(require_date(), 1); | |
| 24533 | +function parseDateLike(value) { | |
| 24534 | + if (!isValid(new Date(value))) { | |
| 24535 | + return null; | |
| 24536 | + } | |
| 24537 | + const parsed = (0, import_date8.getDate)(value); | |
| 24538 | + return parsed && isValid(parsed) ? parsed.getTime() : null; | |
| 24539 | +} | |
| 24540 | +function validateBoundary(item, field, boundary, parse2) { | |
| 24541 | + const constraint = field.isValid[boundary]?.constraint; | |
| 24542 | + if (typeof constraint !== "string") { | |
| 24543 | + return false; | |
| 24544 | + } | |
| 24545 | + const value = field.getValue({ item }); | |
| 24546 | + const boundaryValue = Array.isArray(value) ? value[boundary === "min" ? 0 : value.length - 1] : value; | |
| 24547 | + if (boundaryValue === void 0 || boundaryValue === null || boundaryValue === "") { | |
| 24548 | + return true; | |
| 24549 | + } | |
| 24550 | + const parsedConstraint = parse2(constraint); | |
| 24551 | + const parsedValue = parse2(String(boundaryValue)); | |
| 24552 | + if (parsedConstraint === null || parsedValue === null) { | |
| 24553 | + return false; | |
| 24554 | + } | |
| 24555 | + return boundary === "min" ? parsedValue >= parsedConstraint : parsedValue <= parsedConstraint; | |
| 24556 | +} | |
| 24557 | +function isValidMinDate(item, field) { | |
| 24558 | + return validateBoundary(item, field, "min", parseDateLike); | |
| 24559 | +} | |
| 24560 | +function isValidMaxDate(item, field) { | |
| 24561 | + return validateBoundary(item, field, "max", parseDateLike); | |
| 24562 | +} | |
| 24563 | +function isValidMinTime(item, field) { | |
| 24564 | + return validateBoundary(item, field, "min", parseTime2); | |
| 24565 | +} | |
| 24566 | +function isValidMaxTime(item, field) { | |
| 24567 | + return validateBoundary(item, field, "max", parseTime2); | |
| 24568 | +} | |
| 24569 | + | |
| 24570 | +// packages/dataviews/build-module/field-types/datetime.mjs | |
| 24571 | +var format4 = { | |
| 24572 | + datetime: (0, import_date9.getSettings)().formats.datetime, | |
| 24573 | + weekStartsOn: (0, import_date9.getSettings)().l10n.startOfWeek | |
| 24574 | +}; | |
| 24575 | +function getValueFormatted4({ | |
| 24576 | + item, | |
| 24577 | + field | |
| 24578 | +}) { | |
| 24579 | + const value = field.getValue({ item }); | |
| 24580 | + if (["", void 0, null].includes(value)) { | |
| 24581 | + return ""; | |
| 24582 | + } | |
| 24583 | + let formatDatetime; | |
| 24584 | + if (field.type !== "datetime") { | |
| 24585 | + formatDatetime = format4; | |
| 24586 | + } else { | |
| 24587 | + formatDatetime = field.format; | |
| 24588 | + } | |
| 24589 | + return (0, import_date9.dateI18n)(formatDatetime.datetime, (0, import_date9.getDate)(value)); | |
| 24590 | +} | |
| 24591 | +var sort = (a, b, direction) => { | |
| 24592 | + const timeA = new Date(a).getTime(); | |
| 24593 | + const timeB = new Date(b).getTime(); | |
| 24594 | + return direction === "asc" ? timeA - timeB : timeB - timeA; | |
| 24595 | +}; | |
| 24596 | +var datetime_default = { | |
| 24597 | + type: "datetime", | |
| 24598 | + render, | |
| 24599 | + Edit: "datetime", | |
| 24600 | + sort, | |
| 24601 | + enableSorting: true, | |
| 24602 | + enableGlobalSearch: false, | |
| 24603 | + defaultOperators: [ | |
| 24604 | + OPERATOR_ON, | |
| 24605 | + OPERATOR_NOT_ON, | |
| 24606 | + OPERATOR_BEFORE, | |
| 24607 | + OPERATOR_AFTER, | |
| 24608 | + OPERATOR_BEFORE_INC, | |
| 24609 | + OPERATOR_AFTER_INC, | |
| 24610 | + OPERATOR_IN_THE_PAST, | |
| 24611 | + OPERATOR_OVER | |
| 24612 | + ], | |
| 24613 | + validOperators: [ | |
| 24614 | + OPERATOR_ON, | |
| 24615 | + OPERATOR_NOT_ON, | |
| 24616 | + OPERATOR_BEFORE, | |
| 24617 | + OPERATOR_AFTER, | |
| 24618 | + OPERATOR_BEFORE_INC, | |
| 24619 | + OPERATOR_AFTER_INC, | |
| 24620 | + OPERATOR_IN_THE_PAST, | |
| 24621 | + OPERATOR_OVER | |
| 24622 | + ], | |
| 24623 | + format: format4, | |
| 24624 | + getValueFormatted: getValueFormatted4, | |
| 24625 | + validate: { | |
| 24626 | + required: isValidRequired, | |
| 24627 | + elements: isValidElements, | |
| 24628 | + min: isValidMinDate, | |
| 24629 | + max: isValidMaxDate | |
| 24630 | + } | |
| 24631 | +}; | |
| 24632 | + | |
| 24633 | +// packages/dataviews/build-module/field-types/date.mjs | |
| 24634 | +var import_date10 = __toESM(require_date(), 1); | |
| 24635 | +var format5 = { | |
| 24636 | + date: (0, import_date10.getSettings)().formats.date, | |
| 24637 | + weekStartsOn: (0, import_date10.getSettings)().l10n.startOfWeek | |
| 24638 | +}; | |
| 24639 | +function getValueFormatted5({ | |
| 24640 | + item, | |
| 24641 | + field | |
| 24642 | +}) { | |
| 24643 | + const value = field.getValue({ item }); | |
| 24644 | + if (["", void 0, null].includes(value)) { | |
| 24645 | + return ""; | |
| 24646 | + } | |
| 24647 | + let formatDate2; | |
| 24648 | + if (field.type !== "date") { | |
| 24649 | + formatDate2 = format5; | |
| 24650 | + } else { | |
| 24651 | + formatDate2 = field.format; | |
| 24652 | + } | |
| 24653 | + return (0, import_date10.dateI18n)(formatDate2.date, (0, import_date10.getDate)(value)); | |
| 24654 | +} | |
| 24655 | +var sort2 = (a, b, direction) => { | |
| 24656 | + const timeA = new Date(a).getTime(); | |
| 24657 | + const timeB = new Date(b).getTime(); | |
| 24658 | + return direction === "asc" ? timeA - timeB : timeB - timeA; | |
| 24659 | +}; | |
| 24660 | +var date_default = { | |
| 24661 | + type: "date", | |
| 24662 | + render, | |
| 24663 | + Edit: "date", | |
| 24664 | + sort: sort2, | |
| 24665 | + enableSorting: true, | |
| 24666 | + enableGlobalSearch: false, | |
| 24667 | + defaultOperators: [ | |
| 24668 | + OPERATOR_ON, | |
| 24669 | + OPERATOR_NOT_ON, | |
| 24670 | + OPERATOR_BEFORE, | |
| 24671 | + OPERATOR_AFTER, | |
| 24672 | + OPERATOR_BEFORE_INC, | |
| 24673 | + OPERATOR_AFTER_INC, | |
| 24674 | + OPERATOR_IN_THE_PAST, | |
| 24675 | + OPERATOR_OVER, | |
| 24676 | + OPERATOR_BETWEEN | |
| 24677 | + ], | |
| 24678 | + validOperators: [ | |
| 24679 | + OPERATOR_ON, | |
| 24680 | + OPERATOR_NOT_ON, | |
| 24681 | + OPERATOR_BEFORE, | |
| 24682 | + OPERATOR_AFTER, | |
| 24683 | + OPERATOR_BEFORE_INC, | |
| 24684 | + OPERATOR_AFTER_INC, | |
| 24685 | + OPERATOR_IN_THE_PAST, | |
| 24686 | + OPERATOR_OVER, | |
| 24687 | + OPERATOR_BETWEEN | |
| 24688 | + ], | |
| 24689 | + format: format5, | |
| 24690 | + getValueFormatted: getValueFormatted5, | |
| 24691 | + validate: { | |
| 24692 | + required: isValidRequired, | |
| 24693 | + elements: isValidElements, | |
| 24694 | + min: isValidMinDate, | |
| 24695 | + max: isValidMaxDate | |
| 24696 | + } | |
| 24697 | +}; | |
| 24698 | + | |
| 24699 | +// packages/dataviews/build-module/field-types/time.mjs | |
| 24700 | +var import_date11 = __toESM(require_date(), 1); | |
| 24701 | +var format6 = { | |
| 24702 | + time: (0, import_date11.getSettings)().formats.time | |
| 24703 | +}; | |
| 24704 | +var ANCHOR_DATE = "2000-01-01"; | |
| 24705 | +function toAnchoredDate(secondsSinceMidnight) { | |
| 24706 | + const hours = Math.floor(secondsSinceMidnight / 3600); | |
| 24707 | + const minutes = Math.floor(secondsSinceMidnight % 3600 / 60); | |
| 24708 | + const seconds = secondsSinceMidnight % 60; | |
| 24709 | + const time = [hours, minutes, seconds].map((part) => String(part).padStart(2, "0")).join(":"); | |
| 24710 | + return (0, import_date11.getDate)(`${ANCHOR_DATE}T${time}`); | |
| 24711 | +} | |
| 24712 | +function getValueFormatted6({ | |
| 24713 | + item, | |
| 24714 | + field | |
| 24715 | +}) { | |
| 24716 | + const secondsSinceMidnight = parseTime2(field.getValue({ item })); | |
| 24717 | + if (secondsSinceMidnight === null) { | |
| 24718 | + return ""; | |
| 24719 | + } | |
| 24720 | + let formatTime; | |
| 24721 | + if (field.type !== "time") { | |
| 24722 | + formatTime = format6; | |
| 24723 | + } else { | |
| 24724 | + formatTime = field.format; | |
| 24725 | + } | |
| 24726 | + return (0, import_date11.dateI18n)(formatTime.time, toAnchoredDate(secondsSinceMidnight)); | |
| 24727 | +} | |
| 24728 | +var sort3 = (a, b, direction) => { | |
| 24729 | + const timeA = parseTime2(a); | |
| 24730 | + const timeB = parseTime2(b); | |
| 24731 | + if (timeA === null || timeB === null) { | |
| 24732 | + if (timeA === timeB) { | |
| 24733 | + return 0; | |
| 24734 | + } | |
| 24735 | + return timeA === null ? 1 : -1; | |
| 24736 | + } | |
| 24737 | + return direction === "asc" ? timeA - timeB : timeB - timeA; | |
| 24738 | +}; | |
| 24739 | +var time_default = { | |
| 24740 | + type: "time", | |
| 24741 | + render, | |
| 24742 | + Edit: "time", | |
| 24743 | + sort: sort3, | |
| 24744 | + enableSorting: true, | |
| 24745 | + enableGlobalSearch: false, | |
| 24746 | + defaultOperators: [ | |
| 24747 | + OPERATOR_ON, | |
| 24748 | + OPERATOR_NOT_ON, | |
| 24749 | + OPERATOR_BEFORE, | |
| 24750 | + OPERATOR_AFTER, | |
| 24751 | + OPERATOR_BEFORE_INC, | |
| 24752 | + OPERATOR_AFTER_INC, | |
| 24753 | + OPERATOR_BETWEEN | |
| 24754 | + ], | |
| 24755 | + validOperators: [ | |
| 24756 | + OPERATOR_ON, | |
| 24757 | + OPERATOR_NOT_ON, | |
| 24758 | + OPERATOR_BEFORE, | |
| 24759 | + OPERATOR_AFTER, | |
| 24760 | + OPERATOR_BEFORE_INC, | |
| 24761 | + OPERATOR_AFTER_INC, | |
| 24762 | + OPERATOR_BETWEEN | |
| 24763 | + ], | |
| 24764 | + format: format6, | |
| 24765 | + getValueFormatted: getValueFormatted6, | |
| 24766 | + validate: { | |
| 24767 | + required: isValidRequired, | |
| 24768 | + elements: isValidElements, | |
| 24769 | + min: isValidMinTime, | |
| 24770 | + max: isValidMaxTime | |
| 24771 | + } | |
| 24772 | +}; | |
| 24773 | + | |
| 24774 | +// packages/dataviews/build-module/field-types/boolean.mjs | |
| 24775 | +var import_i18n21 = __toESM(require_i18n(), 1); | |
| 24776 | + | |
| 24777 | +// packages/dataviews/build-module/field-types/utils/is-valid-required-for-bool.mjs | |
| 24778 | +function isValidRequiredForBool(item, field) { | |
| 24779 | + const value = field.getValue({ item }); | |
| 24780 | + return value === true; | |
| 24781 | +} | |
| 24782 | + | |
| 24783 | +// packages/dataviews/build-module/field-types/boolean.mjs | |
| 24784 | +function getValueFormatted7({ | |
| 24785 | + item, | |
| 24786 | + field | |
| 24787 | +}) { | |
| 24788 | + const value = field.getValue({ item }); | |
| 24789 | + if (value === true) { | |
| 24790 | + return (0, import_i18n21.__)("True"); | |
| 24791 | + } | |
| 24792 | + if (value === false) { | |
| 24793 | + return (0, import_i18n21.__)("False"); | |
| 24794 | + } | |
| 24795 | + return ""; | |
| 24796 | +} | |
| 24797 | +function isValidCustom4(item, field) { | |
| 24798 | + const value = field.getValue({ item }); | |
| 24799 | + if (![void 0, "", null].includes(value) && ![true, false].includes(value)) { | |
| 24800 | + return (0, import_i18n21.__)("Value must be true, false, or undefined"); | |
| 24801 | + } | |
| 24802 | + return null; | |
| 24803 | +} | |
| 24804 | +var sort4 = (a, b, direction) => { | |
| 24805 | + const boolA = Boolean(a); | |
| 24806 | + const boolB = Boolean(b); | |
| 24807 | + if (boolA === boolB) { | |
| 24808 | + return 0; | |
| 24809 | + } | |
| 24810 | + if (direction === "asc") { | |
| 24811 | + return boolA ? 1 : -1; | |
| 24812 | + } | |
| 24813 | + return boolA ? -1 : 1; | |
| 24814 | +}; | |
| 24815 | +var boolean_default = { | |
| 24816 | + type: "boolean", | |
| 24817 | + render, | |
| 24818 | + Edit: "checkbox", | |
| 24819 | + sort: sort4, | |
| 24820 | + validate: { | |
| 24821 | + required: isValidRequiredForBool, | |
| 24822 | + elements: isValidElements, | |
| 24823 | + custom: isValidCustom4 | |
| 24824 | + }, | |
| 24825 | + enableSorting: true, | |
| 24826 | + enableGlobalSearch: false, | |
| 24827 | + defaultOperators: [OPERATOR_IS, OPERATOR_IS_NOT], | |
| 24828 | + validOperators: [OPERATOR_IS, OPERATOR_IS_NOT], | |
| 24829 | + format: {}, | |
| 24830 | + getValueFormatted: getValueFormatted7 | |
| 24831 | +}; | |
| 24832 | + | |
| 24833 | +// packages/dataviews/build-module/field-types/media.mjs | |
| 24834 | +var media_default = { | |
| 24835 | + type: "media", | |
| 24836 | + render: () => null, | |
| 24837 | + Edit: null, | |
| 24838 | + sort: () => 0, | |
| 24839 | + enableSorting: false, | |
| 24840 | + enableGlobalSearch: false, | |
| 24841 | + defaultOperators: [], | |
| 24842 | + validOperators: [], | |
| 24843 | + format: {}, | |
| 24844 | + getValueFormatted: get_value_formatted_default_default, | |
| 24845 | + // cannot validate any constraint, so | |
| 24846 | + // the only available validation for the field author | |
| 24847 | + // would be providing a custom validator. | |
| 24848 | + validate: {} | |
| 24849 | +}; | |
| 24850 | + | |
| 24851 | +// packages/dataviews/build-module/field-types/array.mjs | |
| 24852 | +var import_i18n22 = __toESM(require_i18n(), 1); | |
| 24853 | + | |
| 24854 | +// packages/dataviews/build-module/field-types/utils/is-valid-required-for-array.mjs | |
| 24855 | +function isValidRequiredForArray(item, field) { | |
| 24856 | + const value = field.getValue({ item }); | |
| 24857 | + return Array.isArray(value) && value.length > 0 && value.every( | |
| 24858 | + (element) => ![void 0, "", null].includes(element) | |
| 24859 | + ); | |
| 24860 | +} | |
| 24861 | + | |
| 24862 | +// packages/dataviews/build-module/field-types/array.mjs | |
| 24863 | +function getValueFormatted8({ | |
| 24864 | + item, | |
| 24865 | + field | |
| 24866 | +}) { | |
| 24867 | + const value = field.getValue({ item }); | |
| 24868 | + const arr = Array.isArray(value) ? value : []; | |
| 24869 | + return arr.join(", "); | |
| 24870 | +} | |
| 24871 | +function render2({ item, field }) { | |
| 24872 | + return getValueFormatted8({ item, field }); | |
| 24873 | +} | |
| 24874 | +function isValidCustom5(item, field) { | |
| 24875 | + const value = field.getValue({ item }); | |
| 24876 | + if ([void 0, "", null].includes(value)) { | |
| 24877 | + return null; | |
| 24878 | + } | |
| 24879 | + if (!Array.isArray(value)) { | |
| 24880 | + return (0, import_i18n22.__)("Value must be an array."); | |
| 24881 | + } | |
| 24882 | + if (!value.every((v2) => typeof v2 === "string")) { | |
| 24883 | + return (0, import_i18n22.__)("Every value must be a string."); | |
| 24884 | + } | |
| 24885 | + return null; | |
| 24886 | +} | |
| 24887 | +var sort5 = (a, b, direction) => { | |
| 24888 | + const arrA = Array.isArray(a) ? a : []; | |
| 24889 | + const arrB = Array.isArray(b) ? b : []; | |
| 24890 | + if (arrA.length !== arrB.length) { | |
| 24891 | + return direction === "asc" ? arrA.length - arrB.length : arrB.length - arrA.length; | |
| 24892 | + } | |
| 24893 | + const joinedA = arrA.join(","); | |
| 24894 | + const joinedB = arrB.join(","); | |
| 24895 | + return direction === "asc" ? joinedA.localeCompare(joinedB) : joinedB.localeCompare(joinedA); | |
| 24896 | +}; | |
| 24897 | +var array_default = { | |
| 24898 | + type: "array", | |
| 24899 | + render: render2, | |
| 24900 | + Edit: "array", | |
| 24901 | + sort: sort5, | |
| 24902 | + enableSorting: true, | |
| 24903 | + enableGlobalSearch: false, | |
| 24904 | + defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], | |
| 24905 | + validOperators: [ | |
| 24906 | + OPERATOR_IS_ANY, | |
| 24907 | + OPERATOR_IS_NONE, | |
| 24908 | + OPERATOR_IS_ALL, | |
| 24909 | + OPERATOR_IS_NOT_ALL | |
| 24910 | + ], | |
| 24911 | + format: {}, | |
| 24912 | + getValueFormatted: getValueFormatted8, | |
| 24913 | + validate: { | |
| 24914 | + required: isValidRequiredForArray, | |
| 24915 | + elements: isValidElements, | |
| 24916 | + custom: isValidCustom5 | |
| 24917 | + } | |
| 24918 | +}; | |
| 24919 | + | |
| 24920 | +// packages/dataviews/build-module/field-types/password.mjs | |
| 24921 | +function getValueFormatted9({ | |
| 24922 | + item, | |
| 24923 | + field | |
| 24924 | +}) { | |
| 24925 | + return field.getValue({ item }) ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : ""; | |
| 24926 | +} | |
| 24927 | +var password_default = { | |
| 24928 | + type: "password", | |
| 24929 | + render, | |
| 24930 | + Edit: "password", | |
| 24931 | + sort: () => 0, | |
| 24932 | + // Passwords should not be sortable for security reasons | |
| 24933 | + enableSorting: false, | |
| 24934 | + enableGlobalSearch: false, | |
| 24935 | + defaultOperators: [], | |
| 24936 | + validOperators: [], | |
| 24937 | + format: {}, | |
| 24938 | + getValueFormatted: getValueFormatted9, | |
| 24939 | + validate: { | |
| 24940 | + required: isValidRequired, | |
| 24941 | + pattern: isValidPattern, | |
| 24942 | + minLength: isValidMinLength, | |
| 24943 | + maxLength: isValidMaxLength, | |
| 24944 | + elements: isValidElements | |
| 24945 | + } | |
| 24946 | +}; | |
| 24947 | + | |
| 24948 | +// packages/dataviews/build-module/field-types/telephone.mjs | |
| 24949 | +var telephone_default = { | |
| 24950 | + type: "telephone", | |
| 24951 | + render, | |
| 24952 | + Edit: "telephone", | |
| 24953 | + sort: sort_text_default, | |
| 24954 | + enableSorting: true, | |
| 24955 | + enableGlobalSearch: false, | |
| 24956 | + defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], | |
| 24957 | + validOperators: [ | |
| 24958 | + OPERATOR_IS, | |
| 24959 | + OPERATOR_IS_NOT, | |
| 24960 | + OPERATOR_CONTAINS, | |
| 24961 | + OPERATOR_NOT_CONTAINS, | |
| 24962 | + OPERATOR_STARTS_WITH, | |
| 24963 | + // Multiple selection | |
| 24964 | + OPERATOR_IS_ANY, | |
| 24965 | + OPERATOR_IS_NONE, | |
| 24966 | + OPERATOR_IS_NOT_ALL | |
| 24967 | + ], | |
| 24968 | + format: {}, | |
| 24969 | + getValueFormatted: get_value_formatted_default_default, | |
| 24970 | + validate: { | |
| 24971 | + required: isValidRequired, | |
| 24972 | + pattern: isValidPattern, | |
| 24973 | + minLength: isValidMinLength, | |
| 24974 | + maxLength: isValidMaxLength, | |
| 24975 | + elements: isValidElements | |
| 24976 | + } | |
| 24977 | +}; | |
| 24978 | + | |
| 24979 | +// packages/dataviews/build-module/field-types/color.mjs | |
| 24980 | +var import_i18n23 = __toESM(require_i18n(), 1); | |
| 24981 | +var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1); | |
| 24982 | +function render3({ item, field }) { | |
| 24983 | + if (field.hasElements) { | |
| 24984 | + return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(RenderFromElements, { item, field }); | |
| 24985 | + } | |
| 24986 | + const value = get_value_formatted_default_default({ item, field }); | |
| 24987 | + if (!value || !A(value).isValid()) { | |
| 24988 | + return value; | |
| 24989 | + } | |
| 24990 | + return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [ | |
| 24991 | + /* @__PURE__ */ (0, import_jsx_runtime92.jsx)( | |
| 24992 | + "div", | |
| 24993 | + { | |
| 24994 | + style: { | |
| 24995 | + width: "16px", | |
| 24996 | + height: "16px", | |
| 24997 | + borderRadius: "50%", | |
| 24998 | + backgroundColor: value, | |
| 24999 | + border: "1px solid #ddd", | |
| 25000 | + flexShrink: 0 | |
| 25001 | + } | |
| 25002 | + } | |
| 25003 | + ), | |
| 25004 | + /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { children: value }) | |
| 25005 | + ] }); | |
| 25006 | +} | |
| 25007 | +function isValidCustom6(item, field) { | |
| 25008 | + const value = field.getValue({ item }); | |
| 25009 | + if (![void 0, "", null].includes(value) && !A(value).isValid()) { | |
| 25010 | + return (0, import_i18n23.__)("Value must be a valid color."); | |
| 25011 | + } | |
| 25012 | + return null; | |
| 25013 | +} | |
| 25014 | +var sort6 = (a, b, direction) => { | |
| 25015 | + const colorA = A(a); | |
| 25016 | + const colorB = A(b); | |
| 25017 | + if (!colorA.isValid() && !colorB.isValid()) { | |
| 25018 | + return 0; | |
| 25019 | + } | |
| 25020 | + if (!colorA.isValid()) { | |
| 25021 | + return direction === "asc" ? 1 : -1; | |
| 25022 | + } | |
| 25023 | + if (!colorB.isValid()) { | |
| 25024 | + return direction === "asc" ? -1 : 1; | |
| 25025 | + } | |
| 25026 | + const hslA = colorA.toHsl(); | |
| 25027 | + const hslB = colorB.toHsl(); | |
| 25028 | + if (hslA.h !== hslB.h) { | |
| 25029 | + return direction === "asc" ? hslA.h - hslB.h : hslB.h - hslA.h; | |
| 25030 | + } | |
| 25031 | + if (hslA.s !== hslB.s) { | |
| 25032 | + return direction === "asc" ? hslA.s - hslB.s : hslB.s - hslA.s; | |
| 25033 | + } | |
| 25034 | + return direction === "asc" ? hslA.l - hslB.l : hslB.l - hslA.l; | |
| 25035 | +}; | |
| 25036 | +var color_default = { | |
| 25037 | + type: "color", | |
| 25038 | + render: render3, | |
| 25039 | + Edit: "color", | |
| 25040 | + sort: sort6, | |
| 25041 | + enableSorting: true, | |
| 25042 | + enableGlobalSearch: false, | |
| 25043 | + defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], | |
| 25044 | + validOperators: [ | |
| 25045 | + OPERATOR_IS, | |
| 25046 | + OPERATOR_IS_NOT, | |
| 25047 | + OPERATOR_IS_ANY, | |
| 25048 | + OPERATOR_IS_NONE | |
| 25049 | + ], | |
| 25050 | + format: {}, | |
| 25051 | + getValueFormatted: get_value_formatted_default_default, | |
| 25052 | + validate: { | |
| 25053 | + required: isValidRequired, | |
| 25054 | + elements: isValidElements, | |
| 25055 | + custom: isValidCustom6 | |
| 25056 | + } | |
| 25057 | +}; | |
| 25058 | + | |
| 25059 | +// packages/dataviews/build-module/field-types/url.mjs | |
| 25060 | +var url_default = { | |
| 25061 | + type: "url", | |
| 25062 | + render, | |
| 25063 | + Edit: "url", | |
| 25064 | + sort: sort_text_default, | |
| 25065 | + enableSorting: true, | |
| 25066 | + enableGlobalSearch: false, | |
| 25067 | + defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], | |
| 25068 | + validOperators: [ | |
| 25069 | + OPERATOR_IS, | |
| 25070 | + OPERATOR_IS_NOT, | |
| 25071 | + OPERATOR_CONTAINS, | |
| 25072 | + OPERATOR_NOT_CONTAINS, | |
| 25073 | + OPERATOR_STARTS_WITH, | |
| 25074 | + // Multiple selection | |
| 25075 | + OPERATOR_IS_ANY, | |
| 25076 | + OPERATOR_IS_NONE, | |
| 25077 | + OPERATOR_IS_NOT_ALL | |
| 25078 | + ], | |
| 25079 | + format: {}, | |
| 25080 | + getValueFormatted: get_value_formatted_default_default, | |
| 25081 | + validate: { | |
| 25082 | + required: isValidRequired, | |
| 25083 | + pattern: isValidPattern, | |
| 25084 | + minLength: isValidMinLength, | |
| 25085 | + maxLength: isValidMaxLength, | |
| 25086 | + elements: isValidElements | |
| 25087 | + } | |
| 25088 | +}; | |
| 25089 | + | |
| 25090 | +// packages/dataviews/build-module/field-types/no-type.mjs | |
| 25091 | +var sort7 = (a, b, direction) => { | |
| 25092 | + if (typeof a === "number" && typeof b === "number") { | |
| 25093 | + return sort_number_default(a, b, direction); | |
| 25094 | + } | |
| 25095 | + return sort_text_default(a, b, direction); | |
| 25096 | +}; | |
| 25097 | +var no_type_default = { | |
| 25098 | + // type: no type for this one | |
| 25099 | + render, | |
| 25100 | + Edit: null, | |
| 25101 | + sort: sort7, | |
| 25102 | + enableSorting: true, | |
| 25103 | + enableGlobalSearch: false, | |
| 25104 | + defaultOperators: [OPERATOR_IS, OPERATOR_IS_NOT], | |
| 25105 | + validOperators: getAllOperatorNames(), | |
| 25106 | + format: {}, | |
| 25107 | + getValueFormatted: get_value_formatted_default_default, | |
| 25108 | + validate: { | |
| 25109 | + required: isValidRequired, | |
| 25110 | + elements: isValidElements | |
| 25111 | + } | |
| 25112 | +}; | |
| 25113 | + | |
| 25114 | +// packages/dataviews/build-module/field-types/utils/get-is-valid.mjs | |
| 25115 | +function supportsNumericRangeConstraint(type) { | |
| 25116 | + return type === "integer" || type === "number"; | |
| 25117 | +} | |
| 25118 | +function supportsStringRangeConstraint(type) { | |
| 25119 | + return type === "date" || type === "datetime" || type === "time"; | |
| 25120 | +} | |
| 25121 | +function normalizeRangeRule(value, fieldType, key) { | |
| 25122 | + const validator = fieldType.validate[key]; | |
| 25123 | + if (validator && (typeof value === "number" && supportsNumericRangeConstraint(fieldType.type) || typeof value === "string" && supportsStringRangeConstraint(fieldType.type))) { | |
| 25124 | + return { constraint: value, validate: validator }; | |
| 25125 | + } | |
| 25126 | + return void 0; | |
| 25127 | +} | |
| 25128 | +function getIsValid(field, fieldType) { | |
| 25129 | + const rules = field.isValid; | |
| 25130 | + let required; | |
| 25131 | + if (rules?.required === true && fieldType.validate.required !== void 0) { | |
| 25132 | + required = { | |
| 25133 | + constraint: true, | |
| 25134 | + validate: fieldType.validate.required | |
| 25135 | + }; | |
| 25136 | + } | |
| 25137 | + let elements; | |
| 25138 | + if ((rules?.elements === true || // elements is enabled unless the field opts-out | |
| 25139 | + rules?.elements === void 0 && (!!field.elements || !!field.getElements)) && fieldType.validate.elements !== void 0) { | |
| 25140 | + elements = { | |
| 25141 | + constraint: true, | |
| 25142 | + validate: fieldType.validate.elements | |
| 25143 | + }; | |
| 25144 | + } | |
| 25145 | + const min3 = normalizeRangeRule(rules?.min, fieldType, "min"); | |
| 25146 | + const max3 = normalizeRangeRule(rules?.max, fieldType, "max"); | |
| 25147 | + const minLengthValue = rules?.minLength; | |
| 25148 | + let minLength; | |
| 25149 | + if (typeof minLengthValue === "number" && fieldType.validate.minLength !== void 0) { | |
| 25150 | + minLength = { | |
| 25151 | + constraint: minLengthValue, | |
| 25152 | + validate: fieldType.validate.minLength | |
| 25153 | + }; | |
| 25154 | + } | |
| 25155 | + const maxLengthValue = rules?.maxLength; | |
| 25156 | + let maxLength; | |
| 25157 | + if (typeof maxLengthValue === "number" && fieldType.validate.maxLength !== void 0) { | |
| 25158 | + maxLength = { | |
| 25159 | + constraint: maxLengthValue, | |
| 25160 | + validate: fieldType.validate.maxLength | |
| 25161 | + }; | |
| 25162 | + } | |
| 25163 | + const patternValue = rules?.pattern; | |
| 25164 | + let pattern; | |
| 25165 | + if (patternValue !== void 0 && fieldType.validate.pattern !== void 0) { | |
| 25166 | + pattern = { | |
| 25167 | + constraint: patternValue, | |
| 25168 | + validate: fieldType.validate.pattern | |
| 25169 | + }; | |
| 25170 | + } | |
| 25171 | + const custom = rules?.custom ?? fieldType.validate.custom; | |
| 25172 | + return { | |
| 25173 | + required, | |
| 25174 | + elements, | |
| 25175 | + min: min3, | |
| 25176 | + max: max3, | |
| 25177 | + minLength, | |
| 25178 | + maxLength, | |
| 25179 | + pattern, | |
| 25180 | + custom | |
| 25181 | + }; | |
| 25182 | +} | |
| 25183 | + | |
| 25184 | +// packages/dataviews/build-module/field-types/utils/get-filter.mjs | |
| 25185 | +function getFilter(fieldType) { | |
| 25186 | + return fieldType.validOperators.reduce((accumulator, operator) => { | |
| 25187 | + const operatorObj = getOperatorByName(operator); | |
| 25188 | + if (operatorObj?.filter) { | |
| 25189 | + accumulator[operator] = operatorObj.filter; | |
| 25190 | + } | |
| 25191 | + return accumulator; | |
| 25192 | + }, {}); | |
| 25193 | +} | |
| 25194 | + | |
| 25195 | +// packages/dataviews/build-module/field-types/utils/get-format.mjs | |
| 25196 | +function getFormat(field, fieldType) { | |
| 25197 | + return { | |
| 25198 | + ...fieldType.format, | |
| 25199 | + ...field.format | |
| 25200 | + }; | |
| 25201 | +} | |
| 25202 | +var get_format_default = getFormat; | |
| 25203 | + | |
| 25204 | +// packages/dataviews/build-module/field-types/index.mjs | |
| 25205 | +function getFieldTypeByName(type) { | |
| 25206 | + const found = [ | |
| 25207 | + email_default, | |
| 25208 | + integer_default, | |
| 25209 | + number_default, | |
| 25210 | + text_default, | |
| 25211 | + datetime_default, | |
| 25212 | + date_default, | |
| 25213 | + time_default, | |
| 25214 | + boolean_default, | |
| 25215 | + media_default, | |
| 25216 | + array_default, | |
| 25217 | + password_default, | |
| 25218 | + telephone_default, | |
| 25219 | + color_default, | |
| 25220 | + url_default | |
| 25221 | + ].find((fieldType) => fieldType?.type === type); | |
| 25222 | + if (!!found) { | |
| 25223 | + return found; | |
| 25224 | + } | |
| 25225 | + return no_type_default; | |
| 25226 | +} | |
| 25227 | +function normalizeFields(fields) { | |
| 25228 | + return fields.map((field) => { | |
| 25229 | + const fieldType = getFieldTypeByName(field.type); | |
| 25230 | + const getValue = field.getValue || get_value_from_id_default(field.id); | |
| 25231 | + const sort8 = function(a, b, direction) { | |
| 25232 | + const aValue = getValue({ item: a }); | |
| 25233 | + const bValue = getValue({ item: b }); | |
| 25234 | + return field.sort ? field.sort(aValue, bValue, direction) : fieldType.sort(aValue, bValue, direction); | |
| 25235 | + }; | |
| 25236 | + return { | |
| 25237 | + id: field.id, | |
| 25238 | + label: field.label || field.id, | |
| 25239 | + header: field.header || field.label || field.id, | |
| 25240 | + description: field.description, | |
| 25241 | + placeholder: field.placeholder, | |
| 25242 | + getValue, | |
| 25243 | + setValue: field.setValue || set_value_from_id_default(field.id), | |
| 25244 | + elements: field.elements, | |
| 25245 | + getElements: field.getElements, | |
| 25246 | + hasElements: hasElements(field), | |
| 25247 | + isVisible: field.isVisible, | |
| 25248 | + isDisabled: typeof field.isDisabled === "function" ? field.isDisabled : () => !!field.isDisabled, | |
| 25249 | + enableHiding: field.enableHiding ?? true, | |
| 25250 | + readOnly: field.readOnly ?? false, | |
| 25251 | + // The type provides defaults for the following props | |
| 25252 | + type: fieldType.type, | |
| 25253 | + render: field.render ?? fieldType.render, | |
| 25254 | + Edit: getControl(field, fieldType.Edit), | |
| 25255 | + sort: sort8, | |
| 25256 | + enableSorting: field.enableSorting ?? fieldType.enableSorting, | |
| 25257 | + enableGlobalSearch: field.enableGlobalSearch ?? fieldType.enableGlobalSearch, | |
| 25258 | + isValid: getIsValid(field, fieldType), | |
| 25259 | + filterBy: get_filter_by_default( | |
| 25260 | + field, | |
| 25261 | + fieldType.defaultOperators, | |
| 25262 | + fieldType.validOperators | |
| 25263 | + ), | |
| 25264 | + filter: getFilter(fieldType), | |
| 25265 | + format: get_format_default(field, fieldType), | |
| 25266 | + getValueFormatted: field.getValueFormatted ?? fieldType.getValueFormatted | |
| 25267 | + }; | |
| 25268 | + }); | |
| 25269 | +} | |
| 25270 | + | |
| 25271 | +// packages/dataviews/build-module/utils/filter-sort-and-paginate.mjs | |
| 25272 | +var import_remove_accents = __toESM(require_remove_accents(), 1); | |
| 25273 | +var import_deprecated = __toESM(require_deprecated(), 1); | |
| 25274 | +function normalizeSearchInput(input = "") { | |
| 25275 | + return (0, import_remove_accents.default)(input.trim().toLowerCase()); | |
| 25276 | +} | |
| 25277 | +var EMPTY_ARRAY3 = []; | |
| 25278 | +function filterSortAndPaginate(data, view, fields) { | |
| 25279 | + if (!data) { | |
| 25280 | + return { | |
| 25281 | + data: EMPTY_ARRAY3, | |
| 25282 | + paginationInfo: { totalItems: 0, totalPages: 0 } | |
| 25283 | + }; | |
| 25284 | + } | |
| 25285 | + const _fields = normalizeFields(fields); | |
| 25286 | + let filteredData = [...data]; | |
| 25287 | + if (view.search) { | |
| 25288 | + const normalizedSearch = normalizeSearchInput(view.search); | |
| 25289 | + filteredData = filteredData.filter((item) => { | |
| 25290 | + return _fields.filter((field) => field.enableGlobalSearch).some((field) => { | |
| 25291 | + const fieldValue = field.getValue({ item }); | |
| 25292 | + const values = Array.isArray(fieldValue) ? fieldValue : [fieldValue]; | |
| 25293 | + return values.some( | |
| 25294 | + (value) => normalizeSearchInput(String(value)).includes( | |
| 25295 | + normalizedSearch | |
| 25296 | + ) | |
| 25297 | + ); | |
| 25298 | + }); | |
| 25299 | + }); | |
| 25300 | + } | |
| 25301 | + if (view.filters && view.filters?.length > 0) { | |
| 25302 | + view.filters.forEach((filter) => { | |
| 25303 | + const field = _fields.find( | |
| 25304 | + (_field) => _field.id === filter.field | |
| 25305 | + ); | |
| 25306 | + if (field) { | |
| 25307 | + if (filter.operator === OPERATOR_IS_NOT_ALL) { | |
| 25308 | + (0, import_deprecated.default)("The 'isNotAll' filter operator", { | |
| 25309 | + since: "7.0", | |
| 25310 | + alternative: "'isNone'" | |
| 25311 | + }); | |
| 25312 | + } | |
| 25313 | + const handler = field.filter[filter.operator]; | |
| 25314 | + if (handler) { | |
| 25315 | + filteredData = filteredData.filter( | |
| 25316 | + (item) => handler(item, field, filter.value) | |
| 25317 | + ); | |
| 25318 | + } | |
| 25319 | + } | |
| 25320 | + }); | |
| 25321 | + } | |
| 25322 | + const sortByField = view.sort?.field ? _fields.find((field) => { | |
| 25323 | + return field.enableSorting !== false && field.id === view.sort?.field; | |
| 25324 | + }) : null; | |
| 25325 | + const groupByField = view.groupBy?.field ? _fields.find((field) => { | |
| 25326 | + return field.enableSorting !== false && field.id === view.groupBy?.field; | |
| 25327 | + }) : null; | |
| 25328 | + if (sortByField || groupByField) { | |
| 25329 | + filteredData.sort((a, b) => { | |
| 25330 | + if (groupByField) { | |
| 25331 | + const groupCompare = groupByField.sort( | |
| 25332 | + a, | |
| 25333 | + b, | |
| 25334 | + view.groupBy?.direction ?? "asc" | |
| 25335 | + ); | |
| 25336 | + if (groupCompare !== 0) { | |
| 25337 | + return groupCompare; | |
| 25338 | + } | |
| 25339 | + } | |
| 25340 | + if (sortByField) { | |
| 25341 | + return sortByField.sort(a, b, view.sort?.direction ?? "desc"); | |
| 25342 | + } | |
| 25343 | + return 0; | |
| 25344 | + }); | |
| 25345 | + } | |
| 25346 | + let totalItems = filteredData.length; | |
| 25347 | + let totalPages = 1; | |
| 25348 | + if (view.infiniteScrollEnabled && view.startPosition !== void 0 && view.perPage !== void 0) { | |
| 25349 | + const start = view.startPosition - 1; | |
| 25350 | + const end = Math.min(start + view.perPage, totalItems); | |
| 25351 | + filteredData = filteredData?.slice(start, end); | |
| 25352 | + } else if (view.page !== void 0 && view.perPage !== void 0) { | |
| 25353 | + const start = (view.page - 1) * view.perPage; | |
| 25354 | + totalItems = filteredData?.length || 0; | |
| 25355 | + totalPages = Math.ceil(totalItems / view.perPage); | |
| 25356 | + filteredData = filteredData?.slice(start, start + view.perPage); | |
| 25357 | + } | |
| 25358 | + return { | |
| 25359 | + data: filteredData, | |
| 25360 | + paginationInfo: { | |
| 25361 | + totalItems, | |
| 25362 | + totalPages | |
| 25363 | + } | |
| 25364 | + }; | |
| 25365 | +} | |
| 25366 | + | |
| 25367 | +// routes/template-list/route.ts | |
| 25368 | +var import_i18n24 = __toESM(require_i18n()); | |
| 25369 | +import { notFound } from "@wordpress/route"; | |
| 25370 | + | |
| 25371 | +// packages/views/build-module/use-view.mjs | |
| 25372 | +var import_element74 = __toESM(require_element(), 1); | |
| 25373 | +var import_data = __toESM(require_data(), 1); | |
| 25374 | +var import_preferences = __toESM(require_preferences(), 1); | |
| 25375 | + | |
| 25376 | +// packages/views/build-module/preference-keys.mjs | |
| 25377 | +function generatePreferenceKey(kind, name, slug) { | |
| 25378 | + return `dataviews-${kind}-${name}-${slug}`; | |
| 25379 | +} | |
| 25380 | + | |
| 25381 | +// packages/views/build-module/resolve-view.mjs | |
| 25382 | +var QUERY_PARAMS = ["page", "search"]; | |
| 25383 | +function isPlainObject(value) { | |
| 25384 | + return typeof value === "object" && value !== null && !Array.isArray(value); | |
| 25385 | +} | |
| 25386 | +function withoutQueryParams(layer) { | |
| 25387 | + const result = isPlainObject(layer) ? { ...layer } : {}; | |
| 25388 | + for (const key of QUERY_PARAMS) { | |
| 25389 | + delete result[key]; | |
| 25390 | + } | |
| 248 | 25391 | return result; |
| 249 | 25392 | } |
| 25393 | +function mergeLayer(lower, upper) { | |
| 25394 | + const result = { ...lower }; | |
| 25395 | + for (const key of Object.keys(upper)) { | |
| 25396 | + const value = upper[key]; | |
| 25397 | + const current = result[key]; | |
| 25398 | + result[key] = isPlainObject(current) && isPlainObject(value) ? mergeLayer(current, value) : value; | |
| 25399 | + } | |
| 25400 | + return result; | |
| 25401 | +} | |
| 25402 | +function getLockedFilters(overrides) { | |
| 25403 | + return (overrides?.filters ?? []).filter((filter) => filter.isLocked); | |
| 25404 | +} | |
| 25405 | +function applyLockedFilters(view, overrides) { | |
| 25406 | + const locked = getLockedFilters(overrides); | |
| 25407 | + if (locked.length === 0) { | |
| 25408 | + return view; | |
| 25409 | + } | |
| 25410 | + const rest = (view.filters ?? []).filter( | |
| 25411 | + (filter) => !locked.some((f) => f.field === filter.field) | |
| 25412 | + ); | |
| 25413 | + return { ...view, filters: [...locked, ...rest] }; | |
| 25414 | +} | |
| 25415 | +function getApplicablePersistedView(persistedView, defaultLayouts) { | |
| 25416 | + if (!persistedView || persistedView.type === void 0 || !defaultLayouts || defaultLayouts[persistedView.type]) { | |
| 25417 | + return persistedView; | |
| 25418 | + } | |
| 25419 | + const { type, ...rest } = persistedView; | |
| 25420 | + return Object.keys(rest).length > 0 ? rest : void 0; | |
| 25421 | +} | |
| 25422 | +function resolveBaseView(layers, effectiveType) { | |
| 25423 | + const { defaultView, defaultLayouts, activeViewOverrides } = layers; | |
| 25424 | + const layoutDefaults = defaultLayouts?.[effectiveType]; | |
| 25425 | + return applyLockedFilters( | |
| 25426 | + [layoutDefaults, activeViewOverrides].reduce( | |
| 25427 | + (lower, upper) => mergeLayer(lower, withoutQueryParams(upper)), | |
| 25428 | + withoutQueryParams(defaultView) | |
| 25429 | + ), | |
| 25430 | + activeViewOverrides | |
| 25431 | + ); | |
| 25432 | +} | |
| 25433 | +function resolveView(args) { | |
| 25434 | + const { defaultView, defaultLayouts, activeViewOverrides, page, search } = args; | |
| 25435 | + const persistedView = getApplicablePersistedView( | |
| 25436 | + args.persistedView, | |
| 25437 | + defaultLayouts | |
| 25438 | + ); | |
| 25439 | + const effectiveType = persistedView?.type ?? activeViewOverrides?.type ?? defaultView?.type; | |
| 25440 | + const baseView = resolveBaseView(args, effectiveType); | |
| 25441 | + const view = { | |
| 25442 | + ...applyLockedFilters( | |
| 25443 | + mergeLayer(baseView, withoutQueryParams(persistedView)), | |
| 25444 | + activeViewOverrides | |
| 25445 | + ), | |
| 25446 | + page: Number(page ?? 1), | |
| 25447 | + search: search ?? "" | |
| 25448 | + }; | |
| 25449 | + return view; | |
| 25450 | +} | |
| 250 | 25451 | |
| 25452 | +// packages/views/build-module/load-view.mjs | |
| 25453 | +var import_data2 = __toESM(require_data(), 1); | |
| 25454 | +var import_preferences2 = __toESM(require_preferences(), 1); | |
| 25455 | +async function loadView(config) { | |
| 25456 | + const { | |
| 25457 | + kind, | |
| 25458 | + name, | |
| 25459 | + slug, | |
| 25460 | + defaultView, | |
| 25461 | + defaultLayouts, | |
| 25462 | + activeViewOverrides, | |
| 25463 | + queryParams | |
| 25464 | + } = config; | |
| 25465 | + const preferenceKey = generatePreferenceKey(kind, name, slug); | |
| 25466 | + const persistedView = (0, import_data2.select)( | |
| 25467 | + import_preferences2.store | |
| 25468 | + ).get("core/views", preferenceKey); | |
| 25469 | + return resolveView({ | |
| 25470 | + defaultView, | |
| 25471 | + defaultLayouts, | |
| 25472 | + activeViewOverrides, | |
| 25473 | + persistedView, | |
| 25474 | + page: queryParams?.page, | |
| 25475 | + search: queryParams?.search | |
| 25476 | + }); | |
| 25477 | +} | |
| 25478 | + | |
| 25479 | +// packages/views/build-module/use-view-config.mjs | |
| 25480 | +var import_data3 = __toESM(require_data(), 1); | |
| 25481 | +var import_core_data = __toESM(require_core_data(), 1); | |
| 25482 | + | |
| 25483 | +// packages/views/build-module/lock-unlock.mjs | |
| 25484 | +var import_private_apis2 = __toESM(require_private_apis(), 1); | |
| 25485 | +var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( | |
| 25486 | + "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", | |
| 25487 | + "@wordpress/views" | |
| 25488 | +); | |
| 25489 | + | |
| 25490 | +// routes/template-list/view-utils.ts | |
| 25491 | +var import_data4 = __toESM(require_data()); | |
| 25492 | +var import_core_data2 = __toESM(require_core_data()); | |
| 25493 | +var import_editor = __toESM(require_editor()); | |
| 25494 | + | |
| 25495 | +// routes/lock-unlock/index.ts | |
| 25496 | +var import_private_apis3 = __toESM(require_private_apis()); | |
| 25497 | +var { lock: lock3, unlock: unlock3 } = (0, import_private_apis3.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( | |
| 25498 | + "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", | |
| 25499 | + "@wordpress/routes" | |
| 25500 | +); | |
| 25501 | + | |
| 25502 | +// routes/template-list/view-utils.ts | |
| 25503 | +var TEMPLATE_POST_TYPE = "wp_template"; | |
| 25504 | +async function loadTemplateViewConfig() { | |
| 25505 | + const config = await unlock3((0, import_data4.resolveSelect)(import_core_data2.store)).getViewConfig( | |
| 25506 | + "postType", | |
| 25507 | + TEMPLATE_POST_TYPE | |
| 25508 | + ); | |
| 25509 | + return { | |
| 25510 | + default_view: config?.default_view, | |
| 25511 | + default_layouts: config?.default_layouts, | |
| 25512 | + view_list: config?.view_list | |
| 25513 | + }; | |
| 25514 | +} | |
| 25515 | +async function ensureView(activeView, search) { | |
| 25516 | + const { | |
| 25517 | + default_view: defaultView, | |
| 25518 | + default_layouts: defaultLayouts, | |
| 25519 | + view_list: viewList | |
| 25520 | + } = await loadTemplateViewConfig(); | |
| 25521 | + const slug = activeView ?? "all"; | |
| 25522 | + if (!defaultView) { | |
| 25523 | + throw new Error( | |
| 25524 | + `Missing view configuration for the ${TEMPLATE_POST_TYPE} post type.` | |
| 25525 | + ); | |
| 25526 | + } | |
| 25527 | + return loadView({ | |
| 25528 | + kind: "postType", | |
| 25529 | + name: TEMPLATE_POST_TYPE, | |
| 25530 | + slug: "default-new", | |
| 25531 | + defaultView, | |
| 25532 | + defaultLayouts, | |
| 25533 | + activeViewOverrides: viewList?.find((v2) => v2.slug === slug)?.view ?? {}, | |
| 25534 | + queryParams: search | |
| 25535 | + }); | |
| 25536 | +} | |
| 25537 | +async function loadTemplateFields() { | |
| 25538 | + await unlock3((0, import_data4.dispatch)(import_editor.store)).registerPostTypeSchema( | |
| 25539 | + TEMPLATE_POST_TYPE | |
| 25540 | + ); | |
| 25541 | + return unlock3((0, import_data4.select)(import_editor.store)).getEntityFields( | |
| 25542 | + "postType", | |
| 25543 | + TEMPLATE_POST_TYPE | |
| 25544 | + ); | |
| 25545 | +} | |
| 25546 | + | |
| 251 | 25547 | // routes/template-list/route.ts |
| 252 | 25548 | var route = { |
| 253 | - title: () => (0, import_i18n.__)("Templates"), | |
| 25549 | + async beforeLoad() { | |
| 25550 | + const theme2 = await (0, import_data5.resolveSelect)(import_core_data3.store).getCurrentTheme(); | |
| 25551 | + if (!theme2?.theme_supports?.["block-templates"]) { | |
| 25552 | + throw notFound(); | |
| 25553 | + } | |
| 25554 | + }, | |
| 25555 | + title: () => (0, import_i18n24.__)("Templates"), | |
| 254 | 25556 | async canvas(context) { |
| 255 | 25557 | const { params, search } = context; |
| 256 | 25558 | const view = await ensureView(params.activeView, { |
| 257 | 25559 | page: search.page, |
| @@ -264,29 +25566,25 @@ | ||
| 264 | 25566 | const postId = search.postIds[0].toString(); |
| 265 | 25567 | return { |
| 266 | 25568 | postType: "wp_template", |
| 267 | 25569 | postId, |
| 268 | - isPreview: true, | |
| 269 | - editLink: `/types/wp_template/edit/${encodeURIComponent( | |
| 270 | - postId | |
| 271 | - )}` | |
| 25570 | + isPreview: true | |
| 272 | 25571 | }; |
| 273 | 25572 | } |
| 274 | - const query = viewToQuery(view); | |
| 275 | - const posts = await (0, import_data4.resolveSelect)(import_core_data2.store).getEntityRecords( | |
| 276 | - "postType", | |
| 277 | - "wp_template", | |
| 278 | - { ...query, per_page: 1 } | |
| 279 | - ); | |
| 280 | - if (posts && posts.length > 0) { | |
| 281 | - const postId = posts[0].id.toString(); | |
| 25573 | + const [templates, fields] = await Promise.all([ | |
| 25574 | + (0, import_data5.resolveSelect)(import_core_data3.store).getEntityRecords( | |
| 25575 | + "postType", | |
| 25576 | + "wp_template", | |
| 25577 | + { per_page: -1 } | |
| 25578 | + ), | |
| 25579 | + loadTemplateFields() | |
| 25580 | + ]); | |
| 25581 | + const template = filterSortAndPaginate(templates ?? [], view, fields).data[0]; | |
| 25582 | + if (template) { | |
| 282 | 25583 | return { |
| 283 | 25584 | postType: "wp_template", |
| 284 | - postId, | |
| 285 | - isPreview: true, | |
| 286 | - editLink: `/types/wp_template/edit/${encodeURIComponent( | |
| 287 | - postId | |
| 288 | - )}` | |
| 25585 | + postId: template.id.toString(), | |
| 25586 | + isPreview: true | |
| 289 | 25587 | }; |
| 290 | 25588 | } |
| 291 | 25589 | return void 0; |
| 292 | 25590 | } |
| @@ -293,4 +25591,28 @@ | ||
| 293 | 25591 | }; |
| 294 | 25592 | export { |
| 295 | 25593 | route |
| 296 | 25594 | }; |
| 25595 | +/*! Bundled license information: | |
| 25596 | + | |
| 25597 | +use-sync-external-store/cjs/use-sync-external-store-shim.development.js: | |
| 25598 | + (** | |
| 25599 | + * @license React | |
| 25600 | + * use-sync-external-store-shim.development.js | |
| 25601 | + * | |
| 25602 | + * Copyright (c) Meta Platforms, Inc. and affiliates. | |
| 25603 | + * | |
| 25604 | + * This source code is licensed under the MIT license found in the | |
| 25605 | + * LICENSE file in the root directory of this source tree. | |
| 25606 | + *) | |
| 25607 | + | |
| 25608 | +use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js: | |
| 25609 | + (** | |
| 25610 | + * @license React | |
| 25611 | + * use-sync-external-store-shim/with-selector.development.js | |
| 25612 | + * | |
| 25613 | + * Copyright (c) Meta Platforms, Inc. and affiliates. | |
| 25614 | + * | |
| 25615 | + * This source code is licensed under the MIT license found in the | |
| 25616 | + * LICENSE file in the root directory of this source tree. | |
| 25617 | + *) | |
| 25618 | +*/ | |