| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 (function() { 2 "use strict"; 3 var wp; 4 (wp ||= {}).editor = (() => { 5 var __create = Object.create; 6 var __defProp = Object.defineProperty; 7 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 8 var __getOwnPropNames = Object.getOwnPropertyNames; 9 var __getProtoOf = Object.getPrototypeOf; 10 var __hasOwnProp = Object.prototype.hasOwnProperty; 11 var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, { 12 get: (a3, b3) => (typeof require !== "undefined" ? require : a3)[b3] 13 }) : x2)(function(x2) { 14 if (typeof require !== "undefined") return require.apply(this, arguments); 15 throw Error('Dynamic require of "' + x2 + '" is not supported'); 16 }); 17 var __commonJS = (cb, mod) => function __require4() { 18 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 19 }; 20 var __export = (target, all) => { 21 for (var name2 in all) 22 __defProp(target, name2, { get: all[name2], enumerable: true }); 23 }; 24 var __copyProps = (to2, from, except, desc) => { 25 if (from && typeof from === "object" || typeof from === "function") { 26 for (let key of __getOwnPropNames(from)) 27 if (!__hasOwnProp.call(to2, key) && key !== except) 28 __defProp(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 29 } 30 return to2; 31 }; 32 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 33 // If the importer is in node compatibility mode or this is not an ESM 34 // file that has been converted to a CommonJS file using a Babel- 35 // compatible transform (i.e. "__esModule" has not been set), then set 36 // "default" to the CommonJS "module.exports" for node compatibility. 37 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 38 mod 39 )); 40 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 41 42 // package-external:@wordpress/data 43 var require_data = __commonJS({ 44 "package-external:@wordpress/data"(exports, module) { 45 module.exports = window.wp.data; 46 } 47 }); 48 49 // package-external:@wordpress/core-data 50 var require_core_data = __commonJS({ 51 "package-external:@wordpress/core-data"(exports, module) { 52 module.exports = window.wp.coreData; 53 } 54 }); 55 56 // package-external:@wordpress/element 57 var require_element = __commonJS({ 58 "package-external:@wordpress/element"(exports, module) { 59 module.exports = window.wp.element; 60 } 61 }); 62 63 // package-external:@wordpress/compose 64 var require_compose = __commonJS({ 65 "package-external:@wordpress/compose"(exports, module) { 66 module.exports = window.wp.compose; 67 } 68 }); 69 70 // package-external:@wordpress/hooks 71 var require_hooks = __commonJS({ 72 "package-external:@wordpress/hooks"(exports, module) { 73 module.exports = window.wp.hooks; 74 } 75 }); 76 77 // package-external:@wordpress/block-editor 78 var require_block_editor = __commonJS({ 79 "package-external:@wordpress/block-editor"(exports, module) { 80 module.exports = window.wp.blockEditor; 81 } 82 }); 83 84 // package-external:@wordpress/blocks 85 var require_blocks = __commonJS({ 86 "package-external:@wordpress/blocks"(exports, module) { 87 module.exports = window.wp.blocks; 88 } 89 }); 90 91 // package-external:@wordpress/date 92 var require_date = __commonJS({ 93 "package-external:@wordpress/date"(exports, module) { 94 module.exports = window.wp.date; 95 } 96 }); 97 98 // package-external:@wordpress/url 99 var require_url = __commonJS({ 100 "package-external:@wordpress/url"(exports, module) { 101 module.exports = window.wp.url; 102 } 103 }); 104 105 // package-external:@wordpress/deprecated 106 var require_deprecated = __commonJS({ 107 "package-external:@wordpress/deprecated"(exports, module) { 108 module.exports = window.wp.deprecated; 109 } 110 }); 111 112 // package-external:@wordpress/preferences 113 var require_preferences = __commonJS({ 114 "package-external:@wordpress/preferences"(exports, module) { 115 module.exports = window.wp.preferences; 116 } 117 }); 118 119 // package-external:@wordpress/primitives 120 var require_primitives = __commonJS({ 121 "package-external:@wordpress/primitives"(exports, module) { 122 module.exports = window.wp.primitives; 123 } 124 }); 125 126 // vendor-external:react/jsx-runtime 127 var require_jsx_runtime = __commonJS({ 128 "vendor-external:react/jsx-runtime"(exports, module) { 129 module.exports = window.ReactJSXRuntime; 130 } 131 }); 132 133 // package-external:@wordpress/private-apis 134 var require_private_apis = __commonJS({ 135 "package-external:@wordpress/private-apis"(exports, module) { 136 module.exports = window.wp.privateApis; 137 } 138 }); 139 140 // package-external:@wordpress/style-engine 141 var require_style_engine = __commonJS({ 142 "package-external:@wordpress/style-engine"(exports, module) { 143 module.exports = window.wp.styleEngine; 144 } 145 }); 146 147 // package-external:@wordpress/i18n 148 var require_i18n = __commonJS({ 149 "package-external:@wordpress/i18n"(exports, module) { 150 module.exports = window.wp.i18n; 151 } 152 }); 153 154 // node_modules/fast-deep-equal/es6/index.js 155 var require_es6 = __commonJS({ 156 "node_modules/fast-deep-equal/es6/index.js"(exports, module) { 157 "use strict"; 158 module.exports = function equal(a3, b3) { 159 if (a3 === b3) return true; 160 if (a3 && b3 && typeof a3 == "object" && typeof b3 == "object") { 161 if (a3.constructor !== b3.constructor) return false; 162 var length2, i3, keys; 163 if (Array.isArray(a3)) { 164 length2 = a3.length; 165 if (length2 != b3.length) return false; 166 for (i3 = length2; i3-- !== 0; ) 167 if (!equal(a3[i3], b3[i3])) return false; 168 return true; 169 } 170 if (a3 instanceof Map && b3 instanceof Map) { 171 if (a3.size !== b3.size) return false; 172 for (i3 of a3.entries()) 173 if (!b3.has(i3[0])) return false; 174 for (i3 of a3.entries()) 175 if (!equal(i3[1], b3.get(i3[0]))) return false; 176 return true; 177 } 178 if (a3 instanceof Set && b3 instanceof Set) { 179 if (a3.size !== b3.size) return false; 180 for (i3 of a3.entries()) 181 if (!b3.has(i3[0])) return false; 182 return true; 183 } 184 if (ArrayBuffer.isView(a3) && ArrayBuffer.isView(b3)) { 185 length2 = a3.length; 186 if (length2 != b3.length) return false; 187 for (i3 = length2; i3-- !== 0; ) 188 if (a3[i3] !== b3[i3]) return false; 189 return true; 190 } 191 if (a3.constructor === RegExp) return a3.source === b3.source && a3.flags === b3.flags; 192 if (a3.valueOf !== Object.prototype.valueOf) return a3.valueOf() === b3.valueOf(); 193 if (a3.toString !== Object.prototype.toString) return a3.toString() === b3.toString(); 194 keys = Object.keys(a3); 195 length2 = keys.length; 196 if (length2 !== Object.keys(b3).length) return false; 197 for (i3 = length2; i3-- !== 0; ) 198 if (!Object.prototype.hasOwnProperty.call(b3, keys[i3])) return false; 199 for (i3 = length2; i3-- !== 0; ) { 200 var key = keys[i3]; 201 if (!equal(a3[key], b3[key])) return false; 202 } 203 return true; 204 } 205 return a3 !== a3 && b3 !== b3; 206 }; 207 } 208 }); 209 210 // node_modules/deepmerge/dist/cjs.js 211 var require_cjs = __commonJS({ 212 "node_modules/deepmerge/dist/cjs.js"(exports, module) { 213 "use strict"; 214 var isMergeableObject = function isMergeableObject2(value) { 215 return isNonNullObject(value) && !isSpecial(value); 216 }; 217 function isNonNullObject(value) { 218 return !!value && typeof value === "object"; 219 } 220 function isSpecial(value) { 221 var stringValue = Object.prototype.toString.call(value); 222 return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value); 223 } 224 var canUseSymbol = typeof Symbol === "function" && Symbol.for; 225 var REACT_ELEMENT_TYPE = canUseSymbol ? /* @__PURE__ */ Symbol.for("react.element") : 60103; 226 function isReactElement(value) { 227 return value.$$typeof === REACT_ELEMENT_TYPE; 228 } 229 function emptyTarget(val) { 230 return Array.isArray(val) ? [] : {}; 231 } 232 function cloneUnlessOtherwiseSpecified(value, options) { 233 return options.clone !== false && options.isMergeableObject(value) ? deepmerge2(emptyTarget(value), value, options) : value; 234 } 235 function defaultArrayMerge(target, source, options) { 236 return target.concat(source).map(function(element) { 237 return cloneUnlessOtherwiseSpecified(element, options); 238 }); 239 } 240 function getMergeFunction(key, options) { 241 if (!options.customMerge) { 242 return deepmerge2; 243 } 244 var customMerge = options.customMerge(key); 245 return typeof customMerge === "function" ? customMerge : deepmerge2; 246 } 247 function getEnumerableOwnPropertySymbols(target) { 248 return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol3) { 249 return Object.propertyIsEnumerable.call(target, symbol3); 250 }) : []; 251 } 252 function getKeys2(target) { 253 return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)); 254 } 255 function propertyIsOnObject(object, property) { 256 try { 257 return property in object; 258 } catch (_) { 259 return false; 260 } 261 } 262 function propertyIsUnsafe(target, key) { 263 return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key)); 264 } 265 function mergeObject(target, source, options) { 266 var destination = {}; 267 if (options.isMergeableObject(target)) { 268 getKeys2(target).forEach(function(key) { 269 destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); 270 }); 271 } 272 getKeys2(source).forEach(function(key) { 273 if (propertyIsUnsafe(target, key)) { 274 return; 275 } 276 if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { 277 destination[key] = getMergeFunction(key, options)(target[key], source[key], options); 278 } else { 279 destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); 280 } 281 }); 282 return destination; 283 } 284 function deepmerge2(target, source, options) { 285 options = options || {}; 286 options.arrayMerge = options.arrayMerge || defaultArrayMerge; 287 options.isMergeableObject = options.isMergeableObject || isMergeableObject; 288 options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; 289 var sourceIsArray = Array.isArray(source); 290 var targetIsArray = Array.isArray(target); 291 var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; 292 if (!sourceAndTargetTypesMatch) { 293 return cloneUnlessOtherwiseSpecified(source, options); 294 } else if (sourceIsArray) { 295 return options.arrayMerge(target, source, options); 296 } else { 297 return mergeObject(target, source, options); 298 } 299 } 300 deepmerge2.all = function deepmergeAll(array, options) { 301 if (!Array.isArray(array)) { 302 throw new Error("first argument should be an array"); 303 } 304 return array.reduce(function(prev, next) { 305 return deepmerge2(prev, next, options); 306 }, {}); 307 }; 308 var deepmerge_1 = deepmerge2; 309 module.exports = deepmerge_1; 310 } 311 }); 312 313 // package-external:@wordpress/a11y 314 var require_a11y = __commonJS({ 315 "package-external:@wordpress/a11y"(exports, module) { 316 module.exports = window.wp.a11y; 317 } 318 }); 319 320 // package-external:@wordpress/api-fetch 321 var require_api_fetch = __commonJS({ 322 "package-external:@wordpress/api-fetch"(exports, module) { 323 module.exports = window.wp.apiFetch; 324 } 325 }); 326 327 // package-external:@wordpress/notices 328 var require_notices = __commonJS({ 329 "package-external:@wordpress/notices"(exports, module) { 330 module.exports = window.wp.notices; 331 } 332 }); 333 334 // package-external:@wordpress/html-entities 335 var require_html_entities = __commonJS({ 336 "package-external:@wordpress/html-entities"(exports, module) { 337 module.exports = window.wp.htmlEntities; 338 } 339 }); 340 341 // node_modules/fast-deep-equal/index.js 342 var require_fast_deep_equal = __commonJS({ 343 "node_modules/fast-deep-equal/index.js"(exports, module) { 344 "use strict"; 345 module.exports = function equal(a3, b3) { 346 if (a3 === b3) return true; 347 if (a3 && b3 && typeof a3 == "object" && typeof b3 == "object") { 348 if (a3.constructor !== b3.constructor) return false; 349 var length2, i3, keys; 350 if (Array.isArray(a3)) { 351 length2 = a3.length; 352 if (length2 != b3.length) return false; 353 for (i3 = length2; i3-- !== 0; ) 354 if (!equal(a3[i3], b3[i3])) return false; 355 return true; 356 } 357 if (a3.constructor === RegExp) return a3.source === b3.source && a3.flags === b3.flags; 358 if (a3.valueOf !== Object.prototype.valueOf) return a3.valueOf() === b3.valueOf(); 359 if (a3.toString !== Object.prototype.toString) return a3.toString() === b3.toString(); 360 keys = Object.keys(a3); 361 length2 = keys.length; 362 if (length2 !== Object.keys(b3).length) return false; 363 for (i3 = length2; i3-- !== 0; ) 364 if (!Object.prototype.hasOwnProperty.call(b3, keys[i3])) return false; 365 for (i3 = length2; i3-- !== 0; ) { 366 var key = keys[i3]; 367 if (!equal(a3[key], b3[key])) return false; 368 } 369 return true; 370 } 371 return a3 !== a3 && b3 !== b3; 372 }; 373 } 374 }); 375 376 // package-external:@wordpress/media-utils 377 var require_media_utils = __commonJS({ 378 "package-external:@wordpress/media-utils"(exports, module) { 379 module.exports = window.wp.mediaUtils; 380 } 381 }); 382 383 // package-external:@wordpress/components 384 var require_components = __commonJS({ 385 "package-external:@wordpress/components"(exports, module) { 386 module.exports = window.wp.components; 387 } 388 }); 389 390 // package-external:@wordpress/patterns 391 var require_patterns = __commonJS({ 392 "package-external:@wordpress/patterns"(exports, module) { 393 module.exports = window.wp.patterns; 394 } 395 }); 396 397 // vendor-external:react 398 var require_react = __commonJS({ 399 "vendor-external:react"(exports, module) { 400 module.exports = window.React; 401 } 402 }); 403 404 // vendor-external:react-dom 405 var require_react_dom = __commonJS({ 406 "vendor-external:react-dom"(exports, module) { 407 module.exports = window.ReactDOM; 408 } 409 }); 410 411 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js 412 var require_use_sync_external_store_shim_development = __commonJS({ 413 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) { 414 "use strict"; 415 (function() { 416 function is2(x2, y3) { 417 return x2 === y3 && (0 !== x2 || 1 / x2 === 1 / y3) || x2 !== x2 && y3 !== y3; 418 } 419 function useSyncExternalStore$2(subscribe5, getSnapshot2) { 420 didWarnOld18Alpha || void 0 === React77.startTransition || (didWarnOld18Alpha = true, console.error( 421 "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." 422 )); 423 var value = getSnapshot2(); 424 if (!didWarnUncachedGetSnapshot) { 425 var cachedValue = getSnapshot2(); 426 objectIs(value, cachedValue) || (console.error( 427 "The result of getSnapshot should be cached to avoid an infinite loop" 428 ), didWarnUncachedGetSnapshot = true); 429 } 430 cachedValue = useState161({ 431 inst: { value, getSnapshot: getSnapshot2 } 432 }); 433 var inst = cachedValue[0].inst, forceUpdate = cachedValue[1]; 434 useLayoutEffect15( 435 function() { 436 inst.value = value; 437 inst.getSnapshot = getSnapshot2; 438 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 439 }, 440 [subscribe5, value, getSnapshot2] 441 ); 442 useEffect118( 443 function() { 444 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 445 return subscribe5(function() { 446 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 447 }); 448 }, 449 [subscribe5] 450 ); 451 useDebugValue2(value); 452 return value; 453 } 454 function checkIfSnapshotChanged(inst) { 455 var latestGetSnapshot = inst.getSnapshot; 456 inst = inst.value; 457 try { 458 var nextValue = latestGetSnapshot(); 459 return !objectIs(inst, nextValue); 460 } catch (error2) { 461 return true; 462 } 463 } 464 function useSyncExternalStore$1(subscribe5, getSnapshot2) { 465 return getSnapshot2(); 466 } 467 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); 468 var React77 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is2, useState161 = React77.useState, useEffect118 = React77.useEffect, useLayoutEffect15 = React77.useLayoutEffect, useDebugValue2 = React77.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2; 469 exports.useSyncExternalStore = void 0 !== React77.useSyncExternalStore ? React77.useSyncExternalStore : shim; 470 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); 471 })(); 472 } 473 }); 474 475 // node_modules/use-sync-external-store/shim/index.js 476 var require_shim = __commonJS({ 477 "node_modules/use-sync-external-store/shim/index.js"(exports, module) { 478 "use strict"; 479 if (false) { 480 module.exports = null; 481 } else { 482 module.exports = require_use_sync_external_store_shim_development(); 483 } 484 } 485 }); 486 487 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js 488 var require_with_selector_development = __commonJS({ 489 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) { 490 "use strict"; 491 (function() { 492 function is2(x2, y3) { 493 return x2 === y3 && (0 !== x2 || 1 / x2 === 1 / y3) || x2 !== x2 && y3 !== y3; 494 } 495 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); 496 var React77 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is2, useSyncExternalStore6 = shim.useSyncExternalStore, useRef118 = React77.useRef, useEffect118 = React77.useEffect, useMemo153 = React77.useMemo, useDebugValue2 = React77.useDebugValue; 497 exports.useSyncExternalStoreWithSelector = function(subscribe5, getSnapshot2, getServerSnapshot2, selector2, isEqual2) { 498 var instRef = useRef118(null); 499 if (null === instRef.current) { 500 var inst = { hasValue: false, value: null }; 501 instRef.current = inst; 502 } else inst = instRef.current; 503 instRef = useMemo153( 504 function() { 505 function memoizedSelector(nextSnapshot) { 506 if (!hasMemo) { 507 hasMemo = true; 508 memoizedSnapshot = nextSnapshot; 509 nextSnapshot = selector2(nextSnapshot); 510 if (void 0 !== isEqual2 && inst.hasValue) { 511 var currentSelection = inst.value; 512 if (isEqual2(currentSelection, nextSnapshot)) 513 return memoizedSelection = currentSelection; 514 } 515 return memoizedSelection = nextSnapshot; 516 } 517 currentSelection = memoizedSelection; 518 if (objectIs(memoizedSnapshot, nextSnapshot)) 519 return currentSelection; 520 var nextSelection = selector2(nextSnapshot); 521 if (void 0 !== isEqual2 && isEqual2(currentSelection, nextSelection)) 522 return memoizedSnapshot = nextSnapshot, currentSelection; 523 memoizedSnapshot = nextSnapshot; 524 return memoizedSelection = nextSelection; 525 } 526 var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot2 ? null : getServerSnapshot2; 527 return [ 528 function() { 529 return memoizedSelector(getSnapshot2()); 530 }, 531 null === maybeGetServerSnapshot ? void 0 : function() { 532 return memoizedSelector(maybeGetServerSnapshot()); 533 } 534 ]; 535 }, 536 [getSnapshot2, getServerSnapshot2, selector2, isEqual2] 537 ); 538 var value = useSyncExternalStore6(subscribe5, instRef[0], instRef[1]); 539 useEffect118( 540 function() { 541 inst.hasValue = true; 542 inst.value = value; 543 }, 544 [value] 545 ); 546 useDebugValue2(value); 547 return value; 548 }; 549 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); 550 })(); 551 } 552 }); 553 554 // node_modules/use-sync-external-store/shim/with-selector.js 555 var require_with_selector = __commonJS({ 556 "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) { 557 "use strict"; 558 if (false) { 559 module.exports = null; 560 } else { 561 module.exports = require_with_selector_development(); 562 } 563 } 564 }); 565 566 // package-external:@wordpress/theme 567 var require_theme = __commonJS({ 568 "package-external:@wordpress/theme"(exports, module) { 569 module.exports = window.wp.theme; 570 } 571 }); 572 573 // package-external:@wordpress/blob 574 var require_blob = __commonJS({ 575 "package-external:@wordpress/blob"(exports, module) { 576 module.exports = window.wp.blob; 577 } 578 }); 579 580 // node_modules/remove-accents/index.js 581 var require_remove_accents = __commonJS({ 582 "node_modules/remove-accents/index.js"(exports, module) { 583 var characterMap = { 584 "\xC0": "A", 585 "\xC1": "A", 586 "\xC2": "A", 587 "\xC3": "A", 588 "\xC4": "A", 589 "\xC5": "A", 590 "\u1EA4": "A", 591 "\u1EAE": "A", 592 "\u1EB2": "A", 593 "\u1EB4": "A", 594 "\u1EB6": "A", 595 "\xC6": "AE", 596 "\u1EA6": "A", 597 "\u1EB0": "A", 598 "\u0202": "A", 599 "\u1EA2": "A", 600 "\u1EA0": "A", 601 "\u1EA8": "A", 602 "\u1EAA": "A", 603 "\u1EAC": "A", 604 "\xC7": "C", 605 "\u1E08": "C", 606 "\xC8": "E", 607 "\xC9": "E", 608 "\xCA": "E", 609 "\xCB": "E", 610 "\u1EBE": "E", 611 "\u1E16": "E", 612 "\u1EC0": "E", 613 "\u1E14": "E", 614 "\u1E1C": "E", 615 "\u0206": "E", 616 "\u1EBA": "E", 617 "\u1EBC": "E", 618 "\u1EB8": "E", 619 "\u1EC2": "E", 620 "\u1EC4": "E", 621 "\u1EC6": "E", 622 "\xCC": "I", 623 "\xCD": "I", 624 "\xCE": "I", 625 "\xCF": "I", 626 "\u1E2E": "I", 627 "\u020A": "I", 628 "\u1EC8": "I", 629 "\u1ECA": "I", 630 "\xD0": "D", 631 "\xD1": "N", 632 "\xD2": "O", 633 "\xD3": "O", 634 "\xD4": "O", 635 "\xD5": "O", 636 "\xD6": "O", 637 "\xD8": "O", 638 "\u1ED0": "O", 639 "\u1E4C": "O", 640 "\u1E52": "O", 641 "\u020E": "O", 642 "\u1ECE": "O", 643 "\u1ECC": "O", 644 "\u1ED4": "O", 645 "\u1ED6": "O", 646 "\u1ED8": "O", 647 "\u1EDC": "O", 648 "\u1EDE": "O", 649 "\u1EE0": "O", 650 "\u1EDA": "O", 651 "\u1EE2": "O", 652 "\xD9": "U", 653 "\xDA": "U", 654 "\xDB": "U", 655 "\xDC": "U", 656 "\u1EE6": "U", 657 "\u1EE4": "U", 658 "\u1EEC": "U", 659 "\u1EEE": "U", 660 "\u1EF0": "U", 661 "\xDD": "Y", 662 "\xE0": "a", 663 "\xE1": "a", 664 "\xE2": "a", 665 "\xE3": "a", 666 "\xE4": "a", 667 "\xE5": "a", 668 "\u1EA5": "a", 669 "\u1EAF": "a", 670 "\u1EB3": "a", 671 "\u1EB5": "a", 672 "\u1EB7": "a", 673 "\xE6": "ae", 674 "\u1EA7": "a", 675 "\u1EB1": "a", 676 "\u0203": "a", 677 "\u1EA3": "a", 678 "\u1EA1": "a", 679 "\u1EA9": "a", 680 "\u1EAB": "a", 681 "\u1EAD": "a", 682 "\xE7": "c", 683 "\u1E09": "c", 684 "\xE8": "e", 685 "\xE9": "e", 686 "\xEA": "e", 687 "\xEB": "e", 688 "\u1EBF": "e", 689 "\u1E17": "e", 690 "\u1EC1": "e", 691 "\u1E15": "e", 692 "\u1E1D": "e", 693 "\u0207": "e", 694 "\u1EBB": "e", 695 "\u1EBD": "e", 696 "\u1EB9": "e", 697 "\u1EC3": "e", 698 "\u1EC5": "e", 699 "\u1EC7": "e", 700 "\xEC": "i", 701 "\xED": "i", 702 "\xEE": "i", 703 "\xEF": "i", 704 "\u1E2F": "i", 705 "\u020B": "i", 706 "\u1EC9": "i", 707 "\u1ECB": "i", 708 "\xF0": "d", 709 "\xF1": "n", 710 "\xF2": "o", 711 "\xF3": "o", 712 "\xF4": "o", 713 "\xF5": "o", 714 "\xF6": "o", 715 "\xF8": "o", 716 "\u1ED1": "o", 717 "\u1E4D": "o", 718 "\u1E53": "o", 719 "\u020F": "o", 720 "\u1ECF": "o", 721 "\u1ECD": "o", 722 "\u1ED5": "o", 723 "\u1ED7": "o", 724 "\u1ED9": "o", 725 "\u1EDD": "o", 726 "\u1EDF": "o", 727 "\u1EE1": "o", 728 "\u1EDB": "o", 729 "\u1EE3": "o", 730 "\xF9": "u", 731 "\xFA": "u", 732 "\xFB": "u", 733 "\xFC": "u", 734 "\u1EE7": "u", 735 "\u1EE5": "u", 736 "\u1EED": "u", 737 "\u1EEF": "u", 738 "\u1EF1": "u", 739 "\xFD": "y", 740 "\xFF": "y", 741 "\u0100": "A", 742 "\u0101": "a", 743 "\u0102": "A", 744 "\u0103": "a", 745 "\u0104": "A", 746 "\u0105": "a", 747 "\u0106": "C", 748 "\u0107": "c", 749 "\u0108": "C", 750 "\u0109": "c", 751 "\u010A": "C", 752 "\u010B": "c", 753 "\u010C": "C", 754 "\u010D": "c", 755 "C\u0306": "C", 756 "c\u0306": "c", 757 "\u010E": "D", 758 "\u010F": "d", 759 "\u0110": "D", 760 "\u0111": "d", 761 "\u0112": "E", 762 "\u0113": "e", 763 "\u0114": "E", 764 "\u0115": "e", 765 "\u0116": "E", 766 "\u0117": "e", 767 "\u0118": "E", 768 "\u0119": "e", 769 "\u011A": "E", 770 "\u011B": "e", 771 "\u011C": "G", 772 "\u01F4": "G", 773 "\u011D": "g", 774 "\u01F5": "g", 775 "\u011E": "G", 776 "\u011F": "g", 777 "\u0120": "G", 778 "\u0121": "g", 779 "\u0122": "G", 780 "\u0123": "g", 781 "\u0124": "H", 782 "\u0125": "h", 783 "\u0126": "H", 784 "\u0127": "h", 785 "\u1E2A": "H", 786 "\u1E2B": "h", 787 "\u0128": "I", 788 "\u0129": "i", 789 "\u012A": "I", 790 "\u012B": "i", 791 "\u012C": "I", 792 "\u012D": "i", 793 "\u012E": "I", 794 "\u012F": "i", 795 "\u0130": "I", 796 "\u0131": "i", 797 "\u0132": "IJ", 798 "\u0133": "ij", 799 "\u0134": "J", 800 "\u0135": "j", 801 "\u0136": "K", 802 "\u0137": "k", 803 "\u1E30": "K", 804 "\u1E31": "k", 805 "K\u0306": "K", 806 "k\u0306": "k", 807 "\u0139": "L", 808 "\u013A": "l", 809 "\u013B": "L", 810 "\u013C": "l", 811 "\u013D": "L", 812 "\u013E": "l", 813 "\u013F": "L", 814 "\u0140": "l", 815 "\u0141": "l", 816 "\u0142": "l", 817 "\u1E3E": "M", 818 "\u1E3F": "m", 819 "M\u0306": "M", 820 "m\u0306": "m", 821 "\u0143": "N", 822 "\u0144": "n", 823 "\u0145": "N", 824 "\u0146": "n", 825 "\u0147": "N", 826 "\u0148": "n", 827 "\u0149": "n", 828 "N\u0306": "N", 829 "n\u0306": "n", 830 "\u014C": "O", 831 "\u014D": "o", 832 "\u014E": "O", 833 "\u014F": "o", 834 "\u0150": "O", 835 "\u0151": "o", 836 "\u0152": "OE", 837 "\u0153": "oe", 838 "P\u0306": "P", 839 "p\u0306": "p", 840 "\u0154": "R", 841 "\u0155": "r", 842 "\u0156": "R", 843 "\u0157": "r", 844 "\u0158": "R", 845 "\u0159": "r", 846 "R\u0306": "R", 847 "r\u0306": "r", 848 "\u0212": "R", 849 "\u0213": "r", 850 "\u015A": "S", 851 "\u015B": "s", 852 "\u015C": "S", 853 "\u015D": "s", 854 "\u015E": "S", 855 "\u0218": "S", 856 "\u0219": "s", 857 "\u015F": "s", 858 "\u0160": "S", 859 "\u0161": "s", 860 "\u0162": "T", 861 "\u0163": "t", 862 "\u021B": "t", 863 "\u021A": "T", 864 "\u0164": "T", 865 "\u0165": "t", 866 "\u0166": "T", 867 "\u0167": "t", 868 "T\u0306": "T", 869 "t\u0306": "t", 870 "\u0168": "U", 871 "\u0169": "u", 872 "\u016A": "U", 873 "\u016B": "u", 874 "\u016C": "U", 875 "\u016D": "u", 876 "\u016E": "U", 877 "\u016F": "u", 878 "\u0170": "U", 879 "\u0171": "u", 880 "\u0172": "U", 881 "\u0173": "u", 882 "\u0216": "U", 883 "\u0217": "u", 884 "V\u0306": "V", 885 "v\u0306": "v", 886 "\u0174": "W", 887 "\u0175": "w", 888 "\u1E82": "W", 889 "\u1E83": "w", 890 "X\u0306": "X", 891 "x\u0306": "x", 892 "\u0176": "Y", 893 "\u0177": "y", 894 "\u0178": "Y", 895 "Y\u0306": "Y", 896 "y\u0306": "y", 897 "\u0179": "Z", 898 "\u017A": "z", 899 "\u017B": "Z", 900 "\u017C": "z", 901 "\u017D": "Z", 902 "\u017E": "z", 903 "\u017F": "s", 904 "\u0192": "f", 905 "\u01A0": "O", 906 "\u01A1": "o", 907 "\u01AF": "U", 908 "\u01B0": "u", 909 "\u01CD": "A", 910 "\u01CE": "a", 911 "\u01CF": "I", 912 "\u01D0": "i", 913 "\u01D1": "O", 914 "\u01D2": "o", 915 "\u01D3": "U", 916 "\u01D4": "u", 917 "\u01D5": "U", 918 "\u01D6": "u", 919 "\u01D7": "U", 920 "\u01D8": "u", 921 "\u01D9": "U", 922 "\u01DA": "u", 923 "\u01DB": "U", 924 "\u01DC": "u", 925 "\u1EE8": "U", 926 "\u1EE9": "u", 927 "\u1E78": "U", 928 "\u1E79": "u", 929 "\u01FA": "A", 930 "\u01FB": "a", 931 "\u01FC": "AE", 932 "\u01FD": "ae", 933 "\u01FE": "O", 934 "\u01FF": "o", 935 "\xDE": "TH", 936 "\xFE": "th", 937 "\u1E54": "P", 938 "\u1E55": "p", 939 "\u1E64": "S", 940 "\u1E65": "s", 941 "X\u0301": "X", 942 "x\u0301": "x", 943 "\u0403": "\u0413", 944 "\u0453": "\u0433", 945 "\u040C": "\u041A", 946 "\u045C": "\u043A", 947 "A\u030B": "A", 948 "a\u030B": "a", 949 "E\u030B": "E", 950 "e\u030B": "e", 951 "I\u030B": "I", 952 "i\u030B": "i", 953 "\u01F8": "N", 954 "\u01F9": "n", 955 "\u1ED2": "O", 956 "\u1ED3": "o", 957 "\u1E50": "O", 958 "\u1E51": "o", 959 "\u1EEA": "U", 960 "\u1EEB": "u", 961 "\u1E80": "W", 962 "\u1E81": "w", 963 "\u1EF2": "Y", 964 "\u1EF3": "y", 965 "\u0200": "A", 966 "\u0201": "a", 967 "\u0204": "E", 968 "\u0205": "e", 969 "\u0208": "I", 970 "\u0209": "i", 971 "\u020C": "O", 972 "\u020D": "o", 973 "\u0210": "R", 974 "\u0211": "r", 975 "\u0214": "U", 976 "\u0215": "u", 977 "B\u030C": "B", 978 "b\u030C": "b", 979 "\u010C\u0323": "C", 980 "\u010D\u0323": "c", 981 "\xCA\u030C": "E", 982 "\xEA\u030C": "e", 983 "F\u030C": "F", 984 "f\u030C": "f", 985 "\u01E6": "G", 986 "\u01E7": "g", 987 "\u021E": "H", 988 "\u021F": "h", 989 "J\u030C": "J", 990 "\u01F0": "j", 991 "\u01E8": "K", 992 "\u01E9": "k", 993 "M\u030C": "M", 994 "m\u030C": "m", 995 "P\u030C": "P", 996 "p\u030C": "p", 997 "Q\u030C": "Q", 998 "q\u030C": "q", 999 "\u0158\u0329": "R", 1000 "\u0159\u0329": "r", 1001 "\u1E66": "S", 1002 "\u1E67": "s", 1003 "V\u030C": "V", 1004 "v\u030C": "v", 1005 "W\u030C": "W", 1006 "w\u030C": "w", 1007 "X\u030C": "X", 1008 "x\u030C": "x", 1009 "Y\u030C": "Y", 1010 "y\u030C": "y", 1011 "A\u0327": "A", 1012 "a\u0327": "a", 1013 "B\u0327": "B", 1014 "b\u0327": "b", 1015 "\u1E10": "D", 1016 "\u1E11": "d", 1017 "\u0228": "E", 1018 "\u0229": "e", 1019 "\u0190\u0327": "E", 1020 "\u025B\u0327": "e", 1021 "\u1E28": "H", 1022 "\u1E29": "h", 1023 "I\u0327": "I", 1024 "i\u0327": "i", 1025 "\u0197\u0327": "I", 1026 "\u0268\u0327": "i", 1027 "M\u0327": "M", 1028 "m\u0327": "m", 1029 "O\u0327": "O", 1030 "o\u0327": "o", 1031 "Q\u0327": "Q", 1032 "q\u0327": "q", 1033 "U\u0327": "U", 1034 "u\u0327": "u", 1035 "X\u0327": "X", 1036 "x\u0327": "x", 1037 "Z\u0327": "Z", 1038 "z\u0327": "z", 1039 "\u0439": "\u0438", 1040 "\u0419": "\u0418", 1041 "\u0451": "\u0435", 1042 "\u0401": "\u0415" 1043 }; 1044 var chars = Object.keys(characterMap).join("|"); 1045 var allAccents = new RegExp(chars, "g"); 1046 var firstAccent = new RegExp(chars, ""); 1047 function matcher(match3) { 1048 return characterMap[match3]; 1049 } 1050 var removeAccents6 = function(string) { 1051 return string.replace(allAccents, matcher); 1052 }; 1053 var hasAccents = function(string) { 1054 return !!string.match(firstAccent); 1055 }; 1056 module.exports = removeAccents6; 1057 module.exports.has = hasAccents; 1058 module.exports.remove = removeAccents6; 1059 } 1060 }); 1061 1062 // package-external:@wordpress/wordcount 1063 var require_wordcount = __commonJS({ 1064 "package-external:@wordpress/wordcount"(exports, module) { 1065 module.exports = window.wp.wordcount; 1066 } 1067 }); 1068 1069 // package-external:@wordpress/keycodes 1070 var require_keycodes = __commonJS({ 1071 "package-external:@wordpress/keycodes"(exports, module) { 1072 module.exports = window.wp.keycodes; 1073 } 1074 }); 1075 1076 // package-external:@wordpress/warning 1077 var require_warning = __commonJS({ 1078 "package-external:@wordpress/warning"(exports, module) { 1079 module.exports = window.wp.warning; 1080 } 1081 }); 1082 1083 // package-external:@wordpress/rich-text 1084 var require_rich_text = __commonJS({ 1085 "package-external:@wordpress/rich-text"(exports, module) { 1086 module.exports = window.wp.richText; 1087 } 1088 }); 1089 1090 // package-external:@wordpress/keyboard-shortcuts 1091 var require_keyboard_shortcuts = __commonJS({ 1092 "package-external:@wordpress/keyboard-shortcuts"(exports, module) { 1093 module.exports = window.wp.keyboardShortcuts; 1094 } 1095 }); 1096 1097 // package-external:@wordpress/viewport 1098 var require_viewport = __commonJS({ 1099 "package-external:@wordpress/viewport"(exports, module) { 1100 module.exports = window.wp.viewport; 1101 } 1102 }); 1103 1104 // package-external:@wordpress/plugins 1105 var require_plugins = __commonJS({ 1106 "package-external:@wordpress/plugins"(exports, module) { 1107 module.exports = window.wp.plugins; 1108 } 1109 }); 1110 1111 // package-external:@wordpress/block-serialization-default-parser 1112 var require_block_serialization_default_parser = __commonJS({ 1113 "package-external:@wordpress/block-serialization-default-parser"(exports, module) { 1114 module.exports = window.wp.blockSerializationDefaultParser; 1115 } 1116 }); 1117 1118 // package-external:@wordpress/commands 1119 var require_commands = __commonJS({ 1120 "package-external:@wordpress/commands"(exports, module) { 1121 module.exports = window.wp.commands; 1122 } 1123 }); 1124 1125 // package-external:@wordpress/upload-media 1126 var require_upload_media = __commonJS({ 1127 "package-external:@wordpress/upload-media"(exports, module) { 1128 module.exports = window.wp.uploadMedia; 1129 } 1130 }); 1131 1132 // package-external:@wordpress/dom 1133 var require_dom = __commonJS({ 1134 "package-external:@wordpress/dom"(exports, module) { 1135 module.exports = window.wp.dom; 1136 } 1137 }); 1138 1139 // node_modules/react-is/cjs/react-is.development.js 1140 var require_react_is_development = __commonJS({ 1141 "node_modules/react-is/cjs/react-is.development.js"(exports) { 1142 "use strict"; 1143 if (true) { 1144 (function() { 1145 "use strict"; 1146 var hasSymbol = typeof Symbol === "function" && Symbol.for; 1147 var REACT_ELEMENT_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.element") : 60103; 1148 var REACT_PORTAL_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.portal") : 60106; 1149 var REACT_FRAGMENT_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.fragment") : 60107; 1150 var REACT_STRICT_MODE_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.strict_mode") : 60108; 1151 var REACT_PROFILER_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.profiler") : 60114; 1152 var REACT_PROVIDER_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.provider") : 60109; 1153 var REACT_CONTEXT_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.context") : 60110; 1154 var REACT_ASYNC_MODE_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.async_mode") : 60111; 1155 var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.concurrent_mode") : 60111; 1156 var REACT_FORWARD_REF_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.forward_ref") : 60112; 1157 var REACT_SUSPENSE_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.suspense") : 60113; 1158 var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.suspense_list") : 60120; 1159 var REACT_MEMO_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.memo") : 60115; 1160 var REACT_LAZY_TYPE2 = hasSymbol ? /* @__PURE__ */ Symbol.for("react.lazy") : 60116; 1161 var REACT_BLOCK_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.block") : 60121; 1162 var REACT_FUNDAMENTAL_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.fundamental") : 60117; 1163 var REACT_RESPONDER_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.responder") : 60118; 1164 var REACT_SCOPE_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.scope") : 60119; 1165 function isValidElementType(type) { 1166 return typeof type === "string" || typeof type === "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. 1167 type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE2 || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); 1168 } 1169 function typeOf(object) { 1170 if (typeof object === "object" && object !== null) { 1171 var $$typeof = object.$$typeof; 1172 switch ($$typeof) { 1173 case REACT_ELEMENT_TYPE: 1174 var type = object.type; 1175 switch (type) { 1176 case REACT_ASYNC_MODE_TYPE: 1177 case REACT_CONCURRENT_MODE_TYPE: 1178 case REACT_FRAGMENT_TYPE: 1179 case REACT_PROFILER_TYPE: 1180 case REACT_STRICT_MODE_TYPE: 1181 case REACT_SUSPENSE_TYPE: 1182 return type; 1183 default: 1184 var $$typeofType = type && type.$$typeof; 1185 switch ($$typeofType) { 1186 case REACT_CONTEXT_TYPE: 1187 case REACT_FORWARD_REF_TYPE: 1188 case REACT_LAZY_TYPE2: 1189 case REACT_MEMO_TYPE: 1190 case REACT_PROVIDER_TYPE: 1191 return $$typeofType; 1192 default: 1193 return $$typeof; 1194 } 1195 } 1196 case REACT_PORTAL_TYPE: 1197 return $$typeof; 1198 } 1199 } 1200 return void 0; 1201 } 1202 var AsyncMode = REACT_ASYNC_MODE_TYPE; 1203 var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; 1204 var ContextConsumer = REACT_CONTEXT_TYPE; 1205 var ContextProvider = REACT_PROVIDER_TYPE; 1206 var Element2 = REACT_ELEMENT_TYPE; 1207 var ForwardRef = REACT_FORWARD_REF_TYPE; 1208 var Fragment124 = REACT_FRAGMENT_TYPE; 1209 var Lazy = REACT_LAZY_TYPE2; 1210 var Memo = REACT_MEMO_TYPE; 1211 var Portal2 = REACT_PORTAL_TYPE; 1212 var Profiler = REACT_PROFILER_TYPE; 1213 var StrictMode = REACT_STRICT_MODE_TYPE; 1214 var Suspense = REACT_SUSPENSE_TYPE; 1215 var hasWarnedAboutDeprecatedIsAsyncMode = false; 1216 function isAsyncMode(object) { 1217 { 1218 if (!hasWarnedAboutDeprecatedIsAsyncMode) { 1219 hasWarnedAboutDeprecatedIsAsyncMode = true; 1220 console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API."); 1221 } 1222 } 1223 return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; 1224 } 1225 function isConcurrentMode(object) { 1226 return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; 1227 } 1228 function isContextConsumer(object) { 1229 return typeOf(object) === REACT_CONTEXT_TYPE; 1230 } 1231 function isContextProvider(object) { 1232 return typeOf(object) === REACT_PROVIDER_TYPE; 1233 } 1234 function isElement3(object) { 1235 return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; 1236 } 1237 function isForwardRef(object) { 1238 return typeOf(object) === REACT_FORWARD_REF_TYPE; 1239 } 1240 function isFragment(object) { 1241 return typeOf(object) === REACT_FRAGMENT_TYPE; 1242 } 1243 function isLazy(object) { 1244 return typeOf(object) === REACT_LAZY_TYPE2; 1245 } 1246 function isMemo(object) { 1247 return typeOf(object) === REACT_MEMO_TYPE; 1248 } 1249 function isPortal(object) { 1250 return typeOf(object) === REACT_PORTAL_TYPE; 1251 } 1252 function isProfiler(object) { 1253 return typeOf(object) === REACT_PROFILER_TYPE; 1254 } 1255 function isStrictMode(object) { 1256 return typeOf(object) === REACT_STRICT_MODE_TYPE; 1257 } 1258 function isSuspense(object) { 1259 return typeOf(object) === REACT_SUSPENSE_TYPE; 1260 } 1261 exports.AsyncMode = AsyncMode; 1262 exports.ConcurrentMode = ConcurrentMode; 1263 exports.ContextConsumer = ContextConsumer; 1264 exports.ContextProvider = ContextProvider; 1265 exports.Element = Element2; 1266 exports.ForwardRef = ForwardRef; 1267 exports.Fragment = Fragment124; 1268 exports.Lazy = Lazy; 1269 exports.Memo = Memo; 1270 exports.Portal = Portal2; 1271 exports.Profiler = Profiler; 1272 exports.StrictMode = StrictMode; 1273 exports.Suspense = Suspense; 1274 exports.isAsyncMode = isAsyncMode; 1275 exports.isConcurrentMode = isConcurrentMode; 1276 exports.isContextConsumer = isContextConsumer; 1277 exports.isContextProvider = isContextProvider; 1278 exports.isElement = isElement3; 1279 exports.isForwardRef = isForwardRef; 1280 exports.isFragment = isFragment; 1281 exports.isLazy = isLazy; 1282 exports.isMemo = isMemo; 1283 exports.isPortal = isPortal; 1284 exports.isProfiler = isProfiler; 1285 exports.isStrictMode = isStrictMode; 1286 exports.isSuspense = isSuspense; 1287 exports.isValidElementType = isValidElementType; 1288 exports.typeOf = typeOf; 1289 })(); 1290 } 1291 } 1292 }); 1293 1294 // node_modules/react-is/index.js 1295 var require_react_is = __commonJS({ 1296 "node_modules/react-is/index.js"(exports, module) { 1297 "use strict"; 1298 if (false) { 1299 module.exports = null; 1300 } else { 1301 module.exports = require_react_is_development(); 1302 } 1303 } 1304 }); 1305 1306 // node_modules/object-assign/index.js 1307 var require_object_assign = __commonJS({ 1308 "node_modules/object-assign/index.js"(exports, module) { 1309 "use strict"; 1310 var getOwnPropertySymbols = Object.getOwnPropertySymbols; 1311 var hasOwnProperty2 = Object.prototype.hasOwnProperty; 1312 var propIsEnumerable = Object.prototype.propertyIsEnumerable; 1313 function toObject(val) { 1314 if (val === null || val === void 0) { 1315 throw new TypeError("Object.assign cannot be called with null or undefined"); 1316 } 1317 return Object(val); 1318 } 1319 function shouldUseNative() { 1320 try { 1321 if (!Object.assign) { 1322 return false; 1323 } 1324 var test1 = new String("abc"); 1325 test1[5] = "de"; 1326 if (Object.getOwnPropertyNames(test1)[0] === "5") { 1327 return false; 1328 } 1329 var test2 = {}; 1330 for (var i3 = 0; i3 < 10; i3++) { 1331 test2["_" + String.fromCharCode(i3)] = i3; 1332 } 1333 var order2 = Object.getOwnPropertyNames(test2).map(function(n3) { 1334 return test2[n3]; 1335 }); 1336 if (order2.join("") !== "0123456789") { 1337 return false; 1338 } 1339 var test3 = {}; 1340 "abcdefghijklmnopqrst".split("").forEach(function(letter) { 1341 test3[letter] = letter; 1342 }); 1343 if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") { 1344 return false; 1345 } 1346 return true; 1347 } catch (err) { 1348 return false; 1349 } 1350 } 1351 module.exports = shouldUseNative() ? Object.assign : function(target, source) { 1352 var from; 1353 var to2 = toObject(target); 1354 var symbols; 1355 for (var s3 = 1; s3 < arguments.length; s3++) { 1356 from = Object(arguments[s3]); 1357 for (var key in from) { 1358 if (hasOwnProperty2.call(from, key)) { 1359 to2[key] = from[key]; 1360 } 1361 } 1362 if (getOwnPropertySymbols) { 1363 symbols = getOwnPropertySymbols(from); 1364 for (var i3 = 0; i3 < symbols.length; i3++) { 1365 if (propIsEnumerable.call(from, symbols[i3])) { 1366 to2[symbols[i3]] = from[symbols[i3]]; 1367 } 1368 } 1369 } 1370 } 1371 return to2; 1372 }; 1373 } 1374 }); 1375 1376 // node_modules/prop-types/lib/ReactPropTypesSecret.js 1377 var require_ReactPropTypesSecret = __commonJS({ 1378 "node_modules/prop-types/lib/ReactPropTypesSecret.js"(exports, module) { 1379 "use strict"; 1380 var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"; 1381 module.exports = ReactPropTypesSecret; 1382 } 1383 }); 1384 1385 // node_modules/prop-types/lib/has.js 1386 var require_has = __commonJS({ 1387 "node_modules/prop-types/lib/has.js"(exports, module) { 1388 module.exports = Function.call.bind(Object.prototype.hasOwnProperty); 1389 } 1390 }); 1391 1392 // node_modules/prop-types/checkPropTypes.js 1393 var require_checkPropTypes = __commonJS({ 1394 "node_modules/prop-types/checkPropTypes.js"(exports, module) { 1395 "use strict"; 1396 var printWarning = function() { 1397 }; 1398 if (true) { 1399 ReactPropTypesSecret = require_ReactPropTypesSecret(); 1400 loggedTypeFailures = {}; 1401 has = require_has(); 1402 printWarning = function(text) { 1403 var message2 = "Warning: " + text; 1404 if (typeof console !== "undefined") { 1405 console.error(message2); 1406 } 1407 try { 1408 throw new Error(message2); 1409 } catch (x2) { 1410 } 1411 }; 1412 } 1413 var ReactPropTypesSecret; 1414 var loggedTypeFailures; 1415 var has; 1416 function checkPropTypes(typeSpecs, values, location, componentName, getStack) { 1417 if (true) { 1418 for (var typeSpecName in typeSpecs) { 1419 if (has(typeSpecs, typeSpecName)) { 1420 var error2; 1421 try { 1422 if (typeof typeSpecs[typeSpecName] !== "function") { 1423 var err = Error( 1424 (componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`." 1425 ); 1426 err.name = "Invariant Violation"; 1427 throw err; 1428 } 1429 error2 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); 1430 } catch (ex) { 1431 error2 = ex; 1432 } 1433 if (error2 && !(error2 instanceof Error)) { 1434 printWarning( 1435 (componentName || "React class") + ": type specification of " + location + " `" + typeSpecName + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof error2 + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)." 1436 ); 1437 } 1438 if (error2 instanceof Error && !(error2.message in loggedTypeFailures)) { 1439 loggedTypeFailures[error2.message] = true; 1440 var stack = getStack ? getStack() : ""; 1441 printWarning( 1442 "Failed " + location + " type: " + error2.message + (stack != null ? stack : "") 1443 ); 1444 } 1445 } 1446 } 1447 } 1448 } 1449 checkPropTypes.resetWarningCache = function() { 1450 if (true) { 1451 loggedTypeFailures = {}; 1452 } 1453 }; 1454 module.exports = checkPropTypes; 1455 } 1456 }); 1457 1458 // node_modules/prop-types/factoryWithTypeCheckers.js 1459 var require_factoryWithTypeCheckers = __commonJS({ 1460 "node_modules/prop-types/factoryWithTypeCheckers.js"(exports, module) { 1461 "use strict"; 1462 var ReactIs = require_react_is(); 1463 var assign2 = require_object_assign(); 1464 var ReactPropTypesSecret = require_ReactPropTypesSecret(); 1465 var has = require_has(); 1466 var checkPropTypes = require_checkPropTypes(); 1467 var printWarning = function() { 1468 }; 1469 if (true) { 1470 printWarning = function(text) { 1471 var message2 = "Warning: " + text; 1472 if (typeof console !== "undefined") { 1473 console.error(message2); 1474 } 1475 try { 1476 throw new Error(message2); 1477 } catch (x2) { 1478 } 1479 }; 1480 } 1481 function emptyFunctionThatReturnsNull() { 1482 return null; 1483 } 1484 module.exports = function(isValidElement5, throwOnDirectAccess) { 1485 var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator; 1486 var FAUX_ITERATOR_SYMBOL = "@@iterator"; 1487 function getIteratorFn(maybeIterable) { 1488 var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); 1489 if (typeof iteratorFn === "function") { 1490 return iteratorFn; 1491 } 1492 } 1493 var ANONYMOUS = "<<anonymous>>"; 1494 var ReactPropTypes = { 1495 array: createPrimitiveTypeChecker("array"), 1496 bigint: createPrimitiveTypeChecker("bigint"), 1497 bool: createPrimitiveTypeChecker("boolean"), 1498 func: createPrimitiveTypeChecker("function"), 1499 number: createPrimitiveTypeChecker("number"), 1500 object: createPrimitiveTypeChecker("object"), 1501 string: createPrimitiveTypeChecker("string"), 1502 symbol: createPrimitiveTypeChecker("symbol"), 1503 any: createAnyTypeChecker(), 1504 arrayOf: createArrayOfTypeChecker, 1505 element: createElementTypeChecker(), 1506 elementType: createElementTypeTypeChecker(), 1507 instanceOf: createInstanceTypeChecker, 1508 node: createNodeChecker(), 1509 objectOf: createObjectOfTypeChecker, 1510 oneOf: createEnumTypeChecker, 1511 oneOfType: createUnionTypeChecker, 1512 shape: createShapeTypeChecker, 1513 exact: createStrictShapeTypeChecker 1514 }; 1515 function is2(x2, y3) { 1516 if (x2 === y3) { 1517 return x2 !== 0 || 1 / x2 === 1 / y3; 1518 } else { 1519 return x2 !== x2 && y3 !== y3; 1520 } 1521 } 1522 function PropTypeError(message2, data) { 1523 this.message = message2; 1524 this.data = data && typeof data === "object" ? data : {}; 1525 this.stack = ""; 1526 } 1527 PropTypeError.prototype = Error.prototype; 1528 function createChainableTypeChecker(validate) { 1529 if (true) { 1530 var manualPropTypeCallCache = {}; 1531 var manualPropTypeWarningCount = 0; 1532 } 1533 function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { 1534 componentName = componentName || ANONYMOUS; 1535 propFullName = propFullName || propName; 1536 if (secret !== ReactPropTypesSecret) { 1537 if (throwOnDirectAccess) { 1538 var err = new Error( 1539 "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types" 1540 ); 1541 err.name = "Invariant Violation"; 1542 throw err; 1543 } else if (typeof console !== "undefined") { 1544 var cacheKey2 = componentName + ":" + propName; 1545 if (!manualPropTypeCallCache[cacheKey2] && // Avoid spamming the console because they are often not actionable except for lib authors 1546 manualPropTypeWarningCount < 3) { 1547 printWarning( 1548 "You are manually calling a React.PropTypes validation function for the `" + propFullName + "` prop on `" + componentName + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details." 1549 ); 1550 manualPropTypeCallCache[cacheKey2] = true; 1551 manualPropTypeWarningCount++; 1552 } 1553 } 1554 } 1555 if (props[propName] == null) { 1556 if (isRequired) { 1557 if (props[propName] === null) { 1558 return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required " + ("in `" + componentName + "`, but its value is `null`.")); 1559 } 1560 return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required in " + ("`" + componentName + "`, but its value is `undefined`.")); 1561 } 1562 return null; 1563 } else { 1564 return validate(props, propName, componentName, location, propFullName); 1565 } 1566 } 1567 var chainedCheckType = checkType.bind(null, false); 1568 chainedCheckType.isRequired = checkType.bind(null, true); 1569 return chainedCheckType; 1570 } 1571 function createPrimitiveTypeChecker(expectedType) { 1572 function validate(props, propName, componentName, location, propFullName, secret) { 1573 var propValue = props[propName]; 1574 var propType = getPropType(propValue); 1575 if (propType !== expectedType) { 1576 var preciseType = getPreciseType(propValue); 1577 return new PropTypeError( 1578 "Invalid " + location + " `" + propFullName + "` of type " + ("`" + preciseType + "` supplied to `" + componentName + "`, expected ") + ("`" + expectedType + "`."), 1579 { expectedType } 1580 ); 1581 } 1582 return null; 1583 } 1584 return createChainableTypeChecker(validate); 1585 } 1586 function createAnyTypeChecker() { 1587 return createChainableTypeChecker(emptyFunctionThatReturnsNull); 1588 } 1589 function createArrayOfTypeChecker(typeChecker) { 1590 function validate(props, propName, componentName, location, propFullName) { 1591 if (typeof typeChecker !== "function") { 1592 return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside arrayOf."); 1593 } 1594 var propValue = props[propName]; 1595 if (!Array.isArray(propValue)) { 1596 var propType = getPropType(propValue); 1597 return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an array.")); 1598 } 1599 for (var i3 = 0; i3 < propValue.length; i3++) { 1600 var error2 = typeChecker(propValue, i3, componentName, location, propFullName + "[" + i3 + "]", ReactPropTypesSecret); 1601 if (error2 instanceof Error) { 1602 return error2; 1603 } 1604 } 1605 return null; 1606 } 1607 return createChainableTypeChecker(validate); 1608 } 1609 function createElementTypeChecker() { 1610 function validate(props, propName, componentName, location, propFullName) { 1611 var propValue = props[propName]; 1612 if (!isValidElement5(propValue)) { 1613 var propType = getPropType(propValue); 1614 return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement.")); 1615 } 1616 return null; 1617 } 1618 return createChainableTypeChecker(validate); 1619 } 1620 function createElementTypeTypeChecker() { 1621 function validate(props, propName, componentName, location, propFullName) { 1622 var propValue = props[propName]; 1623 if (!ReactIs.isValidElementType(propValue)) { 1624 var propType = getPropType(propValue); 1625 return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement type.")); 1626 } 1627 return null; 1628 } 1629 return createChainableTypeChecker(validate); 1630 } 1631 function createInstanceTypeChecker(expectedClass) { 1632 function validate(props, propName, componentName, location, propFullName) { 1633 if (!(props[propName] instanceof expectedClass)) { 1634 var expectedClassName = expectedClass.name || ANONYMOUS; 1635 var actualClassName = getClassName(props[propName]); 1636 return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`.")); 1637 } 1638 return null; 1639 } 1640 return createChainableTypeChecker(validate); 1641 } 1642 function createEnumTypeChecker(expectedValues) { 1643 if (!Array.isArray(expectedValues)) { 1644 if (true) { 1645 if (arguments.length > 1) { 1646 printWarning( 1647 "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])." 1648 ); 1649 } else { 1650 printWarning("Invalid argument supplied to oneOf, expected an array."); 1651 } 1652 } 1653 return emptyFunctionThatReturnsNull; 1654 } 1655 function validate(props, propName, componentName, location, propFullName) { 1656 var propValue = props[propName]; 1657 for (var i3 = 0; i3 < expectedValues.length; i3++) { 1658 if (is2(propValue, expectedValues[i3])) { 1659 return null; 1660 } 1661 } 1662 var valuesString = JSON.stringify(expectedValues, function replacer(key, value) { 1663 var type = getPreciseType(value); 1664 if (type === "symbol") { 1665 return String(value); 1666 } 1667 return value; 1668 }); 1669 return new PropTypeError("Invalid " + location + " `" + propFullName + "` of value `" + String(propValue) + "` " + ("supplied to `" + componentName + "`, expected one of " + valuesString + ".")); 1670 } 1671 return createChainableTypeChecker(validate); 1672 } 1673 function createObjectOfTypeChecker(typeChecker) { 1674 function validate(props, propName, componentName, location, propFullName) { 1675 if (typeof typeChecker !== "function") { 1676 return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside objectOf."); 1677 } 1678 var propValue = props[propName]; 1679 var propType = getPropType(propValue); 1680 if (propType !== "object") { 1681 return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an object.")); 1682 } 1683 for (var key in propValue) { 1684 if (has(propValue, key)) { 1685 var error2 = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret); 1686 if (error2 instanceof Error) { 1687 return error2; 1688 } 1689 } 1690 } 1691 return null; 1692 } 1693 return createChainableTypeChecker(validate); 1694 } 1695 function createUnionTypeChecker(arrayOfTypeCheckers) { 1696 if (!Array.isArray(arrayOfTypeCheckers)) { 1697 true ? printWarning("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0; 1698 return emptyFunctionThatReturnsNull; 1699 } 1700 for (var i3 = 0; i3 < arrayOfTypeCheckers.length; i3++) { 1701 var checker = arrayOfTypeCheckers[i3]; 1702 if (typeof checker !== "function") { 1703 printWarning( 1704 "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + getPostfixForTypeWarning(checker) + " at index " + i3 + "." 1705 ); 1706 return emptyFunctionThatReturnsNull; 1707 } 1708 } 1709 function validate(props, propName, componentName, location, propFullName) { 1710 var expectedTypes = []; 1711 for (var i4 = 0; i4 < arrayOfTypeCheckers.length; i4++) { 1712 var checker2 = arrayOfTypeCheckers[i4]; 1713 var checkerResult = checker2(props, propName, componentName, location, propFullName, ReactPropTypesSecret); 1714 if (checkerResult == null) { 1715 return null; 1716 } 1717 if (checkerResult.data && has(checkerResult.data, "expectedType")) { 1718 expectedTypes.push(checkerResult.data.expectedType); 1719 } 1720 } 1721 var expectedTypesMessage = expectedTypes.length > 0 ? ", expected one of type [" + expectedTypes.join(", ") + "]" : ""; 1722 return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`" + expectedTypesMessage + ".")); 1723 } 1724 return createChainableTypeChecker(validate); 1725 } 1726 function createNodeChecker() { 1727 function validate(props, propName, componentName, location, propFullName) { 1728 if (!isNode3(props[propName])) { 1729 return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`, expected a ReactNode.")); 1730 } 1731 return null; 1732 } 1733 return createChainableTypeChecker(validate); 1734 } 1735 function invalidValidatorError(componentName, location, propFullName, key, type) { 1736 return new PropTypeError( 1737 (componentName || "React class") + ": " + location + " type `" + propFullName + "." + key + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + type + "`." 1738 ); 1739 } 1740 function createShapeTypeChecker(shapeTypes) { 1741 function validate(props, propName, componentName, location, propFullName) { 1742 var propValue = props[propName]; 1743 var propType = getPropType(propValue); 1744 if (propType !== "object") { 1745 return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`.")); 1746 } 1747 for (var key in shapeTypes) { 1748 var checker = shapeTypes[key]; 1749 if (typeof checker !== "function") { 1750 return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); 1751 } 1752 var error2 = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret); 1753 if (error2) { 1754 return error2; 1755 } 1756 } 1757 return null; 1758 } 1759 return createChainableTypeChecker(validate); 1760 } 1761 function createStrictShapeTypeChecker(shapeTypes) { 1762 function validate(props, propName, componentName, location, propFullName) { 1763 var propValue = props[propName]; 1764 var propType = getPropType(propValue); 1765 if (propType !== "object") { 1766 return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`.")); 1767 } 1768 var allKeys = assign2({}, props[propName], shapeTypes); 1769 for (var key in allKeys) { 1770 var checker = shapeTypes[key]; 1771 if (has(shapeTypes, key) && typeof checker !== "function") { 1772 return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); 1773 } 1774 if (!checker) { 1775 return new PropTypeError( 1776 "Invalid " + location + " `" + propFullName + "` key `" + key + "` supplied to `" + componentName + "`.\nBad object: " + JSON.stringify(props[propName], null, " ") + "\nValid keys: " + JSON.stringify(Object.keys(shapeTypes), null, " ") 1777 ); 1778 } 1779 var error2 = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret); 1780 if (error2) { 1781 return error2; 1782 } 1783 } 1784 return null; 1785 } 1786 return createChainableTypeChecker(validate); 1787 } 1788 function isNode3(propValue) { 1789 switch (typeof propValue) { 1790 case "number": 1791 case "string": 1792 case "undefined": 1793 return true; 1794 case "boolean": 1795 return !propValue; 1796 case "object": 1797 if (Array.isArray(propValue)) { 1798 return propValue.every(isNode3); 1799 } 1800 if (propValue === null || isValidElement5(propValue)) { 1801 return true; 1802 } 1803 var iteratorFn = getIteratorFn(propValue); 1804 if (iteratorFn) { 1805 var iterator = iteratorFn.call(propValue); 1806 var step; 1807 if (iteratorFn !== propValue.entries) { 1808 while (!(step = iterator.next()).done) { 1809 if (!isNode3(step.value)) { 1810 return false; 1811 } 1812 } 1813 } else { 1814 while (!(step = iterator.next()).done) { 1815 var entry = step.value; 1816 if (entry) { 1817 if (!isNode3(entry[1])) { 1818 return false; 1819 } 1820 } 1821 } 1822 } 1823 } else { 1824 return false; 1825 } 1826 return true; 1827 default: 1828 return false; 1829 } 1830 } 1831 function isSymbol(propType, propValue) { 1832 if (propType === "symbol") { 1833 return true; 1834 } 1835 if (!propValue) { 1836 return false; 1837 } 1838 if (propValue["@@toStringTag"] === "Symbol") { 1839 return true; 1840 } 1841 if (typeof Symbol === "function" && propValue instanceof Symbol) { 1842 return true; 1843 } 1844 return false; 1845 } 1846 function getPropType(propValue) { 1847 var propType = typeof propValue; 1848 if (Array.isArray(propValue)) { 1849 return "array"; 1850 } 1851 if (propValue instanceof RegExp) { 1852 return "object"; 1853 } 1854 if (isSymbol(propType, propValue)) { 1855 return "symbol"; 1856 } 1857 return propType; 1858 } 1859 function getPreciseType(propValue) { 1860 if (typeof propValue === "undefined" || propValue === null) { 1861 return "" + propValue; 1862 } 1863 var propType = getPropType(propValue); 1864 if (propType === "object") { 1865 if (propValue instanceof Date) { 1866 return "date"; 1867 } else if (propValue instanceof RegExp) { 1868 return "regexp"; 1869 } 1870 } 1871 return propType; 1872 } 1873 function getPostfixForTypeWarning(value) { 1874 var type = getPreciseType(value); 1875 switch (type) { 1876 case "array": 1877 case "object": 1878 return "an " + type; 1879 case "boolean": 1880 case "date": 1881 case "regexp": 1882 return "a " + type; 1883 default: 1884 return type; 1885 } 1886 } 1887 function getClassName(propValue) { 1888 if (!propValue.constructor || !propValue.constructor.name) { 1889 return ANONYMOUS; 1890 } 1891 return propValue.constructor.name; 1892 } 1893 ReactPropTypes.checkPropTypes = checkPropTypes; 1894 ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache; 1895 ReactPropTypes.PropTypes = ReactPropTypes; 1896 return ReactPropTypes; 1897 }; 1898 } 1899 }); 1900 1901 // node_modules/prop-types/index.js 1902 var require_prop_types = __commonJS({ 1903 "node_modules/prop-types/index.js"(exports, module) { 1904 if (true) { 1905 ReactIs = require_react_is(); 1906 throwOnDirectAccess = true; 1907 module.exports = require_factoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess); 1908 } else { 1909 module.exports = null(); 1910 } 1911 var ReactIs; 1912 var throwOnDirectAccess; 1913 } 1914 }); 1915 1916 // node_modules/autosize/dist/autosize.js 1917 var require_autosize = __commonJS({ 1918 "node_modules/autosize/dist/autosize.js"(exports, module) { 1919 (function(global, factory) { 1920 if (typeof define === "function" && define.amd) { 1921 define(["module", "exports"], factory); 1922 } else if (typeof exports !== "undefined") { 1923 factory(module, exports); 1924 } else { 1925 var mod = { 1926 exports: {} 1927 }; 1928 factory(mod, mod.exports); 1929 global.autosize = mod.exports; 1930 } 1931 })(exports, function(module2, exports2) { 1932 "use strict"; 1933 var map = typeof Map === "function" ? /* @__PURE__ */ new Map() : /* @__PURE__ */ (function() { 1934 var keys = []; 1935 var values = []; 1936 return { 1937 has: function has(key) { 1938 return keys.indexOf(key) > -1; 1939 }, 1940 get: function get(key) { 1941 return values[keys.indexOf(key)]; 1942 }, 1943 set: function set5(key, value) { 1944 if (keys.indexOf(key) === -1) { 1945 keys.push(key); 1946 values.push(value); 1947 } 1948 }, 1949 delete: function _delete(key) { 1950 var index2 = keys.indexOf(key); 1951 if (index2 > -1) { 1952 keys.splice(index2, 1); 1953 values.splice(index2, 1); 1954 } 1955 } 1956 }; 1957 })(); 1958 var createEvent = function createEvent2(name2) { 1959 return new Event(name2, { bubbles: true }); 1960 }; 1961 try { 1962 new Event("test"); 1963 } catch (e3) { 1964 createEvent = function createEvent2(name2) { 1965 var evt = document.createEvent("Event"); 1966 evt.initEvent(name2, true, false); 1967 return evt; 1968 }; 1969 } 1970 function assign2(ta) { 1971 if (!ta || !ta.nodeName || ta.nodeName !== "TEXTAREA" || map.has(ta)) return; 1972 var heightOffset = null; 1973 var clientWidth = null; 1974 var cachedHeight = null; 1975 function init2() { 1976 var style = window.getComputedStyle(ta, null); 1977 if (style.resize === "vertical") { 1978 ta.style.resize = "none"; 1979 } else if (style.resize === "both") { 1980 ta.style.resize = "horizontal"; 1981 } 1982 if (style.boxSizing === "content-box") { 1983 heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom)); 1984 } else { 1985 heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); 1986 } 1987 if (isNaN(heightOffset)) { 1988 heightOffset = 0; 1989 } 1990 update5(); 1991 } 1992 function changeOverflow(value) { 1993 { 1994 var width = ta.style.width; 1995 ta.style.width = "0px"; 1996 ta.offsetWidth; 1997 ta.style.width = width; 1998 } 1999 ta.style.overflowY = value; 2000 } 2001 function getParentOverflows(el) { 2002 var arr = []; 2003 while (el && el.parentNode && el.parentNode instanceof Element) { 2004 if (el.parentNode.scrollTop) { 2005 arr.push({ 2006 node: el.parentNode, 2007 scrollTop: el.parentNode.scrollTop 2008 }); 2009 } 2010 el = el.parentNode; 2011 } 2012 return arr; 2013 } 2014 function resize() { 2015 if (ta.scrollHeight === 0) { 2016 return; 2017 } 2018 var overflows = getParentOverflows(ta); 2019 var docTop = document.documentElement && document.documentElement.scrollTop; 2020 ta.style.height = ""; 2021 ta.style.height = ta.scrollHeight + heightOffset + "px"; 2022 clientWidth = ta.clientWidth; 2023 overflows.forEach(function(el) { 2024 el.node.scrollTop = el.scrollTop; 2025 }); 2026 if (docTop) { 2027 document.documentElement.scrollTop = docTop; 2028 } 2029 } 2030 function update5() { 2031 resize(); 2032 var styleHeight = Math.round(parseFloat(ta.style.height)); 2033 var computed = window.getComputedStyle(ta, null); 2034 var actualHeight = computed.boxSizing === "content-box" ? Math.round(parseFloat(computed.height)) : ta.offsetHeight; 2035 if (actualHeight < styleHeight) { 2036 if (computed.overflowY === "hidden") { 2037 changeOverflow("scroll"); 2038 resize(); 2039 actualHeight = computed.boxSizing === "content-box" ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; 2040 } 2041 } else { 2042 if (computed.overflowY !== "hidden") { 2043 changeOverflow("hidden"); 2044 resize(); 2045 actualHeight = computed.boxSizing === "content-box" ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; 2046 } 2047 } 2048 if (cachedHeight !== actualHeight) { 2049 cachedHeight = actualHeight; 2050 var evt = createEvent("autosize:resized"); 2051 try { 2052 ta.dispatchEvent(evt); 2053 } catch (err) { 2054 } 2055 } 2056 } 2057 var pageResize = function pageResize2() { 2058 if (ta.clientWidth !== clientWidth) { 2059 update5(); 2060 } 2061 }; 2062 var destroy2 = function(style) { 2063 window.removeEventListener("resize", pageResize, false); 2064 ta.removeEventListener("input", update5, false); 2065 ta.removeEventListener("keyup", update5, false); 2066 ta.removeEventListener("autosize:destroy", destroy2, false); 2067 ta.removeEventListener("autosize:update", update5, false); 2068 Object.keys(style).forEach(function(key) { 2069 ta.style[key] = style[key]; 2070 }); 2071 map.delete(ta); 2072 }.bind(ta, { 2073 height: ta.style.height, 2074 resize: ta.style.resize, 2075 overflowY: ta.style.overflowY, 2076 overflowX: ta.style.overflowX, 2077 wordWrap: ta.style.wordWrap 2078 }); 2079 ta.addEventListener("autosize:destroy", destroy2, false); 2080 if ("onpropertychange" in ta && "oninput" in ta) { 2081 ta.addEventListener("keyup", update5, false); 2082 } 2083 window.addEventListener("resize", pageResize, false); 2084 ta.addEventListener("input", update5, false); 2085 ta.addEventListener("autosize:update", update5, false); 2086 ta.style.overflowX = "hidden"; 2087 ta.style.wordWrap = "break-word"; 2088 map.set(ta, { 2089 destroy: destroy2, 2090 update: update5 2091 }); 2092 init2(); 2093 } 2094 function destroy(ta) { 2095 var methods = map.get(ta); 2096 if (methods) { 2097 methods.destroy(); 2098 } 2099 } 2100 function update4(ta) { 2101 var methods = map.get(ta); 2102 if (methods) { 2103 methods.update(); 2104 } 2105 } 2106 var autosize = null; 2107 if (typeof window === "undefined" || typeof window.getComputedStyle !== "function") { 2108 autosize = function autosize2(el) { 2109 return el; 2110 }; 2111 autosize.destroy = function(el) { 2112 return el; 2113 }; 2114 autosize.update = function(el) { 2115 return el; 2116 }; 2117 } else { 2118 autosize = function autosize2(el, options) { 2119 if (el) { 2120 Array.prototype.forEach.call(el.length ? el : [el], function(x2) { 2121 return assign2(x2, options); 2122 }); 2123 } 2124 return el; 2125 }; 2126 autosize.destroy = function(el) { 2127 if (el) { 2128 Array.prototype.forEach.call(el.length ? el : [el], destroy); 2129 } 2130 return el; 2131 }; 2132 autosize.update = function(el) { 2133 if (el) { 2134 Array.prototype.forEach.call(el.length ? el : [el], update4); 2135 } 2136 return el; 2137 }; 2138 } 2139 exports2.default = autosize; 2140 module2.exports = exports2["default"]; 2141 }); 2142 } 2143 }); 2144 2145 // node_modules/computed-style/dist/computedStyle.commonjs.js 2146 var require_computedStyle_commonjs = __commonJS({ 2147 "node_modules/computed-style/dist/computedStyle.commonjs.js"(exports, module) { 2148 var computedStyle = function(el, prop, getComputedStyle3) { 2149 getComputedStyle3 = window.getComputedStyle; 2150 return ( 2151 // If we have getComputedStyle 2152 (getComputedStyle3 ? ( 2153 // Query it 2154 // TODO: From CSS-Query notes, we might need (node, null) for FF 2155 getComputedStyle3(el) 2156 ) : ( 2157 // Otherwise, we are in IE and use currentStyle 2158 el.currentStyle 2159 ))[ 2160 // Switch to camelCase for CSSOM 2161 // DEV: Grabbed from jQuery 2162 // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194 2163 // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597 2164 prop.replace(/-(\w)/gi, function(word, letter) { 2165 return letter.toUpperCase(); 2166 }) 2167 ] 2168 ); 2169 }; 2170 module.exports = computedStyle; 2171 } 2172 }); 2173 2174 // node_modules/line-height/lib/line-height.js 2175 var require_line_height = __commonJS({ 2176 "node_modules/line-height/lib/line-height.js"(exports, module) { 2177 var computedStyle = require_computedStyle_commonjs(); 2178 function lineHeight(node) { 2179 var lnHeightStr = computedStyle(node, "line-height"); 2180 var lnHeight = parseFloat(lnHeightStr, 10); 2181 if (lnHeightStr === lnHeight + "") { 2182 var _lnHeightStyle = node.style.lineHeight; 2183 node.style.lineHeight = lnHeightStr + "em"; 2184 lnHeightStr = computedStyle(node, "line-height"); 2185 lnHeight = parseFloat(lnHeightStr, 10); 2186 if (_lnHeightStyle) { 2187 node.style.lineHeight = _lnHeightStyle; 2188 } else { 2189 delete node.style.lineHeight; 2190 } 2191 } 2192 if (lnHeightStr.indexOf("pt") !== -1) { 2193 lnHeight *= 4; 2194 lnHeight /= 3; 2195 } else if (lnHeightStr.indexOf("mm") !== -1) { 2196 lnHeight *= 96; 2197 lnHeight /= 25.4; 2198 } else if (lnHeightStr.indexOf("cm") !== -1) { 2199 lnHeight *= 96; 2200 lnHeight /= 2.54; 2201 } else if (lnHeightStr.indexOf("in") !== -1) { 2202 lnHeight *= 96; 2203 } else if (lnHeightStr.indexOf("pc") !== -1) { 2204 lnHeight *= 16; 2205 } 2206 lnHeight = Math.round(lnHeight); 2207 if (lnHeightStr === "normal") { 2208 var nodeName = node.nodeName; 2209 var _node = document.createElement(nodeName); 2210 _node.innerHTML = " "; 2211 if (nodeName.toUpperCase() === "TEXTAREA") { 2212 _node.setAttribute("rows", "1"); 2213 } 2214 var fontSizeStr = computedStyle(node, "font-size"); 2215 _node.style.fontSize = fontSizeStr; 2216 _node.style.padding = "0px"; 2217 _node.style.border = "0px"; 2218 var body = document.body; 2219 body.appendChild(_node); 2220 var height = _node.offsetHeight; 2221 lnHeight = height; 2222 body.removeChild(_node); 2223 } 2224 return lnHeight; 2225 } 2226 module.exports = lineHeight; 2227 } 2228 }); 2229 2230 // node_modules/react-autosize-textarea/lib/TextareaAutosize.js 2231 var require_TextareaAutosize = __commonJS({ 2232 "node_modules/react-autosize-textarea/lib/TextareaAutosize.js"(exports) { 2233 "use strict"; 2234 var __extends = exports && exports.__extends || (function() { 2235 var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) { 2236 d3.__proto__ = b3; 2237 } || function(d3, b3) { 2238 for (var p4 in b3) if (b3.hasOwnProperty(p4)) d3[p4] = b3[p4]; 2239 }; 2240 return function(d3, b3) { 2241 extendStatics(d3, b3); 2242 function __337() { 2243 this.constructor = d3; 2244 } 2245 d3.prototype = b3 === null ? Object.create(b3) : (__337.prototype = b3.prototype, new __337()); 2246 }; 2247 })(); 2248 var __assign2 = exports && exports.__assign || Object.assign || function(t4) { 2249 for (var s3, i3 = 1, n3 = arguments.length; i3 < n3; i3++) { 2250 s3 = arguments[i3]; 2251 for (var p4 in s3) if (Object.prototype.hasOwnProperty.call(s3, p4)) 2252 t4[p4] = s3[p4]; 2253 } 2254 return t4; 2255 }; 2256 var __rest = exports && exports.__rest || function(s3, e3) { 2257 var t4 = {}; 2258 for (var p4 in s3) if (Object.prototype.hasOwnProperty.call(s3, p4) && e3.indexOf(p4) < 0) 2259 t4[p4] = s3[p4]; 2260 if (s3 != null && typeof Object.getOwnPropertySymbols === "function") { 2261 for (var i3 = 0, p4 = Object.getOwnPropertySymbols(s3); i3 < p4.length; i3++) if (e3.indexOf(p4[i3]) < 0) 2262 t4[p4[i3]] = s3[p4[i3]]; 2263 } 2264 return t4; 2265 }; 2266 exports.__esModule = true; 2267 var React77 = require_react(); 2268 var PropTypes = require_prop_types(); 2269 var autosize = require_autosize(); 2270 var _getLineHeight = require_line_height(); 2271 var getLineHeight = _getLineHeight; 2272 var RESIZED = "autosize:resized"; 2273 var TextareaAutosizeClass = ( 2274 /** @class */ 2275 (function(_super) { 2276 __extends(TextareaAutosizeClass2, _super); 2277 function TextareaAutosizeClass2() { 2278 var _this = _super !== null && _super.apply(this, arguments) || this; 2279 _this.state = { 2280 lineHeight: null 2281 }; 2282 _this.textarea = null; 2283 _this.onResize = function(e3) { 2284 if (_this.props.onResize) { 2285 _this.props.onResize(e3); 2286 } 2287 }; 2288 _this.updateLineHeight = function() { 2289 if (_this.textarea) { 2290 _this.setState({ 2291 lineHeight: getLineHeight(_this.textarea) 2292 }); 2293 } 2294 }; 2295 _this.onChange = function(e3) { 2296 var onChange = _this.props.onChange; 2297 _this.currentValue = e3.currentTarget.value; 2298 onChange && onChange(e3); 2299 }; 2300 return _this; 2301 } 2302 TextareaAutosizeClass2.prototype.componentDidMount = function() { 2303 var _this = this; 2304 var _a = this.props, maxRows = _a.maxRows, async = _a.async; 2305 if (typeof maxRows === "number") { 2306 this.updateLineHeight(); 2307 } 2308 if (typeof maxRows === "number" || async) { 2309 setTimeout(function() { 2310 return _this.textarea && autosize(_this.textarea); 2311 }); 2312 } else { 2313 this.textarea && autosize(this.textarea); 2314 } 2315 if (this.textarea) { 2316 this.textarea.addEventListener(RESIZED, this.onResize); 2317 } 2318 }; 2319 TextareaAutosizeClass2.prototype.componentWillUnmount = function() { 2320 if (this.textarea) { 2321 this.textarea.removeEventListener(RESIZED, this.onResize); 2322 autosize.destroy(this.textarea); 2323 } 2324 }; 2325 TextareaAutosizeClass2.prototype.render = function() { 2326 var _this = this; 2327 var _a = this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, children = _b.children, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef", "children"]), lineHeight = _a.state.lineHeight; 2328 var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null; 2329 return React77.createElement("textarea", __assign2({}, props, { onChange: this.onChange, style: maxHeight ? __assign2({}, style, { maxHeight }) : style, ref: function(element) { 2330 _this.textarea = element; 2331 if (typeof _this.props.innerRef === "function") { 2332 _this.props.innerRef(element); 2333 } else if (_this.props.innerRef) { 2334 _this.props.innerRef.current = element; 2335 } 2336 } }), children); 2337 }; 2338 TextareaAutosizeClass2.prototype.componentDidUpdate = function() { 2339 this.textarea && autosize.update(this.textarea); 2340 }; 2341 TextareaAutosizeClass2.defaultProps = { 2342 rows: 1, 2343 async: false 2344 }; 2345 TextareaAutosizeClass2.propTypes = { 2346 rows: PropTypes.number, 2347 maxRows: PropTypes.number, 2348 onResize: PropTypes.func, 2349 innerRef: PropTypes.any, 2350 async: PropTypes.bool 2351 }; 2352 return TextareaAutosizeClass2; 2353 })(React77.Component) 2354 ); 2355 exports.TextareaAutosize = React77.forwardRef(function(props, ref) { 2356 return React77.createElement(TextareaAutosizeClass, __assign2({}, props, { innerRef: ref })); 2357 }); 2358 } 2359 }); 2360 2361 // node_modules/react-autosize-textarea/lib/index.js 2362 var require_lib = __commonJS({ 2363 "node_modules/react-autosize-textarea/lib/index.js"(exports, module) { 2364 "use strict"; 2365 var TextareaAutosize_1 = require_TextareaAutosize(); 2366 module.exports = TextareaAutosize_1.TextareaAutosize; 2367 } 2368 }); 2369 2370 // package-external:@wordpress/server-side-render 2371 var require_server_side_render = __commonJS({ 2372 "package-external:@wordpress/server-side-render"(exports, module) { 2373 module.exports = window.wp.serverSideRender; 2374 } 2375 }); 2376 2377 // packages/editor/build-module/index.mjs 2378 var index_exports = {}; 2379 __export(index_exports, { 2380 AlignmentToolbar: () => AlignmentToolbar, 2381 Autocomplete: () => Autocomplete, 2382 AutosaveMonitor: () => AutosaveMonitor, 2383 BlockAlignmentToolbar: () => BlockAlignmentToolbar, 2384 BlockControls: () => BlockControls, 2385 BlockEdit: () => BlockEdit, 2386 BlockEditorKeyboardShortcuts: () => BlockEditorKeyboardShortcuts2, 2387 BlockFormatControls: () => BlockFormatControls, 2388 BlockIcon: () => BlockIcon3, 2389 BlockInspector: () => BlockInspector, 2390 BlockList: () => BlockList4, 2391 BlockMover: () => BlockMover, 2392 BlockNavigationDropdown: () => BlockNavigationDropdown, 2393 BlockSelectionClearer: () => BlockSelectionClearer, 2394 BlockSettingsMenu: () => BlockSettingsMenu, 2395 BlockTitle: () => BlockTitle, 2396 BlockToolbar: () => BlockToolbar, 2397 CharacterCount: () => CharacterCount, 2398 ColorPalette: () => ColorPalette2, 2399 ContrastChecker: () => ContrastChecker, 2400 CopyHandler: () => CopyHandler, 2401 DefaultBlockAppender: () => DefaultBlockAppender, 2402 DocumentBar: () => DocumentBar, 2403 DocumentOutline: () => DocumentOutline, 2404 DocumentOutlineCheck: () => DocumentOutlineCheck, 2405 EditorHistoryRedo: () => redo_default2, 2406 EditorHistoryUndo: () => undo_default2, 2407 EditorKeyboardShortcuts: () => EditorKeyboardShortcuts, 2408 EditorKeyboardShortcutsRegister: () => register_shortcuts_default, 2409 EditorNotices: () => editor_notices_default, 2410 EditorProvider: () => provider_default, 2411 EditorSnackbars: () => EditorSnackbars, 2412 EntitiesSavedStates: () => EntitiesSavedStates, 2413 ErrorBoundary: () => error_boundary_default, 2414 FontSizePicker: () => FontSizePicker, 2415 InnerBlocks: () => InnerBlocks, 2416 Inserter: () => Inserter, 2417 InspectorAdvancedControls: () => InspectorAdvancedControls, 2418 InspectorControls: () => InspectorControls, 2419 LocalAutosaveMonitor: () => local_autosave_monitor_default, 2420 MediaPlaceholder: () => MediaPlaceholder, 2421 MediaUpload: () => MediaUpload3, 2422 MediaUploadCheck: () => MediaUploadCheck2, 2423 MultiSelectScrollIntoView: () => MultiSelectScrollIntoView, 2424 NavigableToolbar: () => NavigableToolbar, 2425 ObserveTyping: () => ObserveTyping, 2426 PageAttributesCheck: () => check_default2, 2427 PageAttributesOrder: () => PageAttributesOrderWithChecks, 2428 PageAttributesPanel: () => PageAttributesPanel, 2429 PageAttributesParent: () => parent_default2, 2430 PageTemplate: () => classic_theme_default, 2431 PanelColorSettings: () => PanelColorSettings, 2432 PlainText: () => PlainText, 2433 PluginBlockSettingsMenuItem: () => plugin_block_settings_menu_item_default, 2434 PluginDocumentSettingPanel: () => plugin_document_setting_panel_default, 2435 PluginMoreMenuItem: () => PluginMoreMenuItem, 2436 PluginPostPublishPanel: () => plugin_post_publish_panel_default, 2437 PluginPostStatusInfo: () => plugin_post_status_info_default, 2438 PluginPrePublishPanel: () => plugin_pre_publish_panel_default, 2439 PluginPreviewMenuItem: () => PluginPreviewMenuItem, 2440 PluginSidebar: () => PluginSidebar, 2441 PluginSidebarMoreMenuItem: () => PluginSidebarMoreMenuItem, 2442 PostAuthor: () => post_author_default, 2443 PostAuthorCheck: () => PostAuthorCheck, 2444 PostAuthorPanel: () => panel_default, 2445 PostComments: () => post_comments_default, 2446 PostDiscussionPanel: () => PostDiscussionPanel, 2447 PostExcerpt: () => PostExcerpt, 2448 PostExcerptCheck: () => check_default3, 2449 PostExcerptPanel: () => PostExcerptPanel, 2450 PostFeaturedImage: () => post_featured_image_default, 2451 PostFeaturedImageCheck: () => check_default4, 2452 PostFeaturedImagePanel: () => PostFeaturedImagePanel, 2453 PostFormat: () => PostFormat, 2454 PostFormatCheck: () => PostFormatCheck, 2455 PostLastRevision: () => post_last_revision_default, 2456 PostLastRevisionCheck: () => check_default5, 2457 PostLastRevisionPanel: () => panel_default2, 2458 PostLockedModal: () => post_locked_modal_default, 2459 PostPendingStatus: () => post_pending_status_default, 2460 PostPendingStatusCheck: () => check_default6, 2461 PostPingbacks: () => post_pingbacks_default, 2462 PostPreviewButton: () => PostPreviewButton, 2463 PostPublishButton: () => post_publish_button_default, 2464 PostPublishButtonLabel: () => PublishButtonLabel, 2465 PostPublishPanel: () => PostPublishPanel, 2466 PostSavedState: () => PostSavedState, 2467 PostSchedule: () => PostSchedule, 2468 PostScheduleCheck: () => PostScheduleCheck, 2469 PostScheduleLabel: () => PostScheduleLabel, 2470 PostSchedulePanel: () => PostSchedulePanel, 2471 PostSticky: () => PostSticky, 2472 PostStickyCheck: () => PostStickyCheck, 2473 PostSwitchToDraftButton: () => PostSwitchToDraftButton, 2474 PostSyncStatus: () => PostSyncStatus, 2475 PostTaxonomies: () => post_taxonomies_default, 2476 PostTaxonomiesCheck: () => PostTaxonomiesCheck, 2477 PostTaxonomiesFlatTermSelector: () => FlatTermSelector, 2478 PostTaxonomiesHierarchicalTermSelector: () => HierarchicalTermSelector, 2479 PostTaxonomiesPanel: () => PostTaxonomies2, 2480 PostTemplatePanel: () => PostTemplatePanel, 2481 PostTextEditor: () => PostTextEditor, 2482 PostTitle: () => post_title_default, 2483 PostTitleRaw: () => post_title_raw_default, 2484 PostTrash: () => PostTrash, 2485 PostTrashCheck: () => PostTrashCheck, 2486 PostTypeSupportCheck: () => post_type_support_check_default, 2487 PostURL: () => PostURL, 2488 PostURLCheck: () => PostURLCheck, 2489 PostURLLabel: () => PostURLLabel, 2490 PostURLPanel: () => PostURLPanel, 2491 PostVisibility: () => PostVisibility, 2492 PostVisibilityCheck: () => PostVisibilityCheck, 2493 PostVisibilityLabel: () => PostVisibilityLabel, 2494 RichText: () => RichText2, 2495 RichTextShortcut: () => RichTextShortcut, 2496 RichTextToolbarButton: () => RichTextToolbarButton, 2497 ServerSideRender: () => import_server_side_render.default, 2498 SkipToSelectedBlock: () => SkipToSelectedBlock, 2499 TableOfContents: () => table_of_contents_default, 2500 TextEditorGlobalKeyboardShortcuts: () => TextEditorGlobalKeyboardShortcuts, 2501 ThemeSupportCheck: () => ThemeSupportCheck, 2502 TimeToRead: () => TimeToRead, 2503 URLInput: () => URLInput, 2504 URLInputButton: () => URLInputButton, 2505 URLPopover: () => URLPopover, 2506 UnsavedChangesWarning: () => UnsavedChangesWarning, 2507 VisualEditorGlobalKeyboardShortcuts: () => VisualEditorGlobalKeyboardShortcuts, 2508 Warning: () => Warning, 2509 WordCount: () => WordCount, 2510 WritingFlow: () => WritingFlow, 2511 __unstableRichTextInputEvent: () => __unstableRichTextInputEvent, 2512 cleanForSlug: () => cleanForSlug2, 2513 createCustomColorsHOC: () => createCustomColorsHOC, 2514 getColorClassName: () => getColorClassName2, 2515 getColorObjectByAttributeValues: () => getColorObjectByAttributeValues, 2516 getColorObjectByColorValue: () => getColorObjectByColorValue, 2517 getFontSize: () => getFontSize, 2518 getFontSizeClass: () => getFontSizeClass, 2519 getTemplatePartIcon: () => getTemplatePartIcon, 2520 linkAutocompleter: () => link_default2, 2521 mediaUpload: () => mediaUpload, 2522 privateApis: () => privateApis21, 2523 registerEntityAction: () => registerEntityAction2, 2524 registerEntityField: () => registerEntityField2, 2525 store: () => store, 2526 storeConfig: () => storeConfig, 2527 transformStyles: () => import_block_editor112.transformStyles, 2528 unregisterEntityAction: () => unregisterEntityAction2, 2529 unregisterEntityField: () => unregisterEntityField2, 2530 useEntitiesSavedStatesIsDirty: () => useIsDirty, 2531 usePostScheduleLabel: () => usePostScheduleLabel, 2532 usePostURLLabel: () => usePostURLLabel, 2533 usePostVisibilityLabel: () => usePostVisibilityLabel, 2534 userAutocompleter: () => user_default, 2535 withColorContext: () => withColorContext, 2536 withColors: () => withColors, 2537 withFontSizes: () => withFontSizes 2538 }); 2539 2540 // packages/editor/build-module/hooks/custom-sources-backwards-compatibility.mjs 2541 var import_data88 = __toESM(require_data(), 1); 2542 var import_core_data58 = __toESM(require_core_data(), 1); 2543 var import_element218 = __toESM(require_element(), 1); 2544 var import_compose35 = __toESM(require_compose(), 1); 2545 var import_hooks40 = __toESM(require_hooks(), 1); 2546 2547 // packages/editor/build-module/store/index.mjs 2548 var import_data87 = __toESM(require_data(), 1); 2549 2550 // packages/editor/build-module/store/reducer.mjs 2551 var import_data2 = __toESM(require_data(), 1); 2552 2553 // packages/editor/build-module/store/defaults.mjs 2554 var import_block_editor = __toESM(require_block_editor(), 1); 2555 var EDITOR_SETTINGS_DEFAULTS = { 2556 ...import_block_editor.SETTINGS_DEFAULTS, 2557 richEditingEnabled: true, 2558 codeEditingEnabled: true, 2559 responsiveEditingEnabled: true, 2560 blockStatesEditingEnabled: true, 2561 fontLibraryEnabled: true, 2562 enableCustomFields: void 0, 2563 defaultRenderingMode: "post-only" 2564 }; 2565 2566 // packages/editor/build-module/dataviews/store/reducer.mjs 2567 var import_data = __toESM(require_data(), 1); 2568 function isReady(state2 = {}, action) { 2569 switch (action.type) { 2570 case "SET_IS_READY": 2571 return { 2572 ...state2, 2573 [action.kind]: { 2574 ...state2[action.kind], 2575 [action.name]: true 2576 } 2577 }; 2578 } 2579 return state2; 2580 } 2581 function actions(state2 = {}, action) { 2582 switch (action.type) { 2583 case "REGISTER_ENTITY_ACTION": 2584 return { 2585 ...state2, 2586 [action.kind]: { 2587 ...state2[action.kind], 2588 [action.name]: [ 2589 ...(state2[action.kind]?.[action.name] ?? []).filter( 2590 (_action) => _action.id !== action.config.id 2591 ), 2592 action.config 2593 ] 2594 } 2595 }; 2596 case "UNREGISTER_ENTITY_ACTION": { 2597 return { 2598 ...state2, 2599 [action.kind]: { 2600 ...state2[action.kind], 2601 [action.name]: (state2[action.kind]?.[action.name] ?? []).filter((_action) => _action.id !== action.actionId) 2602 } 2603 }; 2604 } 2605 } 2606 return state2; 2607 } 2608 function fields(state2 = {}, action) { 2609 switch (action.type) { 2610 case "REGISTER_ENTITY_FIELD": 2611 return { 2612 ...state2, 2613 [action.kind]: { 2614 ...state2[action.kind], 2615 [action.name]: [ 2616 ...(state2[action.kind]?.[action.name] ?? []).filter( 2617 (_field) => _field.id !== action.config.id 2618 ), 2619 action.config 2620 ] 2621 } 2622 }; 2623 case "UNREGISTER_ENTITY_FIELD": 2624 return { 2625 ...state2, 2626 [action.kind]: { 2627 ...state2[action.kind], 2628 [action.name]: (state2[action.kind]?.[action.name] ?? []).filter((_field) => _field.id !== action.fieldId) 2629 } 2630 }; 2631 } 2632 return state2; 2633 } 2634 var reducer_default = (0, import_data.combineReducers)({ 2635 actions, 2636 fields, 2637 isReady 2638 }); 2639 2640 // packages/editor/build-module/store/reducer.mjs 2641 function getPostRawValue(value) { 2642 if (value && "object" === typeof value && "raw" in value) { 2643 return value.raw; 2644 } 2645 return value; 2646 } 2647 function postId(state2 = null, action) { 2648 switch (action.type) { 2649 case "SET_EDITED_POST": 2650 return action.postId; 2651 } 2652 return state2; 2653 } 2654 function templateId(state2 = null, action) { 2655 switch (action.type) { 2656 case "SET_CURRENT_TEMPLATE_ID": 2657 return action.id; 2658 } 2659 return state2; 2660 } 2661 function postType(state2 = null, action) { 2662 switch (action.type) { 2663 case "SET_EDITED_POST": 2664 return action.postType; 2665 } 2666 return state2; 2667 } 2668 function template(state2 = { isValid: true }, action) { 2669 switch (action.type) { 2670 case "SET_TEMPLATE_VALIDITY": 2671 return { 2672 ...state2, 2673 isValid: action.isValid 2674 }; 2675 } 2676 return state2; 2677 } 2678 function saving(state2 = {}, action) { 2679 switch (action.type) { 2680 case "REQUEST_POST_UPDATE_START": 2681 case "REQUEST_POST_UPDATE_FINISH": 2682 return { 2683 pending: action.type === "REQUEST_POST_UPDATE_START", 2684 options: action.options || {} 2685 }; 2686 } 2687 return state2; 2688 } 2689 function deleting(state2 = {}, action) { 2690 switch (action.type) { 2691 case "REQUEST_POST_DELETE_START": 2692 case "REQUEST_POST_DELETE_FINISH": 2693 return { 2694 pending: action.type === "REQUEST_POST_DELETE_START" 2695 }; 2696 } 2697 return state2; 2698 } 2699 function postLock(state2 = { isLocked: false }, action) { 2700 switch (action.type) { 2701 case "UPDATE_POST_LOCK": 2702 return action.lock; 2703 } 2704 return state2; 2705 } 2706 function postSavingLock(state2 = {}, action) { 2707 switch (action.type) { 2708 case "LOCK_POST_SAVING": 2709 return { ...state2, [action.lockName]: true }; 2710 case "UNLOCK_POST_SAVING": { 2711 const { [action.lockName]: removedLockName, ...restState } = state2; 2712 return restState; 2713 } 2714 } 2715 return state2; 2716 } 2717 function postAutosavingLock(state2 = {}, action) { 2718 switch (action.type) { 2719 case "LOCK_POST_AUTOSAVING": 2720 return { ...state2, [action.lockName]: true }; 2721 case "UNLOCK_POST_AUTOSAVING": { 2722 const { [action.lockName]: removedLockName, ...restState } = state2; 2723 return restState; 2724 } 2725 } 2726 return state2; 2727 } 2728 function editorSettings(state2 = EDITOR_SETTINGS_DEFAULTS, action) { 2729 switch (action.type) { 2730 case "UPDATE_EDITOR_SETTINGS": 2731 return { 2732 ...state2, 2733 ...action.settings 2734 }; 2735 } 2736 return state2; 2737 } 2738 function renderingMode(state2 = "post-only", action) { 2739 switch (action.type) { 2740 case "SET_RENDERING_MODE": 2741 return action.mode; 2742 } 2743 return state2; 2744 } 2745 function canvasWidth(state2 = void 0, action) { 2746 switch (action.type) { 2747 case "SET_CANVAS_WIDTH": 2748 return action.width; 2749 } 2750 return state2; 2751 } 2752 function removedPanels(state2 = [], action) { 2753 switch (action.type) { 2754 case "REMOVE_PANEL": 2755 if (!state2.includes(action.panelName)) { 2756 return [...state2, action.panelName]; 2757 } 2758 } 2759 return state2; 2760 } 2761 function blockInserterPanel(state2 = false, action) { 2762 switch (action.type) { 2763 case "SET_IS_LIST_VIEW_OPENED": 2764 return action.isOpen ? false : state2; 2765 case "SET_IS_INSERTER_OPENED": 2766 return action.value; 2767 } 2768 return state2; 2769 } 2770 function listViewPanel(state2 = false, action) { 2771 switch (action.type) { 2772 case "SET_IS_INSERTER_OPENED": 2773 return action.value ? false : state2; 2774 case "SET_IS_LIST_VIEW_OPENED": 2775 return action.isOpen; 2776 } 2777 return state2; 2778 } 2779 function listViewToggleRef(state2 = { current: null }) { 2780 return state2; 2781 } 2782 function inserterSidebarToggleRef(state2 = { current: null }) { 2783 return state2; 2784 } 2785 function publishSidebarActive(state2 = false, action) { 2786 switch (action.type) { 2787 case "OPEN_PUBLISH_SIDEBAR": 2788 return true; 2789 case "CLOSE_PUBLISH_SIDEBAR": 2790 return false; 2791 case "TOGGLE_PUBLISH_SIDEBAR": 2792 return !state2; 2793 } 2794 return state2; 2795 } 2796 function stylesPath(state2 = "/", action) { 2797 switch (action.type) { 2798 case "SET_STYLES_PATH": 2799 return action.path; 2800 case "RESET_STYLES_NAVIGATION": 2801 return "/"; 2802 } 2803 return state2; 2804 } 2805 function showStylebook(state2 = false, action) { 2806 switch (action.type) { 2807 case "SET_SHOW_STYLEBOOK": 2808 return action.show; 2809 case "RESET_STYLES_NAVIGATION": 2810 return false; 2811 } 2812 return state2; 2813 } 2814 function revisionId(state2 = null, action) { 2815 switch (action.type) { 2816 case "SET_CURRENT_REVISION_ID": 2817 return action.revisionId; 2818 } 2819 return state2; 2820 } 2821 function revisionPage(state2 = 1, action) { 2822 switch (action.type) { 2823 case "SET_REVISION_PAGE": 2824 return action.page; 2825 case "SET_CURRENT_REVISION_ID": 2826 if (!action.revisionId) { 2827 return 1; 2828 } 2829 return state2; 2830 } 2831 return state2; 2832 } 2833 function showRevisionDiff(state2 = true, action) { 2834 switch (action.type) { 2835 case "SET_SHOW_REVISION_DIFF": 2836 return action.showDiff; 2837 case "SET_CURRENT_REVISION_ID": 2838 return !action.revisionId ? true : state2; 2839 } 2840 return state2; 2841 } 2842 function selectedNote(state2 = {}, action) { 2843 switch (action.type) { 2844 case "SELECT_NOTE": 2845 return { noteId: action.noteId, options: action.options }; 2846 } 2847 return state2; 2848 } 2849 var reducer_default2 = (0, import_data2.combineReducers)({ 2850 postId, 2851 postType, 2852 templateId, 2853 saving, 2854 deleting, 2855 postLock, 2856 template, 2857 postSavingLock, 2858 editorSettings, 2859 postAutosavingLock, 2860 renderingMode, 2861 canvasWidth, 2862 removedPanels, 2863 blockInserterPanel, 2864 inserterSidebarToggleRef, 2865 listViewPanel, 2866 listViewToggleRef, 2867 publishSidebarActive, 2868 stylesPath, 2869 showStylebook, 2870 revisionId, 2871 revisionPage, 2872 showRevisionDiff, 2873 selectedNote, 2874 dataviews: reducer_default 2875 }); 2876 2877 // packages/editor/build-module/store/selectors.mjs 2878 var selectors_exports = {}; 2879 __export(selectors_exports, { 2880 __experimentalGetDefaultTemplatePartAreas: () => __experimentalGetDefaultTemplatePartAreas, 2881 __experimentalGetDefaultTemplateType: () => __experimentalGetDefaultTemplateType, 2882 __experimentalGetDefaultTemplateTypes: () => __experimentalGetDefaultTemplateTypes, 2883 __experimentalGetTemplateInfo: () => __experimentalGetTemplateInfo, 2884 __unstableIsEditorReady: () => __unstableIsEditorReady, 2885 canInsertBlockType: () => canInsertBlockType, 2886 canUserUseUnfilteredHTML: () => canUserUseUnfilteredHTML, 2887 didPostSaveRequestFail: () => didPostSaveRequestFail, 2888 didPostSaveRequestSucceed: () => didPostSaveRequestSucceed, 2889 getActivePostLock: () => getActivePostLock, 2890 getAdjacentBlockClientId: () => getAdjacentBlockClientId, 2891 getAutosaveAttribute: () => getAutosaveAttribute, 2892 getBlock: () => getBlock, 2893 getBlockAttributes: () => getBlockAttributes, 2894 getBlockCount: () => getBlockCount, 2895 getBlockHierarchyRootClientId: () => getBlockHierarchyRootClientId, 2896 getBlockIndex: () => getBlockIndex, 2897 getBlockInsertionPoint: () => getBlockInsertionPoint, 2898 getBlockListSettings: () => getBlockListSettings, 2899 getBlockMode: () => getBlockMode, 2900 getBlockName: () => getBlockName, 2901 getBlockOrder: () => getBlockOrder, 2902 getBlockRootClientId: () => getBlockRootClientId, 2903 getBlockSelectionEnd: () => getBlockSelectionEnd, 2904 getBlockSelectionStart: () => getBlockSelectionStart, 2905 getBlocks: () => getBlocks, 2906 getBlocksByClientId: () => getBlocksByClientId, 2907 getClientIdsOfDescendants: () => getClientIdsOfDescendants, 2908 getClientIdsWithDescendants: () => getClientIdsWithDescendants, 2909 getCurrentPost: () => getCurrentPost, 2910 getCurrentPostAttribute: () => getCurrentPostAttribute, 2911 getCurrentPostId: () => getCurrentPostId, 2912 getCurrentPostLastRevisionId: () => getCurrentPostLastRevisionId, 2913 getCurrentPostRevisionsCount: () => getCurrentPostRevisionsCount, 2914 getCurrentPostType: () => getCurrentPostType, 2915 getCurrentTemplateId: () => getCurrentTemplateId, 2916 getDeviceType: () => getDeviceType, 2917 getEditedPostAttribute: () => getEditedPostAttribute, 2918 getEditedPostContent: () => getEditedPostContent, 2919 getEditedPostPreviewLink: () => getEditedPostPreviewLink, 2920 getEditedPostSlug: () => getEditedPostSlug, 2921 getEditedPostVisibility: () => getEditedPostVisibility, 2922 getEditorBlocks: () => getEditorBlocks, 2923 getEditorMode: () => getEditorMode, 2924 getEditorSelection: () => getEditorSelection, 2925 getEditorSelectionEnd: () => getEditorSelectionEnd, 2926 getEditorSelectionStart: () => getEditorSelectionStart, 2927 getEditorSettings: () => getEditorSettings, 2928 getFirstMultiSelectedBlockClientId: () => getFirstMultiSelectedBlockClientId, 2929 getGlobalBlockCount: () => getGlobalBlockCount, 2930 getInserterItems: () => getInserterItems, 2931 getLastMultiSelectedBlockClientId: () => getLastMultiSelectedBlockClientId, 2932 getMultiSelectedBlockClientIds: () => getMultiSelectedBlockClientIds, 2933 getMultiSelectedBlocks: () => getMultiSelectedBlocks, 2934 getMultiSelectedBlocksEndClientId: () => getMultiSelectedBlocksEndClientId, 2935 getMultiSelectedBlocksStartClientId: () => getMultiSelectedBlocksStartClientId, 2936 getNextBlockClientId: () => getNextBlockClientId, 2937 getPermalink: () => getPermalink, 2938 getPermalinkParts: () => getPermalinkParts, 2939 getPostEdits: () => getPostEdits, 2940 getPostLockUser: () => getPostLockUser, 2941 getPostTypeLabel: () => getPostTypeLabel, 2942 getPreviousBlockClientId: () => getPreviousBlockClientId, 2943 getRenderingMode: () => getRenderingMode, 2944 getSelectedBlock: () => getSelectedBlock, 2945 getSelectedBlockClientId: () => getSelectedBlockClientId, 2946 getSelectedBlockCount: () => getSelectedBlockCount, 2947 getSelectedBlocksInitialCaretPosition: () => getSelectedBlocksInitialCaretPosition, 2948 getStateBeforeOptimisticTransaction: () => getStateBeforeOptimisticTransaction, 2949 getSuggestedPostFormat: () => getSuggestedPostFormat, 2950 getTemplate: () => getTemplate, 2951 getTemplateLock: () => getTemplateLock, 2952 hasChangedContent: () => hasChangedContent, 2953 hasEditorRedo: () => hasEditorRedo, 2954 hasEditorUndo: () => hasEditorUndo, 2955 hasInserterItems: () => hasInserterItems, 2956 hasMultiSelection: () => hasMultiSelection, 2957 hasNonPostEntityChanges: () => hasNonPostEntityChanges, 2958 hasSelectedBlock: () => hasSelectedBlock, 2959 hasSelectedInnerBlock: () => hasSelectedInnerBlock, 2960 inSomeHistory: () => inSomeHistory, 2961 isAncestorMultiSelected: () => isAncestorMultiSelected, 2962 isAutosavingPost: () => isAutosavingPost, 2963 isBlockInsertionPointVisible: () => isBlockInsertionPointVisible, 2964 isBlockMultiSelected: () => isBlockMultiSelected, 2965 isBlockSelected: () => isBlockSelected, 2966 isBlockValid: () => isBlockValid, 2967 isBlockWithinSelection: () => isBlockWithinSelection, 2968 isCaretWithinFormattedText: () => isCaretWithinFormattedText, 2969 isCleanNewPost: () => isCleanNewPost, 2970 isCurrentPostPending: () => isCurrentPostPending, 2971 isCurrentPostPublished: () => isCurrentPostPublished, 2972 isCurrentPostScheduled: () => isCurrentPostScheduled, 2973 isDeletingPost: () => isDeletingPost, 2974 isEditedPostAutosaveable: () => isEditedPostAutosaveable, 2975 isEditedPostBeingScheduled: () => isEditedPostBeingScheduled, 2976 isEditedPostDateFloating: () => isEditedPostDateFloating, 2977 isEditedPostDirty: () => isEditedPostDirty, 2978 isEditedPostEmpty: () => isEditedPostEmpty, 2979 isEditedPostNew: () => isEditedPostNew, 2980 isEditedPostPublishable: () => isEditedPostPublishable, 2981 isEditedPostSaveable: () => isEditedPostSaveable, 2982 isEditorPanelEnabled: () => isEditorPanelEnabled, 2983 isEditorPanelOpened: () => isEditorPanelOpened, 2984 isEditorPanelRemoved: () => isEditorPanelRemoved, 2985 isFirstMultiSelectedBlock: () => isFirstMultiSelectedBlock, 2986 isInserterOpened: () => isInserterOpened, 2987 isListViewOpened: () => isListViewOpened, 2988 isMultiSelecting: () => isMultiSelecting, 2989 isPermalinkEditable: () => isPermalinkEditable, 2990 isPostAutosavingLocked: () => isPostAutosavingLocked, 2991 isPostLockTakeover: () => isPostLockTakeover, 2992 isPostLocked: () => isPostLocked, 2993 isPostSavingLocked: () => isPostSavingLocked, 2994 isPreviewingPost: () => isPreviewingPost, 2995 isPublishSidebarEnabled: () => isPublishSidebarEnabled, 2996 isPublishSidebarOpened: () => isPublishSidebarOpened, 2997 isPublishingPost: () => isPublishingPost, 2998 isSavingNonPostEntityChanges: () => isSavingNonPostEntityChanges, 2999 isSavingPost: () => isSavingPost, 3000 isSelectionEnabled: () => isSelectionEnabled, 3001 isTyping: () => isTyping, 3002 isValidTemplate: () => isValidTemplate 3003 }); 3004 var import_blocks3 = __toESM(require_blocks(), 1); 3005 var import_date = __toESM(require_date(), 1); 3006 var import_url = __toESM(require_url(), 1); 3007 var import_data4 = __toESM(require_data(), 1); 3008 var import_deprecated = __toESM(require_deprecated(), 1); 3009 var import_block_editor2 = __toESM(require_block_editor(), 1); 3010 var import_core_data = __toESM(require_core_data(), 1); 3011 var import_preferences = __toESM(require_preferences(), 1); 3012 3013 // packages/editor/build-module/store/constants.mjs 3014 var EDIT_MERGE_PROPERTIES = /* @__PURE__ */ new Set(["meta"]); 3015 var STORE_NAME = "core/editor"; 3016 var PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/; 3017 var ONE_MINUTE_IN_MS = 60 * 1e3; 3018 var AUTOSAVE_PROPERTIES = ["title", "excerpt", "content"]; 3019 var TEMPLATE_POST_TYPE = "wp_template"; 3020 var TEMPLATE_PART_POST_TYPE = "wp_template_part"; 3021 var PATTERN_POST_TYPE = "wp_block"; 3022 var NAVIGATION_POST_TYPE = "wp_navigation"; 3023 var ATTACHMENT_POST_TYPE = "attachment"; 3024 var TEMPLATE_ORIGINS = { 3025 custom: "custom", 3026 theme: "theme", 3027 plugin: "plugin" 3028 }; 3029 var TEMPLATE_POST_TYPES = ["wp_template", "wp_template_part"]; 3030 var GLOBAL_POST_TYPES = [ 3031 ...TEMPLATE_POST_TYPES, 3032 "wp_block", 3033 "wp_navigation" 3034 ]; 3035 var DESIGN_POST_TYPES = [ 3036 TEMPLATE_POST_TYPE, 3037 TEMPLATE_PART_POST_TYPE, 3038 PATTERN_POST_TYPE, 3039 NAVIGATION_POST_TYPE 3040 ]; 3041 3042 // packages/icons/build-module/icon/index.mjs 3043 var import_element = __toESM(require_element(), 1); 3044 var icon_default = (0, import_element.forwardRef)( 3045 ({ icon, size: size4 = 24, ...props }, ref) => { 3046 return (0, import_element.cloneElement)(icon, { 3047 width: size4, 3048 height: size4, 3049 ...props, 3050 ref 3051 }); 3052 } 3053 ); 3054 3055 // packages/icons/build-module/library/add-template.mjs 3056 var import_primitives = __toESM(require_primitives(), 1); 3057 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); 3058 var add_template_default = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M18.5 5.5V8H20V5.5H22.5V4H20V1.5H18.5V4H16V5.5H18.5ZM13.9624 4H6C4.89543 4 4 4.89543 4 6V18C4 19.1046 4.89543 20 6 20H18C19.1046 20 20 19.1046 20 18V10.0391H18.5V18C18.5 18.2761 18.2761 18.5 18 18.5H10L10 10.4917L16.4589 10.5139L16.4641 9.01389L5.5 8.97618V6C5.5 5.72386 5.72386 5.5 6 5.5H13.9624V4ZM5.5 10.4762V18C5.5 18.2761 5.72386 18.5 6 18.5H8.5L8.5 10.4865L5.5 10.4762Z" }) }); 3059 3060 // packages/icons/build-module/library/archive.mjs 3061 var import_primitives2 = __toESM(require_primitives(), 1); 3062 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); 3063 var archive_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M11.934 7.406a1 1 0 0 0 .914.594H19a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5h5.764a.5.5 0 0 1 .447.276l.723 1.63Zm1.064-1.216a.5.5 0 0 0 .462.31H19a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5.764a2 2 0 0 1 1.789 1.106l.445 1.084ZM8.5 10.5h7V12h-7v-1.5Zm7 3.5h-7v1.5h7V14Z" }) }); 3064 3065 // packages/icons/build-module/library/arrow-down.mjs 3066 var import_primitives3 = __toESM(require_primitives(), 1); 3067 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); 3068 var arrow_down_default = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.Path, { d: "m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z" }) }); 3069 3070 // packages/icons/build-module/library/arrow-left.mjs 3071 var import_primitives4 = __toESM(require_primitives(), 1); 3072 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); 3073 var arrow_left_default = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.Path, { d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z" }) }); 3074 3075 // packages/icons/build-module/library/arrow-right.mjs 3076 var import_primitives5 = __toESM(require_primitives(), 1); 3077 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); 3078 var arrow_right_default = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.Path, { d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" }) }); 3079 3080 // packages/icons/build-module/library/arrow-up.mjs 3081 var import_primitives6 = __toESM(require_primitives(), 1); 3082 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); 3083 var arrow_up_default = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.Path, { d: "M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z" }) }); 3084 3085 // packages/icons/build-module/library/aspect-ratio.mjs 3086 var import_primitives7 = __toESM(require_primitives(), 1); 3087 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); 3088 var aspect_ratio_default = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.Path, { d: "M18.5 5.5h-13c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2h13c1.1 0 2-.9 2-2v-9c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5h-13c-.3 0-.5-.2-.5-.5v-9c0-.3.2-.5.5-.5h13c.3 0 .5.2.5.5v9zM6.5 12H8v-2h2V8.5H6.5V12zm9.5 2h-2v1.5h3.5V12H16v2z" }) }); 3089 3090 // packages/icons/build-module/library/audio.mjs 3091 var import_primitives8 = __toESM(require_primitives(), 1); 3092 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); 3093 var audio_default = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.Path, { d: "M17.7 4.3c-1.2 0-2.8 0-3.8 1-.6.6-.9 1.5-.9 2.6V14c-.6-.6-1.5-1-2.5-1C8.6 13 7 14.6 7 16.5S8.6 20 10.5 20c1.5 0 2.8-1 3.3-2.3.5-.8.7-1.8.7-2.5V7.9c0-.7.2-1.2.5-1.6.6-.6 1.8-.6 2.8-.6h.3V4.3h-.4z" }) }); 3094 3095 // packages/icons/build-module/library/background.mjs 3096 var import_primitives9 = __toESM(require_primitives(), 1); 3097 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); 3098 var background_default = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M11.53 4.47a.75.75 0 1 0-1.06 1.06l8 8a.75.75 0 1 0 1.06-1.06l-8-8Zm5 1a.75.75 0 1 0-1.06 1.06l2 2a.75.75 0 1 0 1.06-1.06l-2-2Zm-11.06 10a.75.75 0 0 1 1.06 0l2 2a.75.75 0 1 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06Zm.06-5a.75.75 0 0 0-1.06 1.06l8 8a.75.75 0 1 0 1.06-1.06l-8-8Zm-.06-3a.75.75 0 0 1 1.06 0l10 10a.75.75 0 1 1-1.06 1.06l-10-10a.75.75 0 0 1 0-1.06Zm3.06-2a.75.75 0 0 0-1.06 1.06l10 10a.75.75 0 1 0 1.06-1.06l-10-10Z" }) }); 3099 3100 // packages/icons/build-module/library/backup.mjs 3101 var import_primitives10 = __toESM(require_primitives(), 1); 3102 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); 3103 var backup_default = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.Path, { d: "M13.75 4.194a8 8 0 0 0-4.812.415l-.301.132a8 8 0 0 0-3.203 2.692L4 6.001v4h4L6.517 8.516q.333-.526.758-.977l.011-.012q.341-.359.733-.662l.025-.02a6.5 6.5 0 0 1 2.469-1.172l.034-.008q.117-.027.236-.05l.015-.002q.32-.06.65-.088.08-.008.16-.013a7 7 0 0 1 .323-.01L12 5.5h.05l.203.005.101.003q.146.008.293.023l.12.014.158.02q.103.015.205.033l.058.011q.107.02.212.043l.068.016a6.5 6.5 0 0 1 1.447.521l.02.01a7 7 0 0 1 .452.25l.02.014a7 7 0 0 1 .468.317l.07.054a7 7 0 0 1 .403.334l.034.03q.091.084.18.172l.047.045q.293.294.548.627l.03.038.07.097.096.135q.037.053.072.107a6 6 0 0 1 .167.265l.042.073q.236.411.413.857l.027.07a6.5 6.5 0 0 1 .418 2.014 6.6 6.6 0 0 1-.034 1.04 6 6 0 0 1-.063.424q-.109.597-.32 1.152-.016.034-.028.07a6.5 6.5 0 0 1-.413.856l-.042.073a6 6 0 0 1-.327.497l-.087.118-.02.028a7 7 0 0 1-.526.604l-.035.035-.035.032q-.089.088-.18.172l-.034.03a7 7 0 0 1-.38.317l-.093.071q-.09.067-.183.13l-.076.053q-.112.076-.227.146-.218.133-.446.247l-.028.015-.192.093-.081.036a6.5 6.5 0 0 1-1.184.396l-.058.012a7 7 0 0 1-.475.087q-.08.012-.157.02l-.122.014q-.145.015-.292.023l-.136.005-.139.003L12 18.5q-.053-.002-.104-.003l-.127-.004-.162-.007q-.08-.005-.159-.013a7 7 0 0 1-.65-.088q-.008 0-.015-.002a7 7 0 0 1-.236-.05l-.034-.008a6.5 6.5 0 0 1-4.14-3.077l-1.3.75a8 8 0 0 0 3.564 3.26l.301.131a8 8 0 0 0 11.055-7.061l.007-.33c0-1.76-.581-3.473-1.653-4.87l-.206-.256a8 8 0 0 0-4.07-2.6zM12 7.75a.75.75 0 0 0-.75.75V12a.75.75 0 0 0 .218.529l1.282-.839-1.28.84 2.5 2.5a.75.75 0 1 0 1.06-1.06l-2.28-2.28V8.5a.75.75 0 0 0-.75-.75" }) }); 3104 3105 // packages/icons/build-module/library/block-default.mjs 3106 var import_primitives11 = __toESM(require_primitives(), 1); 3107 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); 3108 var block_default_default = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.Path, { d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" }) }); 3109 3110 // packages/icons/build-module/library/block-table.mjs 3111 var import_primitives12 = __toESM(require_primitives(), 1); 3112 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); 3113 var block_table_default = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.Path, { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z" }) }); 3114 3115 // packages/icons/build-module/library/category.mjs 3116 var import_primitives13 = __toESM(require_primitives(), 1); 3117 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); 3118 var category_default = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z" }) }); 3119 3120 // packages/icons/build-module/library/check.mjs 3121 var import_primitives14 = __toESM(require_primitives(), 1); 3122 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); 3123 var check_default = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.Path, { d: "M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" }) }); 3124 3125 // packages/icons/build-module/library/chevron-down.mjs 3126 var import_primitives15 = __toESM(require_primitives(), 1); 3127 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); 3128 var chevron_down_default = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives15.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives15.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) }); 3129 3130 // packages/icons/build-module/library/chevron-left-small.mjs 3131 var import_primitives16 = __toESM(require_primitives(), 1); 3132 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); 3133 var chevron_left_small_default = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives16.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives16.Path, { d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" }) }); 3134 3135 // packages/icons/build-module/library/chevron-left.mjs 3136 var import_primitives17 = __toESM(require_primitives(), 1); 3137 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); 3138 var chevron_left_default = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives17.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives17.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) }); 3139 3140 // packages/icons/build-module/library/chevron-right-small.mjs 3141 var import_primitives18 = __toESM(require_primitives(), 1); 3142 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); 3143 var chevron_right_small_default = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_primitives18.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_primitives18.Path, { d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" }) }); 3144 3145 // packages/icons/build-module/library/chevron-right.mjs 3146 var import_primitives19 = __toESM(require_primitives(), 1); 3147 var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); 3148 var chevron_right_default = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_primitives19.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_primitives19.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) }); 3149 3150 // packages/icons/build-module/library/chevron-up.mjs 3151 var import_primitives20 = __toESM(require_primitives(), 1); 3152 var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); 3153 var chevron_up_default = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_primitives20.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_primitives20.Path, { d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" }) }); 3154 3155 // packages/icons/build-module/library/close-small.mjs 3156 var import_primitives21 = __toESM(require_primitives(), 1); 3157 var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); 3158 var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_primitives21.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_primitives21.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) }); 3159 3160 // packages/icons/build-module/library/close.mjs 3161 var import_primitives22 = __toESM(require_primitives(), 1); 3162 var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); 3163 var close_default = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_primitives22.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_primitives22.Path, { d: "m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z" }) }); 3164 3165 // packages/icons/build-module/library/cloud-upload.mjs 3166 var import_primitives23 = __toESM(require_primitives(), 1); 3167 var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); 3168 var cloud_upload_default = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_primitives23.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_primitives23.Path, { d: "M17.3 10.1C17.3 7.60001 15.2 5.70001 12.5 5.70001C10.3 5.70001 8.4 7.10001 7.9 9.00001H7.7C5.7 9.00001 4 10.7 4 12.8C4 14.9 5.7 16.6 7.7 16.6H9.5V15.2H7.7C6.5 15.2 5.5 14.1 5.5 12.9C5.5 11.7 6.5 10.5 7.7 10.5H9L9.3 9.40001C9.7 8.10001 11 7.20001 12.5 7.20001C14.3 7.20001 15.8 8.50001 15.8 10.1V11.4L17.1 11.6C17.9 11.7 18.5 12.5 18.5 13.4C18.5 14.4 17.7 15.2 16.8 15.2H14.5V16.6H16.7C18.5 16.6 19.9 15.1 19.9 13.3C20 11.7 18.8 10.4 17.3 10.1Z M14.1245 14.2426L15.1852 13.182L12.0032 10L8.82007 13.1831L9.88072 14.2438L11.25 12.8745V18H12.75V12.8681L14.1245 14.2426Z" }) }); 3169 3170 // packages/icons/build-module/library/cloud.mjs 3171 var import_primitives24 = __toESM(require_primitives(), 1); 3172 var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); 3173 var cloud_default = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_primitives24.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_primitives24.Path, { d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-9c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4h1.3l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8-.1 1-.9 1.8-1.8 1.8z" }) }); 3174 3175 // packages/icons/build-module/library/code.mjs 3176 var import_primitives25 = __toESM(require_primitives(), 1); 3177 var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); 3178 var code_default = /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_primitives25.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_primitives25.Path, { d: "M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z" }) }); 3179 3180 // packages/icons/build-module/library/cog.mjs 3181 var import_primitives26 = __toESM(require_primitives(), 1); 3182 var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); 3183 var cog_default = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives26.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives26.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z" }) }); 3184 3185 // packages/icons/build-module/library/color.mjs 3186 var import_primitives27 = __toESM(require_primitives(), 1); 3187 var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); 3188 var color_default = /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_primitives27.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_primitives27.Path, { d: "M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z" }) }); 3189 3190 // packages/icons/build-module/library/comment-author-avatar.mjs 3191 var import_primitives28 = __toESM(require_primitives(), 1); 3192 var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); 3193 var comment_author_avatar_default = /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_primitives28.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_primitives28.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z" }) }); 3194 3195 // packages/icons/build-module/library/comment.mjs 3196 var import_primitives29 = __toESM(require_primitives(), 1); 3197 var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); 3198 var comment_default = /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_primitives29.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_primitives29.Path, { d: "M18 4H6c-1.1 0-2 .9-2 2v12.9c0 .6.5 1.1 1.1 1.1.3 0 .5-.1.8-.3L8.5 17H18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5H7.9l-2.4 2.4V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v9z" }) }); 3199 3200 // packages/icons/build-module/library/copy-small.mjs 3201 var import_primitives30 = __toESM(require_primitives(), 1); 3202 var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); 3203 var copy_small_default = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_primitives30.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_primitives30.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M5.625 5.5h9.75c.069 0 .125.056.125.125v9.75a.125.125 0 0 1-.125.125h-9.75a.125.125 0 0 1-.125-.125v-9.75c0-.069.056-.125.125-.125ZM4 5.625C4 4.728 4.728 4 5.625 4h9.75C16.273 4 17 4.728 17 5.625v9.75c0 .898-.727 1.625-1.625 1.625h-9.75A1.625 1.625 0 0 1 4 15.375v-9.75Zm14.5 11.656v-9H20v9C20 18.8 18.77 20 17.251 20H6.25v-1.5h11.001c.69 0 1.249-.528 1.249-1.219Z" }) }); 3204 3205 // packages/icons/build-module/library/desktop.mjs 3206 var import_primitives31 = __toESM(require_primitives(), 1); 3207 var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); 3208 var desktop_default = /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_primitives31.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_primitives31.Path, { d: "M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z" }) }); 3209 3210 // packages/icons/build-module/library/download.mjs 3211 var import_primitives32 = __toESM(require_primitives(), 1); 3212 var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1); 3213 var download_default = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_primitives32.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_primitives32.Path, { d: "M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z" }) }); 3214 3215 // packages/icons/build-module/library/drafts.mjs 3216 var import_primitives33 = __toESM(require_primitives(), 1); 3217 var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1); 3218 var drafts_default = /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_primitives33.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_primitives33.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 0 4-4H8a4 4 0 0 0 4 4Z" }) }); 3219 3220 // packages/icons/build-module/library/drawer-left.mjs 3221 var import_primitives34 = __toESM(require_primitives(), 1); 3222 var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1); 3223 var drawer_left_default = /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_primitives34.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_primitives34.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z" }) }); 3224 3225 // packages/icons/build-module/library/drawer-right.mjs 3226 var import_primitives35 = __toESM(require_primitives(), 1); 3227 var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1); 3228 var drawer_right_default = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_primitives35.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_primitives35.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z" }) }); 3229 3230 // packages/icons/build-module/library/envelope.mjs 3231 var import_primitives36 = __toESM(require_primitives(), 1); 3232 var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1); 3233 var envelope_default = /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_primitives36.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_primitives36.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M3 7c0-1.1.9-2 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Zm2-.5h14c.3 0 .5.2.5.5v1L12 13.5 4.5 7.9V7c0-.3.2-.5.5-.5Zm-.5 3.3V17c0 .3.2.5.5.5h14c.3 0 .5-.2.5-.5V9.8L12 15.4 4.5 9.8Z" }) }); 3234 3235 // packages/icons/build-module/library/error.mjs 3236 var import_primitives37 = __toESM(require_primitives(), 1); 3237 var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1); 3238 var error_default = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_primitives37.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_primitives37.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12.218 5.377a.25.25 0 0 0-.436 0l-7.29 12.96a.25.25 0 0 0 .218.373h14.58a.25.25 0 0 0 .218-.372l-7.29-12.96Zm-1.743-.735c.669-1.19 2.381-1.19 3.05 0l7.29 12.96a1.75 1.75 0 0 1-1.525 2.608H4.71a1.75 1.75 0 0 1-1.525-2.608l7.29-12.96ZM12.75 17.46h-1.5v-1.5h1.5v1.5Zm-1.5-3h1.5v-5h-1.5v5Z" }) }); 3239 3240 // packages/icons/build-module/library/external.mjs 3241 var import_primitives38 = __toESM(require_primitives(), 1); 3242 var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1); 3243 var external_default = /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_primitives38.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_primitives38.Path, { d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z" }) }); 3244 3245 // packages/icons/build-module/library/file.mjs 3246 var import_primitives39 = __toESM(require_primitives(), 1); 3247 var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1); 3248 var file_default = /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_primitives39.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_primitives39.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z" }) }); 3249 3250 // packages/icons/build-module/library/flip-horizontal.mjs 3251 var import_primitives40 = __toESM(require_primitives(), 1); 3252 var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1); 3253 var flip_horizontal_default = /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_primitives40.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_primitives40.Path, { d: "M4 6v12c0 1.1.9 2 2 2h3v-1.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h3V4H6c-1.1 0-2 .9-2 2zm7.2 16h1.5V2h-1.5v20zM15 5.5h1.5V4H15v1.5zm3.5.5H20c0-1.1-.9-2-2-2v1.5c.3 0 .5.2.5.5zm0 10.5H20v-2h-1.5v2zm0-3.5H20v-2h-1.5v2zm-.5 5.5V20c1.1 0 2-.9 2-2h-1.5c0 .3-.2.5-.5.5zM15 20h1.5v-1.5H15V20zm3.5-10.5H20v-2h-1.5v2z" }) }); 3254 3255 // packages/icons/build-module/library/flip-vertical.mjs 3256 var import_primitives41 = __toESM(require_primitives(), 1); 3257 var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1); 3258 var flip_vertical_default = /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_primitives41.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_primitives41.Path, { d: "M2 11.2v1.5h20v-1.5H2zM5.5 6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v3H20V6c0-1.1-.9-2-2-2H6c-1.1 0-2 .9-2 2v3h1.5V6zm2 14h2v-1.5h-2V20zm3.5 0h2v-1.5h-2V20zm7-1.5V20c1.1 0 2-.9 2-2h-1.5c0 .3-.2.5-.5.5zm.5-2H20V15h-1.5v1.5zM5.5 18H4c0 1.1.9 2 2 2v-1.5c-.3 0-.5-.2-.5-.5zm0-3H4v1.5h1.5V15zm9 5h2v-1.5h-2V20z" }) }); 3259 3260 // packages/icons/build-module/library/footer.mjs 3261 var import_primitives42 = __toESM(require_primitives(), 1); 3262 var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1); 3263 var footer_default = /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_primitives42.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_primitives42.Path, { fillRule: "evenodd", d: "M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) }); 3264 3265 // packages/icons/build-module/library/format-list-bullets-rtl.mjs 3266 var import_primitives43 = __toESM(require_primitives(), 1); 3267 var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1); 3268 var format_list_bullets_rtl_default = /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_primitives43.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_primitives43.Path, { d: "M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z" }) }); 3269 3270 // packages/icons/build-module/library/format-list-bullets.mjs 3271 var import_primitives44 = __toESM(require_primitives(), 1); 3272 var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1); 3273 var format_list_bullets_default = /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_primitives44.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_primitives44.Path, { d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }) }); 3274 3275 // packages/icons/build-module/library/funnel.mjs 3276 var import_primitives45 = __toESM(require_primitives(), 1); 3277 var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1); 3278 var funnel_default = /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_primitives45.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_primitives45.Path, { d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z" }) }); 3279 3280 // packages/icons/build-module/library/globe.mjs 3281 var import_primitives46 = __toESM(require_primitives(), 1); 3282 var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1); 3283 var globe_default = /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_primitives46.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_primitives46.Path, { d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8Zm6.5 8c0 .6 0 1.2-.2 1.8h-2.7c0-.6.2-1.1.2-1.8s0-1.2-.2-1.8h2.7c.2.6.2 1.1.2 1.8Zm-.9-3.2h-2.4c-.3-.9-.7-1.8-1.1-2.4-.1-.2-.2-.4-.3-.5 1.6.5 3 1.6 3.8 3ZM12.8 17c-.3.5-.6 1-.8 1.3-.2-.3-.5-.8-.8-1.3-.3-.5-.6-1.1-.8-1.7h3.3c-.2.6-.5 1.2-.8 1.7Zm-2.9-3.2c-.1-.6-.2-1.1-.2-1.8s0-1.2.2-1.8H14c.1.6.2 1.1.2 1.8s0 1.2-.2 1.8H9.9ZM11.2 7c.3-.5.6-1 .8-1.3.2.3.5.8.8 1.3.3.5.6 1.1.8 1.7h-3.3c.2-.6.5-1.2.8-1.7Zm-1-1.2c-.1.2-.2.3-.3.5-.4.7-.8 1.5-1.1 2.4H6.4c.8-1.4 2.2-2.5 3.8-3Zm-1.8 8H5.7c-.2-.6-.2-1.1-.2-1.8s0-1.2.2-1.8h2.7c0 .6-.2 1.1-.2 1.8s0 1.2.2 1.8Zm-2 1.4h2.4c.3.9.7 1.8 1.1 2.4.1.2.2.4.3.5-1.6-.5-3-1.6-3.8-3Zm7.4 3c.1-.2.2-.3.3-.5.4-.7.8-1.5 1.1-2.4h2.4c-.8 1.4-2.2 2.5-3.8 3Z" }) }); 3284 3285 // packages/icons/build-module/library/header.mjs 3286 var import_primitives47 = __toESM(require_primitives(), 1); 3287 var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1); 3288 var header_default = /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_primitives47.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_primitives47.Path, { d: "M18.5 10.5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) }); 3289 3290 // packages/icons/build-module/library/info.mjs 3291 var import_primitives48 = __toESM(require_primitives(), 1); 3292 var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1); 3293 var info_default = /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_primitives48.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_primitives48.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z" }) }); 3294 3295 // packages/icons/build-module/library/keyboard.mjs 3296 var import_primitives49 = __toESM(require_primitives(), 1); 3297 var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1); 3298 var keyboard_default = /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_primitives49.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: [ 3299 /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_primitives49.Path, { d: "m16 15.5h-8v-1.5h8zm-7.5-2.5h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm-9-3h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2z" }), 3300 /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_primitives49.Path, { d: "m18.5 6.5h-13a.5.5 0 0 0 -.5.5v9.5a.5.5 0 0 0 .5.5h13a.5.5 0 0 0 .5-.5v-9.5a.5.5 0 0 0 -.5-.5zm-13-1.5h13a2 2 0 0 1 2 2v9.5a2 2 0 0 1 -2 2h-13a2 2 0 0 1 -2-2v-9.5a2 2 0 0 1 2-2z" }) 3301 ] }); 3302 3303 // packages/icons/build-module/library/layout.mjs 3304 var import_primitives50 = __toESM(require_primitives(), 1); 3305 var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1); 3306 var layout_default = /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_primitives50.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_primitives50.Path, { d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) }); 3307 3308 // packages/icons/build-module/library/line-solid.mjs 3309 var import_primitives51 = __toESM(require_primitives(), 1); 3310 var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1); 3311 var line_solid_default = /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_primitives51.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_primitives51.Path, { d: "M5 11.25h14v1.5H5z" }) }); 3312 3313 // packages/icons/build-module/library/link.mjs 3314 var import_primitives52 = __toESM(require_primitives(), 1); 3315 var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1); 3316 var link_default = /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_primitives52.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_primitives52.Path, { d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z" }) }); 3317 3318 // packages/icons/build-module/library/list-view.mjs 3319 var import_primitives53 = __toESM(require_primitives(), 1); 3320 var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1); 3321 var list_view_default = /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_primitives53.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_primitives53.Path, { d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z" }) }); 3322 3323 // packages/icons/build-module/library/lock-small.mjs 3324 var import_primitives54 = __toESM(require_primitives(), 1); 3325 var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1); 3326 var lock_small_default = /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_primitives54.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_primitives54.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M15 11h-.2V9c0-1.5-1.2-2.8-2.8-2.8S9.2 7.5 9.2 9v2H9c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h6c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm-1.8 0h-2.5V9c0-.7.6-1.2 1.2-1.2s1.2.6 1.2 1.2v2z" }) }); 3327 3328 // packages/icons/build-module/library/mobile.mjs 3329 var import_primitives55 = __toESM(require_primitives(), 1); 3330 var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1); 3331 var mobile_default = /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_primitives55.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_primitives55.Path, { d: "M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z" }) }); 3332 3333 // packages/icons/build-module/library/more-vertical.mjs 3334 var import_primitives56 = __toESM(require_primitives(), 1); 3335 var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1); 3336 var more_vertical_default = /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_primitives56.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_primitives56.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) }); 3337 3338 // packages/icons/build-module/library/navigation-overlay.mjs 3339 var import_primitives57 = __toESM(require_primitives(), 1); 3340 var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1); 3341 var navigation_overlay_default = /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_primitives57.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_primitives57.Path, { d: "M18.5 10a1.5 1.5 0 0 1 1.5 1.5v7a1.5 1.5 0 0 1-1.5 1.5h-7a1.5 1.5 0 0 1-1.5-1.5v-7a1.5 1.5 0 0 1 1.5-1.5zM16 4a2 2 0 0 1 2 2v2h-1.5V6a.5.5 0 0 0-.5-.5H6a.5.5 0 0 0-.5.5v3H8v1.5H5.5V16a.5.5 0 0 0 .5.5h2V18H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z" }) }); 3342 3343 // packages/icons/build-module/library/navigation.mjs 3344 var import_primitives58 = __toESM(require_primitives(), 1); 3345 var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1); 3346 var navigation_default = /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_primitives58.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_primitives58.Path, { d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z" }) }); 3347 3348 // packages/icons/build-module/library/next.mjs 3349 var import_primitives59 = __toESM(require_primitives(), 1); 3350 var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1); 3351 var next_default = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_primitives59.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_primitives59.Path, { d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z" }) }); 3352 3353 // packages/icons/build-module/library/not-allowed.mjs 3354 var import_primitives60 = __toESM(require_primitives(), 1); 3355 var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1); 3356 var not_allowed_default = /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_primitives60.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_primitives60.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5A6.5 6.5 0 0 1 6.93 7.931l9.139 9.138A6.473 6.473 0 0 1 12 18.5Zm5.123-2.498a6.5 6.5 0 0 0-9.124-9.124l9.124 9.124ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z" }) }); 3357 3358 // packages/icons/build-module/library/page.mjs 3359 var import_primitives61 = __toESM(require_primitives(), 1); 3360 var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1); 3361 var page_default = /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_primitives61.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: [ 3362 /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_primitives61.Path, { d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" }), 3363 /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_primitives61.Path, { d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z" }) 3364 ] }); 3365 3366 // packages/icons/build-module/library/pencil.mjs 3367 var import_primitives62 = __toESM(require_primitives(), 1); 3368 var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1); 3369 var pencil_default = /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_primitives62.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_primitives62.Path, { d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" }) }); 3370 3371 // packages/icons/build-module/library/pending.mjs 3372 var import_primitives63 = __toESM(require_primitives(), 1); 3373 var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1); 3374 var pending_default = /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_primitives63.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_primitives63.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 1-4-4h4V8a4 4 0 0 1 0 8Z" }) }); 3375 3376 // packages/icons/build-module/library/plugins.mjs 3377 var import_primitives64 = __toESM(require_primitives(), 1); 3378 var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1); 3379 var plugins_default = /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_primitives64.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_primitives64.Path, { d: "M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z" }) }); 3380 3381 // packages/icons/build-module/library/plus.mjs 3382 var import_primitives65 = __toESM(require_primitives(), 1); 3383 var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1); 3384 var plus_default = /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_primitives65.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_primitives65.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) }); 3385 3386 // packages/icons/build-module/library/post.mjs 3387 var import_primitives66 = __toESM(require_primitives(), 1); 3388 var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1); 3389 var post_default = /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_primitives66.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_primitives66.Path, { d: "m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z" }) }); 3390 3391 // packages/icons/build-module/library/previous.mjs 3392 var import_primitives67 = __toESM(require_primitives(), 1); 3393 var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1); 3394 var previous_default = /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_primitives67.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_primitives67.Path, { d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z" }) }); 3395 3396 // packages/icons/build-module/library/published.mjs 3397 var import_primitives68 = __toESM(require_primitives(), 1); 3398 var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1); 3399 var published_default = /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_primitives68.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_primitives68.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm11.53-1.47-1.06-1.06L11 12.94l-1.47-1.47-1.06 1.06L11 15.06l4.53-4.53Z" }) }); 3400 3401 // packages/icons/build-module/library/redo.mjs 3402 var import_primitives69 = __toESM(require_primitives(), 1); 3403 var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1); 3404 var redo_default = /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_primitives69.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_primitives69.Path, { d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z" }) }); 3405 3406 // packages/icons/build-module/library/reset.mjs 3407 var import_primitives70 = __toESM(require_primitives(), 1); 3408 var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1); 3409 var reset_default = /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_primitives70.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_primitives70.Path, { d: "M7 11.5h10V13H7z" }) }); 3410 3411 // packages/icons/build-module/library/rotate-left.mjs 3412 var import_primitives71 = __toESM(require_primitives(), 1); 3413 var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1); 3414 var rotate_left_default = /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_primitives71.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_primitives71.Path, { d: "M12 4V2.2L9 4.8l3 2.5V5.5c3.6 0 6.5 2.9 6.5 6.5 0 2.9-1.9 5.3-4.5 6.2v.2l-.1-.2c-.4.1-.7.2-1.1.2l.2 1.5c.3 0 .6-.1 1-.2 3.5-.9 6-4 6-7.7 0-4.4-3.6-8-8-8zm-7.9 7l1.5.2c.1-1.2.5-2.3 1.2-3.2l-1.1-.9C4.8 8.2 4.3 9.6 4.1 11zm1.5 1.8l-1.5.2c.1.7.3 1.4.5 2 .3.7.6 1.3 1 1.8l1.2-.8c-.3-.5-.6-1-.8-1.5s-.4-1.1-.4-1.7zm1.5 5.5c1.1.9 2.4 1.4 3.8 1.6l.2-1.5c-1.1-.1-2.2-.5-3.1-1.2l-.9 1.1z" }) }); 3415 3416 // packages/icons/build-module/library/rotate-right.mjs 3417 var import_primitives72 = __toESM(require_primitives(), 1); 3418 var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1); 3419 var rotate_right_default = /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_primitives72.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_primitives72.Path, { d: "M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z" }) }); 3420 3421 // packages/icons/build-module/library/scheduled.mjs 3422 var import_primitives73 = __toESM(require_primitives(), 1); 3423 var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1); 3424 var scheduled_default = /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_primitives73.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_primitives73.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm9 1V8h-1.5v3.5h-2V13H13Z" }) }); 3425 3426 // packages/icons/build-module/library/search.mjs 3427 var import_primitives74 = __toESM(require_primitives(), 1); 3428 var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1); 3429 var search_default = /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_primitives74.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_primitives74.Path, { d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" }) }); 3430 3431 // packages/icons/build-module/library/seen.mjs 3432 var import_primitives75 = __toESM(require_primitives(), 1); 3433 var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1); 3434 var seen_default = /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_primitives75.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_primitives75.Path, { d: "M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z" }) }); 3435 3436 // packages/icons/build-module/library/settings.mjs 3437 var import_primitives76 = __toESM(require_primitives(), 1); 3438 var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1); 3439 var settings_default = /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_primitives76.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: [ 3440 /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_primitives76.Path, { d: "m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z" }), 3441 /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_primitives76.Path, { d: "m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z" }) 3442 ] }); 3443 3444 // packages/icons/build-module/library/shadow.mjs 3445 var import_primitives77 = __toESM(require_primitives(), 1); 3446 var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1); 3447 var shadow_default = /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_primitives77.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_primitives77.Path, { d: "M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM12.8 3h-1.5v3h1.5V3zm-1.6 18h1.5v-3h-1.5v3zm6.8-9.8v1.5h3v-1.5h-3zm-12 0H3v1.5h3v-1.5zm9.7 5.6 2.1 2.1 1.1-1.1-2.1-2.1-1.1 1.1zM8.3 7.2 6.2 5.1 5.1 6.2l2.1 2.1 1.1-1.1zM5.1 17.8l1.1 1.1 2.1-2.1-1.1-1.1-2.1 2.1zM18.9 6.2l-1.1-1.1-2.1 2.1 1.1 1.1 2.1-2.1z" }) }); 3448 3449 // packages/icons/build-module/library/shuffle.mjs 3450 var import_primitives78 = __toESM(require_primitives(), 1); 3451 var import_jsx_runtime78 = __toESM(require_jsx_runtime(), 1); 3452 var shuffle_default = /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_primitives78.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_primitives78.Path, { d: "M17.192 6.75L15.47 5.03l1.06-1.06 3.537 3.53-3.537 3.53-1.06-1.06 1.723-1.72h-3.19c-.602 0-.993.202-1.28.498-.309.319-.538.792-.695 1.383-.13.488-.222 1.023-.296 1.508-.034.664-.116 1.413-.303 2.117-.193.721-.513 1.467-1.068 2.04-.575.594-1.359.954-2.357.954H4v-1.5h4.003c.601 0 .993-.202 1.28-.498.308-.319.538-.792.695-1.383.149-.557.216-1.093.288-1.662l.039-.31a9.653 9.653 0 0 1 .272-1.653c.193-.722.513-1.467 1.067-2.04.576-.594 1.36-.954 2.358-.954h3.19zM8.004 6.75c.8 0 1.46.23 1.988.628a6.24 6.24 0 0 0-.684 1.396 1.725 1.725 0 0 0-.024-.026c-.287-.296-.679-.498-1.28-.498H4v-1.5h4.003zM12.699 14.726c-.161.459-.38.94-.684 1.396.527.397 1.188.628 1.988.628h3.19l-1.722 1.72 1.06 1.06L20.067 16l-3.537-3.53-1.06 1.06 1.723 1.72h-3.19c-.602 0-.993-.202-1.28-.498a1.96 1.96 0 0 1-.024-.026z" }) }); 3453 3454 // packages/icons/build-module/library/sidebar.mjs 3455 var import_primitives79 = __toESM(require_primitives(), 1); 3456 var import_jsx_runtime79 = __toESM(require_jsx_runtime(), 1); 3457 var sidebar_default = /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_primitives79.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_primitives79.Path, { d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) }); 3458 3459 // packages/icons/build-module/library/square.mjs 3460 var import_primitives80 = __toESM(require_primitives(), 1); 3461 var import_jsx_runtime80 = __toESM(require_jsx_runtime(), 1); 3462 var square_default = /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_primitives80.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_primitives80.Path, { fill: "none", d: "M5.75 12.75V18.25H11.25M12.75 5.75H18.25V11.25", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "square" }) }); 3463 3464 // packages/icons/build-module/library/star-empty.mjs 3465 var import_primitives81 = __toESM(require_primitives(), 1); 3466 var import_jsx_runtime81 = __toESM(require_jsx_runtime(), 1); 3467 var star_empty_default = /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_primitives81.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_primitives81.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z" }) }); 3468 3469 // packages/icons/build-module/library/star-filled.mjs 3470 var import_primitives82 = __toESM(require_primitives(), 1); 3471 var import_jsx_runtime82 = __toESM(require_jsx_runtime(), 1); 3472 var star_filled_default = /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_primitives82.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_primitives82.Path, { d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z" }) }); 3473 3474 // packages/icons/build-module/library/styles.mjs 3475 var import_primitives83 = __toESM(require_primitives(), 1); 3476 var import_jsx_runtime83 = __toESM(require_jsx_runtime(), 1); 3477 var styles_default = /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_primitives83.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_primitives83.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 0 1-6.5 6.5v-13a6.5 6.5 0 0 1 6.5 6.5Z" }) }); 3478 3479 // packages/icons/build-module/library/symbol-filled.mjs 3480 var import_primitives84 = __toESM(require_primitives(), 1); 3481 var import_jsx_runtime84 = __toESM(require_jsx_runtime(), 1); 3482 var symbol_filled_default = /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_primitives84.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_primitives84.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) }); 3483 3484 // packages/icons/build-module/library/symbol.mjs 3485 var import_primitives85 = __toESM(require_primitives(), 1); 3486 var import_jsx_runtime85 = __toESM(require_jsx_runtime(), 1); 3487 var symbol_default = /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_primitives85.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_primitives85.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) }); 3488 3489 // packages/icons/build-module/library/tablet.mjs 3490 var import_primitives86 = __toESM(require_primitives(), 1); 3491 var import_jsx_runtime86 = __toESM(require_jsx_runtime(), 1); 3492 var tablet_default = /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_primitives86.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_primitives86.Path, { d: "M17 4H7c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h10c.3 0 .5.2.5.5v12zm-7.5-.5h4V16h-4v1.5z" }) }); 3493 3494 // packages/icons/build-module/library/trash.mjs 3495 var import_primitives87 = __toESM(require_primitives(), 1); 3496 var import_jsx_runtime87 = __toESM(require_jsx_runtime(), 1); 3497 var trash_default = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_primitives87.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_primitives87.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z" }) }); 3498 3499 // packages/icons/build-module/library/typography.mjs 3500 var import_primitives88 = __toESM(require_primitives(), 1); 3501 var import_jsx_runtime88 = __toESM(require_jsx_runtime(), 1); 3502 var typography_default = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_primitives88.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_primitives88.Path, { d: "m8.6 7 3.9 10.8h-1.7l-1-2.8H5.7l-1 2.8H3L6.9 7h1.7Zm-2.4 6.6h3L7.7 9.3l-1.5 4.3ZM17.691 8.879c.473 0 .88.055 1.221.165.352.1.643.264.875.495.274.253.456.572.544.957.088.374.132.83.132 1.37v4.554c0 .274.033.472.099.593.077.11.198.166.363.166.11 0 .215-.028.313-.083.11-.055.237-.137.38-.247l.165.28a3.304 3.304 0 0 1-.71.446c-.23.11-.527.165-.89.165-.352 0-.639-.055-.858-.165-.22-.11-.386-.27-.495-.479-.1-.209-.149-.468-.149-.775-.286.462-.627.814-1.023 1.056-.396.242-.858.363-1.386.363-.462 0-.858-.088-1.188-.264a1.752 1.752 0 0 1-.742-.726 2.201 2.201 0 0 1-.248-1.056c0-.484.11-.875.33-1.172.22-.308.5-.556.841-.742.352-.187.721-.341 1.106-.462.396-.132.765-.253 1.106-.363.351-.121.637-.259.857-.413.232-.154.347-.357.347-.61V10.81c0-.396-.066-.71-.198-.941a1.05 1.05 0 0 0-.511-.511 1.763 1.763 0 0 0-.76-.149c-.253 0-.522.039-.808.116a1.165 1.165 0 0 0-.677.412 1.1 1.1 0 0 1 .595.396c.165.187.247.424.247.71 0 .307-.104.55-.313.726-.198.176-.451.263-.76.263-.34 0-.594-.104-.758-.313a1.231 1.231 0 0 1-.248-.759c0-.297.072-.539.214-.726.154-.187.352-.363.595-.528.264-.176.6-.324 1.006-.445.418-.121.88-.182 1.386-.182Zm.99 3.729a1.57 1.57 0 0 1-.528.462c-.231.121-.479.248-.742.38a5.377 5.377 0 0 0-.76.462c-.23.165-.423.38-.577.643-.154.264-.231.6-.231 1.007 0 .429.11.77.33 1.023.22.242.517.363.891.363.308 0 .594-.088.858-.264.275-.176.528-.44.759-.792v-3.284Z" }) }); 3503 3504 // packages/icons/build-module/library/undo.mjs 3505 var import_primitives89 = __toESM(require_primitives(), 1); 3506 var import_jsx_runtime89 = __toESM(require_jsx_runtime(), 1); 3507 var undo_default = /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_primitives89.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_primitives89.Path, { d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z" }) }); 3508 3509 // packages/icons/build-module/library/unseen.mjs 3510 var import_primitives90 = __toESM(require_primitives(), 1); 3511 var import_jsx_runtime90 = __toESM(require_jsx_runtime(), 1); 3512 var unseen_default = /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_primitives90.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_primitives90.Path, { d: "M20.7 12.7s0-.1-.1-.2c0-.2-.2-.4-.4-.6-.3-.5-.9-1.2-1.6-1.8-.7-.6-1.5-1.3-2.6-1.8l-.6 1.4c.9.4 1.6 1 2.1 1.5.6.6 1.1 1.2 1.4 1.6.1.2.3.4.3.5v.1l.7-.3.7-.3Zm-5.2-9.3-1.8 4c-.5-.1-1.1-.2-1.7-.2-3 0-5.2 1.4-6.6 2.7-.7.7-1.2 1.3-1.6 1.8-.2.3-.3.5-.4.6 0 0 0 .1-.1.2s0 0 .7.3l.7.3V13c0-.1.2-.3.3-.5.3-.4.7-1 1.4-1.6 1.2-1.2 3-2.3 5.5-2.3H13v.3c-.4 0-.8-.1-1.1-.1-1.9 0-3.5 1.6-3.5 3.5s.6 2.3 1.6 2.9l-2 4.4.9.4 7.6-16.2-.9-.4Zm-3 12.6c1.7-.2 3-1.7 3-3.5s-.2-1.4-.6-1.9L12.4 16Z" }) }); 3513 3514 // packages/icons/build-module/library/verse.mjs 3515 var import_primitives91 = __toESM(require_primitives(), 1); 3516 var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1); 3517 var verse_default = /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_primitives91.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_primitives91.Path, { d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z" }) }); 3518 3519 // packages/icons/build-module/library/video.mjs 3520 var import_primitives92 = __toESM(require_primitives(), 1); 3521 var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1); 3522 var video_default = /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_primitives92.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_primitives92.Path, { d: "M18.7 3H5.3C4 3 3 4 3 5.3v13.4C3 20 4 21 5.3 21h13.4c1.3 0 2.3-1 2.3-2.3V5.3C21 4 20 3 18.7 3zm.8 15.7c0 .4-.4.8-.8.8H5.3c-.4 0-.8-.4-.8-.8V5.3c0-.4.4-.8.8-.8h13.4c.4 0 .8.4.8.8v13.4zM10 15l5-3-5-3v6z" }) }); 3523 3524 // packages/icons/build-module/library/wordpress.mjs 3525 var import_primitives93 = __toESM(require_primitives(), 1); 3526 var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1); 3527 var wordpress_default = /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_primitives93.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "-2 -2 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_primitives93.Path, { d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z" }) }); 3528 3529 // packages/editor/build-module/utils/get-template-part-icon.mjs 3530 function getTemplatePartIcon(areaOrIconName) { 3531 if ("header" === areaOrIconName) { 3532 return header_default; 3533 } else if ("footer" === areaOrIconName) { 3534 return footer_default; 3535 } else if ("sidebar" === areaOrIconName) { 3536 return sidebar_default; 3537 } else if ("navigation-overlay" === areaOrIconName) { 3538 return navigation_overlay_default; 3539 } 3540 return symbol_filled_default; 3541 } 3542 3543 // packages/editor/build-module/lock-unlock.mjs 3544 var import_private_apis = __toESM(require_private_apis(), 1); 3545 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 3546 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 3547 "@wordpress/editor" 3548 ); 3549 3550 // packages/editor/build-module/utils/get-template-info.mjs 3551 var EMPTY_OBJECT = {}; 3552 var getTemplateInfo = (params) => { 3553 if (!params) { 3554 return EMPTY_OBJECT; 3555 } 3556 const { templateTypes, templateAreas, template: template2 } = params; 3557 const { description, slug, title, area } = template2; 3558 const { title: defaultTitle, description: defaultDescription } = Object.values(templateTypes).find((type) => type.slug === slug) ?? EMPTY_OBJECT; 3559 const templateTitle = typeof title === "string" ? title : title?.rendered; 3560 const templateDescription = typeof description === "string" ? description : description?.raw; 3561 const templateAreasWithIcon = templateAreas?.map((item) => ({ 3562 ...item, 3563 icon: getTemplatePartIcon(item.icon) 3564 })); 3565 const templateIcon = templateAreasWithIcon?.find((item) => area === item.area)?.icon || layout_default; 3566 return { 3567 title: templateTitle && templateTitle !== slug ? templateTitle : defaultTitle || slug, 3568 description: templateDescription || defaultDescription, 3569 icon: templateIcon 3570 }; 3571 }; 3572 3573 // packages/global-styles-engine/build-module/utils/object.mjs 3574 function setImmutably(object, path, value) { 3575 path = Array.isArray(path) ? [...path] : [path]; 3576 object = Array.isArray(object) ? [...object] : { ...object }; 3577 const leaf = path.pop(); 3578 let prev = object; 3579 for (const key of path) { 3580 const lvl = prev[key]; 3581 prev = prev[key] = Array.isArray(lvl) ? [...lvl] : { ...lvl }; 3582 } 3583 prev[leaf] = value; 3584 return object; 3585 } 3586 var getValueFromObjectPath = (object, path, defaultValue2) => { 3587 const arrayPath = Array.isArray(path) ? path : path.split("."); 3588 let value = object; 3589 arrayPath.forEach((fieldName) => { 3590 value = value?.[fieldName]; 3591 }); 3592 return value ?? defaultValue2; 3593 }; 3594 3595 // packages/global-styles-engine/build-module/settings/get-setting.mjs 3596 var VALID_SETTINGS = [ 3597 "appearanceTools", 3598 "useRootPaddingAwareAlignments", 3599 "background.backgroundImage", 3600 "background.backgroundRepeat", 3601 "background.backgroundSize", 3602 "background.backgroundPosition", 3603 "background.gradient", 3604 "border.color", 3605 "border.radius", 3606 "border.radiusSizes", 3607 "border.style", 3608 "border.width", 3609 "shadow.presets", 3610 "shadow.defaultPresets", 3611 "color.background", 3612 "color.button", 3613 "color.caption", 3614 "color.custom", 3615 "color.customDuotone", 3616 "color.customGradient", 3617 "color.defaultDuotone", 3618 "color.defaultGradients", 3619 "color.defaultPalette", 3620 "color.duotone", 3621 "color.gradients", 3622 "color.heading", 3623 "color.link", 3624 "color.palette", 3625 "color.text", 3626 "custom", 3627 "dimensions.aspectRatio", 3628 "dimensions.height", 3629 "dimensions.minHeight", 3630 "dimensions.minWidth", 3631 "dimensions.width", 3632 "dimensions.dimensionSizes", 3633 "layout.contentSize", 3634 "layout.definitions", 3635 "layout.wideSize", 3636 "lightbox.enabled", 3637 "lightbox.allowEditing", 3638 "position.fixed", 3639 "position.sticky", 3640 "spacing.customSpacingSize", 3641 "spacing.defaultSpacingSizes", 3642 "spacing.spacingSizes", 3643 "spacing.spacingScale", 3644 "spacing.blockGap", 3645 "spacing.margin", 3646 "spacing.padding", 3647 "spacing.units", 3648 "typography.fluid", 3649 "typography.customFontSize", 3650 "typography.defaultFontSizes", 3651 "typography.dropCap", 3652 "typography.fontFamilies", 3653 "typography.fontSizes", 3654 "typography.fontStyle", 3655 "typography.fontWeight", 3656 "typography.letterSpacing", 3657 "typography.lineHeight", 3658 "typography.textAlign", 3659 "typography.textColumns", 3660 "typography.textDecoration", 3661 "typography.textIndent", 3662 "typography.textTransform", 3663 "typography.writingMode", 3664 "viewport.mobile", 3665 "viewport.tablet" 3666 ]; 3667 function getSetting(globalStyles, path, blockName) { 3668 const appendedBlockPath = blockName ? ".blocks." + blockName : ""; 3669 const appendedPropertyPath = path ? "." + path : ""; 3670 const contextualPath = `settings$appendedBlockPath}$appendedPropertyPath}`; 3671 const globalPath = `settings$appendedPropertyPath}`; 3672 if (path) { 3673 return getValueFromObjectPath(globalStyles, contextualPath) ?? getValueFromObjectPath(globalStyles, globalPath); 3674 } 3675 let result = {}; 3676 VALID_SETTINGS.forEach((setting) => { 3677 const value = getValueFromObjectPath( 3678 globalStyles, 3679 `settings$appendedBlockPath}.$setting}` 3680 ) ?? getValueFromObjectPath(globalStyles, `settings.$setting}`); 3681 if (value !== void 0) { 3682 result = setImmutably(result, setting.split("."), value); 3683 } 3684 }); 3685 return result; 3686 } 3687 3688 // packages/global-styles-engine/build-module/settings/set-setting.mjs 3689 function setSetting(globalStyles, path, newValue, blockName) { 3690 const appendedBlockPath = blockName ? ".blocks." + blockName : ""; 3691 const appendedPropertyPath = path ? "." + path : ""; 3692 const finalPath = `settings$appendedBlockPath}$appendedPropertyPath}`; 3693 return setImmutably( 3694 globalStyles, 3695 finalPath.split("."), 3696 newValue 3697 ); 3698 } 3699 3700 // packages/global-styles-engine/build-module/utils/common.mjs 3701 var import_style_engine = __toESM(require_style_engine(), 1); 3702 3703 // packages/global-styles-engine/build-module/utils/fluid.mjs 3704 var DEFAULT_MAXIMUM_VIEWPORT_WIDTH = "1600px"; 3705 var DEFAULT_MINIMUM_VIEWPORT_WIDTH = "320px"; 3706 var DEFAULT_SCALE_FACTOR = 1; 3707 var DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN = 0.25; 3708 var DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX = 0.75; 3709 var DEFAULT_MINIMUM_FONT_SIZE_LIMIT = "14px"; 3710 function getComputedFluidTypographyValue({ 3711 minimumFontSize, 3712 maximumFontSize, 3713 fontSize, 3714 minimumViewportWidth = DEFAULT_MINIMUM_VIEWPORT_WIDTH, 3715 maximumViewportWidth = DEFAULT_MAXIMUM_VIEWPORT_WIDTH, 3716 scaleFactor = DEFAULT_SCALE_FACTOR, 3717 minimumFontSizeLimit 3718 }) { 3719 minimumFontSizeLimit = !!getTypographyValueAndUnit(minimumFontSizeLimit) ? minimumFontSizeLimit : DEFAULT_MINIMUM_FONT_SIZE_LIMIT; 3720 if (fontSize) { 3721 const fontSizeParsed = getTypographyValueAndUnit(fontSize); 3722 if (!fontSizeParsed?.unit || !fontSizeParsed?.value) { 3723 return null; 3724 } 3725 const minimumFontSizeLimitParsed = getTypographyValueAndUnit( 3726 minimumFontSizeLimit, 3727 { 3728 coerceTo: fontSizeParsed.unit 3729 } 3730 ); 3731 if (!!minimumFontSizeLimitParsed?.value && !minimumFontSize && !maximumFontSize) { 3732 if (fontSizeParsed?.value <= minimumFontSizeLimitParsed?.value) { 3733 return null; 3734 } 3735 } 3736 if (!maximumFontSize) { 3737 maximumFontSize = `$fontSizeParsed.value}$fontSizeParsed.unit}`; 3738 } 3739 if (!minimumFontSize) { 3740 const fontSizeValueInPx = fontSizeParsed.unit === "px" ? fontSizeParsed.value : fontSizeParsed.value * 16; 3741 const minimumFontSizeFactor = Math.min( 3742 Math.max( 3743 1 - 0.075 * Math.log2(fontSizeValueInPx), 3744 DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN 3745 ), 3746 DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX 3747 ); 3748 const calculatedMinimumFontSize = roundToPrecision( 3749 fontSizeParsed.value * minimumFontSizeFactor, 3750 3 3751 ); 3752 if (!!minimumFontSizeLimitParsed?.value && calculatedMinimumFontSize < minimumFontSizeLimitParsed?.value) { 3753 minimumFontSize = `$minimumFontSizeLimitParsed.value}$minimumFontSizeLimitParsed.unit}`; 3754 } else { 3755 minimumFontSize = `$calculatedMinimumFontSize}$fontSizeParsed.unit}`; 3756 } 3757 } 3758 } 3759 const minimumFontSizeParsed = getTypographyValueAndUnit(minimumFontSize); 3760 const fontSizeUnit = minimumFontSizeParsed?.unit || "rem"; 3761 const maximumFontSizeParsed = getTypographyValueAndUnit(maximumFontSize, { 3762 coerceTo: fontSizeUnit 3763 }); 3764 if (!minimumFontSizeParsed || !maximumFontSizeParsed) { 3765 return null; 3766 } 3767 const minimumFontSizeRem = getTypographyValueAndUnit(minimumFontSize, { 3768 coerceTo: "rem" 3769 }); 3770 const maximumViewportWidthParsed = getTypographyValueAndUnit( 3771 maximumViewportWidth, 3772 { coerceTo: fontSizeUnit } 3773 ); 3774 const minimumViewportWidthParsed = getTypographyValueAndUnit( 3775 minimumViewportWidth, 3776 { coerceTo: fontSizeUnit } 3777 ); 3778 if (!maximumViewportWidthParsed || !minimumViewportWidthParsed || !minimumFontSizeRem) { 3779 return null; 3780 } 3781 const linearDenominator = maximumViewportWidthParsed.value - minimumViewportWidthParsed.value; 3782 if (!linearDenominator) { 3783 return null; 3784 } 3785 const minViewportWidthOffsetValue = roundToPrecision( 3786 minimumViewportWidthParsed.value / 100, 3787 3 3788 ); 3789 const viewportWidthOffset = roundToPrecision(minViewportWidthOffsetValue, 3) + fontSizeUnit; 3790 const linearFactor = 100 * ((maximumFontSizeParsed.value - minimumFontSizeParsed.value) / linearDenominator); 3791 const linearFactorScaled = roundToPrecision( 3792 (linearFactor || 1) * scaleFactor, 3793 3 3794 ); 3795 const fluidTargetFontSize = `$minimumFontSizeRem.value}$minimumFontSizeRem.unit} + ((1vw - $viewportWidthOffset}) * $linearFactorScaled})`; 3796 return `clamp($minimumFontSize}, $fluidTargetFontSize}, $maximumFontSize})`; 3797 } 3798 function getTypographyValueAndUnit(rawValue, options = {}) { 3799 if (typeof rawValue !== "string" && typeof rawValue !== "number") { 3800 return null; 3801 } 3802 if (isFinite(rawValue)) { 3803 rawValue = `$rawValue}px`; 3804 } 3805 const { coerceTo, rootSizeValue, acceptableUnits } = { 3806 coerceTo: "", 3807 // Default browser font size. Later we could inject some JS to compute this `getComputedStyle( document.querySelector( "html" ) ).fontSize`. 3808 rootSizeValue: 16, 3809 acceptableUnits: ["rem", "px", "em"], 3810 ...options 3811 }; 3812 const acceptableUnitsGroup = acceptableUnits?.join("|"); 3813 const regexUnits = new RegExp( 3814 `^(\\d*\\.?\\d+)($acceptableUnitsGroup}){1,1}$` 3815 ); 3816 const matches = rawValue.toString().match(regexUnits); 3817 if (!matches || matches.length < 3) { 3818 return null; 3819 } 3820 let [, value, unit] = matches; 3821 let returnValue = parseFloat(value); 3822 if ("px" === coerceTo && ("em" === unit || "rem" === unit)) { 3823 returnValue = returnValue * rootSizeValue; 3824 unit = coerceTo; 3825 } 3826 if ("px" === unit && ("em" === coerceTo || "rem" === coerceTo)) { 3827 returnValue = returnValue / rootSizeValue; 3828 unit = coerceTo; 3829 } 3830 if (("em" === coerceTo || "rem" === coerceTo) && ("em" === unit || "rem" === unit)) { 3831 unit = coerceTo; 3832 } 3833 if (!unit) { 3834 return null; 3835 } 3836 return { 3837 value: roundToPrecision(returnValue, 3), 3838 unit 3839 }; 3840 } 3841 function roundToPrecision(value, digits = 3) { 3842 const base = Math.pow(10, digits); 3843 return Math.round(value * base) / base; 3844 } 3845 3846 // packages/global-styles-engine/build-module/utils/typography.mjs 3847 function isFluidTypographyEnabled(typographySettings) { 3848 const fluidSettings = typographySettings?.fluid; 3849 return true === fluidSettings || fluidSettings && typeof fluidSettings === "object" && Object.keys(fluidSettings).length > 0; 3850 } 3851 function getFluidTypographyOptionsFromSettings(settings) { 3852 const typographySettings = settings?.typography ?? {}; 3853 const layoutSettings = settings?.layout; 3854 const defaultMaxViewportWidth = getTypographyValueAndUnit( 3855 layoutSettings?.wideSize 3856 ) ? layoutSettings?.wideSize : null; 3857 return isFluidTypographyEnabled(typographySettings) && defaultMaxViewportWidth ? { 3858 fluid: { 3859 maxViewportWidth: defaultMaxViewportWidth, 3860 ...typeof typographySettings.fluid === "object" ? typographySettings.fluid : {} 3861 } 3862 } : { 3863 fluid: typographySettings?.fluid 3864 }; 3865 } 3866 function getTypographyFontSizeValue(preset, settings) { 3867 const { size: defaultSize } = preset; 3868 if (!defaultSize || "0" === defaultSize || false === preset?.fluid) { 3869 return defaultSize; 3870 } 3871 if (!isFluidTypographyEnabled(settings?.typography) && !isFluidTypographyEnabled(preset)) { 3872 return defaultSize; 3873 } 3874 const fluidTypographySettings = getFluidTypographyOptionsFromSettings(settings)?.fluid ?? {}; 3875 const fluidFontSizeValue = getComputedFluidTypographyValue({ 3876 minimumFontSize: typeof preset?.fluid === "boolean" ? void 0 : preset?.fluid?.min, 3877 maximumFontSize: typeof preset?.fluid === "boolean" ? void 0 : preset?.fluid?.max, 3878 fontSize: defaultSize, 3879 minimumFontSizeLimit: typeof fluidTypographySettings === "object" ? fluidTypographySettings?.minFontSize : void 0, 3880 maximumViewportWidth: typeof fluidTypographySettings === "object" ? fluidTypographySettings?.maxViewportWidth : void 0, 3881 minimumViewportWidth: typeof fluidTypographySettings === "object" ? fluidTypographySettings?.minViewportWidth : void 0 3882 }); 3883 if (!!fluidFontSizeValue) { 3884 return fluidFontSizeValue; 3885 } 3886 return defaultSize; 3887 } 3888 3889 // packages/global-styles-engine/build-module/utils/common.mjs 3890 var ROOT_BLOCK_SELECTOR = "body"; 3891 var ROOT_CSS_PROPERTIES_SELECTOR = ":root"; 3892 function splitSelectorList(selector2) { 3893 if (!selector2.includes(",")) { 3894 return [selector2]; 3895 } 3896 const selectors3 = []; 3897 let currentSelector = ""; 3898 let parenthesesDepth = 0; 3899 for (const char of selector2) { 3900 if (char === "(") { 3901 parenthesesDepth++; 3902 } else if (char === ")" && parenthesesDepth > 0) { 3903 parenthesesDepth--; 3904 } else if (char === "," && parenthesesDepth === 0) { 3905 selectors3.push(currentSelector); 3906 currentSelector = ""; 3907 continue; 3908 } 3909 currentSelector += char; 3910 } 3911 selectors3.push(currentSelector); 3912 return selectors3; 3913 } 3914 var PRESET_METADATA = [ 3915 { 3916 path: ["color", "palette"], 3917 valueKey: "color", 3918 cssVarInfix: "color", 3919 classes: [ 3920 { classSuffix: "color", propertyName: "color" }, 3921 { 3922 classSuffix: "background-color", 3923 propertyName: "background-color" 3924 }, 3925 { 3926 classSuffix: "border-color", 3927 propertyName: "border-color" 3928 } 3929 ] 3930 }, 3931 { 3932 path: ["color", "gradients"], 3933 valueKey: "gradient", 3934 cssVarInfix: "gradient", 3935 classes: [ 3936 { 3937 classSuffix: "gradient-background", 3938 propertyName: "background" 3939 } 3940 ] 3941 }, 3942 { 3943 path: ["color", "duotone"], 3944 valueKey: "colors", 3945 cssVarInfix: "duotone", 3946 valueFunc: ({ slug }) => `url( '#wp-duotone-$slug}' )`, 3947 classes: [] 3948 }, 3949 { 3950 path: ["shadow", "presets"], 3951 valueKey: "shadow", 3952 cssVarInfix: "shadow", 3953 classes: [] 3954 }, 3955 { 3956 path: ["typography", "fontSizes"], 3957 valueFunc: (preset, settings) => getTypographyFontSizeValue(preset, settings), 3958 valueKey: "size", 3959 cssVarInfix: "font-size", 3960 classes: [{ classSuffix: "font-size", propertyName: "font-size" }] 3961 }, 3962 { 3963 path: ["typography", "fontFamilies"], 3964 valueKey: "fontFamily", 3965 cssVarInfix: "font-family", 3966 classes: [ 3967 { classSuffix: "font-family", propertyName: "font-family" } 3968 ] 3969 }, 3970 { 3971 path: ["spacing", "spacingSizes"], 3972 valueKey: "size", 3973 cssVarInfix: "spacing", 3974 valueFunc: ({ size: size4 }) => size4, 3975 classes: [] 3976 }, 3977 { 3978 path: ["border", "radiusSizes"], 3979 valueKey: "size", 3980 cssVarInfix: "border-radius", 3981 classes: [] 3982 }, 3983 { 3984 path: ["dimensions", "dimensionSizes"], 3985 valueKey: "size", 3986 cssVarInfix: "dimension", 3987 classes: [] 3988 } 3989 ]; 3990 function scopeSelector(scope, selector2) { 3991 if (!scope || !selector2) { 3992 return selector2; 3993 } 3994 const scopes = splitSelectorList(scope); 3995 const selectors3 = splitSelectorList(selector2); 3996 const selectorsScoped = []; 3997 scopes.forEach((outer) => { 3998 selectors3.forEach((inner) => { 3999 selectorsScoped.push(`$outer.trim()} $inner.trim()}`); 4000 }); 4001 }); 4002 return selectorsScoped.join(", "); 4003 } 4004 function scopeFeatureSelectors(scope, selectors3) { 4005 if (!scope || !selectors3) { 4006 return; 4007 } 4008 const featureSelectors = {}; 4009 Object.entries(selectors3).forEach(([feature, selector2]) => { 4010 if (typeof selector2 === "string") { 4011 featureSelectors[feature] = scopeSelector(scope, selector2); 4012 } 4013 if (typeof selector2 === "object") { 4014 featureSelectors[feature] = {}; 4015 Object.entries(selector2).forEach( 4016 ([subfeature, subfeatureSelector]) => { 4017 featureSelectors[feature][subfeature] = scopeSelector( 4018 scope, 4019 subfeatureSelector 4020 ); 4021 } 4022 ); 4023 } 4024 }); 4025 return featureSelectors; 4026 } 4027 function appendToSelector(selector2, toAppend) { 4028 if (!selector2.includes(",")) { 4029 return selector2 + toAppend; 4030 } 4031 const selectors3 = splitSelectorList(selector2); 4032 const newSelectors = selectors3.map((sel) => sel + toAppend); 4033 return newSelectors.join(","); 4034 } 4035 function getBlockStyleVariationSelector(variation, blockSelector) { 4036 const variationClass = `.is-style-$variation}`; 4037 if (!blockSelector) { 4038 return variationClass; 4039 } 4040 const ancestorRegex = /[^\s:]+/; 4041 const addVariationClass = (match3) => match3 + variationClass; 4042 const result = splitSelectorList(blockSelector).map( 4043 (part) => part.replace(ancestorRegex, addVariationClass) 4044 ); 4045 return result.join(","); 4046 } 4047 function getBlockStyleVariationFeatureSelector(variation, featureSelector) { 4048 const variationClass = `.is-style-$variation}`; 4049 const selectorParts = splitSelectorList(featureSelector).map( 4050 (selector2) => { 4051 const trimmedSelector = selector2.trim(); 4052 const prefix2 = `$variationClass} `; 4053 if (trimmedSelector.startsWith(prefix2)) { 4054 return trimmedSelector.slice(prefix2.length); 4055 } 4056 return trimmedSelector; 4057 } 4058 ); 4059 return getBlockStyleVariationSelector( 4060 variation, 4061 selectorParts.join(",") 4062 ); 4063 } 4064 function getResolvedRefValue(ruleValue, tree) { 4065 if (!ruleValue || !tree) { 4066 return ruleValue; 4067 } 4068 if (typeof ruleValue === "object" && "ref" in ruleValue && ruleValue?.ref) { 4069 const resolvedRuleValue = (0, import_style_engine.getCSSValueFromRawStyle)( 4070 getValueFromObjectPath(tree, ruleValue.ref) 4071 ); 4072 if (typeof resolvedRuleValue === "object" && resolvedRuleValue !== null && "ref" in resolvedRuleValue && resolvedRuleValue?.ref) { 4073 return void 0; 4074 } 4075 if (resolvedRuleValue === void 0) { 4076 return ruleValue; 4077 } 4078 return resolvedRuleValue; 4079 } 4080 return ruleValue; 4081 } 4082 function getResolvedThemeFilePath(file, themeFileURIs) { 4083 if (!file || !themeFileURIs || !Array.isArray(themeFileURIs)) { 4084 return file; 4085 } 4086 const uri = themeFileURIs.find( 4087 (themeFileUri) => themeFileUri?.name === file 4088 ); 4089 if (!uri?.href) { 4090 return file; 4091 } 4092 return uri?.href; 4093 } 4094 function getResolvedValue(ruleValue, tree) { 4095 if (!ruleValue || !tree) { 4096 return ruleValue; 4097 } 4098 const resolvedValue = getResolvedRefValue(ruleValue, tree); 4099 if (typeof resolvedValue === "object" && resolvedValue !== null && "url" in resolvedValue && resolvedValue?.url) { 4100 resolvedValue.url = getResolvedThemeFilePath( 4101 resolvedValue.url, 4102 tree?._links?.["wp:theme-file"] 4103 ); 4104 } 4105 return resolvedValue; 4106 } 4107 function findInPresetsBy(settings, blockName, presetPath = [], presetProperty = "slug", presetValueValue) { 4108 const orderedPresetsByOrigin = [ 4109 blockName ? getValueFromObjectPath(settings, [ 4110 "blocks", 4111 blockName, 4112 ...presetPath 4113 ]) : void 0, 4114 getValueFromObjectPath(settings, presetPath) 4115 ].filter(Boolean); 4116 for (const presetByOrigin of orderedPresetsByOrigin) { 4117 if (presetByOrigin) { 4118 const origins = ["custom", "theme", "default"]; 4119 for (const origin of origins) { 4120 const presets = presetByOrigin[origin]; 4121 if (presets) { 4122 const presetObject = presets.find( 4123 (preset) => preset[presetProperty] === presetValueValue 4124 ); 4125 if (presetObject) { 4126 if (presetProperty === "slug") { 4127 return presetObject; 4128 } 4129 const highestPresetObjectWithSameSlug = findInPresetsBy( 4130 settings, 4131 blockName, 4132 presetPath, 4133 "slug", 4134 presetObject.slug 4135 ); 4136 if (highestPresetObjectWithSameSlug[presetProperty] === presetObject[presetProperty]) { 4137 return presetObject; 4138 } 4139 return void 0; 4140 } 4141 } 4142 } 4143 } 4144 } 4145 } 4146 function getValueFromPresetVariable(features, blockName, variable, [presetType, slug] = []) { 4147 const metadata = PRESET_METADATA.find( 4148 (data) => data.cssVarInfix === presetType 4149 ); 4150 if (!metadata || !features.settings) { 4151 return variable; 4152 } 4153 const presetObject = findInPresetsBy( 4154 features.settings, 4155 blockName, 4156 metadata.path, 4157 "slug", 4158 slug 4159 ); 4160 if (presetObject) { 4161 const { valueKey } = metadata; 4162 const result = presetObject[valueKey]; 4163 return getValueFromVariable(features, blockName, result); 4164 } 4165 return variable; 4166 } 4167 function getValueFromCustomVariable(features, blockName, variable, path = []) { 4168 const result = (blockName ? getValueFromObjectPath(features?.settings ?? {}, [ 4169 "blocks", 4170 blockName, 4171 "custom", 4172 ...path 4173 ]) : void 0) ?? getValueFromObjectPath(features?.settings ?? {}, [ 4174 "custom", 4175 ...path 4176 ]); 4177 if (!result) { 4178 return variable; 4179 } 4180 return getValueFromVariable(features, blockName, result); 4181 } 4182 function getValueFromVariable(features, blockName, variable) { 4183 if (!variable || typeof variable !== "string") { 4184 if (typeof variable === "object" && variable !== null && "ref" in variable && typeof variable.ref === "string") { 4185 const resolvedVariable = getValueFromObjectPath( 4186 features, 4187 variable.ref 4188 ); 4189 if (!resolvedVariable || typeof resolvedVariable === "object" && "ref" in resolvedVariable) { 4190 return resolvedVariable; 4191 } 4192 variable = resolvedVariable; 4193 } else { 4194 return variable; 4195 } 4196 } 4197 const USER_VALUE_PREFIX = "var:"; 4198 const THEME_VALUE_PREFIX = "var(--wp--"; 4199 const THEME_VALUE_SUFFIX = ")"; 4200 let parsedVar; 4201 if (variable.startsWith(USER_VALUE_PREFIX)) { 4202 parsedVar = variable.slice(USER_VALUE_PREFIX.length).split("|"); 4203 } else if (variable.startsWith(THEME_VALUE_PREFIX) && variable.endsWith(THEME_VALUE_SUFFIX)) { 4204 parsedVar = variable.slice(THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length).split("--"); 4205 } else { 4206 return variable; 4207 } 4208 const [type, ...path] = parsedVar; 4209 if (type === "preset") { 4210 return getValueFromPresetVariable( 4211 features, 4212 blockName, 4213 variable, 4214 path 4215 ); 4216 } 4217 if (type === "custom") { 4218 return getValueFromCustomVariable( 4219 features, 4220 blockName, 4221 variable, 4222 path 4223 ); 4224 } 4225 return variable; 4226 } 4227 4228 // packages/global-styles-engine/build-module/style-state-back-compat.mjs 4229 var LEGACY_STYLE_STATE_ALIASES = { 4230 "@mobile": "mobile", 4231 "@tablet": "tablet", 4232 "-current": "@current" 4233 }; 4234 function isObjectRecord(value) { 4235 return !!value && typeof value === "object" && !Array.isArray(value); 4236 } 4237 function normalizeStyleStateNode(node) { 4238 if (!isObjectRecord(node)) { 4239 return node; 4240 } 4241 let normalized = node; 4242 Object.entries(LEGACY_STYLE_STATE_ALIASES).forEach( 4243 ([state2, legacyState]) => { 4244 if (Object.hasOwn(node, legacyState)) { 4245 if (normalized === node) { 4246 normalized = { ...node }; 4247 } 4248 if (!Object.hasOwn(node, state2)) { 4249 normalized[state2] = node[legacyState]; 4250 } 4251 delete normalized[legacyState]; 4252 } 4253 } 4254 ); 4255 Object.entries(normalized).forEach(([key, value]) => { 4256 if (!isObjectRecord(value)) { 4257 return; 4258 } 4259 const normalizedValue = normalizeStyleStateNode(value); 4260 if (normalizedValue !== value) { 4261 if (normalized === node) { 4262 normalized = { ...node }; 4263 } 4264 normalized[key] = normalizedValue; 4265 } 4266 }); 4267 return normalized; 4268 } 4269 function normalizeStyleStateAliases(globalStyles) { 4270 if (true) { 4271 return globalStyles; 4272 } 4273 if (!globalStyles?.styles) { 4274 return globalStyles; 4275 } 4276 const styles = normalizeStyleStateNode(globalStyles.styles); 4277 return styles === globalStyles.styles ? globalStyles : { ...globalStyles, styles }; 4278 } 4279 function getLegacyStyleStatePath(path) { 4280 if (true) { 4281 return void 0; 4282 } 4283 const pathParts = path.split("."); 4284 const legacyPathParts = pathParts.map( 4285 (part) => LEGACY_STYLE_STATE_ALIASES[part] ?? part 4286 ); 4287 return legacyPathParts.some( 4288 (part, index2) => part !== pathParts[index2] 4289 ) ? legacyPathParts.join(".") : void 0; 4290 } 4291 4292 // packages/global-styles-engine/build-module/settings/get-style.mjs 4293 function getStyle(globalStyles, path, blockName, shouldDecodeEncode = true) { 4294 const appendedPath = path ? "." + path : ""; 4295 const finalPath = !blockName ? `styles$appendedPath}` : `styles.blocks.$blockName}$appendedPath}`; 4296 if (!globalStyles) { 4297 return void 0; 4298 } 4299 let rawResult = getValueFromObjectPath(globalStyles, finalPath); 4300 const legacyPath = getLegacyStyleStatePath(finalPath); 4301 if (rawResult === void 0 && legacyPath) { 4302 let hasCanonicalPath = true; 4303 let currentValue = globalStyles; 4304 for (const pathPart of finalPath.split(".")) { 4305 if (!currentValue || typeof currentValue !== "object" || !Object.hasOwn(currentValue, pathPart)) { 4306 hasCanonicalPath = false; 4307 break; 4308 } 4309 currentValue = currentValue[pathPart]; 4310 } 4311 if (!hasCanonicalPath) { 4312 rawResult = getValueFromObjectPath(globalStyles, legacyPath); 4313 } 4314 } 4315 const result = shouldDecodeEncode ? getValueFromVariable(globalStyles, blockName, rawResult) : rawResult; 4316 return result; 4317 } 4318 4319 // packages/global-styles-engine/build-module/settings/set-style.mjs 4320 function setStyle(globalStyles, path, newValue, blockName) { 4321 const appendedPath = path ? "." + path : ""; 4322 const finalPath = !blockName ? `styles$appendedPath}` : `styles.blocks.$blockName}$appendedPath}`; 4323 return setImmutably( 4324 normalizeStyleStateAliases(globalStyles), 4325 finalPath.split("."), 4326 newValue 4327 ); 4328 } 4329 4330 // packages/global-styles-engine/build-module/core/equal.mjs 4331 var import_es6 = __toESM(require_es6(), 1); 4332 function areGlobalStylesEqual(original, variation) { 4333 if (typeof original !== "object" || typeof variation !== "object") { 4334 return original === variation; 4335 } 4336 return (0, import_es6.default)(original?.styles, variation?.styles) && (0, import_es6.default)(original?.settings, variation?.settings); 4337 } 4338 4339 // packages/global-styles-engine/build-module/core/merge.mjs 4340 var import_deepmerge = __toESM(require_cjs(), 1); 4341 4342 // node_modules/is-plain-object/dist/is-plain-object.mjs 4343 function isObject(o4) { 4344 return Object.prototype.toString.call(o4) === "[object Object]"; 4345 } 4346 function isPlainObject(o4) { 4347 var ctor, prot; 4348 if (isObject(o4) === false) return false; 4349 ctor = o4.constructor; 4350 if (ctor === void 0) return true; 4351 prot = ctor.prototype; 4352 if (isObject(prot) === false) return false; 4353 if (prot.hasOwnProperty("isPrototypeOf") === false) { 4354 return false; 4355 } 4356 return true; 4357 } 4358 4359 // packages/global-styles-engine/build-module/core/merge.mjs 4360 function mergeGlobalStyles(base, user) { 4361 return (0, import_deepmerge.default)( 4362 normalizeStyleStateAliases(base), 4363 normalizeStyleStateAliases(user), 4364 { 4365 /* 4366 * We only pass as arrays the presets, 4367 * in which case we want the new array of values 4368 * to override the old array (no merging). 4369 */ 4370 isMergeableObject: isPlainObject, 4371 /* 4372 * Exceptions to the above rule. 4373 * Background images should be replaced, not merged, 4374 * as they themselves are specific object definitions for the style. 4375 */ 4376 customMerge: (key) => { 4377 if (key === "backgroundImage") { 4378 return (baseConfig, userConfig) => userConfig ?? baseConfig; 4379 } 4380 return void 0; 4381 } 4382 } 4383 ); 4384 } 4385 4386 // node_modules/memize/dist/index.js 4387 function memize(fn, options) { 4388 var size4 = 0; 4389 var head2; 4390 var tail; 4391 options = options || {}; 4392 function memoized() { 4393 var node = head2, len2 = arguments.length, args, i3; 4394 searchCache: while (node) { 4395 if (node.args.length !== arguments.length) { 4396 node = node.next; 4397 continue; 4398 } 4399 for (i3 = 0; i3 < len2; i3++) { 4400 if (node.args[i3] !== arguments[i3]) { 4401 node = node.next; 4402 continue searchCache; 4403 } 4404 } 4405 if (node !== head2) { 4406 if (node === tail) { 4407 tail = node.prev; 4408 } 4409 node.prev.next = node.next; 4410 if (node.next) { 4411 node.next.prev = node.prev; 4412 } 4413 node.next = head2; 4414 node.prev = null; 4415 head2.prev = node; 4416 head2 = node; 4417 } 4418 return node.val; 4419 } 4420 args = new Array(len2); 4421 for (i3 = 0; i3 < len2; i3++) { 4422 args[i3] = arguments[i3]; 4423 } 4424 node = { 4425 args, 4426 // Generate the result from original function 4427 val: fn.apply(null, args) 4428 }; 4429 if (head2) { 4430 head2.prev = node; 4431 node.next = head2; 4432 } else { 4433 tail = node; 4434 } 4435 if (size4 === /** @type {MemizeOptions} */ 4436 options.maxSize) { 4437 tail = /** @type {MemizeCacheNode} */ 4438 tail.prev; 4439 tail.next = null; 4440 } else { 4441 size4++; 4442 } 4443 head2 = node; 4444 return node.val; 4445 } 4446 memoized.clear = function() { 4447 head2 = null; 4448 tail = null; 4449 size4 = 0; 4450 }; 4451 return memoized; 4452 } 4453 4454 // packages/global-styles-engine/build-module/utils/get-global-styles-changes.mjs 4455 var import_i18n = __toESM(require_i18n(), 1); 4456 var import_blocks = __toESM(require_blocks(), 1); 4457 var globalStylesChangesCache = /* @__PURE__ */ new Map(); 4458 var EMPTY_ARRAY = []; 4459 var translationMap = { 4460 caption: (0, import_i18n.__)("Caption"), 4461 link: (0, import_i18n.__)("Link"), 4462 button: (0, import_i18n.__)("Button"), 4463 heading: (0, import_i18n.__)("Heading"), 4464 h1: (0, import_i18n.__)("H1"), 4465 h2: (0, import_i18n.__)("H2"), 4466 h3: (0, import_i18n.__)("H3"), 4467 h4: (0, import_i18n.__)("H4"), 4468 h5: (0, import_i18n.__)("H5"), 4469 h6: (0, import_i18n.__)("H6"), 4470 "settings.color": (0, import_i18n.__)("Color"), 4471 "settings.typography": (0, import_i18n.__)("Typography"), 4472 "settings.shadow": (0, import_i18n.__)("Shadow"), 4473 "settings.layout": (0, import_i18n.__)("Layout"), 4474 "styles.color": (0, import_i18n.__)("Colors"), 4475 "styles.spacing": (0, import_i18n.__)("Spacing"), 4476 "styles.background": (0, import_i18n.__)("Background"), 4477 "styles.typography": (0, import_i18n.__)("Typography") 4478 }; 4479 var getBlockNames = memize( 4480 () => (0, import_blocks.getBlockTypes)().reduce( 4481 (accumulator, { 4482 name: name2, 4483 title 4484 }) => { 4485 accumulator[name2] = title; 4486 return accumulator; 4487 }, 4488 {} 4489 ) 4490 ); 4491 var isObject2 = (obj) => obj !== null && typeof obj === "object"; 4492 function getTranslation(key) { 4493 if (translationMap[key]) { 4494 return translationMap[key]; 4495 } 4496 const keyArray = key.split("."); 4497 if (keyArray?.[0] === "blocks") { 4498 const blockName = getBlockNames()?.[keyArray[1]]; 4499 return blockName || keyArray[1]; 4500 } 4501 if (keyArray?.[0] === "elements") { 4502 return translationMap[keyArray[1]] || keyArray[1]; 4503 } 4504 return void 0; 4505 } 4506 function deepCompare(changedObject, originalObject, parentPath = "") { 4507 if (!isObject2(changedObject) && !isObject2(originalObject)) { 4508 return changedObject !== originalObject ? parentPath.split(".").slice(0, 2).join(".") : void 0; 4509 } 4510 changedObject = isObject2(changedObject) ? changedObject : {}; 4511 originalObject = isObject2(originalObject) ? originalObject : {}; 4512 const allKeys = /* @__PURE__ */ new Set([ 4513 ...Object.keys(changedObject), 4514 ...Object.keys(originalObject) 4515 ]); 4516 let diffs = []; 4517 for (const key of allKeys) { 4518 const path = parentPath ? parentPath + "." + key : key; 4519 const changedPath = deepCompare( 4520 changedObject[key], 4521 originalObject[key], 4522 path 4523 ); 4524 if (changedPath) { 4525 diffs = diffs.concat(changedPath); 4526 } 4527 } 4528 return diffs; 4529 } 4530 function getGlobalStylesChangelist(next, previous) { 4531 const cacheKey2 = JSON.stringify({ next, previous }); 4532 if (globalStylesChangesCache.has(cacheKey2)) { 4533 return globalStylesChangesCache.get(cacheKey2); 4534 } 4535 const changedValueTree = deepCompare( 4536 { 4537 styles: { 4538 background: next?.styles?.background, 4539 color: next?.styles?.color, 4540 typography: next?.styles?.typography, 4541 spacing: next?.styles?.spacing 4542 }, 4543 blocks: next?.styles?.blocks, 4544 elements: next?.styles?.elements, 4545 settings: next?.settings 4546 }, 4547 { 4548 styles: { 4549 background: previous?.styles?.background, 4550 color: previous?.styles?.color, 4551 typography: previous?.styles?.typography, 4552 spacing: previous?.styles?.spacing 4553 }, 4554 blocks: previous?.styles?.blocks, 4555 elements: previous?.styles?.elements, 4556 settings: previous?.settings 4557 } 4558 ); 4559 if (!changedValueTree || Array.isArray(changedValueTree) && !changedValueTree.length) { 4560 globalStylesChangesCache.set(cacheKey2, []); 4561 return []; 4562 } 4563 const changedValueArray = Array.isArray(changedValueTree) ? changedValueTree : [changedValueTree]; 4564 const result = [...new Set(changedValueArray)].reduce((acc, curr) => { 4565 const translation = getTranslation(curr); 4566 if (translation) { 4567 acc.push([curr.split(".")[0], translation]); 4568 } 4569 return acc; 4570 }, []); 4571 globalStylesChangesCache.set(cacheKey2, result); 4572 return result; 4573 } 4574 function getGlobalStylesChanges(next, previous, options = {}) { 4575 let changeList = getGlobalStylesChangelist(next, previous); 4576 const changesLength = changeList.length; 4577 const { maxResults } = options; 4578 if (changesLength) { 4579 if (!!maxResults && changesLength > maxResults) { 4580 changeList = changeList.slice(0, maxResults); 4581 } 4582 return Object.entries( 4583 changeList.reduce((acc, curr) => { 4584 const group = acc[curr[0]] || []; 4585 if (!group.includes(curr[1])) { 4586 acc[curr[0]] = [...group, curr[1]]; 4587 } 4588 return acc; 4589 }, {}) 4590 ).map(([key, changeValues]) => { 4591 const changeValuesLength = changeValues.length; 4592 const joinedChangesValue = changeValues.join( 4593 /* translators: Used between list items, there is a space after the comma. */ 4594 (0, import_i18n.__)(", ") 4595 // eslint-disable-line @wordpress/i18n-no-flanking-whitespace 4596 ); 4597 switch (key) { 4598 case "blocks": { 4599 return (0, import_i18n.sprintf)( 4600 // translators: %s: a list of block names separated by a comma. 4601 (0, import_i18n._n)("%s block.", "%s blocks.", changeValuesLength), 4602 joinedChangesValue 4603 ); 4604 } 4605 case "elements": { 4606 return (0, import_i18n.sprintf)( 4607 // translators: %s: a list of element names separated by a comma. 4608 (0, import_i18n._n)("%s element.", "%s elements.", changeValuesLength), 4609 joinedChangesValue 4610 ); 4611 } 4612 case "settings": { 4613 return (0, import_i18n.sprintf)( 4614 // translators: %s: a list of theme.json setting labels separated by a comma. 4615 (0, import_i18n.__)("%s settings."), 4616 joinedChangesValue 4617 ); 4618 } 4619 case "styles": { 4620 return (0, import_i18n.sprintf)( 4621 // translators: %s: a list of theme.json top-level styles labels separated by a comma. 4622 (0, import_i18n.__)("%s styles."), 4623 joinedChangesValue 4624 ); 4625 } 4626 default: { 4627 return (0, import_i18n.sprintf)( 4628 // translators: %s: a list of global styles changes separated by a comma. 4629 (0, import_i18n.__)("%s."), 4630 joinedChangesValue 4631 ); 4632 } 4633 } 4634 }); 4635 } 4636 return EMPTY_ARRAY; 4637 } 4638 4639 // packages/global-styles-engine/build-module/core/render.mjs 4640 var import_blocks2 = __toESM(require_blocks(), 1); 4641 var import_style_engine2 = __toESM(require_style_engine(), 1); 4642 var import_data3 = __toESM(require_data(), 1); 4643 4644 // packages/global-styles-engine/build-module/core/selectors.mjs 4645 function getBlockSelector(blockType, target = "root", options = {}) { 4646 if (!target) { 4647 return null; 4648 } 4649 const { fallback = false } = options; 4650 const { name: name2, selectors: selectors3, supports } = blockType; 4651 const hasSelectors = selectors3 && Object.keys(selectors3).length > 0; 4652 const path = Array.isArray(target) ? target.join(".") : target; 4653 let rootSelector = null; 4654 if (hasSelectors && selectors3.root) { 4655 rootSelector = selectors3?.root; 4656 } else if (supports?.__experimentalSelector) { 4657 rootSelector = supports.__experimentalSelector; 4658 } else { 4659 rootSelector = ".wp-block-" + name2.replace("core/", "").replace("/", "-"); 4660 } 4661 if (path === "root") { 4662 return rootSelector; 4663 } 4664 const pathArray = Array.isArray(target) ? target : target.split("."); 4665 if (pathArray.length === 1) { 4666 const fallbackSelector = fallback ? rootSelector : null; 4667 if (hasSelectors) { 4668 const featureSelector2 = getValueFromObjectPath( 4669 selectors3, 4670 `$path}.root`, 4671 null 4672 ) || getValueFromObjectPath(selectors3, path, null); 4673 return featureSelector2 || fallbackSelector; 4674 } 4675 const featureSelector = supports ? getValueFromObjectPath( 4676 supports, 4677 `$path}.__experimentalSelector`, 4678 null 4679 ) : void 0; 4680 if (!featureSelector) { 4681 return fallbackSelector; 4682 } 4683 return scopeSelector(rootSelector, featureSelector); 4684 } 4685 let subfeatureSelector; 4686 if (hasSelectors) { 4687 subfeatureSelector = getValueFromObjectPath(selectors3, path, null); 4688 } 4689 if (subfeatureSelector) { 4690 return subfeatureSelector; 4691 } 4692 if (fallback) { 4693 return getBlockSelector(blockType, pathArray[0], options); 4694 } 4695 return null; 4696 } 4697 4698 // node_modules/colord/index.mjs 4699 var r = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }; 4700 var t = function(r4) { 4701 return "string" == typeof r4 ? r4.length > 0 : "number" == typeof r4; 4702 }; 4703 var n = function(r4, t4, n3) { 4704 return void 0 === t4 && (t4 = 0), void 0 === n3 && (n3 = Math.pow(10, t4)), Math.round(n3 * r4) / n3 + 0; 4705 }; 4706 var e = function(r4, t4, n3) { 4707 return void 0 === t4 && (t4 = 0), void 0 === n3 && (n3 = 1), r4 > n3 ? n3 : r4 > t4 ? r4 : t4; 4708 }; 4709 var u = function(r4) { 4710 return (r4 = isFinite(r4) ? r4 % 360 : 0) > 0 ? r4 : r4 + 360; 4711 }; 4712 var a = function(r4) { 4713 return { r: e(r4.r, 0, 255), g: e(r4.g, 0, 255), b: e(r4.b, 0, 255), a: e(r4.a) }; 4714 }; 4715 var o = function(r4) { 4716 return { r: n(r4.r), g: n(r4.g), b: n(r4.b), a: n(r4.a, 3) }; 4717 }; 4718 var i = /^#([0-9a-f]{3,8})$/i; 4719 var s = function(r4) { 4720 var t4 = r4.toString(16); 4721 return t4.length < 2 ? "0" + t4 : t4; 4722 }; 4723 var h = function(r4) { 4724 var t4 = r4.r, n3 = r4.g, e3 = r4.b, u3 = r4.a, a3 = Math.max(t4, n3, e3), o4 = a3 - Math.min(t4, n3, e3), i3 = o4 ? a3 === t4 ? (n3 - e3) / o4 : a3 === n3 ? 2 + (e3 - t4) / o4 : 4 + (t4 - n3) / o4 : 0; 4725 return { h: 60 * (i3 < 0 ? i3 + 6 : i3), s: a3 ? o4 / a3 * 100 : 0, v: a3 / 255 * 100, a: u3 }; 4726 }; 4727 var b = function(r4) { 4728 var t4 = r4.h, n3 = r4.s, e3 = r4.v, u3 = r4.a; 4729 t4 = t4 / 360 * 6, n3 /= 100, e3 /= 100; 4730 var a3 = Math.floor(t4), o4 = e3 * (1 - n3), i3 = e3 * (1 - (t4 - a3) * n3), s3 = e3 * (1 - (1 - t4 + a3) * n3), h3 = a3 % 6; 4731 return { r: 255 * [e3, i3, o4, o4, s3, e3][h3], g: 255 * [s3, e3, e3, i3, o4, o4][h3], b: 255 * [o4, o4, s3, e3, e3, i3][h3], a: u3 }; 4732 }; 4733 var g = function(r4) { 4734 return { h: u(r4.h), s: e(r4.s, 0, 100), l: e(r4.l, 0, 100), a: e(r4.a) }; 4735 }; 4736 var d = function(r4) { 4737 return { h: n(r4.h), s: n(r4.s), l: n(r4.l), a: n(r4.a, 3) }; 4738 }; 4739 var f = function(r4) { 4740 return b((n3 = (t4 = r4).s, { h: t4.h, s: (n3 *= ((e3 = t4.l) < 50 ? e3 : 100 - e3) / 100) > 0 ? 2 * n3 / (e3 + n3) * 100 : 0, v: e3 + n3, a: t4.a })); 4741 var t4, n3, e3; 4742 }; 4743 var c = function(r4) { 4744 return { h: (t4 = h(r4)).h, s: (u3 = (200 - (n3 = t4.s)) * (e3 = t4.v) / 100) > 0 && u3 < 200 ? n3 * e3 / 100 / (u3 <= 100 ? u3 : 200 - u3) * 100 : 0, l: u3 / 2, a: t4.a }; 4745 var t4, n3, e3, u3; 4746 }; 4747 var l = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 4748 var p2 = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 4749 var v = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 4750 var m = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 4751 var y = { string: [[function(r4) { 4752 var t4 = i.exec(r4); 4753 return t4 ? (r4 = t4[1]).length <= 4 ? { r: parseInt(r4[0] + r4[0], 16), g: parseInt(r4[1] + r4[1], 16), b: parseInt(r4[2] + r4[2], 16), a: 4 === r4.length ? n(parseInt(r4[3] + r4[3], 16) / 255, 2) : 1 } : 6 === r4.length || 8 === r4.length ? { r: parseInt(r4.substr(0, 2), 16), g: parseInt(r4.substr(2, 2), 16), b: parseInt(r4.substr(4, 2), 16), a: 8 === r4.length ? n(parseInt(r4.substr(6, 2), 16) / 255, 2) : 1 } : null : null; 4754 }, "hex"], [function(r4) { 4755 var t4 = v.exec(r4) || m.exec(r4); 4756 return t4 ? t4[2] !== t4[4] || t4[4] !== t4[6] ? null : a({ r: Number(t4[1]) / (t4[2] ? 100 / 255 : 1), g: Number(t4[3]) / (t4[4] ? 100 / 255 : 1), b: Number(t4[5]) / (t4[6] ? 100 / 255 : 1), a: void 0 === t4[7] ? 1 : Number(t4[7]) / (t4[8] ? 100 : 1) }) : null; 4757 }, "rgb"], [function(t4) { 4758 var n3 = l.exec(t4) || p2.exec(t4); 4759 if (!n3) return null; 4760 var e3, u3, a3 = g({ h: (e3 = n3[1], u3 = n3[2], void 0 === u3 && (u3 = "deg"), Number(e3) * (r[u3] || 1)), s: Number(n3[3]), l: Number(n3[4]), a: void 0 === n3[5] ? 1 : Number(n3[5]) / (n3[6] ? 100 : 1) }); 4761 return f(a3); 4762 }, "hsl"]], object: [[function(r4) { 4763 var n3 = r4.r, e3 = r4.g, u3 = r4.b, o4 = r4.a, i3 = void 0 === o4 ? 1 : o4; 4764 return t(n3) && t(e3) && t(u3) ? a({ r: Number(n3), g: Number(e3), b: Number(u3), a: Number(i3) }) : null; 4765 }, "rgb"], [function(r4) { 4766 var n3 = r4.h, e3 = r4.s, u3 = r4.l, a3 = r4.a, o4 = void 0 === a3 ? 1 : a3; 4767 if (!t(n3) || !t(e3) || !t(u3)) return null; 4768 var i3 = g({ h: Number(n3), s: Number(e3), l: Number(u3), a: Number(o4) }); 4769 return f(i3); 4770 }, "hsl"], [function(r4) { 4771 var n3 = r4.h, a3 = r4.s, o4 = r4.v, i3 = r4.a, s3 = void 0 === i3 ? 1 : i3; 4772 if (!t(n3) || !t(a3) || !t(o4)) return null; 4773 var h3 = (function(r5) { 4774 return { h: u(r5.h), s: e(r5.s, 0, 100), v: e(r5.v, 0, 100), a: e(r5.a) }; 4775 })({ h: Number(n3), s: Number(a3), v: Number(o4), a: Number(s3) }); 4776 return b(h3); 4777 }, "hsv"]] }; 4778 var N = function(r4, t4) { 4779 for (var n3 = 0; n3 < t4.length; n3++) { 4780 var e3 = t4[n3][0](r4); 4781 if (e3) return [e3, t4[n3][1]]; 4782 } 4783 return [null, void 0]; 4784 }; 4785 var x = function(r4) { 4786 return "string" == typeof r4 ? N(r4.trim(), y.string) : "object" == typeof r4 && null !== r4 ? N(r4, y.object) : [null, void 0]; 4787 }; 4788 var M = function(r4, t4) { 4789 var n3 = c(r4); 4790 return { h: n3.h, s: e(n3.s + 100 * t4, 0, 100), l: n3.l, a: n3.a }; 4791 }; 4792 var H = function(r4) { 4793 return (299 * r4.r + 587 * r4.g + 114 * r4.b) / 1e3 / 255; 4794 }; 4795 var $ = function(r4, t4) { 4796 var n3 = c(r4); 4797 return { h: n3.h, s: n3.s, l: e(n3.l + 100 * t4, 0, 100), a: n3.a }; 4798 }; 4799 var j = (function() { 4800 function r4(r5) { 4801 this.parsed = x(r5)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 }; 4802 } 4803 return r4.prototype.isValid = function() { 4804 return null !== this.parsed; 4805 }, r4.prototype.brightness = function() { 4806 return n(H(this.rgba), 2); 4807 }, r4.prototype.isDark = function() { 4808 return H(this.rgba) < 0.5; 4809 }, r4.prototype.isLight = function() { 4810 return H(this.rgba) >= 0.5; 4811 }, r4.prototype.toHex = function() { 4812 return r5 = o(this.rgba), t4 = r5.r, e3 = r5.g, u3 = r5.b, i3 = (a3 = r5.a) < 1 ? s(n(255 * a3)) : "", "#" + s(t4) + s(e3) + s(u3) + i3; 4813 var r5, t4, e3, u3, a3, i3; 4814 }, r4.prototype.toRgb = function() { 4815 return o(this.rgba); 4816 }, r4.prototype.toRgbString = function() { 4817 return r5 = o(this.rgba), t4 = r5.r, n3 = r5.g, e3 = r5.b, (u3 = r5.a) < 1 ? "rgba(" + t4 + ", " + n3 + ", " + e3 + ", " + u3 + ")" : "rgb(" + t4 + ", " + n3 + ", " + e3 + ")"; 4818 var r5, t4, n3, e3, u3; 4819 }, r4.prototype.toHsl = function() { 4820 return d(c(this.rgba)); 4821 }, r4.prototype.toHslString = function() { 4822 return r5 = d(c(this.rgba)), t4 = r5.h, n3 = r5.s, e3 = r5.l, (u3 = r5.a) < 1 ? "hsla(" + t4 + ", " + n3 + "%, " + e3 + "%, " + u3 + ")" : "hsl(" + t4 + ", " + n3 + "%, " + e3 + "%)"; 4823 var r5, t4, n3, e3, u3; 4824 }, r4.prototype.toHsv = function() { 4825 return r5 = h(this.rgba), { h: n(r5.h), s: n(r5.s), v: n(r5.v), a: n(r5.a, 3) }; 4826 var r5; 4827 }, r4.prototype.invert = function() { 4828 return w({ r: 255 - (r5 = this.rgba).r, g: 255 - r5.g, b: 255 - r5.b, a: r5.a }); 4829 var r5; 4830 }, r4.prototype.saturate = function(r5) { 4831 return void 0 === r5 && (r5 = 0.1), w(M(this.rgba, r5)); 4832 }, r4.prototype.desaturate = function(r5) { 4833 return void 0 === r5 && (r5 = 0.1), w(M(this.rgba, -r5)); 4834 }, r4.prototype.grayscale = function() { 4835 return w(M(this.rgba, -1)); 4836 }, r4.prototype.lighten = function(r5) { 4837 return void 0 === r5 && (r5 = 0.1), w($(this.rgba, r5)); 4838 }, r4.prototype.darken = function(r5) { 4839 return void 0 === r5 && (r5 = 0.1), w($(this.rgba, -r5)); 4840 }, r4.prototype.rotate = function(r5) { 4841 return void 0 === r5 && (r5 = 15), this.hue(this.hue() + r5); 4842 }, r4.prototype.alpha = function(r5) { 4843 return "number" == typeof r5 ? w({ r: (t4 = this.rgba).r, g: t4.g, b: t4.b, a: r5 }) : n(this.rgba.a, 3); 4844 var t4; 4845 }, r4.prototype.hue = function(r5) { 4846 var t4 = c(this.rgba); 4847 return "number" == typeof r5 ? w({ h: r5, s: t4.s, l: t4.l, a: t4.a }) : n(t4.h); 4848 }, r4.prototype.isEqual = function(r5) { 4849 return this.toHex() === w(r5).toHex(); 4850 }, r4; 4851 })(); 4852 var w = function(r4) { 4853 return r4 instanceof j ? r4 : new j(r4); 4854 }; 4855 var S = []; 4856 var k = function(r4) { 4857 r4.forEach(function(r5) { 4858 S.indexOf(r5) < 0 && (r5(j, y), S.push(r5)); 4859 }); 4860 }; 4861 4862 // packages/global-styles-engine/build-module/utils/duotone.mjs 4863 function getValuesFromColors(colors2 = []) { 4864 const values = { 4865 r: [], 4866 g: [], 4867 b: [], 4868 a: [] 4869 }; 4870 colors2.forEach((color) => { 4871 const rgbColor = w(color).toRgb(); 4872 values.r.push(rgbColor.r / 255); 4873 values.g.push(rgbColor.g / 255); 4874 values.b.push(rgbColor.b / 255); 4875 values.a.push(rgbColor.a); 4876 }); 4877 return values; 4878 } 4879 function getDuotoneFilter(id, colors2) { 4880 const values = getValuesFromColors(colors2); 4881 return ` 4882 <svg 4883 xmlns:xlink="http://www.w3.org/1999/xlink" 4884 viewBox="0 0 0 0" 4885 width="0" 4886 height="0" 4887 focusable="false" 4888 role="none" 4889 aria-hidden="true" 4890 style="visibility: hidden; position: absolute; left: -9999px; overflow: hidden;" 4891 > 4892 <defs> 4893 <filter id="$id}"> 4894 <!-- 4895 Use sRGB instead of linearRGB so transparency looks correct. 4896 Use perceptual brightness to convert to grayscale. 4897 --> 4898 <feColorMatrix color-interpolation-filters="sRGB" type="matrix" values=" .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 "></feColorMatrix> 4899 <!-- Use sRGB instead of linearRGB to be consistent with how CSS gradients work. --> 4900 <feComponentTransfer color-interpolation-filters="sRGB"> 4901 <feFuncR type="table" tableValues="$values.r.join(" ")}"></feFuncR> 4902 <feFuncG type="table" tableValues="$values.g.join(" ")}"></feFuncG> 4903 <feFuncB type="table" tableValues="$values.b.join(" ")}"></feFuncB> 4904 <feFuncA type="table" tableValues="$values.a.join(" ")}"></feFuncA> 4905 </feComponentTransfer> 4906 <!-- Re-mask the image with the original transparency since the feColorMatrix above loses that information. --> 4907 <feComposite in2="SourceGraphic" operator="in"></feComposite> 4908 </filter> 4909 </defs> 4910 </svg>`; 4911 } 4912 4913 // packages/global-styles-engine/build-module/utils/string.mjs 4914 function kebabCase(str3) { 4915 return str3.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([0-9])([a-zA-Z])/g, "$1-$2").replace(/([a-zA-Z])([0-9])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase(); 4916 } 4917 4918 // packages/global-styles-engine/build-module/utils/spacing.mjs 4919 function getSpacingPresetCssVar(value) { 4920 if (!value) { 4921 return; 4922 } 4923 const slug = value.match(/var:preset\|spacing\|(.+)/); 4924 if (!slug) { 4925 return value; 4926 } 4927 return `var(--wp--preset--spacing--$slug[1]})`; 4928 } 4929 4930 // packages/global-styles-engine/build-module/utils/gap.mjs 4931 function getGapBoxControlValueFromStyle(blockGapValue) { 4932 if (!blockGapValue) { 4933 return null; 4934 } 4935 const isValueString = typeof blockGapValue === "string"; 4936 return { 4937 top: isValueString ? blockGapValue : blockGapValue?.top, 4938 left: isValueString ? blockGapValue : blockGapValue?.left 4939 }; 4940 } 4941 function getGapCSSValue(blockGapValue, defaultValue2 = "0") { 4942 const blockGapBoxControlValue = getGapBoxControlValueFromStyle(blockGapValue); 4943 if (!blockGapBoxControlValue) { 4944 return null; 4945 } 4946 const row = getSpacingPresetCssVar(blockGapBoxControlValue?.top) || defaultValue2; 4947 const column = getSpacingPresetCssVar(blockGapBoxControlValue?.left) || defaultValue2; 4948 return row === column ? row : `$row} $column}`; 4949 } 4950 4951 // packages/global-styles-engine/build-module/utils/background.mjs 4952 var BACKGROUND_BLOCK_DEFAULT_VALUES = { 4953 backgroundSize: "cover", 4954 backgroundPosition: "50% 50%" 4955 // used only when backgroundSize is 'contain'. 4956 }; 4957 function setBackgroundStyleDefaults(backgroundStyle) { 4958 if (!backgroundStyle || // @ts-expect-error 4959 !backgroundStyle?.backgroundImage?.url) { 4960 return; 4961 } 4962 let backgroundStylesWithDefaults; 4963 if (!backgroundStyle?.backgroundSize) { 4964 backgroundStylesWithDefaults = { 4965 backgroundSize: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundSize 4966 }; 4967 } 4968 if ("contain" === backgroundStyle?.backgroundSize && !backgroundStyle?.backgroundPosition) { 4969 backgroundStylesWithDefaults = { 4970 backgroundPosition: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundPosition 4971 }; 4972 } 4973 return backgroundStylesWithDefaults; 4974 } 4975 4976 // packages/global-styles-engine/build-module/utils/layout.mjs 4977 var LAYOUT_DEFINITIONS = { 4978 default: { 4979 name: "default", 4980 slug: "flow", 4981 className: "is-layout-flow", 4982 baseStyles: [ 4983 { 4984 selector: " > .alignleft", 4985 rules: { 4986 float: "left", 4987 "margin-inline-start": "0", 4988 "margin-inline-end": "2em" 4989 } 4990 }, 4991 { 4992 selector: " > .alignright", 4993 rules: { 4994 float: "right", 4995 "margin-inline-start": "2em", 4996 "margin-inline-end": "0" 4997 } 4998 }, 4999 { 5000 selector: " > .aligncenter", 5001 rules: { 5002 "margin-left": "auto !important", 5003 "margin-right": "auto !important" 5004 } 5005 } 5006 ], 5007 spacingStyles: [ 5008 { 5009 selector: " > :first-child", 5010 rules: { 5011 "margin-block-start": "0" 5012 } 5013 }, 5014 { 5015 selector: " > :last-child", 5016 rules: { 5017 "margin-block-end": "0" 5018 } 5019 }, 5020 { 5021 selector: " > *", 5022 rules: { 5023 "margin-block-start": null, 5024 "margin-block-end": "0" 5025 } 5026 } 5027 ] 5028 }, 5029 constrained: { 5030 name: "constrained", 5031 slug: "constrained", 5032 className: "is-layout-constrained", 5033 baseStyles: [ 5034 { 5035 selector: " > .alignleft", 5036 rules: { 5037 float: "left", 5038 "margin-inline-start": "0", 5039 "margin-inline-end": "2em" 5040 } 5041 }, 5042 { 5043 selector: " > .alignright", 5044 rules: { 5045 float: "right", 5046 "margin-inline-start": "2em", 5047 "margin-inline-end": "0" 5048 } 5049 }, 5050 { 5051 selector: " > .aligncenter", 5052 rules: { 5053 "margin-left": "auto !important", 5054 "margin-right": "auto !important" 5055 } 5056 }, 5057 { 5058 selector: " > :where(:not(.alignleft):not(.alignright):not(.alignfull))", 5059 rules: { 5060 "max-width": "var(--wp--style--global--content-size)", 5061 "margin-left": "auto !important", 5062 "margin-right": "auto !important" 5063 } 5064 }, 5065 { 5066 selector: " > .alignwide", 5067 rules: { 5068 "max-width": "var(--wp--style--global--wide-size)" 5069 } 5070 } 5071 ], 5072 spacingStyles: [ 5073 { 5074 selector: " > :first-child", 5075 rules: { 5076 "margin-block-start": "0" 5077 } 5078 }, 5079 { 5080 selector: " > :last-child", 5081 rules: { 5082 "margin-block-end": "0" 5083 } 5084 }, 5085 { 5086 selector: " > *", 5087 rules: { 5088 "margin-block-start": null, 5089 "margin-block-end": "0" 5090 } 5091 } 5092 ] 5093 }, 5094 flex: { 5095 name: "flex", 5096 slug: "flex", 5097 className: "is-layout-flex", 5098 displayMode: "flex", 5099 baseStyles: [ 5100 { 5101 selector: "", 5102 rules: { 5103 "flex-wrap": "wrap", 5104 "align-items": "center" 5105 } 5106 }, 5107 { 5108 selector: " > :is(*, div)", 5109 // :is(*, div) instead of just * increases the specificity by 001. 5110 rules: { 5111 margin: "0" 5112 } 5113 } 5114 ], 5115 spacingStyles: [ 5116 { 5117 selector: "", 5118 rules: { 5119 gap: null 5120 } 5121 } 5122 ] 5123 }, 5124 grid: { 5125 name: "grid", 5126 slug: "grid", 5127 className: "is-layout-grid", 5128 displayMode: "grid", 5129 baseStyles: [ 5130 { 5131 selector: " > :is(*, div)", 5132 // :is(*, div) instead of just * increases the specificity by 001. 5133 rules: { 5134 margin: "0" 5135 } 5136 } 5137 ], 5138 spacingStyles: [ 5139 { 5140 selector: "", 5141 rules: { 5142 gap: null 5143 } 5144 } 5145 ] 5146 } 5147 }; 5148 5149 // packages/global-styles-engine/build-module/utils/viewport.mjs 5150 var DEFAULT_VIEWPORT_BREAKPOINTS = { 5151 mobile: "480px", 5152 tablet: "782px" 5153 }; 5154 var VIEWPORT_SIZE_REGEXP = /^(\d+|\d*\.\d+)(px|em|rem)$/; 5155 var DEFAULT_FONT_SIZE = 16; 5156 function isViewportSettings(configOrSettings) { 5157 return "mobile" in configOrSettings || "tablet" in configOrSettings; 5158 } 5159 function getViewportSettings(configOrSettings) { 5160 if (!configOrSettings || typeof configOrSettings !== "object") { 5161 return {}; 5162 } 5163 if (isViewportSettings(configOrSettings)) { 5164 return configOrSettings; 5165 } 5166 return configOrSettings.settings?.viewport ?? {}; 5167 } 5168 function isValidViewportSize(value) { 5169 return typeof value === "string" && VIEWPORT_SIZE_REGEXP.test(value.trim()); 5170 } 5171 function getViewportBreakpointValueInPixels(value) { 5172 if (typeof value === "number") { 5173 return value; 5174 } 5175 if (typeof value !== "string") { 5176 return void 0; 5177 } 5178 const match3 = value.trim().match(VIEWPORT_SIZE_REGEXP); 5179 if (!match3) { 5180 return void 0; 5181 } 5182 const numericValue = Number.parseFloat(match3[1]); 5183 const unit = match3[2]; 5184 return unit === "px" ? numericValue : numericValue * DEFAULT_FONT_SIZE; 5185 } 5186 function getViewportBreakpoints(configOrSettings) { 5187 const viewportSettings = getViewportSettings(configOrSettings); 5188 const breakpoints = {}; 5189 const breakpointValuesInPixels = {}; 5190 Object.keys(DEFAULT_VIEWPORT_BREAKPOINTS).forEach((breakpoint) => { 5191 const key = breakpoint; 5192 const value = viewportSettings[key]; 5193 const px = getViewportBreakpointValueInPixels(value); 5194 if (px !== void 0 && isValidViewportSize(value)) { 5195 breakpoints[key] = value.trim(); 5196 breakpointValuesInPixels[key] = px; 5197 } 5198 }); 5199 const breakpointNames = Object.keys(breakpoints); 5200 if (!breakpointNames.length) { 5201 return { ...DEFAULT_VIEWPORT_BREAKPOINTS }; 5202 } 5203 if (1 === breakpointNames.length) { 5204 return breakpoints; 5205 } 5206 const mobile = breakpoints.mobile; 5207 const tablet = breakpoints.tablet; 5208 if (breakpointValuesInPixels.mobile >= breakpointValuesInPixels.tablet) { 5209 return { mobile }; 5210 } 5211 return { mobile, tablet }; 5212 } 5213 function getResponsiveMediaQueries(configOrSettings) { 5214 const breakpoints = getViewportBreakpoints(configOrSettings); 5215 const mediaQueries = {}; 5216 if (breakpoints.mobile) { 5217 mediaQueries["@mobile"] = `@media (width <= $breakpoints.mobile})`; 5218 } 5219 if (breakpoints.tablet) { 5220 mediaQueries["@tablet"] = breakpoints.mobile ? `@media ($breakpoints.mobile} < width <= $breakpoints.tablet})` : `@media (width <= $breakpoints.tablet})`; 5221 } 5222 return mediaQueries; 5223 } 5224 5225 // packages/global-styles-engine/build-module/core/render.mjs 5226 var ELEMENT_CLASS_NAMES = { 5227 button: "wp-element-button", 5228 caption: "wp-element-caption" 5229 }; 5230 var BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = { 5231 __experimentalBorder: "border", 5232 color: "color", 5233 dimensions: "dimensions", 5234 spacing: "spacing", 5235 typography: "typography" 5236 }; 5237 var VALID_BLOCK_PSEUDO_SELECTORS = { 5238 "core/button": [":hover", ":focus", ":focus-visible", ":active"], 5239 "core/navigation-link": [":hover", ":focus", ":focus-visible", ":active"] 5240 }; 5241 var VALID_ELEMENT_PSEUDO_SELECTORS = { 5242 link: [ 5243 ":link", 5244 ":any-link", 5245 ":visited", 5246 ":hover", 5247 ":focus", 5248 ":focus-visible", 5249 ":active" 5250 ], 5251 button: [ 5252 ":link", 5253 ":any-link", 5254 ":visited", 5255 ":hover", 5256 ":focus", 5257 ":focus-visible", 5258 ":active" 5259 ] 5260 }; 5261 function getPresetsClasses(blockSelector = "*", blockPresets = {}) { 5262 return PRESET_METADATA.reduce( 5263 (declarations, { path, cssVarInfix, classes }) => { 5264 if (!classes) { 5265 return declarations; 5266 } 5267 const presetByOrigin = getValueFromObjectPath( 5268 blockPresets, 5269 path, 5270 [] 5271 ); 5272 ["default", "theme", "custom"].forEach((origin) => { 5273 if (presetByOrigin[origin]) { 5274 presetByOrigin[origin].forEach( 5275 ({ slug }) => { 5276 classes.forEach( 5277 ({ 5278 classSuffix, 5279 propertyName 5280 }) => { 5281 const classSelectorToUse = `.has-$kebabCase( 5282 slug 5283 )}-$classSuffix}`; 5284 const selectorToUse = blockSelector ? `:where($blockSelector})$classSelectorToUse}` : classSelectorToUse; 5285 const value = `var(--wp--preset--$cssVarInfix}--$kebabCase( 5286 slug 5287 )})`; 5288 declarations += `$selectorToUse}{$propertyName}: $value} !important;}`; 5289 } 5290 ); 5291 } 5292 ); 5293 } 5294 }); 5295 return declarations; 5296 }, 5297 "" 5298 ); 5299 } 5300 function getPresetsSvgFilters(blockPresets = {}) { 5301 return PRESET_METADATA.filter( 5302 // Duotone are the only type of filters for now. 5303 (metadata) => metadata.path.at(-1) === "duotone" 5304 ).flatMap((metadata) => { 5305 const presetByOrigin = getValueFromObjectPath( 5306 blockPresets, 5307 metadata.path, 5308 {} 5309 ); 5310 return ["default", "theme"].filter((origin) => presetByOrigin[origin]).flatMap( 5311 (origin) => presetByOrigin[origin].map( 5312 (preset) => getDuotoneFilter( 5313 `wp-duotone-$preset.slug}`, 5314 preset.colors 5315 ) 5316 ) 5317 ).join(""); 5318 }); 5319 } 5320 function flattenTree(input = {}, prefix2, token) { 5321 let result = []; 5322 Object.keys(input).forEach((key) => { 5323 const newKey = prefix2 + kebabCase(key.replace("/", "-")); 5324 const newLeaf = input[key]; 5325 if (newLeaf instanceof Object) { 5326 const newPrefix = newKey + token; 5327 result = [...result, ...flattenTree(newLeaf, newPrefix, token)]; 5328 } else { 5329 result.push(`$newKey}: $newLeaf}`); 5330 } 5331 }); 5332 return result; 5333 } 5334 var updateParagraphTextIndentSelector = (featureDeclarations, settings, blockName) => { 5335 if (blockName !== "core/paragraph") { 5336 return featureDeclarations; 5337 } 5338 const blockSettings = settings?.blocks?.["core/paragraph"]; 5339 const textIndentSetting = blockSettings?.typography?.textIndent ?? settings?.typography?.textIndent ?? "subsequent"; 5340 if (textIndentSetting !== "all") { 5341 return featureDeclarations; 5342 } 5343 const oldSelector = ".wp-block-paragraph + .wp-block-paragraph"; 5344 const newSelector = ".wp-block-paragraph"; 5345 if (oldSelector in featureDeclarations) { 5346 const declarations = featureDeclarations[oldSelector]; 5347 const updated = { ...featureDeclarations }; 5348 delete updated[oldSelector]; 5349 updated[newSelector] = declarations; 5350 return updated; 5351 } 5352 return featureDeclarations; 5353 }; 5354 var updateButtonWidthDeclarations = (featureDeclarations, settings) => { 5355 const buttonSelector = ".wp-block-button"; 5356 if (!(buttonSelector in featureDeclarations)) { 5357 return featureDeclarations; 5358 } 5359 const updated = { ...featureDeclarations }; 5360 updated[buttonSelector] = updated[buttonSelector].map( 5361 (declaration) => { 5362 const match3 = declaration.match(/^width:\s*(.+)$/); 5363 if (!match3) { 5364 return declaration; 5365 } 5366 const value = match3[1]; 5367 let percentage = null; 5368 if (value.endsWith("%")) { 5369 percentage = parseFloat(value); 5370 } 5371 const presetPrefix = "var(--wp--preset--dimension--"; 5372 if (percentage === null && value.startsWith(presetPrefix) && value.endsWith(")")) { 5373 const slug = value.slice(presetPrefix.length, -1); 5374 const dimensionSizes = { 5375 ...settings?.dimensions?.dimensionSizes ?? {}, 5376 ...settings?.blocks?.["core/button"]?.dimensions?.dimensionSizes ?? {} 5377 }; 5378 for (const origin of Object.values(dimensionSizes)) { 5379 if (!Array.isArray(origin)) { 5380 continue; 5381 } 5382 for (const preset of origin) { 5383 if (preset.slug === slug && typeof preset.size === "string" && preset.size.endsWith("%")) { 5384 percentage = parseFloat(preset.size); 5385 break; 5386 } 5387 } 5388 if (percentage !== null) { 5389 break; 5390 } 5391 } 5392 } 5393 if (percentage === null || isNaN(percentage)) { 5394 return declaration; 5395 } 5396 return `width: calc($percentage} * 1% - (var(--wp--style--block-gap, 0.5em) * (1 - $percentage} / 100)))`; 5397 } 5398 ); 5399 return updated; 5400 }; 5401 var getFeatureDeclarations = (selectors3, styles) => { 5402 const declarations = {}; 5403 Object.entries(selectors3).forEach(([feature, selector2]) => { 5404 if (feature === "root" || !styles?.[feature]) { 5405 return; 5406 } 5407 const isShorthand = typeof selector2 === "string"; 5408 if (!isShorthand && typeof selector2 === "object" && selector2 !== null) { 5409 Object.entries(selector2).forEach( 5410 ([subfeature, subfeatureSelector]) => { 5411 if (subfeature === "root" || !styles?.[feature][subfeature]) { 5412 return; 5413 } 5414 const subfeatureStyles = { 5415 [feature]: { 5416 [subfeature]: styles[feature][subfeature] 5417 } 5418 }; 5419 const newDeclarations = getStylesDeclarations(subfeatureStyles); 5420 declarations[subfeatureSelector] = [ 5421 ...declarations[subfeatureSelector] || [], 5422 ...newDeclarations 5423 ]; 5424 delete styles[feature][subfeature]; 5425 } 5426 ); 5427 } 5428 if (isShorthand || typeof selector2 === "object" && selector2 !== null && "root" in selector2) { 5429 const featureSelector = isShorthand ? selector2 : selector2.root; 5430 const featureStyles = { [feature]: styles[feature] }; 5431 const newDeclarations = getStylesDeclarations(featureStyles); 5432 declarations[featureSelector] = [ 5433 ...declarations[featureSelector] || [], 5434 ...newDeclarations 5435 ]; 5436 delete styles[feature]; 5437 } 5438 }); 5439 return declarations; 5440 }; 5441 function getStylesDeclarations(blockStyles = {}, selector2 = "", useRootPaddingAlign, tree = {}, disableRootPadding = false) { 5442 const isRoot = ROOT_BLOCK_SELECTOR === selector2; 5443 const output = Object.entries( 5444 import_blocks2.__EXPERIMENTAL_STYLE_PROPERTY 5445 ).reduce( 5446 (declarations, [key, { value, properties, useEngine, rootOnly }]) => { 5447 if (rootOnly && !isRoot) { 5448 return declarations; 5449 } 5450 const pathToValue = value; 5451 if (pathToValue[0] === "elements" || useEngine) { 5452 return declarations; 5453 } 5454 const styleValue = getValueFromObjectPath( 5455 blockStyles, 5456 pathToValue 5457 ); 5458 if (key === "--wp--style--root--padding" && (typeof styleValue === "string" || !useRootPaddingAlign)) { 5459 return declarations; 5460 } 5461 if (properties && typeof styleValue !== "string") { 5462 Object.entries(properties).forEach((entry) => { 5463 const [name2, prop] = entry; 5464 if (!getValueFromObjectPath(styleValue, [prop], false)) { 5465 return; 5466 } 5467 const cssProperty = name2.startsWith("--") ? name2 : kebabCase(name2); 5468 declarations.push( 5469 `$cssProperty}: ${(0, import_style_engine2.getCSSValueFromRawStyle)( 5470 getValueFromObjectPath(styleValue, [prop]) 5471 )}` 5472 ); 5473 }); 5474 } else if (getValueFromObjectPath(blockStyles, pathToValue, false)) { 5475 const cssProperty = key.startsWith("--") ? key : kebabCase(key); 5476 declarations.push( 5477 `$cssProperty}: ${(0, import_style_engine2.getCSSValueFromRawStyle)( 5478 getValueFromObjectPath(blockStyles, pathToValue) 5479 )}` 5480 ); 5481 } 5482 return declarations; 5483 }, 5484 [] 5485 ); 5486 if (!!blockStyles.background) { 5487 if (blockStyles.background?.backgroundImage) { 5488 blockStyles.background.backgroundImage = getResolvedValue( 5489 blockStyles.background.backgroundImage, 5490 tree 5491 ); 5492 } 5493 if (!isRoot && !!blockStyles.background?.backgroundImage?.id) { 5494 blockStyles = { 5495 ...blockStyles, 5496 background: { 5497 ...blockStyles.background, 5498 ...setBackgroundStyleDefaults(blockStyles.background) 5499 } 5500 }; 5501 } 5502 } 5503 const extraRules = (0, import_style_engine2.getCSSRules)(blockStyles); 5504 extraRules.forEach((rule) => { 5505 if (isRoot && (useRootPaddingAlign || disableRootPadding) && rule.key.startsWith("padding")) { 5506 return; 5507 } 5508 const cssProperty = rule.key.startsWith("--") ? rule.key : kebabCase(rule.key); 5509 let ruleValue = getResolvedValue(rule.value, tree); 5510 if (cssProperty === "font-size") { 5511 ruleValue = getTypographyFontSizeValue( 5512 { name: "", slug: "", size: ruleValue }, 5513 tree?.settings 5514 ); 5515 } 5516 if (cssProperty === "aspect-ratio") { 5517 output.push("min-height: unset"); 5518 } 5519 output.push(`$cssProperty}: $ruleValue}`); 5520 }); 5521 return output; 5522 } 5523 function getLayoutStyles({ 5524 layoutDefinitions = LAYOUT_DEFINITIONS, 5525 style, 5526 selector: selector2, 5527 hasBlockGapSupport, 5528 hasFallbackGapSupport, 5529 fallbackGapValue 5530 }) { 5531 let ruleset = ""; 5532 let gapValue = hasBlockGapSupport ? getGapCSSValue(style?.spacing?.blockGap) : ""; 5533 if (hasFallbackGapSupport) { 5534 if (selector2 === ROOT_BLOCK_SELECTOR) { 5535 gapValue = !gapValue ? "0.5em" : gapValue; 5536 } else if (!hasBlockGapSupport && fallbackGapValue) { 5537 gapValue = fallbackGapValue; 5538 } 5539 } 5540 if (gapValue && layoutDefinitions) { 5541 Object.values(layoutDefinitions).forEach( 5542 ({ className, name: name2, spacingStyles }) => { 5543 if (!hasBlockGapSupport && "flex" !== name2 && "grid" !== name2) { 5544 return; 5545 } 5546 if (spacingStyles?.length) { 5547 spacingStyles.forEach((spacingStyle) => { 5548 const declarations = []; 5549 if (spacingStyle.rules) { 5550 Object.entries(spacingStyle.rules).forEach( 5551 ([cssProperty, cssValue]) => { 5552 declarations.push( 5553 `$cssProperty}: $cssValue ? cssValue : gapValue}` 5554 ); 5555 } 5556 ); 5557 } 5558 if (declarations.length) { 5559 let combinedSelector = ""; 5560 if (!hasBlockGapSupport) { 5561 combinedSelector = selector2 === ROOT_BLOCK_SELECTOR ? `:where(.$className}$spacingStyle?.selector || ""})` : `:where($selector2}.$className}$spacingStyle?.selector || ""})`; 5562 } else { 5563 combinedSelector = selector2 === ROOT_BLOCK_SELECTOR ? `:root :where(.$className})$spacingStyle?.selector || ""}` : `:root :where($selector2}-$className})$spacingStyle?.selector || ""}`; 5564 } 5565 ruleset += `$combinedSelector} { $declarations.join( 5566 "; " 5567 )}; }`; 5568 } 5569 }); 5570 } 5571 } 5572 ); 5573 if (selector2 === ROOT_BLOCK_SELECTOR && hasBlockGapSupport) { 5574 ruleset += `$ROOT_CSS_PROPERTIES_SELECTOR} { --wp--style--block-gap: $gapValue}; }`; 5575 } 5576 } 5577 if (selector2 === ROOT_BLOCK_SELECTOR && layoutDefinitions) { 5578 const validDisplayModes = ["block", "flex", "grid"]; 5579 Object.values(layoutDefinitions).forEach( 5580 ({ className, displayMode, baseStyles }) => { 5581 if (displayMode && validDisplayModes.includes(displayMode)) { 5582 ruleset += `$selector2} .$className} { display:$displayMode}; }`; 5583 } 5584 if (baseStyles?.length) { 5585 baseStyles.forEach((baseStyle) => { 5586 const declarations = []; 5587 if (baseStyle.rules) { 5588 Object.entries(baseStyle.rules).forEach( 5589 ([cssProperty, cssValue]) => { 5590 declarations.push( 5591 `$cssProperty}: $cssValue}` 5592 ); 5593 } 5594 ); 5595 } 5596 if (declarations.length) { 5597 const combinedSelector = `.$className}$baseStyle?.selector || ""}`; 5598 ruleset += `$combinedSelector} { $declarations.join( 5599 "; " 5600 )}; }`; 5601 } 5602 }); 5603 } 5604 } 5605 ); 5606 } 5607 return ruleset; 5608 } 5609 var STYLE_KEYS = [ 5610 "border", 5611 "color", 5612 "dimensions", 5613 "spacing", 5614 "typography", 5615 "filter", 5616 "outline", 5617 "shadow", 5618 "background" 5619 ]; 5620 function pickStyleKeys(treeToPickFrom, responsiveMediaQueries) { 5621 return pickStyleAndPseudoKeys( 5622 treeToPickFrom, 5623 void 0, 5624 responsiveMediaQueries 5625 ); 5626 } 5627 function pickStyleAndPseudoKeys(treeToPickFrom, blockName, responsiveMediaQueries) { 5628 if (!treeToPickFrom) { 5629 return {}; 5630 } 5631 const entries = Object.entries(treeToPickFrom); 5632 const allowedPseudoSelectors = blockName ? VALID_BLOCK_PSEUDO_SELECTORS[blockName] ?? [] : []; 5633 const pickedEntries = entries.filter( 5634 ([key]) => STYLE_KEYS.includes(key) || allowedPseudoSelectors.includes(key) || responsiveMediaQueries[key] 5635 ); 5636 const clonedEntries = pickedEntries.map(([key, style]) => [ 5637 key, 5638 JSON.parse(JSON.stringify(style)) 5639 ]); 5640 return Object.fromEntries(clonedEntries); 5641 } 5642 function getPseudoStyleNodes(node) { 5643 const { 5644 styles, 5645 selector: selector2, 5646 featureSelectors, 5647 name: name2, 5648 elementName, 5649 mediaQuery, 5650 variationName 5651 } = node; 5652 const pseudoSelectors = name2 ? VALID_BLOCK_PSEUDO_SELECTORS[name2] ?? [] : VALID_ELEMENT_PSEUDO_SELECTORS[elementName ?? ""] ?? []; 5653 if (!pseudoSelectors.length) { 5654 return []; 5655 } 5656 return pseudoSelectors.flatMap((pseudoSelector) => { 5657 const pseudoStyles = styles?.[pseudoSelector]; 5658 if (!pseudoStyles || typeof pseudoStyles !== "object") { 5659 return []; 5660 } 5661 return [ 5662 { 5663 styles: JSON.parse(JSON.stringify(pseudoStyles)), 5664 selector: selector2, 5665 selectorSuffix: pseudoSelector, 5666 mediaQuery, 5667 featureSelectors: featureSelectors && typeof featureSelectors !== "string" ? featureSelectors : void 0, 5668 name: name2, 5669 elementName, 5670 variationName 5671 } 5672 ]; 5673 }); 5674 } 5675 function getResponsiveStyleNodes(node, responsiveMediaQueries) { 5676 const { 5677 styles, 5678 selector: selector2, 5679 fallbackGapValue, 5680 featureSelectors, 5681 hasLayoutSupport, 5682 layoutHasBlockGapSupport, 5683 layoutSelector, 5684 name: name2, 5685 elementName, 5686 isStyleVariation, 5687 variationName 5688 } = node; 5689 if (!name2 && !elementName) { 5690 return []; 5691 } 5692 return Object.entries(responsiveMediaQueries).flatMap( 5693 ([breakpointKey, mediaQuery]) => { 5694 const breakpointStyles = styles?.[breakpointKey]; 5695 if (!breakpointStyles || typeof breakpointStyles !== "object") { 5696 return []; 5697 } 5698 return [ 5699 { 5700 styles: JSON.parse(JSON.stringify(breakpointStyles)), 5701 selector: selector2, 5702 mediaQuery, 5703 featureSelectors: featureSelectors && typeof featureSelectors !== "string" ? featureSelectors : void 0, 5704 fallbackGapValue, 5705 hasLayoutSupport, 5706 name: name2, 5707 elementName, 5708 isStyleVariation, 5709 variationName, 5710 layoutSelector, 5711 layoutHasBlockGapSupport 5712 } 5713 ]; 5714 } 5715 ); 5716 } 5717 var getNodesWithStyles = (tree, blockSelectors) => { 5718 const nodes = []; 5719 if (!tree?.styles) { 5720 return nodes; 5721 } 5722 const responsiveMediaQueries = getResponsiveMediaQueries(tree); 5723 const styles = pickStyleKeys(tree.styles, responsiveMediaQueries); 5724 if (styles) { 5725 nodes.push({ 5726 styles, 5727 selector: ROOT_BLOCK_SELECTOR, 5728 // Root selector (body) styles should not be wrapped in `:root where()` to keep 5729 // specificity at (0,0,1) and maintain backwards compatibility. 5730 skipSelectorWrapper: true 5731 }); 5732 } 5733 Object.entries(import_blocks2.__EXPERIMENTAL_ELEMENTS).forEach(([name2, selector2]) => { 5734 if (tree.styles?.elements?.[name2]) { 5735 nodes.push({ 5736 styles: tree.styles?.elements?.[name2] ?? {}, 5737 selector: selector2, 5738 elementName: name2, 5739 // Top level elements that don't use a class name should not receive the 5740 // `:root :where()` wrapper to maintain backwards compatibility. 5741 skipSelectorWrapper: !ELEMENT_CLASS_NAMES[name2] 5742 }); 5743 } 5744 }); 5745 Object.entries(tree.styles?.blocks ?? {}).forEach( 5746 ([blockName, node]) => { 5747 const blockStyles = pickStyleAndPseudoKeys( 5748 node, 5749 blockName, 5750 responsiveMediaQueries 5751 ); 5752 const typedNode = node; 5753 const variationNodesToAdd = []; 5754 const variationStyleNodesToAdd = []; 5755 if (typedNode?.variations) { 5756 Object.entries(typedNode.variations).forEach( 5757 ([variationName, variation]) => { 5758 const typedVariation = variation; 5759 const variationStyles = pickStyleAndPseudoKeys( 5760 typedVariation, 5761 blockName, 5762 responsiveMediaQueries 5763 ); 5764 if (typedVariation?.css) { 5765 variationStyles.css = typedVariation.css; 5766 } 5767 const variationSelector = typeof blockSelectors !== "string" ? blockSelectors[blockName]?.styleVariationSelectors?.[variationName] : void 0; 5768 if (variationSelector && typeof blockSelectors !== "string") { 5769 const blockSelector = blockSelectors[blockName]; 5770 variationStyleNodesToAdd.push({ 5771 styles: variationStyles, 5772 selector: variationSelector, 5773 featureSelectors: blockSelector?.featureSelectors, 5774 fallbackGapValue: blockSelector?.fallbackGapValue, 5775 hasLayoutSupport: blockSelector?.hasLayoutSupport, 5776 isStyleVariation: true, 5777 variationName, 5778 layoutSelector: variationSelector + blockSelector.selector, 5779 layoutHasBlockGapSupport: true, 5780 name: blockName 5781 }); 5782 } 5783 Object.entries( 5784 typedVariation?.elements ?? {} 5785 ).forEach(([element, elementStyles]) => { 5786 if (elementStyles && import_blocks2.__EXPERIMENTAL_ELEMENTS[element]) { 5787 variationNodesToAdd.push({ 5788 styles: elementStyles, 5789 selector: scopeSelector( 5790 variationSelector, 5791 import_blocks2.__EXPERIMENTAL_ELEMENTS[element] 5792 ), 5793 elementName: element, 5794 isStyleVariation: true 5795 }); 5796 } 5797 }); 5798 Object.entries(typedVariation?.blocks ?? {}).forEach( 5799 ([ 5800 variationBlockName, 5801 variationBlockStyles 5802 ]) => { 5803 const variationBlockSelector = typeof blockSelectors !== "string" ? scopeSelector( 5804 variationSelector, 5805 blockSelectors[variationBlockName]?.selector 5806 ) : void 0; 5807 const variationDuotoneSelector = typeof blockSelectors !== "string" ? scopeSelector( 5808 variationSelector, 5809 blockSelectors[variationBlockName]?.duotoneSelector 5810 ) : void 0; 5811 const variationFeatureSelectors = typeof blockSelectors !== "string" ? scopeFeatureSelectors( 5812 variationSelector, 5813 blockSelectors[variationBlockName]?.featureSelectors ?? {} 5814 ) : void 0; 5815 const variationBlockStyleNodes = pickStyleAndPseudoKeys( 5816 variationBlockStyles, 5817 variationBlockName, 5818 responsiveMediaQueries 5819 ); 5820 if (variationBlockStyles?.css) { 5821 variationBlockStyleNodes.css = variationBlockStyles.css; 5822 } 5823 if (!variationBlockSelector || typeof blockSelectors === "string") { 5824 return; 5825 } 5826 variationNodesToAdd.push({ 5827 selector: variationBlockSelector, 5828 name: variationBlockName, 5829 isStyleVariation: true, 5830 duotoneSelector: variationDuotoneSelector, 5831 featureSelectors: variationFeatureSelectors, 5832 fallbackGapValue: blockSelectors[variationBlockName]?.fallbackGapValue, 5833 hasLayoutSupport: blockSelectors[variationBlockName]?.hasLayoutSupport, 5834 styles: variationBlockStyleNodes 5835 }); 5836 Object.entries( 5837 variationBlockStyles.elements ?? {} 5838 ).forEach( 5839 ([ 5840 variationBlockElement, 5841 variationBlockElementStyles 5842 ]) => { 5843 if (variationBlockElementStyles && import_blocks2.__EXPERIMENTAL_ELEMENTS[variationBlockElement]) { 5844 variationNodesToAdd.push({ 5845 styles: variationBlockElementStyles, 5846 selector: scopeSelector( 5847 variationBlockSelector, 5848 import_blocks2.__EXPERIMENTAL_ELEMENTS[variationBlockElement] 5849 ), 5850 elementName: variationBlockElement, 5851 isStyleVariation: true 5852 }); 5853 } 5854 } 5855 ); 5856 } 5857 ); 5858 } 5859 ); 5860 } 5861 if (typeof blockSelectors !== "string" && blockSelectors?.[blockName]?.selector) { 5862 nodes.push({ 5863 duotoneSelector: blockSelectors[blockName].duotoneSelector, 5864 fallbackGapValue: blockSelectors[blockName].fallbackGapValue, 5865 hasLayoutSupport: blockSelectors[blockName].hasLayoutSupport, 5866 selector: blockSelectors[blockName].selector, 5867 styles: blockStyles, 5868 featureSelectors: blockSelectors[blockName].featureSelectors, 5869 name: blockName 5870 }); 5871 } 5872 nodes.push(...variationStyleNodesToAdd); 5873 Object.entries(typedNode?.elements ?? {}).forEach( 5874 ([elementName, value]) => { 5875 if (typeof blockSelectors !== "string" && value && blockSelectors?.[blockName] && import_blocks2.__EXPERIMENTAL_ELEMENTS[elementName]) { 5876 nodes.push({ 5877 styles: value, 5878 selector: blockSelectors[blockName]?.selector.split(",").map((sel) => { 5879 const elementSelectors = import_blocks2.__EXPERIMENTAL_ELEMENTS[elementName].split(","); 5880 return elementSelectors.map( 5881 (elementSelector) => sel + " " + elementSelector 5882 ); 5883 }).join(","), 5884 elementName 5885 }); 5886 } 5887 } 5888 ); 5889 nodes.push(...variationNodesToAdd); 5890 } 5891 ); 5892 return nodes; 5893 }; 5894 var getNodesWithSettings = (tree, blockSelectors) => { 5895 const nodes = []; 5896 if (!tree?.settings) { 5897 return nodes; 5898 } 5899 const pickPresets = (treeToPickFrom) => { 5900 let presets2 = {}; 5901 PRESET_METADATA.forEach(({ path }) => { 5902 const value = getValueFromObjectPath(treeToPickFrom, path, false); 5903 if (value !== false) { 5904 presets2 = setImmutably(presets2, path, value); 5905 } 5906 }); 5907 return presets2; 5908 }; 5909 const presets = pickPresets(tree.settings); 5910 const custom = tree.settings?.custom; 5911 if (Object.keys(presets).length > 0 || custom) { 5912 nodes.push({ 5913 presets, 5914 custom, 5915 selector: ROOT_CSS_PROPERTIES_SELECTOR 5916 }); 5917 } 5918 Object.entries(tree.settings?.blocks ?? {}).forEach( 5919 ([blockName, node]) => { 5920 const blockCustom = node.custom; 5921 if (typeof blockSelectors === "string" || !blockSelectors[blockName]) { 5922 return; 5923 } 5924 const blockPresets = pickPresets(node); 5925 if (Object.keys(blockPresets).length > 0 || blockCustom) { 5926 nodes.push({ 5927 presets: blockPresets, 5928 custom: blockCustom, 5929 selector: blockSelectors[blockName]?.selector, 5930 featureSelectors: blockSelectors[blockName]?.featureSelectors 5931 }); 5932 } 5933 } 5934 ); 5935 return nodes; 5936 }; 5937 function resolveFeatureSelector(featureSelectors, featureKey, fallback) { 5938 if (!featureSelectors || typeof featureSelectors === "string") { 5939 return fallback; 5940 } 5941 const feature = featureSelectors[featureKey]; 5942 if (typeof feature === "string") { 5943 return feature; 5944 } 5945 if (typeof feature === "object" && feature.root) { 5946 return feature.root; 5947 } 5948 return fallback; 5949 } 5950 function getPresetVarDeclarations(presets, mergedSettings, { path, valueKey, valueFunc, cssVarInfix }) { 5951 const presetByOrigin = getValueFromObjectPath( 5952 presets, 5953 path, 5954 [] 5955 ); 5956 const declarations = []; 5957 for (const origin of ["default", "theme", "custom"]) { 5958 if (!presetByOrigin[origin]) { 5959 continue; 5960 } 5961 for (const value of presetByOrigin[origin]) { 5962 const slug = kebabCase(value.slug); 5963 if (valueKey && !valueFunc) { 5964 declarations.push( 5965 `--wp--preset--$cssVarInfix}--$slug}: $value[valueKey]}` 5966 ); 5967 } else if (valueFunc && typeof valueFunc === "function") { 5968 declarations.push( 5969 `--wp--preset--$cssVarInfix}--$slug}: $valueFunc( 5970 value, 5971 mergedSettings 5972 )}` 5973 ); 5974 } 5975 } 5976 } 5977 return declarations; 5978 } 5979 var generateCustomProperties = (tree, blockSelectors) => { 5980 const nodes = getNodesWithSettings(tree, blockSelectors); 5981 let ruleset = ""; 5982 for (const { presets, custom, selector: selector2, featureSelectors } of nodes) { 5983 const defaultSelector = selector2; 5984 const varsBySelector = { 5985 [defaultSelector]: [] 5986 }; 5987 if (tree?.settings) { 5988 for (const metadata of PRESET_METADATA) { 5989 const declarations = getPresetVarDeclarations( 5990 presets, 5991 tree.settings, 5992 metadata 5993 ); 5994 if (declarations.length === 0) { 5995 continue; 5996 } 5997 const target = resolveFeatureSelector( 5998 featureSelectors, 5999 metadata.path[0], 6000 defaultSelector 6001 ); 6002 if (!varsBySelector[target]) { 6003 varsBySelector[target] = []; 6004 } 6005 varsBySelector[target].push(...declarations); 6006 } 6007 } 6008 const customProps = flattenTree(custom, "--wp--custom--", "--"); 6009 if (customProps.length > 0) { 6010 varsBySelector[defaultSelector].push(...customProps); 6011 } 6012 for (const [ruleSelector, declarations] of Object.entries( 6013 varsBySelector 6014 )) { 6015 if (declarations.length > 0) { 6016 ruleset += `$ruleSelector}{$declarations.join(";")};}`; 6017 } 6018 } 6019 } 6020 return ruleset; 6021 }; 6022 function renderStylesNode(node, { 6023 tree, 6024 useRootPaddingAlign, 6025 disableLayoutStyles, 6026 hasBlockGapSupport, 6027 hasFallbackGapSupport, 6028 disableRootPadding 6029 }) { 6030 const { 6031 selector: selector2, 6032 selectorSuffix, 6033 mediaQuery, 6034 duotoneSelector, 6035 styles, 6036 fallbackGapValue, 6037 hasLayoutSupport, 6038 featureSelectors, 6039 layoutSelector, 6040 layoutHasBlockGapSupport, 6041 skipSelectorWrapper, 6042 name: name2, 6043 variationName 6044 } = node; 6045 let ruleset = ""; 6046 const effectiveSelector = selectorSuffix ? appendToSelector(selector2, selectorSuffix) : selector2; 6047 if (featureSelectors && typeof featureSelectors !== "string") { 6048 let featureDeclarations = getFeatureDeclarations( 6049 featureSelectors, 6050 styles 6051 ); 6052 featureDeclarations = updateParagraphTextIndentSelector( 6053 featureDeclarations, 6054 tree.settings, 6055 name2 6056 ); 6057 featureDeclarations = updateButtonWidthDeclarations( 6058 featureDeclarations, 6059 tree.settings 6060 ); 6061 Object.entries(featureDeclarations).forEach( 6062 ([featureSelector, declarations]) => { 6063 if (declarations.length) { 6064 let selectorForRule = variationName ? getBlockStyleVariationFeatureSelector( 6065 variationName, 6066 featureSelector 6067 ) : featureSelector; 6068 selectorForRule = selectorSuffix ? appendToSelector(selectorForRule, selectorSuffix) : selectorForRule; 6069 const rules = declarations.join(";"); 6070 ruleset += `:root :where($selectorForRule}){$rules};}`; 6071 } 6072 } 6073 ); 6074 } 6075 if (duotoneSelector) { 6076 const duotoneStyles = {}; 6077 if (styles?.filter) { 6078 duotoneStyles.filter = styles.filter; 6079 delete styles.filter; 6080 } 6081 const duotoneDeclarations = getStylesDeclarations(duotoneStyles); 6082 if (duotoneDeclarations.length) { 6083 ruleset += `$duotoneSelector}{$duotoneDeclarations.join( 6084 ";" 6085 )};}`; 6086 } 6087 } 6088 const selectorForLayout = layoutSelector ?? effectiveSelector; 6089 const hasBlockGapSupportForLayout = layoutHasBlockGapSupport ?? hasBlockGapSupport; 6090 if (!disableLayoutStyles && (ROOT_BLOCK_SELECTOR === selectorForLayout || hasLayoutSupport)) { 6091 ruleset += getLayoutStyles({ 6092 style: styles, 6093 selector: selectorForLayout, 6094 hasBlockGapSupport: hasBlockGapSupportForLayout, 6095 hasFallbackGapSupport, 6096 fallbackGapValue 6097 }); 6098 } 6099 const styleDeclarations = getStylesDeclarations( 6100 styles, 6101 effectiveSelector, 6102 useRootPaddingAlign, 6103 tree, 6104 disableRootPadding 6105 ); 6106 if (styleDeclarations?.length) { 6107 const generalSelector = skipSelectorWrapper ? effectiveSelector : `:root :where($effectiveSelector})`; 6108 ruleset += `$generalSelector}{$styleDeclarations.join(";")};}`; 6109 } 6110 if (styles?.css) { 6111 ruleset += processCSSNesting( 6112 styles.css, 6113 `:root :where($effectiveSelector})` 6114 ); 6115 } 6116 if (mediaQuery && ruleset) { 6117 return `$mediaQuery}{$ruleset}}`; 6118 } 6119 return ruleset; 6120 } 6121 var transformToStyles = (tree, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles = false, disableRootPadding = false, styleOptions = {}) => { 6122 const options = { 6123 blockGap: true, 6124 blockStyles: true, 6125 layoutStyles: true, 6126 marginReset: true, 6127 presets: true, 6128 rootPadding: true, 6129 variationStyles: false, 6130 ...styleOptions 6131 }; 6132 const normalizedTree = normalizeStyleStateAliases(tree); 6133 const nodesWithStyles = getNodesWithStyles( 6134 normalizedTree, 6135 blockSelectors 6136 ); 6137 const nodesWithSettings = getNodesWithSettings( 6138 normalizedTree, 6139 blockSelectors 6140 ); 6141 const useRootPaddingAlign = normalizedTree?.settings?.useRootPaddingAwareAlignments; 6142 const { contentSize, wideSize } = normalizedTree?.settings?.layout || {}; 6143 const hasBodyStyles = options.marginReset || options.rootPadding || options.layoutStyles; 6144 let ruleset = ""; 6145 if (options.presets && (contentSize || wideSize)) { 6146 ruleset += `$ROOT_CSS_PROPERTIES_SELECTOR} {`; 6147 ruleset = contentSize ? ruleset + ` --wp--style--global--content-size: $contentSize};` : ruleset; 6148 ruleset = wideSize ? ruleset + ` --wp--style--global--wide-size: $wideSize};` : ruleset; 6149 ruleset += "}"; 6150 } 6151 if (hasBodyStyles) { 6152 ruleset += ":where(body) {margin: 0;"; 6153 if (options.rootPadding && useRootPaddingAlign) { 6154 ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) } 6155 .has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); } 6156 .has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); } 6157 .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) { padding-right: 0; padding-left: 0; } 6158 .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) > .alignfull { margin-left: 0; margin-right: 0; 6159 `; 6160 } 6161 ruleset += "}"; 6162 } 6163 if (options.blockStyles) { 6164 const responsiveMediaQueries = getResponsiveMediaQueries(tree); 6165 nodesWithStyles.forEach((node) => { 6166 if (node.isStyleVariation && !options.variationStyles) { 6167 return; 6168 } 6169 const responsiveNodes = getResponsiveStyleNodes( 6170 node, 6171 responsiveMediaQueries 6172 ); 6173 [ 6174 node, 6175 ...responsiveNodes, 6176 ...getPseudoStyleNodes(node), 6177 ...responsiveNodes.flatMap(getPseudoStyleNodes) 6178 ].forEach((expandedNode) => { 6179 ruleset += renderStylesNode(expandedNode, { 6180 tree: normalizedTree, 6181 useRootPaddingAlign, 6182 disableLayoutStyles, 6183 hasBlockGapSupport, 6184 hasFallbackGapSupport, 6185 disableRootPadding 6186 }); 6187 }); 6188 }); 6189 } 6190 if (options.layoutStyles) { 6191 ruleset = ruleset + ".wp-site-blocks > .alignleft { float: left; margin-right: 2em; }"; 6192 ruleset = ruleset + ".wp-site-blocks > .alignright { float: right; margin-left: 2em; }"; 6193 ruleset = ruleset + ".wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }"; 6194 } 6195 if (options.blockGap && hasBlockGapSupport) { 6196 const gapValue = getGapCSSValue(normalizedTree?.styles?.spacing?.blockGap) || "0.5em"; 6197 ruleset = ruleset + `:root :where(.wp-site-blocks) > * { margin-block-start: $gapValue}; margin-block-end: 0; }`; 6198 ruleset = ruleset + ":root :where(.wp-site-blocks) > :first-child { margin-block-start: 0; }"; 6199 ruleset = ruleset + ":root :where(.wp-site-blocks) > :last-child { margin-block-end: 0; }"; 6200 } 6201 if (options.presets) { 6202 nodesWithSettings.forEach(({ selector: selector2, presets }) => { 6203 if (ROOT_BLOCK_SELECTOR === selector2 || ROOT_CSS_PROPERTIES_SELECTOR === selector2) { 6204 selector2 = ""; 6205 } 6206 const classes = getPresetsClasses(selector2, presets); 6207 if (classes.length > 0) { 6208 ruleset += classes; 6209 } 6210 }); 6211 } 6212 return ruleset; 6213 }; 6214 function generateSvgFilters(tree, blockSelectors) { 6215 const nodesWithSettings = getNodesWithSettings(tree, blockSelectors); 6216 return nodesWithSettings.flatMap(({ presets }) => { 6217 return getPresetsSvgFilters(presets); 6218 }); 6219 } 6220 var getSelectorsConfig = (blockType, rootSelector) => { 6221 if (blockType?.selectors && Object.keys(blockType.selectors).length > 0) { 6222 return blockType.selectors; 6223 } 6224 const config2 = { 6225 root: rootSelector 6226 }; 6227 Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach( 6228 ([featureKey, featureName]) => { 6229 const featureSelector = getBlockSelector(blockType, featureKey); 6230 if (featureSelector) { 6231 config2[featureName] = featureSelector; 6232 } 6233 } 6234 ); 6235 return config2; 6236 }; 6237 var getBlockSelectors = (blockTypes, variationInstanceId) => { 6238 const { getBlockStyles } = (0, import_data3.select)(import_blocks2.store); 6239 const result = {}; 6240 blockTypes.forEach((blockType) => { 6241 const name2 = blockType.name; 6242 const selector2 = getBlockSelector(blockType); 6243 if (!selector2) { 6244 return; 6245 } 6246 let duotoneSelector = getBlockSelector(blockType, "filter.duotone"); 6247 if (!duotoneSelector) { 6248 const rootSelector = getBlockSelector(blockType); 6249 const duotoneSupport = (0, import_blocks2.getBlockSupport)( 6250 blockType, 6251 "color.__experimentalDuotone", 6252 false 6253 ); 6254 if (typeof duotoneSupport === "string" && rootSelector) { 6255 duotoneSelector = scopeSelector(rootSelector, duotoneSupport); 6256 } 6257 } 6258 const hasLayoutSupport = !!blockType?.supports?.layout || !!blockType?.supports?.__experimentalLayout; 6259 const fallbackGapValue = ( 6260 // @ts-expect-error 6261 blockType?.supports?.spacing?.blockGap?.__experimentalDefault 6262 ); 6263 const blockStyleVariations = getBlockStyles(name2); 6264 const styleVariationSelectors = {}; 6265 blockStyleVariations?.forEach((variation) => { 6266 const variationSuffix = variationInstanceId ? `-$variationInstanceId}` : ""; 6267 const variationName = `$variation.name}$variationSuffix}`; 6268 const styleVariationSelector = getBlockStyleVariationSelector( 6269 variationName, 6270 selector2 6271 ); 6272 styleVariationSelectors[variationName] = styleVariationSelector; 6273 }); 6274 const featureSelectors = getSelectorsConfig(blockType, selector2); 6275 result[name2] = { 6276 duotoneSelector: duotoneSelector ?? void 0, 6277 fallbackGapValue, 6278 featureSelectors: Object.keys(featureSelectors).length ? featureSelectors : void 0, 6279 hasLayoutSupport, 6280 name: name2, 6281 selector: selector2, 6282 styleVariationSelectors: blockStyleVariations?.length ? styleVariationSelectors : void 0 6283 }; 6284 }); 6285 return result; 6286 }; 6287 function updateConfigWithSeparator(config2) { 6288 const blocks = config2.styles?.blocks; 6289 const separatorBlock = blocks?.["core/separator"]; 6290 const needsSeparatorStyleUpdate = separatorBlock && separatorBlock.color?.background && !separatorBlock.color?.text && !separatorBlock.border?.color; 6291 if (needsSeparatorStyleUpdate) { 6292 return { 6293 ...config2, 6294 styles: { 6295 ...config2.styles, 6296 blocks: { 6297 ...blocks, 6298 "core/separator": { 6299 ...separatorBlock, 6300 color: { 6301 ...separatorBlock.color, 6302 text: separatorBlock.color?.background 6303 } 6304 } 6305 } 6306 } 6307 }; 6308 } 6309 return config2; 6310 } 6311 function processCSSNesting(css, blockSelector) { 6312 let processedCSS = ""; 6313 if (!css || css.trim() === "") { 6314 return processedCSS; 6315 } 6316 const parts = css.split("&"); 6317 parts.forEach((part) => { 6318 if (!part || part.trim() === "") { 6319 return; 6320 } 6321 const isRootCss = !part.includes("{"); 6322 if (isRootCss) { 6323 processedCSS += `:root :where($blockSelector}){$part.trim()}}`; 6324 } else { 6325 const splitPart = part.replace("}", "").split("{"); 6326 if (splitPart.length !== 2) { 6327 return; 6328 } 6329 const [nestedSelector, cssValue] = splitPart; 6330 const matches = nestedSelector.match(/([>+~\s]*::[a-zA-Z-]+)/); 6331 const pseudoPart = matches ? matches[1] : ""; 6332 const withoutPseudoElement = matches ? nestedSelector.replace(pseudoPart, "").trim() : nestedSelector.trim(); 6333 let combinedSelector; 6334 if (withoutPseudoElement === "") { 6335 combinedSelector = blockSelector; 6336 } else { 6337 combinedSelector = nestedSelector.startsWith(" ") ? scopeSelector(blockSelector, withoutPseudoElement) : appendToSelector(blockSelector, withoutPseudoElement); 6338 } 6339 processedCSS += `:root :where($combinedSelector})$pseudoPart}{$cssValue.trim()}}`; 6340 } 6341 }); 6342 return processedCSS; 6343 } 6344 function generateGlobalStyles(config2 = {}, blockTypes = [], options = {}) { 6345 const { 6346 hasBlockGapSupport: hasBlockGapSupportOption, 6347 hasFallbackGapSupport: hasFallbackGapSupportOption, 6348 disableLayoutStyles = false, 6349 disableRootPadding = false, 6350 styleOptions = {} 6351 } = options; 6352 const blocks = blockTypes.length > 0 ? blockTypes : (0, import_blocks2.getBlockTypes)(); 6353 const blockGap = getSetting(config2, "spacing.blockGap"); 6354 const hasBlockGapSupport = hasBlockGapSupportOption ?? blockGap !== null; 6355 const hasFallbackGapSupport = hasFallbackGapSupportOption ?? !hasBlockGapSupport; 6356 if (!config2?.styles || !config2?.settings) { 6357 return [[], {}]; 6358 } 6359 const updatedConfig = updateConfigWithSeparator(config2); 6360 const blockSelectors = getBlockSelectors(blocks); 6361 const customProperties = generateCustomProperties( 6362 updatedConfig, 6363 blockSelectors 6364 ); 6365 const globalStyles = transformToStyles( 6366 updatedConfig, 6367 blockSelectors, 6368 hasBlockGapSupport, 6369 hasFallbackGapSupport, 6370 disableLayoutStyles, 6371 disableRootPadding, 6372 styleOptions 6373 ); 6374 const svgs = generateSvgFilters(updatedConfig, blockSelectors); 6375 const styles = [ 6376 { 6377 css: customProperties, 6378 isGlobalStyles: true 6379 }, 6380 { 6381 css: globalStyles, 6382 isGlobalStyles: true 6383 }, 6384 // Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor. 6385 { 6386 css: updatedConfig?.styles?.css ?? "", 6387 isGlobalStyles: true 6388 }, 6389 { 6390 assets: svgs, 6391 __unstableType: "svgs", 6392 isGlobalStyles: true 6393 } 6394 ]; 6395 blocks.forEach((blockType) => { 6396 const blockStyles = updatedConfig?.styles?.blocks?.[blockType.name]; 6397 if (blockStyles?.css) { 6398 const { featureSelectors } = blockSelectors[blockType.name]; 6399 const cssFeatureSelector = typeof featureSelectors === "object" ? featureSelectors?.css : void 0; 6400 let resolvedCssSelector; 6401 if (typeof cssFeatureSelector === "string") { 6402 resolvedCssSelector = cssFeatureSelector; 6403 } else if (typeof cssFeatureSelector === "object") { 6404 resolvedCssSelector = cssFeatureSelector?.root; 6405 } 6406 const selector2 = resolvedCssSelector ?? blockSelectors[blockType.name].selector; 6407 styles.push({ 6408 css: processCSSNesting(blockStyles.css, selector2), 6409 isGlobalStyles: true 6410 }); 6411 } 6412 }); 6413 return [styles, updatedConfig.settings]; 6414 } 6415 6416 // packages/global-styles-engine/build-module/variation.mjs 6417 function getVariationStyle(globalStyles, name2, variation, { resolveRefs = true } = {}) { 6418 if (!globalStyles?.styles?.blocks?.[name2]?.variations?.[variation]) { 6419 return void 0; 6420 } 6421 const replaceRefs = (variationStyles) => { 6422 Object.keys(variationStyles).forEach((key) => { 6423 const value = variationStyles[key]; 6424 if (typeof value === "object" && value !== null) { 6425 if (value.ref !== void 0) { 6426 if (typeof value.ref !== "string" || value.ref.trim() === "") { 6427 delete variationStyles[key]; 6428 } else { 6429 const refValue = getValueFromObjectPath( 6430 globalStyles, 6431 value.ref 6432 ); 6433 if (refValue !== void 0 && refValue !== null) { 6434 variationStyles[key] = refValue; 6435 } else { 6436 delete variationStyles[key]; 6437 } 6438 } 6439 } else { 6440 replaceRefs(value); 6441 if (Object.keys(value).length === 0) { 6442 delete variationStyles[key]; 6443 } 6444 } 6445 } 6446 }); 6447 }; 6448 const styles = JSON.parse( 6449 JSON.stringify( 6450 globalStyles.styles.blocks[name2].variations[variation] 6451 ) 6452 ); 6453 if (resolveRefs) { 6454 replaceRefs(styles); 6455 } 6456 return styles; 6457 } 6458 6459 // packages/global-styles-engine/build-module/resolve-style.mjs 6460 var DEFAULT_STATE_VALUE = "default"; 6461 function isDefaultBlockStyleState(selectedState) { 6462 const viewport = selectedState?.viewport; 6463 const pseudoState = selectedState?.pseudoState; 6464 return (!viewport || viewport === DEFAULT_STATE_VALUE) && (!pseudoState || pseudoState === DEFAULT_STATE_VALUE); 6465 } 6466 function getStyleStatePath(selectedState) { 6467 if (isDefaultBlockStyleState(selectedState)) { 6468 return []; 6469 } 6470 return [selectedState.viewport, selectedState.pseudoState].filter( 6471 (state2) => !!state2 && state2 !== DEFAULT_STATE_VALUE 6472 ); 6473 } 6474 function getStyleForState(style, selectedState) { 6475 const path = getStyleStatePath(selectedState); 6476 if (!path.length) { 6477 return style; 6478 } 6479 return getValueFromObjectPath(style, path); 6480 } 6481 var TREE_STRUCTURAL_KEYS = /* @__PURE__ */ new Set(["blocks", "variations", "css"]); 6482 var EMPTY_INHERITANCE = Object.freeze({ 6483 value: {}, 6484 sources: {} 6485 }); 6486 var SOURCE_DESCRIPTORS = { 6487 root: { layer: "root" }, 6488 element: { layer: "element" }, 6489 block: { layer: "block" }, 6490 blockVariation: { layer: "blockVariation" } 6491 }; 6492 function createSourceDescriptor(type) { 6493 const descriptor = SOURCE_DESCRIPTORS[type]; 6494 if (!descriptor) { 6495 return null; 6496 } 6497 return { ...descriptor }; 6498 } 6499 function createContribution(styles, source) { 6500 if (!styles || !source) { 6501 return null; 6502 } 6503 return { styles, source }; 6504 } 6505 function getPathKey(path) { 6506 return path.join("."); 6507 } 6508 function getSourceForPath(source) { 6509 return { ...source }; 6510 } 6511 function isExplicitEmpty(value) { 6512 if (value === "" || value === null) { 6513 return true; 6514 } 6515 if (typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0) { 6516 return true; 6517 } 6518 return false; 6519 } 6520 function isRefObject(value) { 6521 return value !== null && typeof value === "object" && !Array.isArray(value) && typeof value.ref === "string"; 6522 } 6523 function pickLayerRootContribution(layer) { 6524 if (!layer || typeof layer !== "object" || Array.isArray(layer)) { 6525 return null; 6526 } 6527 const contribution = {}; 6528 for (const key of Object.keys(layer)) { 6529 if (TREE_STRUCTURAL_KEYS.has(key)) { 6530 continue; 6531 } 6532 if (key === "elements") { 6533 if (layer.elements && typeof layer.elements === "object") { 6534 contribution.elements = layer.elements; 6535 } 6536 continue; 6537 } 6538 if (isExplicitEmpty(layer[key])) { 6539 continue; 6540 } 6541 contribution[key] = layer[key]; 6542 } 6543 return Object.keys(contribution).length === 0 ? null : contribution; 6544 } 6545 var ATOMIC_OBJECT_KEYS = /* @__PURE__ */ new Set(["backgroundImage"]); 6546 function deepMergeDroppingEmpties(target, source, globalStyles, sourceMetadata, sources, path = []) { 6547 if (!source || typeof source !== "object" || Array.isArray(source)) { 6548 return target; 6549 } 6550 for (const key of Object.keys(source)) { 6551 let sourceValue = source[key]; 6552 if (isExplicitEmpty(sourceValue)) { 6553 continue; 6554 } 6555 if (isRefObject(sourceValue)) { 6556 if (sourceValue.ref.trim() === "") { 6557 continue; 6558 } 6559 const resolved = getValueFromObjectPath( 6560 globalStyles, 6561 sourceValue.ref 6562 ); 6563 if (resolved === void 0 || resolved === null || isRefObject(resolved)) { 6564 continue; 6565 } 6566 sourceValue = resolved; 6567 } 6568 const nextPath = [...path, key]; 6569 if (!ATOMIC_OBJECT_KEYS.has(key) && sourceValue !== null && typeof sourceValue === "object" && !Array.isArray(sourceValue) && !isRefObject(sourceValue)) { 6570 const existing = target[key] && typeof target[key] === "object" && !Array.isArray(target[key]) ? target[key] : {}; 6571 target[key] = deepMergeDroppingEmpties( 6572 { ...existing }, 6573 sourceValue, 6574 globalStyles, 6575 sourceMetadata, 6576 sources, 6577 nextPath 6578 ); 6579 } else { 6580 target[key] = ATOMIC_OBJECT_KEYS.has(key) && sourceValue !== null && typeof sourceValue === "object" && !Array.isArray(sourceValue) ? { ...sourceValue } : sourceValue; 6581 if (sourceMetadata && sources) { 6582 sources[getPathKey(nextPath)] = getSourceForPath(sourceMetadata); 6583 } 6584 } 6585 } 6586 return target; 6587 } 6588 function getStateSlice(layerObject, selectedState) { 6589 if (!layerObject) { 6590 return null; 6591 } 6592 const slice2 = getStyleForState(layerObject, selectedState); 6593 return slice2 && typeof slice2 === "object" && !Array.isArray(slice2) ? slice2 : null; 6594 } 6595 var NON_CASCADING_ROOT_PREFIXES = [ 6596 "color.background", 6597 "color.gradient", 6598 "background", 6599 "spacing", 6600 "dimensions", 6601 "border", 6602 "shadow", 6603 "filter" 6604 ]; 6605 function isNonCascadingRootPath(pathKey) { 6606 if (pathKey.startsWith("elements.")) { 6607 return false; 6608 } 6609 return NON_CASCADING_ROOT_PREFIXES.some( 6610 (prefix2) => pathKey === prefix2 || pathKey.startsWith(`$prefix2}.`) 6611 ); 6612 } 6613 function deleteAtPath(target, pathSegments) { 6614 if (!target || typeof target !== "object") { 6615 return; 6616 } 6617 const [head2, ...rest] = pathSegments; 6618 if (rest.length === 0) { 6619 delete target[head2]; 6620 return; 6621 } 6622 const child = target[head2]; 6623 if (child && typeof child === "object") { 6624 deleteAtPath(child, rest); 6625 if (Object.keys(child).length === 0) { 6626 delete target[head2]; 6627 } 6628 } 6629 } 6630 function dropNonCascadingRootLeaves(value, sources) { 6631 for (const pathKey of Object.keys(sources)) { 6632 if (sources[pathKey].layer === "root" && isNonCascadingRootPath(pathKey)) { 6633 deleteAtPath(value, pathKey.split(".")); 6634 delete sources[pathKey]; 6635 } 6636 } 6637 } 6638 function resolveThemeFileBackgroundImage(value, globalStyles, links) { 6639 const image = value?.background?.backgroundImage; 6640 if (!image) { 6641 return; 6642 } 6643 const resolved = getResolvedValue(image, { 6644 ...globalStyles, 6645 _links: links ?? void 0 6646 }); 6647 if (resolved !== void 0) { 6648 value.background.backgroundImage = resolved; 6649 } 6650 } 6651 function computeResolvedStyle(globalStyles, { 6652 blockName, 6653 variationName = null, 6654 elements: elements2 = null, 6655 viewport = null, 6656 pseudoState = null 6657 } = {}) { 6658 if (!globalStyles || !globalStyles.styles) { 6659 return EMPTY_INHERITANCE; 6660 } 6661 if (!blockName) { 6662 return EMPTY_INHERITANCE; 6663 } 6664 const styles = globalStyles.styles; 6665 const selectedState = { viewport, pseudoState }; 6666 const root = styles; 6667 const block = styles.blocks?.[blockName] ?? null; 6668 const elementLayers = (elements2 ?? []).map((elementName) => styles.elements?.[elementName] ?? null).filter((layer) => !!layer); 6669 const variation = variationName ? getVariationStyle(globalStyles, blockName, variationName) ?? null : null; 6670 const contributions = [ 6671 createContribution( 6672 pickLayerRootContribution(root), 6673 createSourceDescriptor("root") 6674 ), 6675 ...elementLayers.map( 6676 (layer) => createContribution( 6677 pickLayerRootContribution(layer), 6678 createSourceDescriptor("element") 6679 ) 6680 ), 6681 block ? createContribution( 6682 pickLayerRootContribution(block), 6683 createSourceDescriptor("block") 6684 ) : null, 6685 variation ? createContribution( 6686 pickLayerRootContribution(variation), 6687 createSourceDescriptor("blockVariation") 6688 ) : null 6689 ]; 6690 if (!isDefaultBlockStyleState(selectedState)) { 6691 contributions.push( 6692 createContribution( 6693 pickLayerRootContribution( 6694 getStateSlice(root, selectedState) 6695 ), 6696 createSourceDescriptor("root") 6697 ), 6698 ...elementLayers.map( 6699 (layer) => createContribution( 6700 pickLayerRootContribution( 6701 getStateSlice(layer, selectedState) 6702 ), 6703 createSourceDescriptor("element") 6704 ) 6705 ), 6706 block ? createContribution( 6707 pickLayerRootContribution( 6708 getStateSlice(block, selectedState) 6709 ), 6710 createSourceDescriptor("block") 6711 ) : null, 6712 variation ? createContribution( 6713 pickLayerRootContribution( 6714 getStateSlice(variation, selectedState) 6715 ), 6716 createSourceDescriptor("blockVariation") 6717 ) : null 6718 ); 6719 } 6720 const filteredContributions = contributions.filter( 6721 Boolean 6722 ); 6723 if (filteredContributions.length === 0) { 6724 return EMPTY_INHERITANCE; 6725 } 6726 const sources = {}; 6727 const value = filteredContributions.reduce( 6728 (mergedValue, contribution) => deepMergeDroppingEmpties( 6729 mergedValue, 6730 contribution.styles, 6731 globalStyles, 6732 contribution.source, 6733 sources 6734 ), 6735 {} 6736 ); 6737 dropNonCascadingRootLeaves(value, sources); 6738 resolveThemeFileBackgroundImage( 6739 value, 6740 globalStyles, 6741 globalStyles._links ?? null 6742 ); 6743 return { value, sources }; 6744 } 6745 var NO_LINKS = {}; 6746 var memo = /* @__PURE__ */ new WeakMap(); 6747 function resolveStyle(globalStyles, context = {}) { 6748 const styleData = globalStyles?.styles; 6749 if (!styleData || typeof styleData !== "object") { 6750 return computeResolvedStyle(globalStyles, context); 6751 } 6752 let byLinks = memo.get(styleData); 6753 if (!byLinks) { 6754 byLinks = /* @__PURE__ */ new WeakMap(); 6755 memo.set(styleData, byLinks); 6756 } 6757 const linksKey = globalStyles?._links ?? NO_LINKS; 6758 let inner = byLinks.get(linksKey); 6759 if (!inner) { 6760 inner = /* @__PURE__ */ new Map(); 6761 byLinks.set(linksKey, inner); 6762 } 6763 const sliceKey = `$context.elements?.join(",") ?? ""}:$context.viewport ?? ""}:$context.pseudoState ?? ""}`; 6764 const key = (context.blockName || "") + "" + (context.variationName || "") + "" + sliceKey; 6765 if (inner.has(key)) { 6766 return inner.get(key); 6767 } 6768 const result = computeResolvedStyle(globalStyles, context); 6769 inner.set(key, result); 6770 return result; 6771 } 6772 6773 // packages/global-styles-engine/build-module/lock-unlock.mjs 6774 var import_private_apis2 = __toESM(require_private_apis(), 1); 6775 var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 6776 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 6777 "@wordpress/global-styles-engine" 6778 ); 6779 6780 // packages/global-styles-engine/build-module/private-apis.mjs 6781 var privateApis = {}; 6782 lock2(privateApis, { 6783 getResponsiveMediaQueries, 6784 getViewportBreakpoints, 6785 getViewportBreakpointValueInPixels, 6786 resolveStyle, 6787 getVariationStyle 6788 }); 6789 6790 // packages/global-styles-engine/build-module/preview-state-styles.mjs 6791 function generatePreviewStateStyles(stateStyles, blockName) { 6792 if (!stateStyles || !blockName) { 6793 return ""; 6794 } 6795 const previewConfig = { 6796 settings: {}, 6797 // Empty settings to satisfy the config structure 6798 styles: { 6799 blocks: { 6800 [blockName]: stateStyles 6801 } 6802 } 6803 }; 6804 try { 6805 const [generatedStyles] = generateGlobalStyles(previewConfig, []); 6806 return generatedStyles.map((style) => style.css).join("\n"); 6807 } catch { 6808 return ""; 6809 } 6810 } 6811 6812 // packages/editor/build-module/utils/device-type.mjs 6813 var { getViewportBreakpoints: getViewportBreakpoints2, getViewportBreakpointValueInPixels: getViewportBreakpointValueInPixels2 } = unlock( 6814 privateApis 6815 ); 6816 var VIEWPORT_KEY_BY_DEVICE_TYPE = { 6817 Tablet: "tablet", 6818 Mobile: "mobile" 6819 }; 6820 var DESKTOP_DEVICE_TYPE = "Desktop"; 6821 var TABLET_DEVICE_TYPE = "Tablet"; 6822 var MOBILE_DEVICE_TYPE = "Mobile"; 6823 var DEVICE_PREVIEW_WIDTH_OFFSET = 1; 6824 var VIEWPORT_STATE_BY_DEVICE_TYPE = { 6825 Desktop: "default", 6826 Tablet: "@tablet", 6827 Mobile: "@mobile" 6828 }; 6829 function getDeviceTypeByCanvasWidth(canvasWidth2, viewportSettings) { 6830 const width = getViewportBreakpointValueInPixels2(canvasWidth2); 6831 const breakpoints = getViewportBreakpoints2(viewportSettings); 6832 if (width && width <= getViewportBreakpointValueInPixels2(breakpoints.mobile)) { 6833 return MOBILE_DEVICE_TYPE; 6834 } 6835 if (width && width <= getViewportBreakpointValueInPixels2(breakpoints.tablet)) { 6836 return TABLET_DEVICE_TYPE; 6837 } 6838 return DESKTOP_DEVICE_TYPE; 6839 } 6840 function getCanvasWidthByDeviceType(deviceType, viewportSettings) { 6841 const viewportKey = VIEWPORT_KEY_BY_DEVICE_TYPE[deviceType]; 6842 if (!viewportKey) { 6843 return void 0; 6844 } 6845 const breakpoints = getViewportBreakpoints2(viewportSettings); 6846 const width = getViewportBreakpointValueInPixels2( 6847 breakpoints[viewportKey] 6848 ); 6849 if (width === void 0) { 6850 return void 0; 6851 } 6852 let lowerBreakpoint = 0; 6853 if (deviceType === TABLET_DEVICE_TYPE) { 6854 lowerBreakpoint = getViewportBreakpointValueInPixels2(breakpoints.mobile) ?? 0; 6855 } 6856 const offset4 = Math.min( 6857 DEVICE_PREVIEW_WIDTH_OFFSET, 6858 (width - lowerBreakpoint) / 2 6859 ); 6860 return width - offset4; 6861 } 6862 6863 // packages/editor/build-module/store/selectors.mjs 6864 var EMPTY_OBJECT2 = {}; 6865 var hasEditorUndo = (0, import_data4.createRegistrySelector)((select9) => () => { 6866 return select9(import_core_data.store).hasUndo(); 6867 }); 6868 var hasEditorRedo = (0, import_data4.createRegistrySelector)((select9) => () => { 6869 return select9(import_core_data.store).hasRedo(); 6870 }); 6871 function isEditedPostNew(state2) { 6872 return getCurrentPost(state2).status === "auto-draft"; 6873 } 6874 function hasChangedContent(state2) { 6875 const edits = getPostEdits(state2); 6876 return "content" in edits; 6877 } 6878 var isEditedPostDirty = (0, import_data4.createRegistrySelector)( 6879 (select9) => (state2) => { 6880 const postType2 = getCurrentPostType(state2); 6881 const postId2 = getCurrentPostId(state2); 6882 return select9(import_core_data.store).hasEditsForEntityRecord( 6883 "postType", 6884 postType2, 6885 postId2 6886 ); 6887 } 6888 ); 6889 var hasNonPostEntityChanges = (0, import_data4.createRegistrySelector)( 6890 (select9) => (state2) => { 6891 const dirtyEntityRecords = select9(import_core_data.store).__experimentalGetDirtyEntityRecords(); 6892 const { type, id } = getCurrentPost(state2); 6893 return dirtyEntityRecords.some( 6894 (entityRecord) => entityRecord.kind !== "postType" || entityRecord.name !== type || entityRecord.key !== id 6895 ); 6896 } 6897 ); 6898 function isCleanNewPost(state2) { 6899 return !isEditedPostDirty(state2) && isEditedPostNew(state2); 6900 } 6901 var getCurrentPost = (0, import_data4.createRegistrySelector)( 6902 (select9) => (state2) => { 6903 const postId2 = getCurrentPostId(state2); 6904 const postType2 = getCurrentPostType(state2); 6905 const post2 = select9(import_core_data.store).getRawEntityRecord( 6906 "postType", 6907 postType2, 6908 postId2 6909 ); 6910 if (post2) { 6911 return post2; 6912 } 6913 return EMPTY_OBJECT2; 6914 } 6915 ); 6916 function getCurrentPostType(state2) { 6917 return state2.postType; 6918 } 6919 function getCurrentPostId(state2) { 6920 return state2.postId; 6921 } 6922 function getCurrentTemplateId(state2) { 6923 return state2.templateId; 6924 } 6925 function getCurrentPostRevisionsCount(state2) { 6926 return getCurrentPost(state2)._links?.["version-history"]?.[0]?.count ?? 0; 6927 } 6928 function getCurrentPostLastRevisionId(state2) { 6929 return getCurrentPost(state2)._links?.["predecessor-version"]?.[0]?.id ?? null; 6930 } 6931 var getPostEdits = (0, import_data4.createRegistrySelector)((select9) => (state2) => { 6932 const postType2 = getCurrentPostType(state2); 6933 const postId2 = getCurrentPostId(state2); 6934 return select9(import_core_data.store).getEntityRecordEdits( 6935 "postType", 6936 postType2, 6937 postId2 6938 ) || EMPTY_OBJECT2; 6939 }); 6940 function getCurrentPostAttribute(state2, attributeName) { 6941 switch (attributeName) { 6942 case "type": 6943 return getCurrentPostType(state2); 6944 case "id": 6945 return getCurrentPostId(state2); 6946 default: 6947 const post2 = getCurrentPost(state2); 6948 if (!post2.hasOwnProperty(attributeName)) { 6949 break; 6950 } 6951 return getPostRawValue(post2[attributeName]); 6952 } 6953 } 6954 var getNestedEditedPostProperty = (0, import_data4.createSelector)( 6955 (state2, attributeName) => { 6956 const edits = getPostEdits(state2); 6957 if (!edits.hasOwnProperty(attributeName)) { 6958 return getCurrentPostAttribute(state2, attributeName); 6959 } 6960 return { 6961 ...getCurrentPostAttribute(state2, attributeName), 6962 ...edits[attributeName] 6963 }; 6964 }, 6965 (state2, attributeName) => [ 6966 getCurrentPostAttribute(state2, attributeName), 6967 getPostEdits(state2)[attributeName] 6968 ] 6969 ); 6970 function getEditedPostAttribute(state2, attributeName) { 6971 switch (attributeName) { 6972 case "content": 6973 return getEditedPostContent(state2); 6974 } 6975 const edits = getPostEdits(state2); 6976 if (!edits.hasOwnProperty(attributeName)) { 6977 return getCurrentPostAttribute(state2, attributeName); 6978 } 6979 if (EDIT_MERGE_PROPERTIES.has(attributeName)) { 6980 return getNestedEditedPostProperty(state2, attributeName); 6981 } 6982 return edits[attributeName]; 6983 } 6984 var getAutosaveAttribute = (0, import_data4.createRegistrySelector)( 6985 (select9) => (state2, attributeName) => { 6986 if (!AUTOSAVE_PROPERTIES.includes(attributeName) && attributeName !== "preview_link") { 6987 return; 6988 } 6989 const postType2 = getCurrentPostType(state2); 6990 const postId2 = getCurrentPostId(state2); 6991 const currentUserId = select9(import_core_data.store).getCurrentUser()?.id; 6992 const autosave2 = select9(import_core_data.store).getAutosave( 6993 postType2, 6994 postId2, 6995 currentUserId 6996 ); 6997 if (autosave2) { 6998 return getPostRawValue(autosave2[attributeName]); 6999 } 7000 } 7001 ); 7002 function getEditedPostVisibility(state2) { 7003 const status = getEditedPostAttribute(state2, "status"); 7004 if (status === "private") { 7005 return "private"; 7006 } 7007 const password = getEditedPostAttribute(state2, "password"); 7008 if (password) { 7009 return "password"; 7010 } 7011 return "public"; 7012 } 7013 function isCurrentPostPending(state2) { 7014 return getCurrentPost(state2).status === "pending"; 7015 } 7016 function isCurrentPostPublished(state2, currentPost) { 7017 const post2 = currentPost || getCurrentPost(state2); 7018 return ["publish", "private"].indexOf(post2.status) !== -1 || post2.status === "future" && !(0, import_date.isInTheFuture)( 7019 new Date(Number((0, import_date.getDate)(post2.date)) - ONE_MINUTE_IN_MS) 7020 ); 7021 } 7022 function isCurrentPostScheduled(state2) { 7023 return getCurrentPost(state2).status === "future" && !isCurrentPostPublished(state2); 7024 } 7025 function isEditedPostPublishable(state2) { 7026 const post2 = getCurrentPost(state2); 7027 if (post2.type === ATTACHMENT_POST_TYPE) { 7028 return isEditedPostDirty(state2); 7029 } 7030 return isEditedPostDirty(state2) || ["publish", "private", "future"].indexOf(post2.status) === -1; 7031 } 7032 function isEditedPostSaveable(state2) { 7033 if (isSavingPost(state2)) { 7034 return false; 7035 } 7036 return !!getEditedPostAttribute(state2, "title") || !!getEditedPostAttribute(state2, "excerpt") || !isEditedPostEmpty(state2); 7037 } 7038 var isEditedPostEmpty = (0, import_data4.createRegistrySelector)( 7039 (select9) => (state2) => { 7040 const postId2 = getCurrentPostId(state2); 7041 const postType2 = getCurrentPostType(state2); 7042 const record = select9(import_core_data.store).getEditedEntityRecord( 7043 "postType", 7044 postType2, 7045 postId2 7046 ); 7047 if (typeof record.content !== "function") { 7048 return !record.content; 7049 } 7050 const blocks = getEditedPostAttribute(state2, "blocks"); 7051 if (blocks.length === 0) { 7052 return true; 7053 } 7054 if (blocks.length > 1) { 7055 return false; 7056 } 7057 const blockName = blocks[0].name; 7058 if (blockName !== (0, import_blocks3.getDefaultBlockName)() && blockName !== (0, import_blocks3.getFreeformContentHandlerName)()) { 7059 return false; 7060 } 7061 return !getEditedPostContent(state2); 7062 } 7063 ); 7064 var isEditedPostAutosaveable = (0, import_data4.createRegistrySelector)( 7065 (select9) => (state2) => { 7066 if (!isEditedPostSaveable(state2)) { 7067 return false; 7068 } 7069 if (isPostAutosavingLocked(state2)) { 7070 return false; 7071 } 7072 const postType2 = getCurrentPostType(state2); 7073 const postTypeObject = select9(import_core_data.store).getPostType(postType2); 7074 if (!postTypeObject?.supports?.autosave) { 7075 return false; 7076 } 7077 const postId2 = getCurrentPostId(state2); 7078 const hasFetchedAutosave = select9(import_core_data.store).hasFetchedAutosaves( 7079 postType2, 7080 postId2 7081 ); 7082 const currentUserId = select9(import_core_data.store).getCurrentUser()?.id; 7083 const autosave2 = select9(import_core_data.store).getAutosave( 7084 postType2, 7085 postId2, 7086 currentUserId 7087 ); 7088 if (!hasFetchedAutosave) { 7089 return false; 7090 } 7091 if (!autosave2) { 7092 return true; 7093 } 7094 if (hasChangedContent(state2)) { 7095 return true; 7096 } 7097 return ["title", "excerpt", "meta"].some( 7098 (field) => getPostRawValue(autosave2[field]) !== getEditedPostAttribute(state2, field) 7099 ); 7100 } 7101 ); 7102 function isEditedPostBeingScheduled(state2) { 7103 const date = getEditedPostAttribute(state2, "date"); 7104 const checkedDate = new Date( 7105 Number((0, import_date.getDate)(date)) - ONE_MINUTE_IN_MS 7106 ); 7107 return (0, import_date.isInTheFuture)(checkedDate); 7108 } 7109 function isEditedPostDateFloating(state2) { 7110 const date = getEditedPostAttribute(state2, "date"); 7111 const modified = getEditedPostAttribute(state2, "modified"); 7112 const status = getCurrentPost(state2).status; 7113 if (status === "draft" || status === "auto-draft" || status === "pending") { 7114 return date === modified || date === null; 7115 } 7116 return false; 7117 } 7118 function isDeletingPost(state2) { 7119 return !!state2.deleting.pending; 7120 } 7121 function isSavingPost(state2) { 7122 return !!state2.saving.pending; 7123 } 7124 var isSavingNonPostEntityChanges = (0, import_data4.createRegistrySelector)( 7125 (select9) => (state2) => { 7126 const entitiesBeingSaved = select9(import_core_data.store).__experimentalGetEntitiesBeingSaved(); 7127 const { type, id } = getCurrentPost(state2); 7128 return entitiesBeingSaved.some( 7129 (entityRecord) => entityRecord.kind !== "postType" || entityRecord.name !== type || entityRecord.key !== id 7130 ); 7131 } 7132 ); 7133 var didPostSaveRequestSucceed = (0, import_data4.createRegistrySelector)( 7134 (select9) => (state2) => { 7135 const postType2 = getCurrentPostType(state2); 7136 const postId2 = getCurrentPostId(state2); 7137 return !select9(import_core_data.store).getLastEntitySaveError( 7138 "postType", 7139 postType2, 7140 postId2 7141 ); 7142 } 7143 ); 7144 var didPostSaveRequestFail = (0, import_data4.createRegistrySelector)( 7145 (select9) => (state2) => { 7146 const postType2 = getCurrentPostType(state2); 7147 const postId2 = getCurrentPostId(state2); 7148 return !!select9(import_core_data.store).getLastEntitySaveError( 7149 "postType", 7150 postType2, 7151 postId2 7152 ); 7153 } 7154 ); 7155 function isAutosavingPost(state2) { 7156 return isSavingPost(state2) && Boolean(state2.saving.options?.isAutosave); 7157 } 7158 function isPreviewingPost(state2) { 7159 return isSavingPost(state2) && Boolean(state2.saving.options?.isPreview); 7160 } 7161 function getEditedPostPreviewLink(state2) { 7162 if (state2.saving.pending || isSavingPost(state2)) { 7163 return; 7164 } 7165 let previewLink = getAutosaveAttribute(state2, "preview_link"); 7166 if (!previewLink || "draft" === getCurrentPost(state2).status) { 7167 previewLink = getEditedPostAttribute(state2, "link"); 7168 if (previewLink) { 7169 previewLink = (0, import_url.addQueryArgs)(previewLink, { preview: true }); 7170 } 7171 } 7172 const featuredImageId = getEditedPostAttribute(state2, "featured_media"); 7173 if (previewLink && featuredImageId) { 7174 return (0, import_url.addQueryArgs)(previewLink, { _thumbnail_id: featuredImageId }); 7175 } 7176 return previewLink; 7177 } 7178 var getSuggestedPostFormat = (0, import_data4.createRegistrySelector)( 7179 (select9) => () => { 7180 const blocks = select9(import_block_editor2.store).getBlocks(); 7181 if (blocks.length > 2) { 7182 return null; 7183 } 7184 let name2; 7185 if (blocks.length === 1) { 7186 name2 = blocks[0].name; 7187 if (name2 === "core/embed") { 7188 const provider = blocks[0].attributes?.providerNameSlug; 7189 if (["youtube", "vimeo"].includes(provider)) { 7190 name2 = "core/video"; 7191 } else if (["spotify", "soundcloud"].includes(provider)) { 7192 name2 = "core/audio"; 7193 } 7194 } 7195 } 7196 if (blocks.length === 2 && blocks[1].name === "core/paragraph") { 7197 name2 = blocks[0].name; 7198 } 7199 switch (name2) { 7200 case "core/image": 7201 return "image"; 7202 case "core/quote": 7203 case "core/pullquote": 7204 return "quote"; 7205 case "core/gallery": 7206 return "gallery"; 7207 case "core/video": 7208 return "video"; 7209 case "core/audio": 7210 return "audio"; 7211 default: 7212 return null; 7213 } 7214 } 7215 ); 7216 var getEditedPostContent = (0, import_data4.createRegistrySelector)( 7217 (select9) => (state2) => { 7218 const postId2 = getCurrentPostId(state2); 7219 const postType2 = getCurrentPostType(state2); 7220 const record = select9(import_core_data.store).getEditedEntityRecord( 7221 "postType", 7222 postType2, 7223 postId2 7224 ); 7225 if (record) { 7226 if (typeof record.content === "function") { 7227 return record.content(record); 7228 } else if (record.blocks) { 7229 return (0, import_blocks3.__unstableSerializeAndClean)(record.blocks); 7230 } else if (record.content) { 7231 return record.content; 7232 } 7233 } 7234 return ""; 7235 } 7236 ); 7237 function isPublishingPost(state2) { 7238 return isSavingPost(state2) && !isCurrentPostPublished(state2) && getEditedPostAttribute(state2, "status") === "publish"; 7239 } 7240 function isPermalinkEditable(state2) { 7241 const permalinkTemplate = getEditedPostAttribute( 7242 state2, 7243 "permalink_template" 7244 ); 7245 return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate); 7246 } 7247 function getPermalink(state2) { 7248 const permalinkParts = getPermalinkParts(state2); 7249 if (!permalinkParts) { 7250 return null; 7251 } 7252 const { prefix: prefix2, postName, suffix } = permalinkParts; 7253 if (isPermalinkEditable(state2)) { 7254 return prefix2 + postName + suffix; 7255 } 7256 return prefix2; 7257 } 7258 function getEditedPostSlug(state2) { 7259 return getEditedPostAttribute(state2, "slug") || (0, import_url.cleanForSlug)(getEditedPostAttribute(state2, "title")) || getCurrentPostId(state2); 7260 } 7261 function getPermalinkParts(state2) { 7262 const permalinkTemplate = getEditedPostAttribute( 7263 state2, 7264 "permalink_template" 7265 ); 7266 if (!permalinkTemplate) { 7267 return null; 7268 } 7269 const postName = getEditedPostAttribute(state2, "slug") || getEditedPostAttribute(state2, "generated_slug"); 7270 const [prefix2, suffix] = permalinkTemplate.split( 7271 PERMALINK_POSTNAME_REGEX 7272 ); 7273 return { 7274 prefix: prefix2, 7275 postName, 7276 suffix 7277 }; 7278 } 7279 function isPostLocked(state2) { 7280 return state2.postLock.isLocked; 7281 } 7282 function isPostSavingLocked(state2) { 7283 return Object.keys(state2.postSavingLock).length > 0; 7284 } 7285 function isPostAutosavingLocked(state2) { 7286 return Object.keys(state2.postAutosavingLock).length > 0; 7287 } 7288 function isPostLockTakeover(state2) { 7289 return state2.postLock.isTakeover; 7290 } 7291 function getPostLockUser(state2) { 7292 return state2.postLock.user; 7293 } 7294 function getActivePostLock(state2) { 7295 return state2.postLock.activePostLock; 7296 } 7297 function canUserUseUnfilteredHTML(state2) { 7298 return Boolean( 7299 getCurrentPost(state2)._links?.hasOwnProperty( 7300 "wp:action-unfiltered-html" 7301 ) 7302 ); 7303 } 7304 var isPublishSidebarEnabled = (0, import_data4.createRegistrySelector)( 7305 (select9) => () => !!select9(import_preferences.store).get("core", "isPublishSidebarEnabled") 7306 ); 7307 var getEditorBlocks = (0, import_data4.createSelector)( 7308 (state2) => { 7309 return getEditedPostAttribute(state2, "blocks") || (0, import_blocks3.parse)(getEditedPostContent(state2)); 7310 }, 7311 (state2) => [ 7312 getEditedPostAttribute(state2, "blocks"), 7313 getEditedPostContent(state2) 7314 ] 7315 ); 7316 function isEditorPanelRemoved(state2, panelName) { 7317 return state2.removedPanels.includes(panelName); 7318 } 7319 var isEditorPanelEnabled = (0, import_data4.createRegistrySelector)( 7320 (select9) => (state2, panelName) => { 7321 const inactivePanels = select9(import_preferences.store).get( 7322 "core", 7323 "inactivePanels" 7324 ); 7325 return !isEditorPanelRemoved(state2, panelName) && !inactivePanels?.includes(panelName); 7326 } 7327 ); 7328 var isEditorPanelOpened = (0, import_data4.createRegistrySelector)( 7329 (select9) => (state2, panelName) => { 7330 const openPanels = select9(import_preferences.store).get( 7331 "core", 7332 "openPanels" 7333 ); 7334 return !!openPanels?.includes(panelName); 7335 } 7336 ); 7337 function getEditorSelectionStart(state2) { 7338 (0, import_deprecated.default)("select('core/editor').getEditorSelectionStart", { 7339 since: "5.8", 7340 alternative: "select('core/editor').getEditorSelection" 7341 }); 7342 return getEditedPostAttribute(state2, "selection")?.selectionStart; 7343 } 7344 function getEditorSelectionEnd(state2) { 7345 (0, import_deprecated.default)("select('core/editor').getEditorSelectionStart", { 7346 since: "5.8", 7347 alternative: "select('core/editor').getEditorSelection" 7348 }); 7349 return getEditedPostAttribute(state2, "selection")?.selectionEnd; 7350 } 7351 function getEditorSelection(state2) { 7352 return getEditedPostAttribute(state2, "selection"); 7353 } 7354 function __unstableIsEditorReady(state2) { 7355 return !!state2.postId; 7356 } 7357 function getEditorSettings(state2) { 7358 return state2.editorSettings; 7359 } 7360 function getRenderingMode(state2) { 7361 return state2.renderingMode; 7362 } 7363 var getDeviceType = (0, import_data4.createRegistrySelector)( 7364 (select9) => (state2) => { 7365 const blockEditorSelect = unlock(select9(import_block_editor2.store)); 7366 const isZoomOut = blockEditorSelect.isZoomOut(); 7367 if (isZoomOut) { 7368 return "Desktop"; 7369 } 7370 const canvasWidth2 = state2.canvasWidth; 7371 const viewportSettings = blockEditorSelect.getSettings().__experimentalFeatures?.viewport; 7372 return getDeviceTypeByCanvasWidth(canvasWidth2, viewportSettings); 7373 } 7374 ); 7375 function isListViewOpened(state2) { 7376 return state2.listViewPanel; 7377 } 7378 function isInserterOpened(state2) { 7379 return !!state2.blockInserterPanel; 7380 } 7381 var getEditorMode = (0, import_data4.createRegistrySelector)( 7382 (select9) => () => select9(import_preferences.store).get("core", "editorMode") ?? "visual" 7383 ); 7384 function getStateBeforeOptimisticTransaction() { 7385 (0, import_deprecated.default)("select('core/editor').getStateBeforeOptimisticTransaction", { 7386 since: "5.7", 7387 hint: "No state history is kept on this store anymore" 7388 }); 7389 return null; 7390 } 7391 function inSomeHistory() { 7392 (0, import_deprecated.default)("select('core/editor').inSomeHistory", { 7393 since: "5.7", 7394 hint: "No state history is kept on this store anymore" 7395 }); 7396 return false; 7397 } 7398 function getBlockEditorSelector(name2) { 7399 return (0, import_data4.createRegistrySelector)((select9) => (state2, ...args) => { 7400 (0, import_deprecated.default)("`wp.data.select( 'core/editor' )." + name2 + "`", { 7401 since: "5.3", 7402 alternative: "`wp.data.select( 'core/block-editor' )." + name2 + "`", 7403 version: "6.2" 7404 }); 7405 return select9(import_block_editor2.store)[name2](...args); 7406 }); 7407 } 7408 var getBlockName = getBlockEditorSelector("getBlockName"); 7409 var isBlockValid = getBlockEditorSelector("isBlockValid"); 7410 var getBlockAttributes = getBlockEditorSelector("getBlockAttributes"); 7411 var getBlock = getBlockEditorSelector("getBlock"); 7412 var getBlocks = getBlockEditorSelector("getBlocks"); 7413 var getClientIdsOfDescendants = getBlockEditorSelector( 7414 "getClientIdsOfDescendants" 7415 ); 7416 var getClientIdsWithDescendants = getBlockEditorSelector( 7417 "getClientIdsWithDescendants" 7418 ); 7419 var getGlobalBlockCount = getBlockEditorSelector( 7420 "getGlobalBlockCount" 7421 ); 7422 var getBlocksByClientId = getBlockEditorSelector( 7423 "getBlocksByClientId" 7424 ); 7425 var getBlockCount = getBlockEditorSelector("getBlockCount"); 7426 var getBlockSelectionStart = getBlockEditorSelector( 7427 "getBlockSelectionStart" 7428 ); 7429 var getBlockSelectionEnd = getBlockEditorSelector( 7430 "getBlockSelectionEnd" 7431 ); 7432 var getSelectedBlockCount = getBlockEditorSelector( 7433 "getSelectedBlockCount" 7434 ); 7435 var hasSelectedBlock = getBlockEditorSelector("hasSelectedBlock"); 7436 var getSelectedBlockClientId = getBlockEditorSelector( 7437 "getSelectedBlockClientId" 7438 ); 7439 var getSelectedBlock = getBlockEditorSelector("getSelectedBlock"); 7440 var getBlockRootClientId = getBlockEditorSelector( 7441 "getBlockRootClientId" 7442 ); 7443 var getBlockHierarchyRootClientId = getBlockEditorSelector( 7444 "getBlockHierarchyRootClientId" 7445 ); 7446 var getAdjacentBlockClientId = getBlockEditorSelector( 7447 "getAdjacentBlockClientId" 7448 ); 7449 var getPreviousBlockClientId = getBlockEditorSelector( 7450 "getPreviousBlockClientId" 7451 ); 7452 var getNextBlockClientId = getBlockEditorSelector( 7453 "getNextBlockClientId" 7454 ); 7455 var getSelectedBlocksInitialCaretPosition = getBlockEditorSelector( 7456 "getSelectedBlocksInitialCaretPosition" 7457 ); 7458 var getMultiSelectedBlockClientIds = getBlockEditorSelector( 7459 "getMultiSelectedBlockClientIds" 7460 ); 7461 var getMultiSelectedBlocks = getBlockEditorSelector( 7462 "getMultiSelectedBlocks" 7463 ); 7464 var getFirstMultiSelectedBlockClientId = getBlockEditorSelector( 7465 "getFirstMultiSelectedBlockClientId" 7466 ); 7467 var getLastMultiSelectedBlockClientId = getBlockEditorSelector( 7468 "getLastMultiSelectedBlockClientId" 7469 ); 7470 var isFirstMultiSelectedBlock = getBlockEditorSelector( 7471 "isFirstMultiSelectedBlock" 7472 ); 7473 var isBlockMultiSelected = getBlockEditorSelector( 7474 "isBlockMultiSelected" 7475 ); 7476 var isAncestorMultiSelected = getBlockEditorSelector( 7477 "isAncestorMultiSelected" 7478 ); 7479 var getMultiSelectedBlocksStartClientId = getBlockEditorSelector( 7480 "getMultiSelectedBlocksStartClientId" 7481 ); 7482 var getMultiSelectedBlocksEndClientId = getBlockEditorSelector( 7483 "getMultiSelectedBlocksEndClientId" 7484 ); 7485 var getBlockOrder = getBlockEditorSelector("getBlockOrder"); 7486 var getBlockIndex = getBlockEditorSelector("getBlockIndex"); 7487 var isBlockSelected = getBlockEditorSelector("isBlockSelected"); 7488 var hasSelectedInnerBlock = getBlockEditorSelector( 7489 "hasSelectedInnerBlock" 7490 ); 7491 var isBlockWithinSelection = getBlockEditorSelector( 7492 "isBlockWithinSelection" 7493 ); 7494 var hasMultiSelection = getBlockEditorSelector("hasMultiSelection"); 7495 var isMultiSelecting = getBlockEditorSelector("isMultiSelecting"); 7496 var isSelectionEnabled = getBlockEditorSelector("isSelectionEnabled"); 7497 var getBlockMode = getBlockEditorSelector("getBlockMode"); 7498 var isTyping = getBlockEditorSelector("isTyping"); 7499 var isCaretWithinFormattedText = getBlockEditorSelector( 7500 "isCaretWithinFormattedText" 7501 ); 7502 var getBlockInsertionPoint = getBlockEditorSelector( 7503 "getBlockInsertionPoint" 7504 ); 7505 var isBlockInsertionPointVisible = getBlockEditorSelector( 7506 "isBlockInsertionPointVisible" 7507 ); 7508 var isValidTemplate = getBlockEditorSelector("isValidTemplate"); 7509 var getTemplate = getBlockEditorSelector("getTemplate"); 7510 var getTemplateLock = getBlockEditorSelector("getTemplateLock"); 7511 var canInsertBlockType = getBlockEditorSelector("canInsertBlockType"); 7512 var getInserterItems = getBlockEditorSelector("getInserterItems"); 7513 var hasInserterItems = getBlockEditorSelector("hasInserterItems"); 7514 var getBlockListSettings = getBlockEditorSelector( 7515 "getBlockListSettings" 7516 ); 7517 var __experimentalGetDefaultTemplateTypes = (0, import_data4.createRegistrySelector)( 7518 (select9) => () => { 7519 (0, import_deprecated.default)( 7520 "select('core/editor').__experimentalGetDefaultTemplateTypes", 7521 { 7522 since: "6.8", 7523 alternative: "select('core/core-data').getCurrentTheme()?.default_template_types" 7524 } 7525 ); 7526 return select9(import_core_data.store).getCurrentTheme()?.default_template_types; 7527 } 7528 ); 7529 var __experimentalGetDefaultTemplatePartAreas = (0, import_data4.createRegistrySelector)( 7530 (select9) => (0, import_data4.createSelector)(() => { 7531 (0, import_deprecated.default)( 7532 "select('core/editor').__experimentalGetDefaultTemplatePartAreas", 7533 { 7534 since: "6.8", 7535 alternative: "select('core/core-data').getCurrentTheme()?.default_template_part_areas" 7536 } 7537 ); 7538 const areas = select9(import_core_data.store).getCurrentTheme()?.default_template_part_areas || []; 7539 return areas.map((item) => { 7540 return { ...item, icon: getTemplatePartIcon(item.icon) }; 7541 }); 7542 }) 7543 ); 7544 var __experimentalGetDefaultTemplateType = (0, import_data4.createRegistrySelector)( 7545 (select9) => (0, import_data4.createSelector)((state2, slug) => { 7546 (0, import_deprecated.default)( 7547 "select('core/editor').__experimentalGetDefaultTemplateType", 7548 { 7549 since: "6.8" 7550 } 7551 ); 7552 const templateTypes = select9(import_core_data.store).getCurrentTheme()?.default_template_types; 7553 if (!templateTypes) { 7554 return EMPTY_OBJECT2; 7555 } 7556 return Object.values(templateTypes).find( 7557 (type) => type.slug === slug 7558 ) ?? EMPTY_OBJECT2; 7559 }) 7560 ); 7561 var __experimentalGetTemplateInfo = (0, import_data4.createRegistrySelector)( 7562 (select9) => (0, import_data4.createSelector)((state2, template2) => { 7563 (0, import_deprecated.default)("select('core/editor').__experimentalGetTemplateInfo", { 7564 since: "6.8" 7565 }); 7566 if (!template2) { 7567 return EMPTY_OBJECT2; 7568 } 7569 const currentTheme = select9(import_core_data.store).getCurrentTheme(); 7570 const templateTypes = currentTheme?.default_template_types || []; 7571 const templateAreas = currentTheme?.default_template_part_areas || []; 7572 return getTemplateInfo({ 7573 template: template2, 7574 templateAreas, 7575 templateTypes 7576 }); 7577 }) 7578 ); 7579 var getPostTypeLabel = (0, import_data4.createRegistrySelector)( 7580 (select9) => (state2) => { 7581 const currentPostType = getCurrentPostType(state2); 7582 const postType2 = select9(import_core_data.store).getPostType(currentPostType); 7583 return postType2?.labels?.singular_name; 7584 } 7585 ); 7586 function isPublishSidebarOpened(state2) { 7587 return state2.publishSidebarActive; 7588 } 7589 7590 // packages/editor/build-module/store/actions.mjs 7591 var actions_exports3 = {}; 7592 __export(actions_exports3, { 7593 __experimentalTearDownEditor: () => __experimentalTearDownEditor, 7594 __unstableSaveForPreview: () => __unstableSaveForPreview, 7595 autosave: () => autosave, 7596 clearSelectedBlock: () => clearSelectedBlock, 7597 closePublishSidebar: () => closePublishSidebar, 7598 createUndoLevel: () => createUndoLevel, 7599 disablePublishSidebar: () => disablePublishSidebar, 7600 editPost: () => editPost, 7601 enablePublishSidebar: () => enablePublishSidebar, 7602 enterFormattedText: () => enterFormattedText, 7603 exitFormattedText: () => exitFormattedText, 7604 hideInsertionPoint: () => hideInsertionPoint, 7605 insertBlock: () => insertBlock, 7606 insertBlocks: () => insertBlocks, 7607 insertDefaultBlock: () => insertDefaultBlock, 7608 lockPostAutosaving: () => lockPostAutosaving, 7609 lockPostSaving: () => lockPostSaving, 7610 mergeBlocks: () => mergeBlocks, 7611 moveBlockToPosition: () => moveBlockToPosition, 7612 moveBlocksDown: () => moveBlocksDown, 7613 moveBlocksUp: () => moveBlocksUp, 7614 multiSelect: () => multiSelect, 7615 openPublishSidebar: () => openPublishSidebar, 7616 receiveBlocks: () => receiveBlocks, 7617 redo: () => redo, 7618 refreshPost: () => refreshPost, 7619 removeBlock: () => removeBlock, 7620 removeBlocks: () => removeBlocks, 7621 removeEditorPanel: () => removeEditorPanel, 7622 replaceBlock: () => replaceBlock, 7623 replaceBlocks: () => replaceBlocks, 7624 resetBlocks: () => resetBlocks, 7625 resetEditorBlocks: () => resetEditorBlocks, 7626 resetPost: () => resetPost, 7627 savePost: () => savePost, 7628 selectBlock: () => selectBlock, 7629 setDeviceType: () => setDeviceType, 7630 setEditedPost: () => setEditedPost, 7631 setIsInserterOpened: () => setIsInserterOpened, 7632 setIsListViewOpened: () => setIsListViewOpened, 7633 setRenderingMode: () => setRenderingMode, 7634 setTemplateValidity: () => setTemplateValidity, 7635 setupEditor: () => setupEditor, 7636 setupEditorState: () => setupEditorState, 7637 showInsertionPoint: () => showInsertionPoint, 7638 startMultiSelect: () => startMultiSelect, 7639 startTyping: () => startTyping, 7640 stopMultiSelect: () => stopMultiSelect, 7641 stopTyping: () => stopTyping, 7642 switchEditorMode: () => switchEditorMode, 7643 synchronizeTemplate: () => synchronizeTemplate, 7644 toggleBlockMode: () => toggleBlockMode, 7645 toggleDistractionFree: () => toggleDistractionFree, 7646 toggleEditorPanelEnabled: () => toggleEditorPanelEnabled, 7647 toggleEditorPanelOpened: () => toggleEditorPanelOpened, 7648 togglePublishSidebar: () => togglePublishSidebar, 7649 toggleSelection: () => toggleSelection, 7650 toggleSpotlightMode: () => toggleSpotlightMode, 7651 toggleTopToolbar: () => toggleTopToolbar, 7652 trashPost: () => trashPost2, 7653 undo: () => undo, 7654 unlockPostAutosaving: () => unlockPostAutosaving, 7655 unlockPostSaving: () => unlockPostSaving, 7656 updateBlock: () => updateBlock, 7657 updateBlockAttributes: () => updateBlockAttributes, 7658 updateBlockListSettings: () => updateBlockListSettings, 7659 updateEditorSettings: () => updateEditorSettings, 7660 updatePost: () => updatePost, 7661 updatePostLock: () => updatePostLock 7662 }); 7663 var import_a11y7 = __toESM(require_a11y(), 1); 7664 var import_api_fetch8 = __toESM(require_api_fetch(), 1); 7665 var import_deprecated9 = __toESM(require_deprecated(), 1); 7666 var import_blocks20 = __toESM(require_blocks(), 1); 7667 var import_notices20 = __toESM(require_notices(), 1); 7668 var import_core_data57 = __toESM(require_core_data(), 1); 7669 var import_block_editor36 = __toESM(require_block_editor(), 1); 7670 var import_hooks39 = __toESM(require_hooks(), 1); 7671 var import_preferences10 = __toESM(require_preferences(), 1); 7672 var import_i18n205 = __toESM(require_i18n(), 1); 7673 7674 // packages/editor/build-module/store/local-autosave.mjs 7675 function postKey(postId2, isPostNew) { 7676 return `wp-autosave-block-editor-post-$isPostNew ? "auto-draft" : postId2}`; 7677 } 7678 function localAutosaveGet(postId2, isPostNew) { 7679 return window.sessionStorage.getItem(postKey(postId2, isPostNew)); 7680 } 7681 function localAutosaveSet(postId2, isPostNew, title, content, excerpt) { 7682 window.sessionStorage.setItem( 7683 postKey(postId2, isPostNew), 7684 JSON.stringify({ 7685 post_title: title, 7686 content, 7687 excerpt 7688 }) 7689 ); 7690 } 7691 function localAutosaveClear(postId2, isPostNew) { 7692 window.sessionStorage.removeItem(postKey(postId2, isPostNew)); 7693 } 7694 7695 // packages/editor/build-module/store/utils/notice-builder.mjs 7696 var import_i18n2 = __toESM(require_i18n(), 1); 7697 function getNotificationArgumentsForSaveSuccess(data) { 7698 const { previousPost, post: post2, postType: postType2 } = data; 7699 if (data.options?.isAutosave) { 7700 return []; 7701 } 7702 const publishStatus = ["publish", "private", "future"]; 7703 const isPublished = publishStatus.includes(previousPost.status); 7704 const willPublish = publishStatus.includes(post2.status); 7705 const willTrash = post2.status === "trash" && previousPost.status !== "trash"; 7706 let noticeMessage; 7707 let shouldShowLink = postType2?.viewable ?? false; 7708 let isDraft; 7709 if (willTrash) { 7710 noticeMessage = postType2.labels.item_trashed; 7711 shouldShowLink = false; 7712 } else if (post2.type === ATTACHMENT_POST_TYPE) { 7713 noticeMessage = (0, import_i18n2.__)("Media updated."); 7714 shouldShowLink = false; 7715 } else if (!isPublished && !willPublish) { 7716 noticeMessage = (0, import_i18n2.__)("Draft saved."); 7717 isDraft = true; 7718 } else if (isPublished && !willPublish) { 7719 noticeMessage = postType2.labels.item_reverted_to_draft; 7720 shouldShowLink = false; 7721 } else if (!isPublished && willPublish) { 7722 noticeMessage = { 7723 publish: postType2.labels.item_published, 7724 private: postType2.labels.item_published_privately, 7725 future: postType2.labels.item_scheduled 7726 }[post2.status]; 7727 } else { 7728 noticeMessage = postType2.labels.item_updated; 7729 } 7730 const actions2 = []; 7731 if (shouldShowLink) { 7732 actions2.push({ 7733 label: isDraft ? (0, import_i18n2.__)("View Preview") : postType2.labels.view_item, 7734 url: post2.link, 7735 openInNewTab: true 7736 }); 7737 } 7738 return [ 7739 noticeMessage, 7740 { 7741 id: "editor-save", 7742 type: "snackbar", 7743 actions: actions2 7744 } 7745 ]; 7746 } 7747 function getNotificationArgumentsForSaveFail(data) { 7748 const { post: post2, edits, error: error2 } = data; 7749 if (error2 && "rest_autosave_no_changes" === error2.code) { 7750 return []; 7751 } 7752 const publishStatus = ["publish", "private", "future"]; 7753 const isPublished = publishStatus.indexOf(post2.status) !== -1; 7754 if (error2.code === "offline_error") { 7755 const messages2 = { 7756 publish: (0, import_i18n2.__)( 7757 "Publishing failed because you were offline. Please verify your connection and try again." 7758 ), 7759 private: (0, import_i18n2.__)( 7760 "Publishing failed because you were offline. Please verify your connection and try again." 7761 ), 7762 future: (0, import_i18n2.__)( 7763 "Scheduling failed because you were offline. Please verify your connection and try again." 7764 ), 7765 default: (0, import_i18n2.__)( 7766 "Updating failed because you were offline. Please verify your connection and try again." 7767 ) 7768 }; 7769 const noticeMessage2 = !isPublished && edits.status in messages2 ? messages2[edits.status] : messages2.default; 7770 return [noticeMessage2, { id: "editor-save" }]; 7771 } 7772 const messages = { 7773 publish: (0, import_i18n2.__)("Publishing failed."), 7774 private: (0, import_i18n2.__)("Publishing failed."), 7775 future: (0, import_i18n2.__)("Scheduling failed."), 7776 default: (0, import_i18n2.__)("Updating failed.") 7777 }; 7778 let noticeMessage = !isPublished && edits.status in messages ? messages[edits.status] : messages.default; 7779 if (error2.message && !/<\/?[^>]*>/.test(error2.message)) { 7780 noticeMessage = [noticeMessage, error2.message].join(" "); 7781 } 7782 return [ 7783 noticeMessage, 7784 { 7785 id: "editor-save" 7786 } 7787 ]; 7788 } 7789 function getNotificationArgumentsForTrashFail(data) { 7790 return [ 7791 data.error.message && data.error.code !== "unknown_error" ? data.error.message : (0, import_i18n2.__)("Trashing failed"), 7792 { 7793 id: "editor-trash-fail" 7794 } 7795 ]; 7796 } 7797 7798 // packages/editor/build-module/store/private-actions.mjs 7799 var private_actions_exports = {}; 7800 __export(private_actions_exports, { 7801 createTemplate: () => createTemplate, 7802 hideBlockTypes: () => hideBlockTypes, 7803 openRevision: () => openRevision, 7804 registerEntityAction: () => registerEntityAction, 7805 registerEntityField: () => registerEntityField, 7806 registerPostTypeSchema: () => registerPostTypeSchema, 7807 removeTemplates: () => removeTemplates, 7808 resetStylesNavigation: () => resetStylesNavigation, 7809 restoreRevision: () => restoreRevision, 7810 revertTemplate: () => revertTemplate2, 7811 saveDirtyEntities: () => saveDirtyEntities, 7812 selectNote: () => selectNote, 7813 setCanvasWidth: () => setCanvasWidth, 7814 setCurrentRevisionId: () => setCurrentRevisionId, 7815 setCurrentTemplateId: () => setCurrentTemplateId, 7816 setDefaultRenderingMode: () => setDefaultRenderingMode, 7817 setIsReady: () => setIsReady, 7818 setRevisionPage: () => setRevisionPage, 7819 setShowRevisionDiff: () => setShowRevisionDiff, 7820 setShowStylebook: () => setShowStylebook, 7821 setStylesPath: () => setStylesPath, 7822 showBlockTypes: () => showBlockTypes, 7823 unregisterEntityAction: () => unregisterEntityAction, 7824 unregisterEntityField: () => unregisterEntityField 7825 }); 7826 var import_core_data56 = __toESM(require_core_data(), 1); 7827 var import_i18n204 = __toESM(require_i18n(), 1); 7828 var import_notices19 = __toESM(require_notices(), 1); 7829 var import_block_editor35 = __toESM(require_block_editor(), 1); 7830 var import_preferences9 = __toESM(require_preferences(), 1); 7831 var import_url14 = __toESM(require_url(), 1); 7832 var import_api_fetch7 = __toESM(require_api_fetch(), 1); 7833 var import_blocks19 = __toESM(require_blocks(), 1); 7834 var import_html_entities12 = __toESM(require_html_entities(), 1); 7835 var import_date16 = __toESM(require_date(), 1); 7836 7837 // packages/editor/build-module/store/utils/is-template-revertable.mjs 7838 function isTemplateRevertable(templateOrTemplatePart) { 7839 if (!templateOrTemplatePart) { 7840 return false; 7841 } 7842 return templateOrTemplatePart.source === TEMPLATE_ORIGINS.custom && (Boolean(templateOrTemplatePart?.plugin) || templateOrTemplatePart?.has_theme_file); 7843 } 7844 7845 // packages/editor/build-module/store/private-selectors.mjs 7846 var private_selectors_exports = {}; 7847 __export(private_selectors_exports, { 7848 buildRevisionsPageQuery: () => buildRevisionsPageQuery, 7849 getCanvasHeight: () => getCanvasHeight, 7850 getCanvasWidth: () => getCanvasWidth, 7851 getCurrentRevision: () => getCurrentRevision, 7852 getCurrentRevisionId: () => getCurrentRevisionId, 7853 getDefaultRenderingMode: () => getDefaultRenderingMode, 7854 getEntityActions: () => getEntityActions2, 7855 getEntityFields: () => getEntityFields2, 7856 getInserter: () => getInserter, 7857 getInserterSidebarToggleRef: () => getInserterSidebarToggleRef, 7858 getListViewToggleRef: () => getListViewToggleRef, 7859 getPageRevisions: () => getPageRevisions, 7860 getPostBlocksByName: () => getPostBlocksByName, 7861 getPostIcon: () => getPostIcon, 7862 getPreviousRevision: () => getPreviousRevision, 7863 getRevisionPage: () => getRevisionPage, 7864 getRevisionsPerPage: () => getRevisionsPerPage, 7865 getSelectedNote: () => getSelectedNote, 7866 getShowStylebook: () => getShowStylebook, 7867 getStylesPath: () => getStylesPath, 7868 hasPostMetaChanges: () => hasPostMetaChanges, 7869 isCollaborationEnabledForCurrentPost: () => isCollaborationEnabledForCurrentPost, 7870 isEntityReady: () => isEntityReady2, 7871 isNoteFocused: () => isNoteFocused, 7872 isRevisionsMode: () => isRevisionsMode, 7873 isShowingRevisionDiff: () => isShowingRevisionDiff 7874 }); 7875 var import_fast_deep_equal = __toESM(require_fast_deep_equal(), 1); 7876 var import_block_editor3 = __toESM(require_block_editor(), 1); 7877 var import_data6 = __toESM(require_data(), 1); 7878 var import_core_data3 = __toESM(require_core_data(), 1); 7879 var import_preferences2 = __toESM(require_preferences(), 1); 7880 7881 // packages/editor/build-module/dataviews/store/private-selectors.mjs 7882 var EMPTY_ARRAY2 = []; 7883 function getEntityActions(state2, kind, name2) { 7884 return state2.actions[kind]?.[name2] ?? EMPTY_ARRAY2; 7885 } 7886 function getEntityFields(state2, kind, name2) { 7887 return state2.fields[kind]?.[name2] ?? EMPTY_ARRAY2; 7888 } 7889 function isEntityReady(state2, kind, name2) { 7890 return state2.isReady[kind]?.[name2]; 7891 } 7892 7893 // node_modules/uuid/dist/stringify.js 7894 var byteToHex = []; 7895 for (let i3 = 0; i3 < 256; ++i3) { 7896 byteToHex.push((i3 + 256).toString(16).slice(1)); 7897 } 7898 function unsafeStringify(arr, offset4 = 0) { 7899 return (byteToHex[arr[offset4 + 0]] + byteToHex[arr[offset4 + 1]] + byteToHex[arr[offset4 + 2]] + byteToHex[arr[offset4 + 3]] + "-" + byteToHex[arr[offset4 + 4]] + byteToHex[arr[offset4 + 5]] + "-" + byteToHex[arr[offset4 + 6]] + byteToHex[arr[offset4 + 7]] + "-" + byteToHex[arr[offset4 + 8]] + byteToHex[arr[offset4 + 9]] + "-" + byteToHex[arr[offset4 + 10]] + byteToHex[arr[offset4 + 11]] + byteToHex[arr[offset4 + 12]] + byteToHex[arr[offset4 + 13]] + byteToHex[arr[offset4 + 14]] + byteToHex[arr[offset4 + 15]]).toLowerCase(); 7900 } 7901 7902 // node_modules/uuid/dist/rng.js 7903 var rnds8 = new Uint8Array(16); 7904 function rng() { 7905 return crypto.getRandomValues(rnds8); 7906 } 7907 7908 // node_modules/uuid/dist/v4.js 7909 function v4(options, buf, offset4) { 7910 if (!buf && !options && crypto.randomUUID) { 7911 return crypto.randomUUID(); 7912 } 7913 return _v4(options, buf, offset4); 7914 } 7915 function _v4(options, buf, offset4) { 7916 options = options || {}; 7917 const rnds = options.random ?? options.rng?.() ?? rng(); 7918 if (rnds.length < 16) { 7919 throw new Error("Random bytes length must be >= 16"); 7920 } 7921 rnds[6] = rnds[6] & 15 | 64; 7922 rnds[8] = rnds[8] & 63 | 128; 7923 if (buf) { 7924 offset4 = offset4 || 0; 7925 if (offset4 < 0 || offset4 + 16 > buf.length) { 7926 throw new RangeError(`UUID byte range $offset4}:$offset4 + 15} is out of buffer bounds`); 7927 } 7928 for (let i3 = 0; i3 < 16; ++i3) { 7929 buf[offset4 + i3] = rnds[i3]; 7930 } 7931 return buf; 7932 } 7933 return unsafeStringify(rnds); 7934 } 7935 var v4_default = v4; 7936 7937 // packages/editor/build-module/utils/media-upload/index.mjs 7938 var import_data5 = __toESM(require_data(), 1); 7939 var import_core_data2 = __toESM(require_core_data(), 1); 7940 var import_media_utils = __toESM(require_media_utils(), 1); 7941 7942 // packages/editor/build-module/components/upload-progress-snackbar/tracker.mjs 7943 var import_element2 = __toESM(require_element(), 1); 7944 var state = null; 7945 var listeners = /* @__PURE__ */ new Set(); 7946 function notify() { 7947 listeners.forEach((listener) => listener()); 7948 } 7949 function addFiles(filenames) { 7950 if (!filenames.length) { 7951 return; 7952 } 7953 if (!state) { 7954 state = { total: 0, completed: 0, pending: [] }; 7955 } 7956 state = { 7957 total: state.total + filenames.length, 7958 completed: state.completed, 7959 pending: [...state.pending, ...filenames] 7960 }; 7961 notify(); 7962 } 7963 function advance(count) { 7964 if (!state || count <= 0) { 7965 return; 7966 } 7967 const completed = Math.min(state.total, state.completed + count); 7968 const pending = state.pending.slice(count); 7969 if (completed >= state.total) { 7970 state = null; 7971 } else { 7972 state = { total: state.total, completed, pending }; 7973 } 7974 notify(); 7975 } 7976 function getState() { 7977 return state; 7978 } 7979 function subscribe(listener) { 7980 listeners.add(listener); 7981 return () => { 7982 listeners.delete(listener); 7983 }; 7984 } 7985 function useTracker() { 7986 return (0, import_element2.useSyncExternalStore)(subscribe, getState, getState); 7987 } 7988 7989 // packages/editor/build-module/utils/media-upload/index.mjs 7990 var noop = () => { 7991 }; 7992 function mediaUpload({ 7993 additionalData = {}, 7994 allowedTypes, 7995 filesList, 7996 maxUploadFileSize, 7997 onError = noop, 7998 onFileChange, 7999 onSuccess, 8000 multiple = true, 8001 isTransportOnly = false 8002 }) { 8003 const { receiveEntityRecords } = (0, import_data5.dispatch)(import_core_data2.store); 8004 const { getCurrentPost: getCurrentPost2, getEditorSettings: getEditorSettings2 } = (0, import_data5.select)(store); 8005 const { 8006 lockPostAutosaving: lockPostAutosaving2, 8007 unlockPostAutosaving: unlockPostAutosaving2, 8008 lockPostSaving: lockPostSaving2, 8009 unlockPostSaving: unlockPostSaving2 8010 } = (0, import_data5.dispatch)(store); 8011 const wpAllowedMimeTypes = getEditorSettings2().allowedMimeTypes; 8012 const lockKey = `image-upload-$v4_default()}`; 8013 maxUploadFileSize = maxUploadFileSize || getEditorSettings2().maxUploadFileSize; 8014 const currentPost = getCurrentPost2(); 8015 const currentPostId = typeof currentPost?.id === "number" ? currentPost.id : currentPost?.wp_id; 8016 const clearSaveLock = () => { 8017 unlockPostSaving2(lockKey); 8018 unlockPostAutosaving2(lockKey); 8019 }; 8020 if (!isTransportOnly) { 8021 lockPostSaving2(lockKey); 8022 lockPostAutosaving2(lockKey); 8023 } 8024 const postData = currentPostId ? { post: currentPostId } : {}; 8025 if (!isTransportOnly) { 8026 const trackingFiles = Array.from(filesList).map( 8027 (f3) => f3?.name || "" 8028 ); 8029 addFiles(trackingFiles); 8030 } 8031 let lastCompletedCount = 0; 8032 (0, import_media_utils.uploadMedia)({ 8033 allowedTypes, 8034 filesList, 8035 onFileChange: (files) => { 8036 onFileChange?.(files); 8037 const entityFiles = files.filter((_file) => _file?.id); 8038 if (entityFiles?.length) { 8039 const invalidateCache = true; 8040 receiveEntityRecords( 8041 "postType", 8042 "attachment", 8043 entityFiles, 8044 void 0, 8045 invalidateCache 8046 ); 8047 } 8048 if (!isTransportOnly && entityFiles.length === files.length) { 8049 clearSaveLock(); 8050 } 8051 if (!isTransportOnly) { 8052 const completedCount = entityFiles.length; 8053 if (completedCount > lastCompletedCount) { 8054 advance(completedCount - lastCompletedCount); 8055 lastCompletedCount = completedCount; 8056 } 8057 } 8058 }, 8059 onSuccess, 8060 additionalData: { 8061 ...postData, 8062 ...additionalData 8063 }, 8064 maxUploadFileSize, 8065 onError: ({ message: message2 }) => { 8066 if (!isTransportOnly) { 8067 clearSaveLock(); 8068 advance(1); 8069 } 8070 onError(message2); 8071 }, 8072 wpAllowedMimeTypes, 8073 multiple 8074 }); 8075 } 8076 8077 // packages/editor/build-module/utils/url.mjs 8078 var import_url2 = __toESM(require_url(), 1); 8079 var import_deprecated2 = __toESM(require_deprecated(), 1); 8080 function cleanForSlug2(string) { 8081 (0, import_deprecated2.default)("wp.editor.cleanForSlug", { 8082 since: "12.7", 8083 plugin: "Gutenberg", 8084 alternative: "wp.url.cleanForSlug" 8085 }); 8086 return (0, import_url2.cleanForSlug)(string); 8087 } 8088 8089 // packages/editor/build-module/store/private-selectors.mjs 8090 var DEVICE_ASPECT_RATIO_BY_DEVICE_TYPE = { 8091 Mobile: 8 / 5, 8092 Tablet: 4 / 3 8093 }; 8094 var EMPTY_INSERTION_POINT = { 8095 rootClientId: void 0, 8096 insertionIndex: void 0, 8097 filterValue: void 0 8098 }; 8099 var RENDERING_MODES = ["post-only", "template-locked"]; 8100 var getInserter = (0, import_data6.createRegistrySelector)( 8101 (select9) => (0, import_data6.createSelector)( 8102 (state2) => { 8103 if (typeof state2.blockInserterPanel === "object") { 8104 return state2.blockInserterPanel; 8105 } 8106 if (getRenderingMode(state2) === "template-locked") { 8107 const { 8108 getBlocksByName, 8109 getSelectedBlockClientId: getSelectedBlockClientId2, 8110 getBlockParents, 8111 getBlockOrder: getBlockOrder2 8112 } = select9(import_block_editor3.store); 8113 const [postContentClientId] = getBlocksByName("core/post-content"); 8114 if (postContentClientId) { 8115 const selectedBlockClientId = getSelectedBlockClientId2(); 8116 if (selectedBlockClientId && selectedBlockClientId !== postContentClientId && getBlockParents(selectedBlockClientId).includes( 8117 postContentClientId 8118 )) { 8119 return EMPTY_INSERTION_POINT; 8120 } 8121 return { 8122 rootClientId: postContentClientId, 8123 insertionIndex: getBlockOrder2(postContentClientId).length, 8124 filterValue: void 0 8125 }; 8126 } 8127 } 8128 return EMPTY_INSERTION_POINT; 8129 }, 8130 (state2) => { 8131 const { 8132 getBlocksByName, 8133 getSelectedBlockClientId: getSelectedBlockClientId2, 8134 getBlockParents, 8135 getBlockOrder: getBlockOrder2 8136 } = select9(import_block_editor3.store); 8137 const [postContentClientId] = getBlocksByName("core/post-content"); 8138 const selectedBlockClientId = getSelectedBlockClientId2(); 8139 return [ 8140 state2.blockInserterPanel, 8141 getRenderingMode(state2), 8142 postContentClientId, 8143 selectedBlockClientId, 8144 selectedBlockClientId ? getBlockParents(selectedBlockClientId) : void 0, 8145 postContentClientId ? getBlockOrder2(postContentClientId).length : void 0 8146 ]; 8147 } 8148 ) 8149 ); 8150 function getListViewToggleRef(state2) { 8151 return state2.listViewToggleRef; 8152 } 8153 function getInserterSidebarToggleRef(state2) { 8154 return state2.inserterSidebarToggleRef; 8155 } 8156 var CARD_ICONS = { 8157 wp_block: symbol_default, 8158 wp_navigation: navigation_default, 8159 page: page_default, 8160 post: verse_default 8161 }; 8162 var getPostIcon = (0, import_data6.createRegistrySelector)( 8163 (select9) => (state2, postType2, options) => { 8164 { 8165 if (postType2 === "wp_template_part" || postType2 === "wp_template") { 8166 const templateAreas = select9(import_core_data3.store).getCurrentTheme()?.default_template_part_areas || []; 8167 const areaData = templateAreas.find( 8168 (item) => options.area === item.area 8169 ); 8170 if (areaData?.icon) { 8171 return getTemplatePartIcon(areaData.icon); 8172 } 8173 return layout_default; 8174 } 8175 if (CARD_ICONS[postType2]) { 8176 return CARD_ICONS[postType2]; 8177 } 8178 const postTypeEntity = select9(import_core_data3.store).getPostType(postType2); 8179 if (typeof postTypeEntity?.icon === "string" && postTypeEntity.icon.startsWith("dashicons-")) { 8180 return postTypeEntity.icon.slice(10); 8181 } 8182 return page_default; 8183 } 8184 } 8185 ); 8186 var hasPostMetaChanges = (0, import_data6.createRegistrySelector)( 8187 (select9) => (state2, postType2, postId2) => { 8188 const { type: currentPostType, id: currentPostId } = getCurrentPost(state2); 8189 const edits = select9(import_core_data3.store).getEntityRecordNonTransientEdits( 8190 "postType", 8191 postType2 || currentPostType, 8192 postId2 || currentPostId 8193 ); 8194 if (!edits?.meta) { 8195 return false; 8196 } 8197 const originalPostMeta = select9(import_core_data3.store).getEntityRecord( 8198 "postType", 8199 postType2 || currentPostType, 8200 postId2 || currentPostId 8201 )?.meta; 8202 return !(0, import_fast_deep_equal.default)( 8203 { ...originalPostMeta, footnotes: void 0 }, 8204 { ...edits.meta, footnotes: void 0 } 8205 ); 8206 } 8207 ); 8208 function getEntityActions2(state2, ...args) { 8209 return getEntityActions(state2.dataviews, ...args); 8210 } 8211 function isEntityReady2(state2, ...args) { 8212 return isEntityReady(state2.dataviews, ...args); 8213 } 8214 function getEntityFields2(state2, ...args) { 8215 return getEntityFields(state2.dataviews, ...args); 8216 } 8217 var getPostBlocksByName = (0, import_data6.createRegistrySelector)( 8218 (select9) => (0, import_data6.createSelector)( 8219 (state2, blockNames) => { 8220 blockNames = Array.isArray(blockNames) ? blockNames : [blockNames]; 8221 const { getBlocksByName, getBlockParents, getBlockName: getBlockName2 } = select9(import_block_editor3.store); 8222 return getBlocksByName(blockNames).filter( 8223 (clientId) => getBlockParents(clientId).every((parentClientId) => { 8224 const parentBlockName = getBlockName2(parentClientId); 8225 return ( 8226 // Ignore descendents of the query block. 8227 parentBlockName !== "core/query" && // Enable only the top-most block. 8228 !blockNames.includes(parentBlockName) 8229 ); 8230 }) 8231 ); 8232 }, 8233 (state2, blockNames) => { 8234 blockNames = Array.isArray(blockNames) ? blockNames : [blockNames]; 8235 const { getBlocksByName, getBlockParents } = select9(import_block_editor3.store); 8236 const clientIds = getBlocksByName(blockNames); 8237 const parentsOfClientIds = clientIds.map( 8238 (id) => getBlockParents(id) 8239 ); 8240 return [clientIds, ...parentsOfClientIds]; 8241 } 8242 ) 8243 ); 8244 var getDefaultRenderingMode = (0, import_data6.createRegistrySelector)( 8245 (select9) => (state2, postType2) => { 8246 const { getPostType, getCurrentTheme, hasFinishedResolution } = select9(import_core_data3.store); 8247 const currentTheme = getCurrentTheme(); 8248 const postTypeEntity = getPostType(postType2); 8249 if (!hasFinishedResolution("getPostType", [postType2]) || !hasFinishedResolution("getCurrentTheme")) { 8250 return void 0; 8251 } 8252 const theme2 = currentTheme?.stylesheet; 8253 const defaultModePreference = select9(import_preferences2.store).get( 8254 "core", 8255 "renderingModes" 8256 )?.[theme2]?.[postType2]; 8257 if (RENDERING_MODES.includes(defaultModePreference)) { 8258 return defaultModePreference; 8259 } 8260 const postTypeDefaultMode = Array.isArray( 8261 postTypeEntity?.supports?.editor 8262 ) ? postTypeEntity.supports.editor.find( 8263 (features) => "default-mode" in features 8264 )?.["default-mode"] : void 0; 8265 if (RENDERING_MODES.includes(postTypeDefaultMode)) { 8266 return postTypeDefaultMode; 8267 } 8268 const settingsDefaultMode = getEditorSettings(state2).defaultRenderingMode; 8269 if (RENDERING_MODES.includes(settingsDefaultMode)) { 8270 return settingsDefaultMode; 8271 } 8272 return "post-only"; 8273 } 8274 ); 8275 function getStylesPath(state2) { 8276 return state2.stylesPath ?? "/"; 8277 } 8278 function getShowStylebook(state2) { 8279 return state2.showStylebook ?? false; 8280 } 8281 var getCanvasWidth = (0, import_data6.createRegistrySelector)( 8282 (select9) => (state2) => { 8283 if (unlock(select9(import_block_editor3.store)).isZoomOut()) { 8284 return void 0; 8285 } 8286 return state2.canvasWidth; 8287 } 8288 ); 8289 var getCanvasHeight = (0, import_data6.createRegistrySelector)( 8290 (select9) => (state2) => { 8291 const blockEditorSelect = unlock(select9(import_block_editor3.store)); 8292 if (blockEditorSelect.isZoomOut()) { 8293 return void 0; 8294 } 8295 const canvasWidth2 = state2.canvasWidth; 8296 const viewportSettings = blockEditorSelect.getSettings().__experimentalFeatures?.viewport; 8297 const deviceType = getDeviceTypeByCanvasWidth( 8298 canvasWidth2, 8299 viewportSettings 8300 ); 8301 if (canvasWidth2 !== getCanvasWidthByDeviceType(deviceType, viewportSettings)) { 8302 return void 0; 8303 } 8304 const ratio = DEVICE_ASPECT_RATIO_BY_DEVICE_TYPE[deviceType]; 8305 if (ratio && canvasWidth2 > 0) { 8306 return Math.round(canvasWidth2 * ratio); 8307 } 8308 return void 0; 8309 } 8310 ); 8311 function getRevisionPage(state2) { 8312 return state2.revisionPage; 8313 } 8314 function buildRevisionsPageQuery(revisionKey, page) { 8315 return { 8316 per_page: REVISIONS_PER_PAGE, 8317 page, 8318 context: "edit", 8319 orderby: "date", 8320 order: "desc", 8321 _fields: [ 8322 .../* @__PURE__ */ new Set([ 8323 "id", 8324 "date", 8325 "modified", 8326 "author", 8327 "slug", 8328 "meta", 8329 "title.raw", 8330 "excerpt.raw", 8331 "content.raw", 8332 revisionKey 8333 ]) 8334 ].join() 8335 }; 8336 } 8337 var REVISIONS_PER_PAGE = 100; 8338 function getRevisionsPerPage() { 8339 return REVISIONS_PER_PAGE; 8340 } 8341 var getPageRevisions = (0, import_data6.createRegistrySelector)( 8342 (select9) => (state2, page) => { 8343 if (!page) { 8344 return null; 8345 } 8346 const { type: postType2, id: postId2 } = getCurrentPost(state2); 8347 if (!postType2 || !postId2) { 8348 return null; 8349 } 8350 const entityConfig = select9(import_core_data3.store).getEntityConfig( 8351 "postType", 8352 postType2 8353 ); 8354 const revisionKey = entityConfig?.revisionKey || "id"; 8355 return select9(import_core_data3.store).getRevisions( 8356 "postType", 8357 postType2, 8358 postId2, 8359 buildRevisionsPageQuery(revisionKey, page) 8360 ); 8361 } 8362 ); 8363 function isRevisionsMode(state2) { 8364 return state2.revisionId !== null; 8365 } 8366 function isShowingRevisionDiff(state2) { 8367 return state2.showRevisionDiff; 8368 } 8369 function getCurrentRevisionId(state2) { 8370 return state2.revisionId; 8371 } 8372 var getCurrentRevision = (0, import_data6.createRegistrySelector)( 8373 (select9) => (state2) => { 8374 const revisionId2 = getCurrentRevisionId(state2); 8375 if (!revisionId2) { 8376 return void 0; 8377 } 8378 const page = getRevisionPage(state2); 8379 if (!page) { 8380 return null; 8381 } 8382 const { type: postType2, id: postId2 } = getCurrentPost(state2); 8383 const entityConfig = select9(import_core_data3.store).getEntityConfig( 8384 "postType", 8385 postType2 8386 ); 8387 const revisionKey = entityConfig?.revisionKey || "id"; 8388 const revisions = select9(import_core_data3.store).getRevisions( 8389 "postType", 8390 postType2, 8391 postId2, 8392 buildRevisionsPageQuery(revisionKey, page) 8393 ); 8394 if (!revisions) { 8395 return null; 8396 } 8397 const revision = revisions.find( 8398 (record) => record[revisionKey] === revisionId2 8399 ); 8400 if (revision) { 8401 return revision; 8402 } 8403 return select9(import_core_data3.store).getRevision( 8404 "postType", 8405 postType2, 8406 postId2, 8407 revisionId2, 8408 { context: "edit" } 8409 ) ?? null; 8410 } 8411 ); 8412 function getSelectedNote(state2) { 8413 return state2.selectedNote?.noteId; 8414 } 8415 function isNoteFocused(state2) { 8416 return !!state2.selectedNote?.options?.focus; 8417 } 8418 var getPreviousRevision = (0, import_data6.createRegistrySelector)( 8419 (select9) => (state2) => { 8420 const currentRevisionId = getCurrentRevisionId(state2); 8421 if (!currentRevisionId) { 8422 return void 0; 8423 } 8424 const page = getRevisionPage(state2); 8425 if (!page) { 8426 return null; 8427 } 8428 const { type: postType2, id: postId2 } = getCurrentPost(state2); 8429 const entityConfig = select9(import_core_data3.store).getEntityConfig( 8430 "postType", 8431 postType2 8432 ); 8433 const revisionKey = entityConfig?.revisionKey || "id"; 8434 const query = buildRevisionsPageQuery(revisionKey, page); 8435 const revisions = select9(import_core_data3.store).getRevisions( 8436 "postType", 8437 postType2, 8438 postId2, 8439 query 8440 ); 8441 if (!revisions) { 8442 return null; 8443 } 8444 const currentIndex = revisions.findIndex( 8445 (r4) => r4[revisionKey] === currentRevisionId 8446 ); 8447 if (currentIndex >= 0 && currentIndex < revisions.length - 1) { 8448 return revisions[currentIndex + 1]; 8449 } 8450 const totalRevisions = getCurrentPostRevisionsCount(state2); 8451 const totalPages = Math.ceil(totalRevisions / query.per_page) || 1; 8452 if (currentIndex === revisions.length - 1 && page < totalPages) { 8453 const nextPageRevisions = select9(import_core_data3.store).getRevisions( 8454 "postType", 8455 postType2, 8456 postId2, 8457 buildRevisionsPageQuery(revisionKey, page + 1) 8458 ); 8459 return nextPageRevisions?.[0] ?? null; 8460 } 8461 return null; 8462 } 8463 ); 8464 var isCollaborationEnabledForCurrentPost = (0, import_data6.createRegistrySelector)( 8465 (select9) => (state2) => { 8466 if (!unlock(select9(import_core_data3.store)).isCollaborationSupported()) { 8467 return false; 8468 } 8469 const currentPostType = getCurrentPostType(state2); 8470 const currentPostId = getCurrentPostId(state2); 8471 const entityConfig = select9(import_core_data3.store).getEntityConfig( 8472 "postType", 8473 currentPostType 8474 ); 8475 const syncConfig = entityConfig?.syncConfig; 8476 return Boolean( 8477 syncConfig && syncConfig.supportsPersistence && window._wpCollaborationEnabled && false !== syncConfig.shouldSync?.( 8478 `postType/$currentPostType}`, 8479 currentPostId 8480 ) 8481 ); 8482 } 8483 ); 8484 8485 // packages/editor/build-module/dataviews/store/private-actions.mjs 8486 var import_core_data55 = __toESM(require_core_data(), 1); 8487 var import_hooks38 = __toESM(require_hooks(), 1); 8488 8489 // packages/fields/build-module/fields/slug/index.mjs 8490 var import_i18n5 = __toESM(require_i18n(), 1); 8491 8492 // packages/fields/build-module/fields/slug/slug-edit.mjs 8493 var import_components = __toESM(require_components(), 1); 8494 var import_compose = __toESM(require_compose(), 1); 8495 var import_data7 = __toESM(require_data(), 1); 8496 var import_element3 = __toESM(require_element(), 1); 8497 var import_notices = __toESM(require_notices(), 1); 8498 var import_url5 = __toESM(require_url(), 1); 8499 var import_i18n4 = __toESM(require_i18n(), 1); 8500 8501 // packages/fields/build-module/fields/slug/utils.mjs 8502 var import_url4 = __toESM(require_url(), 1); 8503 8504 // packages/fields/build-module/actions/utils.mjs 8505 var import_html_entities = __toESM(require_html_entities(), 1); 8506 var import_i18n3 = __toESM(require_i18n(), 1); 8507 function isTemplate(post2) { 8508 return post2.type === "wp_template"; 8509 } 8510 function isTemplatePart(post2) { 8511 return post2.type === "wp_template_part"; 8512 } 8513 function isTemplateOrTemplatePart(p4) { 8514 return p4.type === "wp_template" || p4.type === "wp_template_part"; 8515 } 8516 function getItemTitle(item, fallback = (0, import_i18n3.__)("(no title)")) { 8517 let title = ""; 8518 if (typeof item.title === "string") { 8519 title = (0, import_html_entities.decodeEntities)(item.title); 8520 } else if (item.title && "rendered" in item.title) { 8521 title = (0, import_html_entities.decodeEntities)(item.title.rendered); 8522 } else if (item.title && "raw" in item.title) { 8523 title = (0, import_html_entities.decodeEntities)(item.title.raw); 8524 } 8525 return title || fallback; 8526 } 8527 function isTemplateRemovable(template2) { 8528 if (!template2) { 8529 return false; 8530 } 8531 return [template2.source, template2.source].includes("custom") && !Boolean(template2.type === "wp_template" && template2?.plugin) && !template2.has_theme_file; 8532 } 8533 8534 // packages/fields/build-module/fields/slug/utils.mjs 8535 var getSlug = (item) => { 8536 if (typeof item !== "object") { 8537 return ""; 8538 } 8539 return item.slug || (0, import_url4.cleanForSlug)(getItemTitle(item)) || item.id.toString(); 8540 }; 8541 8542 // packages/fields/build-module/fields/slug/slug-edit.mjs 8543 var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1); 8544 var SlugEdit = ({ 8545 field, 8546 onChange, 8547 data 8548 }) => { 8549 const { id } = field; 8550 const slug = field.getValue({ item: data }) || getSlug(data); 8551 const permalinkTemplate = data.permalink_template || ""; 8552 const PERMALINK_POSTNAME_REGEX2 = /%(?:postname|pagename)%/; 8553 const [prefix2, suffix] = permalinkTemplate.split( 8554 PERMALINK_POSTNAME_REGEX2 8555 ); 8556 const permalinkPrefix = prefix2; 8557 const permalinkSuffix = suffix; 8558 const isEditable = PERMALINK_POSTNAME_REGEX2.test(permalinkTemplate); 8559 const originalSlugRef = (0, import_element3.useRef)(slug); 8560 const slugToDisplay = slug || originalSlugRef.current; 8561 const permalink = isEditable ? `$permalinkPrefix}$slugToDisplay}$permalinkSuffix}` : (0, import_url5.safeDecodeURIComponent)(data.link || ""); 8562 (0, import_element3.useEffect)(() => { 8563 if (slug && originalSlugRef.current === void 0) { 8564 originalSlugRef.current = slug; 8565 } 8566 }, [slug]); 8567 const onChangeControl = (0, import_element3.useCallback)( 8568 (newValue) => onChange({ 8569 [id]: newValue 8570 }), 8571 [id, onChange] 8572 ); 8573 const { createNotice } = (0, import_data7.useDispatch)(import_notices.store); 8574 const copyButtonRef = (0, import_compose.useCopyToClipboard)(permalink, () => { 8575 createNotice("info", (0, import_i18n4.__)("Copied Permalink to clipboard."), { 8576 isDismissible: true, 8577 type: "snackbar" 8578 }); 8579 }); 8580 const postUrlSlugDescriptionId = "editor-post-url__slug-description-" + (0, import_compose.useInstanceId)(SlugEdit); 8581 return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("fieldset", { className: "fields-controls__slug", children: [ 8582 isEditable && /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_components.__experimentalVStack, { children: [ 8583 /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_components.__experimentalVStack, { spacing: "0px", children: [ 8584 /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { children: (0, import_i18n4.__)( 8585 "Customize the last part of the Permalink." 8586 ) }), 8587 /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_components.ExternalLink, { href: "https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink", children: (0, import_i18n4.__)("Learn more") }) 8588 ] }), 8589 /* @__PURE__ */ (0, import_jsx_runtime94.jsx)( 8590 import_components.__experimentalInputControl, 8591 { 8592 prefix: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_components.__experimentalInputControlPrefixWrapper, { children: "/" }), 8593 suffix: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_components.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)( 8594 import_components.Button, 8595 { 8596 size: "small", 8597 icon: copy_small_default, 8598 ref: copyButtonRef, 8599 label: (0, import_i18n4.__)("Copy") 8600 } 8601 ) }), 8602 label: (0, import_i18n4.__)("Link"), 8603 hideLabelFromVision: true, 8604 value: slug, 8605 autoComplete: "off", 8606 spellCheck: "false", 8607 type: "text", 8608 className: "fields-controls__slug-input", 8609 onChange: (newValue) => { 8610 onChangeControl(newValue); 8611 }, 8612 onBlur: () => { 8613 if (slug === "") { 8614 onChangeControl(originalSlugRef.current); 8615 } 8616 }, 8617 "aria-describedby": postUrlSlugDescriptionId 8618 } 8619 ), 8620 /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "fields-controls__slug-help", children: [ 8621 /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "fields-controls__slug-help-visual-label", children: (0, import_i18n4.__)("Permalink:") }), 8622 /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)( 8623 import_components.ExternalLink, 8624 { 8625 className: "fields-controls__slug-help-link", 8626 href: permalink, 8627 children: [ 8628 /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "fields-controls__slug-help-prefix", children: permalinkPrefix }), 8629 /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "fields-controls__slug-help-slug", children: slugToDisplay }), 8630 /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "fields-controls__slug-help-suffix", children: permalinkSuffix }) 8631 ] 8632 } 8633 ) 8634 ] }) 8635 ] }), 8636 !isEditable && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)( 8637 import_components.ExternalLink, 8638 { 8639 className: "fields-controls__slug-help", 8640 href: permalink, 8641 children: permalink 8642 } 8643 ) 8644 ] }); 8645 }; 8646 var slug_edit_default = SlugEdit; 8647 8648 // packages/fields/build-module/fields/slug/slug-view.mjs 8649 var import_element4 = __toESM(require_element(), 1); 8650 var SlugView = ({ item }) => { 8651 const slug = getSlug(item); 8652 const originalSlugRef = (0, import_element4.useRef)(slug); 8653 (0, import_element4.useEffect)(() => { 8654 if (slug && originalSlugRef.current === void 0) { 8655 originalSlugRef.current = slug; 8656 } 8657 }, [slug]); 8658 const slugToDisplay = slug || originalSlugRef.current; 8659 return `$slugToDisplay}`; 8660 }; 8661 var slug_view_default = SlugView; 8662 8663 // packages/fields/build-module/fields/slug/index.mjs 8664 var slugField = { 8665 id: "slug", 8666 type: "text", 8667 label: (0, import_i18n5.__)("Slug"), 8668 Edit: slug_edit_default, 8669 render: slug_view_default, 8670 filterBy: false 8671 }; 8672 var slug_default = slugField; 8673 8674 // packages/fields/build-module/fields/title/index.mjs 8675 var import_i18n7 = __toESM(require_i18n(), 1); 8676 8677 // node_modules/clsx/dist/clsx.mjs 8678 function r2(e3) { 8679 var t4, f3, n3 = ""; 8680 if ("string" == typeof e3 || "number" == typeof e3) n3 += e3; 8681 else if ("object" == typeof e3) if (Array.isArray(e3)) { 8682 var o4 = e3.length; 8683 for (t4 = 0; t4 < o4; t4++) e3[t4] && (f3 = r2(e3[t4])) && (n3 && (n3 += " "), n3 += f3); 8684 } else for (f3 in e3) e3[f3] && (n3 && (n3 += " "), n3 += f3); 8685 return n3; 8686 } 8687 function clsx() { 8688 for (var e3, t4, f3 = 0, n3 = "", o4 = arguments.length; f3 < o4; f3++) (e3 = arguments[f3]) && (t4 = r2(e3)) && (n3 && (n3 += " "), n3 += t4); 8689 return n3; 8690 } 8691 var clsx_default = clsx; 8692 8693 // packages/fields/build-module/fields/title/view.mjs 8694 var import_components2 = __toESM(require_components(), 1); 8695 var import_i18n6 = __toESM(require_i18n(), 1); 8696 var import_jsx_runtime95 = __toESM(require_jsx_runtime(), 1); 8697 function BaseTitleView({ 8698 item, 8699 className, 8700 children 8701 }) { 8702 const renderedTitle = getItemTitle(item); 8703 return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)( 8704 import_components2.__experimentalHStack, 8705 { 8706 className: clsx_default("fields-field__title", className), 8707 alignment: "center", 8708 justify: "flex-start", 8709 children: [ 8710 /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { children: renderedTitle || (0, import_i18n6.__)("(no title)") }), 8711 children 8712 ] 8713 } 8714 ); 8715 } 8716 function TitleView({ item }) { 8717 return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(BaseTitleView, { item }); 8718 } 8719 8720 // packages/fields/build-module/fields/title/index.mjs 8721 var titleField = { 8722 type: "text", 8723 id: "title", 8724 label: (0, import_i18n7.__)("Title"), 8725 placeholder: (0, import_i18n7.__)("No title"), 8726 getValue: ({ item }) => getItemTitle(item), 8727 render: TitleView, 8728 enableHiding: true, 8729 enableGlobalSearch: true, 8730 filterBy: false 8731 }; 8732 var title_default = titleField; 8733 8734 // packages/fields/build-module/fields/page-title/index.mjs 8735 var import_i18n9 = __toESM(require_i18n(), 1); 8736 8737 // packages/fields/build-module/fields/page-title/view.mjs 8738 var import_i18n8 = __toESM(require_i18n(), 1); 8739 var import_data8 = __toESM(require_data(), 1); 8740 var import_core_data4 = __toESM(require_core_data(), 1); 8741 var import_components3 = __toESM(require_components(), 1); 8742 8743 // packages/fields/build-module/lock-unlock.mjs 8744 var import_private_apis4 = __toESM(require_private_apis(), 1); 8745 var { lock: lock3, unlock: unlock3 } = (0, import_private_apis4.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 8746 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 8747 "@wordpress/fields" 8748 ); 8749 8750 // packages/fields/build-module/fields/page-title/view.mjs 8751 var import_jsx_runtime96 = __toESM(require_jsx_runtime(), 1); 8752 var { Badge: WCBadge } = unlock3(import_components3.privateApis); 8753 function PageTitleView({ item }) { 8754 const { frontPageId, postsPageId } = (0, import_data8.useSelect)((select9) => { 8755 const { getEntityRecord } = select9(import_core_data4.store); 8756 const siteSettings = getEntityRecord( 8757 "root", 8758 "site" 8759 ); 8760 return { 8761 frontPageId: siteSettings?.page_on_front, 8762 postsPageId: siteSettings?.page_for_posts 8763 }; 8764 }, []); 8765 return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(BaseTitleView, { item, className: "fields-field__page-title", children: [frontPageId, postsPageId].includes(item.id) && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(WCBadge, { children: item.id === frontPageId ? (0, import_i18n8.__)("Homepage") : (0, import_i18n8.__)("Posts Page") }) }); 8766 } 8767 8768 // packages/fields/build-module/fields/page-title/index.mjs 8769 var pageTitleField = { 8770 type: "text", 8771 id: "title", 8772 label: (0, import_i18n9.__)("Title"), 8773 placeholder: (0, import_i18n9.__)("No title"), 8774 getValue: ({ item }) => getItemTitle(item), 8775 render: PageTitleView, 8776 enableHiding: false, 8777 enableGlobalSearch: true, 8778 filterBy: false 8779 }; 8780 var page_title_default = pageTitleField; 8781 8782 // packages/fields/build-module/fields/template-title/index.mjs 8783 var import_i18n10 = __toESM(require_i18n(), 1); 8784 var templateTitleField = { 8785 id: "title", 8786 type: "text", 8787 label: (0, import_i18n10.__)("Template"), 8788 placeholder: (0, import_i18n10.__)("No title"), 8789 getValue: ({ item }) => getItemTitle(item), 8790 render: TitleView, 8791 enableHiding: false, 8792 enableGlobalSearch: true, 8793 filterBy: false 8794 }; 8795 var template_title_default = templateTitleField; 8796 8797 // packages/fields/build-module/fields/pattern-title/index.mjs 8798 var import_i18n14 = __toESM(require_i18n(), 1); 8799 8800 // packages/fields/build-module/fields/pattern-title/view.mjs 8801 var import_i18n13 = __toESM(require_i18n(), 1); 8802 var import_patterns = __toESM(require_patterns(), 1); 8803 8804 // packages/ui/build-module/badge/badge.mjs 8805 var import_element15 = __toESM(require_element(), 1); 8806 8807 // node_modules/@base-ui/utils/useControlled.mjs 8808 var React = __toESM(require_react(), 1); 8809 8810 // node_modules/@base-ui/utils/error.mjs 8811 var set; 8812 if (true) { 8813 set = /* @__PURE__ */ new Set(); 8814 } 8815 function error(...messages) { 8816 if (true) { 8817 const messageKey = messages.join(" "); 8818 if (!set.has(messageKey)) { 8819 set.add(messageKey); 8820 console.error(`Base UI: $messageKey}`); 8821 } 8822 } 8823 } 8824 8825 // node_modules/@base-ui/utils/useControlled.mjs 8826 function useControlled({ 8827 controlled, 8828 default: defaultProp, 8829 name: name2, 8830 state: state2 = "value" 8831 }) { 8832 const { 8833 current: isControlled 8834 } = React.useRef(controlled !== void 0); 8835 const [valueState, setValue] = React.useState(defaultProp); 8836 const value = isControlled ? controlled : valueState; 8837 if (true) { 8838 React.useEffect(() => { 8839 if (isControlled !== (controlled !== void 0)) { 8840 error([`A component is changing the $isControlled ? "" : "un"}controlled $state2} state of $name2} to be $isControlled ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled $name2} 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")); 8841 } 8842 }, [state2, name2, controlled]); 8843 const { 8844 current: defaultValue2 8845 } = React.useRef(defaultProp); 8846 React.useEffect(() => { 8847 if (!isControlled && serializeToDevModeString(defaultValue2) !== serializeToDevModeString(defaultProp)) { 8848 error([`A component is changing the default $state2} state of an uncontrolled $name2} after being initialized. To suppress this warning opt to use a controlled $name2}.`].join("\n")); 8849 } 8850 }, [defaultProp]); 8851 } 8852 const setValueIfUncontrolled = React.useCallback((newValue) => { 8853 if (!isControlled) { 8854 setValue(newValue); 8855 } 8856 }, []); 8857 return [value, setValueIfUncontrolled]; 8858 } 8859 function serializeToDevModeString(input) { 8860 let nextId2 = 0; 8861 const seen = /* @__PURE__ */ new WeakMap(); 8862 try { 8863 const result = JSON.stringify(input, function replacer(key, value) { 8864 if (key === "_owner" && this != null && typeof this === "object" && "$$typeof" in this) { 8865 return void 0; 8866 } 8867 if (typeof value === "bigint") { 8868 return `__bigint__:$value}`; 8869 } 8870 if (value !== null && typeof value === "object") { 8871 const id = seen.get(value); 8872 if (id !== void 0) { 8873 return `__object__:$id}`; 8874 } 8875 seen.set(value, nextId2); 8876 nextId2 += 1; 8877 } 8878 return value; 8879 }); 8880 return result ?? `__top__:$typeof input}`; 8881 } catch { 8882 return "__unserializable__"; 8883 } 8884 } 8885 8886 // node_modules/@base-ui/utils/safeReact.mjs 8887 var React2 = __toESM(require_react(), 1); 8888 var SafeReact = { 8889 ...React2 8890 }; 8891 8892 // node_modules/@base-ui/utils/useRefWithInit.mjs 8893 var React3 = __toESM(require_react(), 1); 8894 var UNINITIALIZED = {}; 8895 function useRefWithInit(init2, initArg) { 8896 const ref = React3.useRef(UNINITIALIZED); 8897 if (ref.current === UNINITIALIZED) { 8898 ref.current = init2(initArg); 8899 } 8900 return ref; 8901 } 8902 8903 // node_modules/@base-ui/utils/useStableCallback.mjs 8904 var useInsertionEffect = SafeReact.useInsertionEffect; 8905 var useSafeInsertionEffect = ( 8906 // React 17 doesn't have useInsertionEffect. 8907 useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late. 8908 useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn() 8909 ); 8910 function useStableCallback(callback) { 8911 const stable = useRefWithInit(createStableCallback).current; 8912 stable.next = callback; 8913 useSafeInsertionEffect(stable.effect); 8914 return stable.trampoline; 8915 } 8916 function createStableCallback() { 8917 const stable = { 8918 next: void 0, 8919 callback: assertNotCalled, 8920 trampoline: (...args) => stable.callback?.(...args), 8921 effect: () => { 8922 stable.callback = stable.next; 8923 } 8924 }; 8925 return stable; 8926 } 8927 function assertNotCalled() { 8928 if (true) { 8929 throw ( 8930 /* minify-error-disabled */ 8931 new Error("Base UI: Cannot call an event handler while rendering.") 8932 ); 8933 } 8934 } 8935 8936 // node_modules/@base-ui/utils/useIsoLayoutEffect.mjs 8937 var React4 = __toESM(require_react(), 1); 8938 var noop2 = () => { 8939 }; 8940 var useIsoLayoutEffect = typeof document !== "undefined" ? React4.useLayoutEffect : noop2; 8941 8942 // node_modules/@base-ui/utils/warn.mjs 8943 var set2; 8944 if (true) { 8945 set2 = /* @__PURE__ */ new Set(); 8946 } 8947 function warn(...messages) { 8948 if (true) { 8949 const messageKey = messages.join(" "); 8950 if (!set2.has(messageKey)) { 8951 set2.add(messageKey); 8952 console.warn(`Base UI: $messageKey}`); 8953 } 8954 } 8955 } 8956 8957 // node_modules/@base-ui/react/internals/composite/list/CompositeList.mjs 8958 var React6 = __toESM(require_react(), 1); 8959 8960 // node_modules/@base-ui/react/internals/composite/list/CompositeListContext.mjs 8961 var React5 = __toESM(require_react(), 1); 8962 var CompositeListContext = /* @__PURE__ */ React5.createContext({ 8963 register: () => { 8964 }, 8965 unregister: () => { 8966 }, 8967 subscribeMapChange: () => { 8968 return () => { 8969 }; 8970 }, 8971 elementsRef: { 8972 current: [] 8973 }, 8974 nextIndexRef: { 8975 current: 0 8976 } 8977 }); 8978 if (true) CompositeListContext.displayName = "CompositeListContext"; 8979 function useCompositeListContext() { 8980 return React5.useContext(CompositeListContext); 8981 } 8982 8983 // node_modules/@base-ui/react/internals/composite/list/CompositeList.mjs 8984 var import_jsx_runtime97 = __toESM(require_jsx_runtime(), 1); 8985 function CompositeList(props) { 8986 const { 8987 children, 8988 elementsRef, 8989 labelsRef, 8990 onMapChange: onMapChangeProp 8991 } = props; 8992 const onMapChange = useStableCallback(onMapChangeProp); 8993 const nextIndexRef = React6.useRef(0); 8994 const listeners2 = useRefWithInit(createListeners).current; 8995 const map = useRefWithInit(createMap).current; 8996 const [mapTick, setMapTick] = React6.useState(0); 8997 const lastTickRef = React6.useRef(mapTick); 8998 const register5 = useStableCallback((node, metadata) => { 8999 map.set(node, metadata ?? null); 9000 lastTickRef.current += 1; 9001 setMapTick(lastTickRef.current); 9002 }); 9003 const unregister = useStableCallback((node) => { 9004 map.delete(node); 9005 lastTickRef.current += 1; 9006 setMapTick(lastTickRef.current); 9007 }); 9008 const sortedMap = React6.useMemo(() => { 9009 disableEslintWarning(mapTick); 9010 const newMap = /* @__PURE__ */ new Map(); 9011 const sortedNodes = Array.from(map.keys()).filter((node) => node.isConnected).sort(sortByDocumentPosition); 9012 sortedNodes.forEach((node, index2) => { 9013 const metadata = map.get(node) ?? {}; 9014 newMap.set(node, { 9015 ...metadata, 9016 index: index2 9017 }); 9018 }); 9019 return newMap; 9020 }, [map, mapTick]); 9021 useIsoLayoutEffect(() => { 9022 if (typeof MutationObserver !== "function" || sortedMap.size === 0) { 9023 return void 0; 9024 } 9025 const mutationObserver = new MutationObserver((entries) => { 9026 const diff = /* @__PURE__ */ new Set(); 9027 const updateDiff = (node) => diff.has(node) ? diff.delete(node) : diff.add(node); 9028 entries.forEach((entry) => { 9029 entry.removedNodes.forEach(updateDiff); 9030 entry.addedNodes.forEach(updateDiff); 9031 }); 9032 if (diff.size === 0) { 9033 lastTickRef.current += 1; 9034 setMapTick(lastTickRef.current); 9035 } 9036 }); 9037 sortedMap.forEach((_, node) => { 9038 if (node.parentElement) { 9039 mutationObserver.observe(node.parentElement, { 9040 childList: true 9041 }); 9042 } 9043 }); 9044 return () => { 9045 mutationObserver.disconnect(); 9046 }; 9047 }, [sortedMap]); 9048 useIsoLayoutEffect(() => { 9049 const shouldUpdateLengths = lastTickRef.current === mapTick; 9050 if (shouldUpdateLengths) { 9051 if (elementsRef.current.length !== sortedMap.size) { 9052 elementsRef.current.length = sortedMap.size; 9053 } 9054 if (labelsRef && labelsRef.current.length !== sortedMap.size) { 9055 labelsRef.current.length = sortedMap.size; 9056 } 9057 nextIndexRef.current = sortedMap.size; 9058 } 9059 onMapChange(sortedMap); 9060 }, [onMapChange, sortedMap, elementsRef, labelsRef, mapTick]); 9061 useIsoLayoutEffect(() => { 9062 return () => { 9063 elementsRef.current = []; 9064 }; 9065 }, [elementsRef]); 9066 useIsoLayoutEffect(() => { 9067 return () => { 9068 if (labelsRef) { 9069 labelsRef.current = []; 9070 } 9071 }; 9072 }, [labelsRef]); 9073 const subscribeMapChange = useStableCallback((fn) => { 9074 listeners2.add(fn); 9075 return () => { 9076 listeners2.delete(fn); 9077 }; 9078 }); 9079 useIsoLayoutEffect(() => { 9080 listeners2.forEach((l3) => l3(sortedMap)); 9081 }, [listeners2, sortedMap]); 9082 const contextValue = React6.useMemo(() => ({ 9083 register: register5, 9084 unregister, 9085 subscribeMapChange, 9086 elementsRef, 9087 labelsRef, 9088 nextIndexRef 9089 }), [register5, unregister, subscribeMapChange, elementsRef, labelsRef, nextIndexRef]); 9090 return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(CompositeListContext.Provider, { 9091 value: contextValue, 9092 children 9093 }); 9094 } 9095 function createMap() { 9096 return /* @__PURE__ */ new Map(); 9097 } 9098 function createListeners() { 9099 return /* @__PURE__ */ new Set(); 9100 } 9101 function sortByDocumentPosition(a3, b3) { 9102 const position = a3.compareDocumentPosition(b3); 9103 if (position & Node.DOCUMENT_POSITION_FOLLOWING || position & Node.DOCUMENT_POSITION_CONTAINED_BY) { 9104 return -1; 9105 } 9106 if (position & Node.DOCUMENT_POSITION_PRECEDING || position & Node.DOCUMENT_POSITION_CONTAINS) { 9107 return 1; 9108 } 9109 return 0; 9110 } 9111 function disableEslintWarning(_) { 9112 } 9113 9114 // node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs 9115 var React7 = __toESM(require_react(), 1); 9116 var DirectionContext = /* @__PURE__ */ React7.createContext(void 0); 9117 if (true) DirectionContext.displayName = "DirectionContext"; 9118 function useDirection() { 9119 const context = React7.useContext(DirectionContext); 9120 return context?.direction ?? "ltr"; 9121 } 9122 9123 // node_modules/@base-ui/react/internals/useRenderElement.mjs 9124 var React10 = __toESM(require_react(), 1); 9125 9126 // node_modules/@base-ui/utils/useMergedRefs.mjs 9127 function useMergedRefs(a3, b3, c6, d3) { 9128 const forkRef = useRefWithInit(createForkRef).current; 9129 if (didChange(forkRef, a3, b3, c6, d3)) { 9130 update(forkRef, [a3, b3, c6, d3]); 9131 } 9132 return forkRef.callback; 9133 } 9134 function useMergedRefsN(refs) { 9135 const forkRef = useRefWithInit(createForkRef).current; 9136 if (didChangeN(forkRef, refs)) { 9137 update(forkRef, refs); 9138 } 9139 return forkRef.callback; 9140 } 9141 function createForkRef() { 9142 return { 9143 callback: null, 9144 cleanup: null, 9145 refs: [] 9146 }; 9147 } 9148 function didChange(forkRef, a3, b3, c6, d3) { 9149 return forkRef.refs[0] !== a3 || forkRef.refs[1] !== b3 || forkRef.refs[2] !== c6 || forkRef.refs[3] !== d3; 9150 } 9151 function didChangeN(forkRef, newRefs) { 9152 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]); 9153 } 9154 function update(forkRef, refs) { 9155 forkRef.refs = refs; 9156 if (refs.every((ref) => ref == null)) { 9157 forkRef.callback = null; 9158 return; 9159 } 9160 forkRef.callback = (instance) => { 9161 if (forkRef.cleanup) { 9162 forkRef.cleanup(); 9163 forkRef.cleanup = null; 9164 } 9165 if (instance != null) { 9166 const cleanupCallbacks = Array(refs.length).fill(null); 9167 for (let i3 = 0; i3 < refs.length; i3 += 1) { 9168 const ref = refs[i3]; 9169 if (ref == null) { 9170 continue; 9171 } 9172 switch (typeof ref) { 9173 case "function": { 9174 const refCleanup = ref(instance); 9175 if (typeof refCleanup === "function") { 9176 cleanupCallbacks[i3] = refCleanup; 9177 } 9178 break; 9179 } 9180 case "object": { 9181 ref.current = instance; 9182 break; 9183 } 9184 default: 9185 } 9186 } 9187 forkRef.cleanup = () => { 9188 for (let i3 = 0; i3 < refs.length; i3 += 1) { 9189 const ref = refs[i3]; 9190 if (ref == null) { 9191 continue; 9192 } 9193 switch (typeof ref) { 9194 case "function": { 9195 const cleanupCallback = cleanupCallbacks[i3]; 9196 if (typeof cleanupCallback === "function") { 9197 cleanupCallback(); 9198 } else { 9199 ref(null); 9200 } 9201 break; 9202 } 9203 case "object": { 9204 ref.current = null; 9205 break; 9206 } 9207 default: 9208 } 9209 } 9210 }; 9211 } 9212 }; 9213 } 9214 9215 // node_modules/@base-ui/utils/getReactElementRef.mjs 9216 var React9 = __toESM(require_react(), 1); 9217 9218 // node_modules/@base-ui/utils/reactVersion.mjs 9219 var React8 = __toESM(require_react(), 1); 9220 var majorVersion = parseInt(React8.version, 10); 9221 function isReactVersionAtLeast(reactVersionToCheck) { 9222 return majorVersion >= reactVersionToCheck; 9223 } 9224 9225 // node_modules/@base-ui/utils/getReactElementRef.mjs 9226 function getReactElementRef(element) { 9227 if (!/* @__PURE__ */ React9.isValidElement(element)) { 9228 return null; 9229 } 9230 const reactElement = element; 9231 const propsWithRef = reactElement.props; 9232 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; 9233 } 9234 9235 // node_modules/@base-ui/utils/mergeObjects.mjs 9236 function mergeObjects(a3, b3) { 9237 if (a3 && !b3) { 9238 return a3; 9239 } 9240 if (!a3 && b3) { 9241 return b3; 9242 } 9243 if (a3 || b3) { 9244 return { 9245 ...a3, 9246 ...b3 9247 }; 9248 } 9249 return void 0; 9250 } 9251 9252 // node_modules/@base-ui/utils/empty.mjs 9253 function NOOP() { 9254 } 9255 var EMPTY_ARRAY3 = Object.freeze([]); 9256 var EMPTY_OBJECT3 = Object.freeze({}); 9257 9258 // node_modules/@base-ui/react/internals/getStateAttributesProps.mjs 9259 function getStateAttributesProps(state2, customMapping) { 9260 const props = {}; 9261 for (const key in state2) { 9262 const value = state2[key]; 9263 if (customMapping?.hasOwnProperty(key)) { 9264 const customProps = customMapping[key](value); 9265 if (customProps != null) { 9266 Object.assign(props, customProps); 9267 } 9268 continue; 9269 } 9270 if (value === true) { 9271 props[`data-$key.toLowerCase()}`] = ""; 9272 } else if (value) { 9273 props[`data-$key.toLowerCase()}`] = value.toString(); 9274 } 9275 } 9276 return props; 9277 } 9278 9279 // node_modules/@base-ui/react/utils/resolveClassName.mjs 9280 function resolveClassName(className, state2) { 9281 return typeof className === "function" ? className(state2) : className; 9282 } 9283 9284 // node_modules/@base-ui/react/utils/resolveStyle.mjs 9285 function resolveStyle2(style, state2) { 9286 return typeof style === "function" ? style(state2) : style; 9287 } 9288 9289 // node_modules/@base-ui/react/merge-props/mergeProps.mjs 9290 var EMPTY_PROPS = {}; 9291 function mergeProps(a3, b3, c6, d3, e3) { 9292 if (!c6 && !d3 && !e3 && !a3) { 9293 return createInitialMergedProps(b3); 9294 } 9295 let merged = createInitialMergedProps(a3); 9296 if (b3) { 9297 merged = mergeInto(merged, b3); 9298 } 9299 if (c6) { 9300 merged = mergeInto(merged, c6); 9301 } 9302 if (d3) { 9303 merged = mergeInto(merged, d3); 9304 } 9305 if (e3) { 9306 merged = mergeInto(merged, e3); 9307 } 9308 return merged; 9309 } 9310 function mergePropsN(props) { 9311 if (props.length === 0) { 9312 return EMPTY_PROPS; 9313 } 9314 if (props.length === 1) { 9315 return createInitialMergedProps(props[0]); 9316 } 9317 let merged = createInitialMergedProps(props[0]); 9318 for (let i3 = 1; i3 < props.length; i3 += 1) { 9319 merged = mergeInto(merged, props[i3]); 9320 } 9321 return merged; 9322 } 9323 function createInitialMergedProps(inputProps) { 9324 if (isPropsGetter(inputProps)) { 9325 return { 9326 ...resolvePropsGetter(inputProps, EMPTY_PROPS) 9327 }; 9328 } 9329 return copyInitialProps(inputProps); 9330 } 9331 function mergeInto(merged, inputProps) { 9332 if (isPropsGetter(inputProps)) { 9333 return resolvePropsGetter(inputProps, merged); 9334 } 9335 return mutablyMergeInto(merged, inputProps); 9336 } 9337 function copyInitialProps(inputProps) { 9338 const copiedProps = { 9339 ...inputProps 9340 }; 9341 for (const propName in copiedProps) { 9342 const propValue = copiedProps[propName]; 9343 if (isEventHandler(propName, propValue)) { 9344 copiedProps[propName] = wrapEventHandler(propValue); 9345 } 9346 } 9347 return copiedProps; 9348 } 9349 function mutablyMergeInto(mergedProps, externalProps) { 9350 if (!externalProps) { 9351 return mergedProps; 9352 } 9353 for (const propName in externalProps) { 9354 const externalPropValue = externalProps[propName]; 9355 switch (propName) { 9356 case "style": { 9357 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); 9358 break; 9359 } 9360 case "className": { 9361 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); 9362 break; 9363 } 9364 default: { 9365 if (isEventHandler(propName, externalPropValue)) { 9366 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); 9367 } else { 9368 mergedProps[propName] = externalPropValue; 9369 } 9370 } 9371 } 9372 } 9373 return mergedProps; 9374 } 9375 function isEventHandler(key, value) { 9376 const code0 = key.charCodeAt(0); 9377 const code1 = key.charCodeAt(1); 9378 const code2 = key.charCodeAt(2); 9379 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); 9380 } 9381 function isPropsGetter(inputProps) { 9382 return typeof inputProps === "function"; 9383 } 9384 function resolvePropsGetter(inputProps, previousProps) { 9385 if (isPropsGetter(inputProps)) { 9386 return inputProps(previousProps); 9387 } 9388 return inputProps ?? EMPTY_PROPS; 9389 } 9390 function mergeEventHandlers(ourHandler, theirHandler) { 9391 if (!theirHandler) { 9392 return ourHandler; 9393 } 9394 if (!ourHandler) { 9395 return wrapEventHandler(theirHandler); 9396 } 9397 return (...args) => { 9398 const event = args[0]; 9399 if (isSyntheticEvent(event)) { 9400 const baseUIEvent = event; 9401 makeEventPreventable(baseUIEvent); 9402 const result2 = theirHandler(...args); 9403 if (!baseUIEvent.baseUIHandlerPrevented) { 9404 ourHandler?.(...args); 9405 } 9406 return result2; 9407 } 9408 const result = theirHandler(...args); 9409 ourHandler?.(...args); 9410 return result; 9411 }; 9412 } 9413 function wrapEventHandler(handler) { 9414 if (!handler) { 9415 return handler; 9416 } 9417 return (...args) => { 9418 const event = args[0]; 9419 if (isSyntheticEvent(event)) { 9420 makeEventPreventable(event); 9421 } 9422 return handler(...args); 9423 }; 9424 } 9425 function makeEventPreventable(event) { 9426 event.preventBaseUIHandler = () => { 9427 event.baseUIHandlerPrevented = true; 9428 }; 9429 return event; 9430 } 9431 function mergeClassNames(ourClassName, theirClassName) { 9432 if (theirClassName) { 9433 if (ourClassName) { 9434 return theirClassName + " " + ourClassName; 9435 } 9436 return theirClassName; 9437 } 9438 return ourClassName; 9439 } 9440 function isSyntheticEvent(event) { 9441 return event != null && typeof event === "object" && "nativeEvent" in event; 9442 } 9443 9444 // node_modules/@base-ui/react/internals/useRenderElement.mjs 9445 var import_react = __toESM(require_react(), 1); 9446 function useRenderElement(element, componentProps, params = {}) { 9447 const renderProp = componentProps.render; 9448 const outProps = useRenderElementProps(componentProps, params); 9449 if (params.enabled === false) { 9450 return null; 9451 } 9452 const state2 = params.state ?? EMPTY_OBJECT3; 9453 return evaluateRenderProp(element, renderProp, outProps, state2); 9454 } 9455 function useRenderElementProps(componentProps, params = {}) { 9456 const { 9457 className: classNameProp, 9458 style: styleProp, 9459 render: renderProp 9460 } = componentProps; 9461 const { 9462 state: state2 = EMPTY_OBJECT3, 9463 ref, 9464 props, 9465 stateAttributesMapping: stateAttributesMapping6, 9466 enabled = true 9467 } = params; 9468 const className = enabled ? resolveClassName(classNameProp, state2) : void 0; 9469 const style = enabled ? resolveStyle2(styleProp, state2) : void 0; 9470 const stateProps = enabled ? getStateAttributesProps(state2, stateAttributesMapping6) : EMPTY_OBJECT3; 9471 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; 9472 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT3; 9473 if (typeof document !== "undefined") { 9474 if (!enabled) { 9475 useMergedRefs(null, null); 9476 } else if (Array.isArray(ref)) { 9477 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); 9478 } else { 9479 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); 9480 } 9481 } 9482 if (!enabled) { 9483 return EMPTY_OBJECT3; 9484 } 9485 if (className !== void 0) { 9486 outProps.className = mergeClassNames(outProps.className, className); 9487 } 9488 if (style !== void 0) { 9489 outProps.style = mergeObjects(outProps.style, style); 9490 } 9491 return outProps; 9492 } 9493 function resolveRenderFunctionProps(props) { 9494 if (Array.isArray(props)) { 9495 return mergePropsN(props); 9496 } 9497 return mergeProps(void 0, props); 9498 } 9499 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); 9500 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; 9501 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; 9502 function evaluateRenderProp(element, render5, props, state2) { 9503 if (render5) { 9504 if (typeof render5 === "function") { 9505 if (true) { 9506 warnIfRenderPropLooksLikeComponent(render5); 9507 } 9508 return render5(props, state2); 9509 } 9510 const mergedProps = mergeProps(props, render5.props); 9511 mergedProps.ref = props.ref; 9512 let newElement = render5; 9513 if (newElement?.$$typeof === REACT_LAZY_TYPE) { 9514 const children = React10.Children.toArray(render5); 9515 newElement = children[0]; 9516 } 9517 if (true) { 9518 if (!/* @__PURE__ */ React10.isValidElement(newElement)) { 9519 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")); 9520 } 9521 } 9522 return /* @__PURE__ */ React10.cloneElement(newElement, mergedProps); 9523 } 9524 if (element) { 9525 if (typeof element === "string") { 9526 return renderTag(element, props); 9527 } 9528 } 9529 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8)); 9530 } 9531 function warnIfRenderPropLooksLikeComponent(renderFn) { 9532 const functionName = renderFn.name; 9533 if (functionName.length === 0) { 9534 return; 9535 } 9536 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { 9537 return; 9538 } 9539 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { 9540 return; 9541 } 9542 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"); 9543 } 9544 function renderTag(Tag, props) { 9545 if (Tag === "button") { 9546 return /* @__PURE__ */ (0, import_react.createElement)("button", { 9547 type: "button", 9548 ...props, 9549 key: props.key 9550 }); 9551 } 9552 if (Tag === "img") { 9553 return /* @__PURE__ */ (0, import_react.createElement)("img", { 9554 alt: "", 9555 ...props, 9556 key: props.key 9557 }); 9558 } 9559 return /* @__PURE__ */ React10.createElement(Tag, props); 9560 } 9561 9562 // node_modules/@base-ui/utils/useId.mjs 9563 var React11 = __toESM(require_react(), 1); 9564 var globalId = 0; 9565 function useGlobalId(idOverride, prefix2 = "mui") { 9566 const [defaultId, setDefaultId] = React11.useState(idOverride); 9567 const id = idOverride || defaultId; 9568 React11.useEffect(() => { 9569 if (defaultId == null) { 9570 globalId += 1; 9571 setDefaultId(`$prefix2}-$globalId}`); 9572 } 9573 }, [defaultId, prefix2]); 9574 return id; 9575 } 9576 var maybeReactUseId = SafeReact.useId; 9577 function useId(idOverride, prefix2) { 9578 if (maybeReactUseId !== void 0) { 9579 const reactId = maybeReactUseId(); 9580 return idOverride ?? (prefix2 ? `$prefix2}-$reactId}` : reactId); 9581 } 9582 return useGlobalId(idOverride, prefix2); 9583 } 9584 9585 // node_modules/@base-ui/react/internals/useBaseUiId.mjs 9586 function useBaseUiId(idOverride) { 9587 return useId(idOverride, "base-ui"); 9588 } 9589 9590 // node_modules/@base-ui/react/collapsible/root/useCollapsibleRoot.mjs 9591 var React14 = __toESM(require_react(), 1); 9592 9593 // node_modules/@base-ui/react/internals/reason-parts.mjs 9594 var reason_parts_exports = {}; 9595 __export(reason_parts_exports, { 9596 cancelOpen: () => cancelOpen, 9597 chipRemovePress: () => chipRemovePress, 9598 clearPress: () => clearPress, 9599 closePress: () => closePress, 9600 closeWatcher: () => closeWatcher, 9601 decrementPress: () => decrementPress, 9602 disabled: () => disabled, 9603 drag: () => drag, 9604 escapeKey: () => escapeKey, 9605 focusOut: () => focusOut, 9606 imperativeAction: () => imperativeAction, 9607 incrementPress: () => incrementPress, 9608 initial: () => initial, 9609 inputBlur: () => inputBlur, 9610 inputChange: () => inputChange, 9611 inputClear: () => inputClear, 9612 inputPaste: () => inputPaste, 9613 inputPress: () => inputPress, 9614 itemPress: () => itemPress, 9615 keyboard: () => keyboard, 9616 linkPress: () => linkPress, 9617 listNavigation: () => listNavigation, 9618 missing: () => missing, 9619 none: () => none, 9620 outsidePress: () => outsidePress, 9621 pointer: () => pointer, 9622 scrub: () => scrub, 9623 siblingOpen: () => siblingOpen, 9624 swipe: () => swipe, 9625 trackPress: () => trackPress, 9626 triggerFocus: () => triggerFocus, 9627 triggerHover: () => triggerHover, 9628 triggerPress: () => triggerPress, 9629 wheel: () => wheel, 9630 windowResize: () => windowResize 9631 }); 9632 var none = "none"; 9633 var triggerPress = "trigger-press"; 9634 var triggerHover = "trigger-hover"; 9635 var triggerFocus = "trigger-focus"; 9636 var outsidePress = "outside-press"; 9637 var itemPress = "item-press"; 9638 var closePress = "close-press"; 9639 var linkPress = "link-press"; 9640 var clearPress = "clear-press"; 9641 var chipRemovePress = "chip-remove-press"; 9642 var trackPress = "track-press"; 9643 var incrementPress = "increment-press"; 9644 var decrementPress = "decrement-press"; 9645 var inputChange = "input-change"; 9646 var inputClear = "input-clear"; 9647 var inputBlur = "input-blur"; 9648 var inputPaste = "input-paste"; 9649 var inputPress = "input-press"; 9650 var focusOut = "focus-out"; 9651 var escapeKey = "escape-key"; 9652 var closeWatcher = "close-watcher"; 9653 var listNavigation = "list-navigation"; 9654 var keyboard = "keyboard"; 9655 var pointer = "pointer"; 9656 var drag = "drag"; 9657 var wheel = "wheel"; 9658 var scrub = "scrub"; 9659 var cancelOpen = "cancel-open"; 9660 var siblingOpen = "sibling-open"; 9661 var disabled = "disabled"; 9662 var missing = "missing"; 9663 var initial = "initial"; 9664 var imperativeAction = "imperative-action"; 9665 var swipe = "swipe"; 9666 var windowResize = "window-resize"; 9667 9668 // node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs 9669 function createChangeEventDetails(reason, event, trigger, customProperties) { 9670 let canceled = false; 9671 let allowPropagation = false; 9672 const custom = customProperties ?? EMPTY_OBJECT3; 9673 const details = { 9674 reason, 9675 event: event ?? new Event("base-ui"), 9676 cancel() { 9677 canceled = true; 9678 }, 9679 allowPropagation() { 9680 allowPropagation = true; 9681 }, 9682 get isCanceled() { 9683 return canceled; 9684 }, 9685 get isPropagationAllowed() { 9686 return allowPropagation; 9687 }, 9688 trigger, 9689 ...custom 9690 }; 9691 return details; 9692 } 9693 9694 // node_modules/@base-ui/react/internals/useTransitionStatus.mjs 9695 var React13 = __toESM(require_react(), 1); 9696 9697 // node_modules/@base-ui/utils/useOnMount.mjs 9698 var React12 = __toESM(require_react(), 1); 9699 var EMPTY = []; 9700 function useOnMount(fn) { 9701 React12.useEffect(fn, EMPTY); 9702 } 9703 9704 // node_modules/@base-ui/utils/useAnimationFrame.mjs 9705 var EMPTY2 = null; 9706 var LAST_RAF = globalThis.requestAnimationFrame; 9707 var Scheduler = class { 9708 /* This implementation uses an array as a backing data-structure for frame callbacks. 9709 * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it 9710 * never calls the native `cancelAnimationFrame` if there are no frames left. This can 9711 * be much more efficient if there is a call pattern that alterns as 9712 * "request-cancel-request-cancel-…". 9713 * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation 9714 * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */ 9715 callbacks = []; 9716 callbacksCount = 0; 9717 nextId = 1; 9718 startId = 1; 9719 isScheduled = false; 9720 tick = (timestamp) => { 9721 this.isScheduled = false; 9722 const currentCallbacks = this.callbacks; 9723 const currentCallbacksCount = this.callbacksCount; 9724 this.callbacks = []; 9725 this.callbacksCount = 0; 9726 this.startId = this.nextId; 9727 if (currentCallbacksCount > 0) { 9728 for (let i3 = 0; i3 < currentCallbacks.length; i3 += 1) { 9729 currentCallbacks[i3]?.(timestamp); 9730 } 9731 } 9732 }; 9733 request(fn) { 9734 const id = this.nextId; 9735 this.nextId += 1; 9736 this.callbacks.push(fn); 9737 this.callbacksCount += 1; 9738 const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true); 9739 if (!this.isScheduled || didRAFChange) { 9740 requestAnimationFrame(this.tick); 9741 this.isScheduled = true; 9742 } 9743 return id; 9744 } 9745 cancel(id) { 9746 const index2 = id - this.startId; 9747 if (index2 < 0 || index2 >= this.callbacks.length) { 9748 return; 9749 } 9750 this.callbacks[index2] = null; 9751 this.callbacksCount -= 1; 9752 } 9753 }; 9754 var scheduler = new Scheduler(); 9755 var AnimationFrame = class _AnimationFrame { 9756 static create() { 9757 return new _AnimationFrame(); 9758 } 9759 static request(fn) { 9760 return scheduler.request(fn); 9761 } 9762 static cancel(id) { 9763 return scheduler.cancel(id); 9764 } 9765 currentId = EMPTY2; 9766 /** 9767 * Executes `fn` after `delay`, clearing any previously scheduled call. 9768 */ 9769 request(fn) { 9770 this.cancel(); 9771 this.currentId = scheduler.request(() => { 9772 this.currentId = EMPTY2; 9773 fn(); 9774 }); 9775 } 9776 cancel = () => { 9777 if (this.currentId !== EMPTY2) { 9778 scheduler.cancel(this.currentId); 9779 this.currentId = EMPTY2; 9780 } 9781 }; 9782 disposeEffect = () => { 9783 return this.cancel; 9784 }; 9785 }; 9786 function useAnimationFrame() { 9787 const timeout = useRefWithInit(AnimationFrame.create).current; 9788 useOnMount(timeout.disposeEffect); 9789 return timeout; 9790 } 9791 9792 // node_modules/@base-ui/react/internals/useTransitionStatus.mjs 9793 function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) { 9794 const [transitionStatus, setTransitionStatus] = React13.useState(open && enableIdleState ? "idle" : void 0); 9795 const [mounted, setMounted] = React13.useState(open); 9796 if (open && !mounted) { 9797 setMounted(true); 9798 setTransitionStatus("starting"); 9799 } 9800 if (!open && mounted && transitionStatus !== "ending" && !deferEndingState) { 9801 setTransitionStatus("ending"); 9802 } 9803 if (!open && !mounted && transitionStatus === "ending") { 9804 setTransitionStatus(void 0); 9805 } 9806 useIsoLayoutEffect(() => { 9807 if (!open && mounted && transitionStatus !== "ending" && deferEndingState) { 9808 const frame = AnimationFrame.request(() => { 9809 setTransitionStatus("ending"); 9810 }); 9811 return () => { 9812 AnimationFrame.cancel(frame); 9813 }; 9814 } 9815 return void 0; 9816 }, [open, mounted, transitionStatus, deferEndingState]); 9817 useIsoLayoutEffect(() => { 9818 if (!open || enableIdleState) { 9819 return void 0; 9820 } 9821 const frame = AnimationFrame.request(() => { 9822 setTransitionStatus(void 0); 9823 }); 9824 return () => { 9825 AnimationFrame.cancel(frame); 9826 }; 9827 }, [enableIdleState, open]); 9828 useIsoLayoutEffect(() => { 9829 if (!open || !enableIdleState) { 9830 return void 0; 9831 } 9832 if (open && mounted && transitionStatus !== "idle") { 9833 setTransitionStatus("starting"); 9834 } 9835 const frame = AnimationFrame.request(() => { 9836 setTransitionStatus("idle"); 9837 }); 9838 return () => { 9839 AnimationFrame.cancel(frame); 9840 }; 9841 }, [enableIdleState, open, mounted, transitionStatus]); 9842 return { 9843 mounted, 9844 setMounted, 9845 transitionStatus 9846 }; 9847 } 9848 9849 // node_modules/@base-ui/react/collapsible/root/useCollapsibleRoot.mjs 9850 function useCollapsibleRoot(parameters) { 9851 const { 9852 open: openParam, 9853 defaultOpen, 9854 onOpenChange, 9855 disabled: disabled2 9856 } = parameters; 9857 const [open, setOpen] = useControlled({ 9858 controlled: openParam, 9859 default: defaultOpen, 9860 name: "Collapsible", 9861 state: "open" 9862 }); 9863 const { 9864 mounted, 9865 setMounted, 9866 transitionStatus 9867 } = useTransitionStatus(open, true, true); 9868 const defaultPanelId = useBaseUiId(); 9869 const [panelIdState, setPanelIdState] = React14.useState(); 9870 const panelId = panelIdState ?? defaultPanelId; 9871 const handleTrigger = useStableCallback((event) => { 9872 const nextOpen = !open; 9873 const eventDetails = createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent); 9874 onOpenChange(nextOpen, eventDetails); 9875 if (eventDetails.isCanceled) { 9876 return; 9877 } 9878 setOpen(nextOpen); 9879 }); 9880 return React14.useMemo(() => ({ 9881 disabled: disabled2, 9882 handleTrigger, 9883 mounted, 9884 open, 9885 panelId, 9886 setMounted, 9887 setOpen, 9888 setPanelIdState, 9889 transitionStatus 9890 }), [disabled2, handleTrigger, mounted, open, panelId, setMounted, setOpen, setPanelIdState, transitionStatus]); 9891 } 9892 9893 // node_modules/@base-ui/react/collapsible/root/CollapsibleRootContext.mjs 9894 var React15 = __toESM(require_react(), 1); 9895 var CollapsibleRootContext = /* @__PURE__ */ React15.createContext(void 0); 9896 if (true) CollapsibleRootContext.displayName = "CollapsibleRootContext"; 9897 function useCollapsibleRootContext() { 9898 const context = React15.useContext(CollapsibleRootContext); 9899 if (context === void 0) { 9900 throw new Error(true ? "Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within <Collapsible.Root>." : formatErrorMessage_default(15)); 9901 } 9902 return context; 9903 } 9904 9905 // node_modules/@base-ui/react/internals/composite/list/useCompositeListItem.mjs 9906 var React16 = __toESM(require_react(), 1); 9907 var IndexGuessBehavior = /* @__PURE__ */ (function(IndexGuessBehavior2) { 9908 IndexGuessBehavior2[IndexGuessBehavior2["None"] = 0] = "None"; 9909 IndexGuessBehavior2[IndexGuessBehavior2["GuessFromOrder"] = 1] = "GuessFromOrder"; 9910 return IndexGuessBehavior2; 9911 })({}); 9912 function useCompositeListItem(params = {}) { 9913 const { 9914 label, 9915 metadata, 9916 textRef, 9917 indexGuessBehavior, 9918 index: externalIndex 9919 } = params; 9920 const { 9921 register: register5, 9922 unregister, 9923 subscribeMapChange, 9924 elementsRef, 9925 labelsRef, 9926 nextIndexRef 9927 } = useCompositeListContext(); 9928 const indexRef = React16.useRef(-1); 9929 const [index2, setIndex] = React16.useState(externalIndex ?? (indexGuessBehavior === IndexGuessBehavior.GuessFromOrder ? () => { 9930 if (indexRef.current === -1) { 9931 const newIndex = nextIndexRef.current; 9932 nextIndexRef.current += 1; 9933 indexRef.current = newIndex; 9934 } 9935 return indexRef.current; 9936 } : -1)); 9937 const componentRef = React16.useRef(null); 9938 const ref = React16.useCallback((node) => { 9939 componentRef.current = node; 9940 if (index2 !== -1 && node !== null) { 9941 elementsRef.current[index2] = node; 9942 if (labelsRef) { 9943 const isLabelDefined = label !== void 0; 9944 labelsRef.current[index2] = isLabelDefined ? label : textRef?.current?.textContent ?? node.textContent; 9945 } 9946 } 9947 }, [index2, elementsRef, labelsRef, label, textRef]); 9948 useIsoLayoutEffect(() => { 9949 if (externalIndex != null) { 9950 return void 0; 9951 } 9952 const node = componentRef.current; 9953 if (node) { 9954 register5(node, metadata); 9955 return () => { 9956 unregister(node); 9957 }; 9958 } 9959 return void 0; 9960 }, [externalIndex, register5, unregister, metadata]); 9961 useIsoLayoutEffect(() => { 9962 if (externalIndex != null) { 9963 return void 0; 9964 } 9965 return subscribeMapChange((map) => { 9966 const i3 = componentRef.current ? map.get(componentRef.current)?.index : null; 9967 if (i3 != null) { 9968 setIndex(i3); 9969 } 9970 }); 9971 }, [externalIndex, subscribeMapChange, setIndex]); 9972 return { 9973 ref, 9974 index: index2 9975 }; 9976 } 9977 9978 // node_modules/@base-ui/react/internals/stateAttributesMapping.mjs 9979 var TransitionStatusDataAttributes = /* @__PURE__ */ (function(TransitionStatusDataAttributes2) { 9980 TransitionStatusDataAttributes2["startingStyle"] = "data-starting-style"; 9981 TransitionStatusDataAttributes2["endingStyle"] = "data-ending-style"; 9982 return TransitionStatusDataAttributes2; 9983 })({}); 9984 var STARTING_HOOK = { 9985 [TransitionStatusDataAttributes.startingStyle]: "" 9986 }; 9987 var ENDING_HOOK = { 9988 [TransitionStatusDataAttributes.endingStyle]: "" 9989 }; 9990 var transitionStatusMapping = { 9991 transitionStatus(value) { 9992 if (value === "starting") { 9993 return STARTING_HOOK; 9994 } 9995 if (value === "ending") { 9996 return ENDING_HOOK; 9997 } 9998 return null; 9999 } 10000 }; 10001 10002 // node_modules/@base-ui/react/collapsible/panel/CollapsiblePanelDataAttributes.mjs 10003 var CollapsiblePanelDataAttributes = (function(CollapsiblePanelDataAttributes2) { 10004 CollapsiblePanelDataAttributes2["open"] = "data-open"; 10005 CollapsiblePanelDataAttributes2["closed"] = "data-closed"; 10006 CollapsiblePanelDataAttributes2[CollapsiblePanelDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle"; 10007 CollapsiblePanelDataAttributes2[CollapsiblePanelDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle"; 10008 return CollapsiblePanelDataAttributes2; 10009 })({}); 10010 10011 // node_modules/@base-ui/react/collapsible/trigger/CollapsibleTriggerDataAttributes.mjs 10012 var CollapsibleTriggerDataAttributes = /* @__PURE__ */ (function(CollapsibleTriggerDataAttributes2) { 10013 CollapsibleTriggerDataAttributes2["panelOpen"] = "data-panel-open"; 10014 return CollapsibleTriggerDataAttributes2; 10015 })({}); 10016 10017 // node_modules/@base-ui/react/utils/collapsibleOpenStateMapping.mjs 10018 var PANEL_OPEN_HOOK = { 10019 [CollapsiblePanelDataAttributes.open]: "" 10020 }; 10021 var PANEL_CLOSED_HOOK = { 10022 [CollapsiblePanelDataAttributes.closed]: "" 10023 }; 10024 var triggerOpenStateMapping = { 10025 open(value) { 10026 if (value) { 10027 return { 10028 [CollapsibleTriggerDataAttributes.panelOpen]: "" 10029 }; 10030 } 10031 return null; 10032 } 10033 }; 10034 var collapsibleOpenStateMapping = { 10035 open(value) { 10036 if (value) { 10037 return PANEL_OPEN_HOOK; 10038 } 10039 return PANEL_CLOSED_HOOK; 10040 } 10041 }; 10042 10043 // node_modules/@base-ui/react/internals/use-button/useButton.mjs 10044 var React19 = __toESM(require_react(), 1); 10045 10046 // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs 10047 function hasWindow() { 10048 return typeof window !== "undefined"; 10049 } 10050 function getNodeName(node) { 10051 if (isNode(node)) { 10052 return (node.nodeName || "").toLowerCase(); 10053 } 10054 return "#document"; 10055 } 10056 function getWindow(node) { 10057 var _node$ownerDocument; 10058 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; 10059 } 10060 function getDocumentElement(node) { 10061 var _ref; 10062 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; 10063 } 10064 function isNode(value) { 10065 if (!hasWindow()) { 10066 return false; 10067 } 10068 return value instanceof Node || value instanceof getWindow(value).Node; 10069 } 10070 function isElement(value) { 10071 if (!hasWindow()) { 10072 return false; 10073 } 10074 return value instanceof Element || value instanceof getWindow(value).Element; 10075 } 10076 function isHTMLElement(value) { 10077 if (!hasWindow()) { 10078 return false; 10079 } 10080 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; 10081 } 10082 function isShadowRoot(value) { 10083 if (!hasWindow() || typeof ShadowRoot === "undefined") { 10084 return false; 10085 } 10086 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; 10087 } 10088 function isOverflowElement(element) { 10089 const { 10090 overflow, 10091 overflowX, 10092 overflowY, 10093 display 10094 } = getComputedStyle2(element); 10095 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents"; 10096 } 10097 function isTableElement(element) { 10098 return /^(table|td|th)$/.test(getNodeName(element)); 10099 } 10100 function isTopLayer(element) { 10101 try { 10102 if (element.matches(":popover-open")) { 10103 return true; 10104 } 10105 } catch (_e) { 10106 } 10107 try { 10108 return element.matches(":modal"); 10109 } catch (_e) { 10110 return false; 10111 } 10112 } 10113 var willChangeRe = /transform|translate|scale|rotate|perspective|filter/; 10114 var containRe = /paint|layout|strict|content/; 10115 var isNotNone = (value) => !!value && value !== "none"; 10116 var isWebKitValue; 10117 function isContainingBlock(elementOrCss) { 10118 const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss; 10119 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 || ""); 10120 } 10121 function getContainingBlock(element) { 10122 let currentNode = getParentNode(element); 10123 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { 10124 if (isContainingBlock(currentNode)) { 10125 return currentNode; 10126 } else if (isTopLayer(currentNode)) { 10127 return null; 10128 } 10129 currentNode = getParentNode(currentNode); 10130 } 10131 return null; 10132 } 10133 function isWebKit() { 10134 if (isWebKitValue == null) { 10135 isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"); 10136 } 10137 return isWebKitValue; 10138 } 10139 function isLastTraversableNode(node) { 10140 return /^(html|body|#document)$/.test(getNodeName(node)); 10141 } 10142 function getComputedStyle2(element) { 10143 return getWindow(element).getComputedStyle(element); 10144 } 10145 function getNodeScroll(element) { 10146 if (isElement(element)) { 10147 return { 10148 scrollLeft: element.scrollLeft, 10149 scrollTop: element.scrollTop 10150 }; 10151 } 10152 return { 10153 scrollLeft: element.scrollX, 10154 scrollTop: element.scrollY 10155 }; 10156 } 10157 function getParentNode(node) { 10158 if (getNodeName(node) === "html") { 10159 return node; 10160 } 10161 const result = ( 10162 // Step into the shadow DOM of the parent of a slotted node. 10163 node.assignedSlot || // DOM Element detected. 10164 node.parentNode || // ShadowRoot detected. 10165 isShadowRoot(node) && node.host || // Fallback. 10166 getDocumentElement(node) 10167 ); 10168 return isShadowRoot(result) ? result.host : result; 10169 } 10170 function getNearestOverflowAncestor(node) { 10171 const parentNode = getParentNode(node); 10172 if (isLastTraversableNode(parentNode)) { 10173 return node.ownerDocument ? node.ownerDocument.body : node.body; 10174 } 10175 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { 10176 return parentNode; 10177 } 10178 return getNearestOverflowAncestor(parentNode); 10179 } 10180 function getOverflowAncestors(node, list, traverseIframes) { 10181 var _node$ownerDocument2; 10182 if (list === void 0) { 10183 list = []; 10184 } 10185 if (traverseIframes === void 0) { 10186 traverseIframes = true; 10187 } 10188 const scrollableAncestor = getNearestOverflowAncestor(node); 10189 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); 10190 const win = getWindow(scrollableAncestor); 10191 if (isBody) { 10192 const frameElement = getFrameElement(win); 10193 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); 10194 } else { 10195 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); 10196 } 10197 } 10198 function getFrameElement(win) { 10199 return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; 10200 } 10201 10202 // node_modules/@base-ui/react/internals/composite/root/CompositeRootContext.mjs 10203 var React17 = __toESM(require_react(), 1); 10204 var CompositeRootContext = /* @__PURE__ */ React17.createContext(void 0); 10205 if (true) CompositeRootContext.displayName = "CompositeRootContext"; 10206 function useCompositeRootContext(optional = false) { 10207 const context = React17.useContext(CompositeRootContext); 10208 if (context === void 0 && !optional) { 10209 throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : formatErrorMessage_default(16)); 10210 } 10211 return context; 10212 } 10213 10214 // node_modules/@base-ui/react/utils/useFocusableWhenDisabled.mjs 10215 var React18 = __toESM(require_react(), 1); 10216 function useFocusableWhenDisabled(parameters) { 10217 const { 10218 focusableWhenDisabled, 10219 disabled: disabled2, 10220 composite = false, 10221 tabIndex: tabIndexProp = 0, 10222 isNativeButton 10223 } = parameters; 10224 const isFocusableComposite = composite && focusableWhenDisabled !== false; 10225 const isNonFocusableComposite = composite && focusableWhenDisabled === false; 10226 const props = React18.useMemo(() => { 10227 const additionalProps = { 10228 // allow Tabbing away from focusableWhenDisabled elements 10229 onKeyDown(event) { 10230 if (disabled2 && focusableWhenDisabled && event.key !== "Tab") { 10231 event.preventDefault(); 10232 } 10233 } 10234 }; 10235 if (!composite) { 10236 additionalProps.tabIndex = tabIndexProp; 10237 if (!isNativeButton && disabled2) { 10238 additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1; 10239 } 10240 } 10241 if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) { 10242 additionalProps["aria-disabled"] = disabled2; 10243 } 10244 if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) { 10245 additionalProps.disabled = disabled2; 10246 } 10247 return additionalProps; 10248 }, [composite, disabled2, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]); 10249 return { 10250 props 10251 }; 10252 } 10253 10254 // node_modules/@base-ui/react/internals/use-button/useButton.mjs 10255 function useButton(parameters = {}) { 10256 const { 10257 disabled: disabled2 = false, 10258 focusableWhenDisabled, 10259 tabIndex = 0, 10260 native: isNativeButton = true, 10261 composite: compositeProp 10262 } = parameters; 10263 const elementRef = React19.useRef(null); 10264 const compositeRootContext = useCompositeRootContext(true); 10265 const isCompositeItem = compositeProp ?? compositeRootContext !== void 0; 10266 const { 10267 props: focusableWhenDisabledProps 10268 } = useFocusableWhenDisabled({ 10269 focusableWhenDisabled, 10270 disabled: disabled2, 10271 composite: isCompositeItem, 10272 tabIndex, 10273 isNativeButton 10274 }); 10275 if (true) { 10276 React19.useEffect(() => { 10277 if (!elementRef.current) { 10278 return; 10279 } 10280 const isButtonTag = isButtonElement(elementRef.current); 10281 if (isNativeButton) { 10282 if (!isButtonTag) { 10283 const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; 10284 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`."; 10285 error(`$message2}$ownerStackMessage}`); 10286 } 10287 } else if (isButtonTag) { 10288 const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; 10289 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`."; 10290 error(`$message2}$ownerStackMessage}`); 10291 } 10292 }, [isNativeButton]); 10293 } 10294 const updateDisabled = React19.useCallback(() => { 10295 const element = elementRef.current; 10296 if (!isButtonElement(element)) { 10297 return; 10298 } 10299 if (isCompositeItem && disabled2 && focusableWhenDisabledProps.disabled === void 0 && element.disabled) { 10300 element.disabled = false; 10301 } 10302 }, [disabled2, focusableWhenDisabledProps.disabled, isCompositeItem]); 10303 useIsoLayoutEffect(updateDisabled, [updateDisabled]); 10304 const getButtonProps = React19.useCallback((externalProps = {}) => { 10305 const { 10306 onClick: externalOnClick, 10307 onMouseDown: externalOnMouseDown, 10308 onKeyUp: externalOnKeyUp, 10309 onKeyDown: externalOnKeyDown, 10310 onPointerDown: externalOnPointerDown, 10311 ...otherExternalProps 10312 } = externalProps; 10313 return mergeProps({ 10314 onClick(event) { 10315 if (disabled2) { 10316 event.preventDefault(); 10317 return; 10318 } 10319 externalOnClick?.(event); 10320 }, 10321 onMouseDown(event) { 10322 if (!disabled2) { 10323 externalOnMouseDown?.(event); 10324 } 10325 }, 10326 onKeyDown(event) { 10327 if (disabled2) { 10328 return; 10329 } 10330 makeEventPreventable(event); 10331 externalOnKeyDown?.(event); 10332 if (event.baseUIHandlerPrevented) { 10333 return; 10334 } 10335 const isCurrentTarget = event.target === event.currentTarget; 10336 const currentTarget = event.currentTarget; 10337 const isButton2 = isButtonElement(currentTarget); 10338 const isLink = !isNativeButton && isValidLinkElement(currentTarget); 10339 const shouldClick = isCurrentTarget && (isNativeButton ? isButton2 : !isLink); 10340 const isEnterKey = event.key === "Enter"; 10341 const isSpaceKey = event.key === " "; 10342 const role = currentTarget.getAttribute("role"); 10343 const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell"; 10344 if (isCurrentTarget && isCompositeItem && isSpaceKey) { 10345 if (event.defaultPrevented && isTextNavigationRole) { 10346 return; 10347 } 10348 event.preventDefault(); 10349 if (isLink || isNativeButton && isButton2) { 10350 currentTarget.click(); 10351 event.preventBaseUIHandler(); 10352 } else if (shouldClick) { 10353 externalOnClick?.(event); 10354 event.preventBaseUIHandler(); 10355 } 10356 return; 10357 } 10358 if (shouldClick) { 10359 if (!isNativeButton && (isSpaceKey || isEnterKey)) { 10360 event.preventDefault(); 10361 } 10362 if (!isNativeButton && isEnterKey) { 10363 externalOnClick?.(event); 10364 } 10365 } 10366 }, 10367 onKeyUp(event) { 10368 if (disabled2) { 10369 return; 10370 } 10371 makeEventPreventable(event); 10372 externalOnKeyUp?.(event); 10373 if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") { 10374 event.preventDefault(); 10375 return; 10376 } 10377 if (event.baseUIHandlerPrevented) { 10378 return; 10379 } 10380 if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && event.key === " ") { 10381 externalOnClick?.(event); 10382 } 10383 }, 10384 onPointerDown(event) { 10385 if (disabled2) { 10386 event.preventDefault(); 10387 return; 10388 } 10389 externalOnPointerDown?.(event); 10390 } 10391 }, isNativeButton ? { 10392 type: "button" 10393 } : { 10394 role: "button" 10395 }, focusableWhenDisabledProps, otherExternalProps); 10396 }, [disabled2, focusableWhenDisabledProps, isCompositeItem, isNativeButton]); 10397 const buttonRef = useStableCallback((element) => { 10398 elementRef.current = element; 10399 updateDisabled(); 10400 }); 10401 return { 10402 getButtonProps, 10403 buttonRef 10404 }; 10405 } 10406 function isButtonElement(elem) { 10407 return isHTMLElement(elem) && elem.tagName === "BUTTON"; 10408 } 10409 function isValidLinkElement(elem) { 10410 return Boolean(elem?.tagName === "A" && elem?.href); 10411 } 10412 10413 // node_modules/@base-ui/react/collapsible/panel/useCollapsiblePanel.mjs 10414 var React21 = __toESM(require_react(), 1); 10415 10416 // node_modules/@base-ui/utils/addEventListener.mjs 10417 function addEventListener(target, type, listener, options) { 10418 target.addEventListener(type, listener, options); 10419 return () => { 10420 target.removeEventListener(type, listener, options); 10421 }; 10422 } 10423 10424 // node_modules/@base-ui/utils/useValueAsRef.mjs 10425 function useValueAsRef(value) { 10426 const latest = useRefWithInit(createLatestRef, value).current; 10427 latest.next = value; 10428 useIsoLayoutEffect(latest.effect); 10429 return latest; 10430 } 10431 function createLatestRef(value) { 10432 const latest = { 10433 current: value, 10434 next: value, 10435 effect: () => { 10436 latest.current = latest.next; 10437 } 10438 }; 10439 return latest; 10440 } 10441 10442 // node_modules/@base-ui/utils/owner.mjs 10443 function ownerDocument(node) { 10444 return node?.ownerDocument || document; 10445 } 10446 10447 // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs 10448 var React20 = __toESM(require_react(), 1); 10449 10450 // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs 10451 var ReactDOM = __toESM(require_react_dom(), 1); 10452 10453 // node_modules/@base-ui/react/utils/resolveRef.mjs 10454 function resolveRef(maybeRef) { 10455 if (maybeRef == null) { 10456 return maybeRef; 10457 } 10458 return "current" in maybeRef ? maybeRef.current : maybeRef; 10459 } 10460 10461 // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs 10462 function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, treatAbortedAsFinished = true) { 10463 const frame = useAnimationFrame(); 10464 return useStableCallback((fnToExecute, signal = null) => { 10465 frame.cancel(); 10466 const element = resolveRef(elementOrRef); 10467 if (element == null) { 10468 return; 10469 } 10470 const resolvedElement = element; 10471 const done = () => { 10472 ReactDOM.flushSync(fnToExecute); 10473 }; 10474 if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) { 10475 fnToExecute(); 10476 return; 10477 } 10478 function exec() { 10479 Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => { 10480 if (!signal?.aborted) { 10481 done(); 10482 } 10483 }).catch(() => { 10484 if (treatAbortedAsFinished) { 10485 if (!signal?.aborted) { 10486 done(); 10487 } 10488 return; 10489 } 10490 const currentAnimations = resolvedElement.getAnimations(); 10491 if (!signal?.aborted && currentAnimations.length > 0 && currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) { 10492 exec(); 10493 } 10494 }); 10495 } 10496 if (waitForStartingStyleRemoved) { 10497 const startingStyleAttribute = TransitionStatusDataAttributes.startingStyle; 10498 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 10499 frame.request(exec); 10500 return; 10501 } 10502 const attributeObserver = new MutationObserver(() => { 10503 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 10504 attributeObserver.disconnect(); 10505 exec(); 10506 } 10507 }); 10508 attributeObserver.observe(resolvedElement, { 10509 attributes: true, 10510 attributeFilter: [startingStyleAttribute] 10511 }); 10512 signal?.addEventListener("abort", () => attributeObserver.disconnect(), { 10513 once: true 10514 }); 10515 return; 10516 } 10517 frame.request(exec); 10518 }); 10519 } 10520 10521 // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs 10522 function useOpenChangeComplete(parameters) { 10523 const { 10524 enabled = true, 10525 open, 10526 ref, 10527 onComplete: onCompleteParam 10528 } = parameters; 10529 const onComplete = useStableCallback(onCompleteParam); 10530 const runOnceAnimationsFinish = useAnimationsFinished(ref, open, false); 10531 React20.useEffect(() => { 10532 if (!enabled) { 10533 return void 0; 10534 } 10535 const abortController = new AbortController(); 10536 runOnceAnimationsFinish(onComplete, abortController.signal); 10537 return () => { 10538 abortController.abort(); 10539 }; 10540 }, [enabled, open, onComplete, runOnceAnimationsFinish]); 10541 } 10542 10543 // node_modules/@base-ui/react/collapsible/panel/useCollapsiblePanel.mjs 10544 var EMPTY_DIMENSIONS = { 10545 height: void 0, 10546 width: void 0 10547 }; 10548 function useCollapsiblePanel(parameters) { 10549 const { 10550 externalRef, 10551 hiddenUntilFound, 10552 id: idParam, 10553 keepMounted, 10554 mounted, 10555 onOpenChange, 10556 open, 10557 setMounted, 10558 setOpen, 10559 transitionStatus 10560 } = parameters; 10561 const panelRef = React21.useRef(null); 10562 const animationTypeRef = React21.useRef(null); 10563 const [dimensions, setDimensionsUnwrapped] = React21.useState(EMPTY_DIMENSIONS); 10564 const lastMeasuredDimensionsRef = React21.useRef(EMPTY_DIMENSIONS); 10565 const shouldSkipNextOpenRef = React21.useRef(false); 10566 const shouldPreventMountAnimationRef = React21.useRef(open); 10567 const shouldPreventActivityResumeAnimationRef = React21.useRef(false); 10568 const [forcePanelIdle, setForcePanelIdle] = React21.useState(false); 10569 const pendingTemporaryStyleRestoreRef = React21.useRef(null); 10570 const mergedPanelRef = useMergedRefs(externalRef, panelRef); 10571 const latestStateRef = useValueAsRef({ 10572 mounted, 10573 open 10574 }); 10575 const runOnceCloseAnimationsFinish = useAnimationsFinished(panelRef, false, false); 10576 const hidden = !open && !mounted; 10577 const panelTransitionStatus = forcePanelIdle ? "idle" : transitionStatus; 10578 const shouldPreventOpenAnimation = open && // These 2 refs are safe to read in render, they are only written from committed 10579 // layout/effect paths and gate one-shot motion suppression for the next open 10580 // lifecycle. They intentionally expose the last committed motion snapshot. 10581 (shouldPreventMountAnimationRef.current || shouldPreventActivityResumeAnimationRef.current); 10582 const renderedDimensions = !open && mounted && // These 2 refs are also safe to read in render, both hold the last committed 10583 // animation mode and measurement. This fallback only restores a previously 10584 // measured pixel size after the live dimensions state has been reset back to `auto`. 10585 animationTypeRef.current === "css-animation" && dimensions.height === void 0 && dimensions.width === void 0 ? lastMeasuredDimensionsRef.current : dimensions; 10586 const shouldPersistHiddenTransitionStyles = hiddenUntilFound && hidden && animationTypeRef.current !== "css-animation"; 10587 const setDimensions = useStableCallback((nextDimensions, shouldCacheMeasurement = true) => { 10588 if (shouldCacheMeasurement) { 10589 lastMeasuredDimensionsRef.current = nextDimensions; 10590 } 10591 setDimensionsUnwrapped(nextDimensions); 10592 }); 10593 const restorePendingTemporaryStyle = useStableCallback(() => { 10594 pendingTemporaryStyleRestoreRef.current?.(); 10595 pendingTemporaryStyleRestoreRef.current = null; 10596 }); 10597 const setPendingTemporaryStyleRestore = useStableCallback((restore) => { 10598 restorePendingTemporaryStyle(); 10599 pendingTemporaryStyleRestoreRef.current = () => { 10600 pendingTemporaryStyleRestoreRef.current = null; 10601 restore(); 10602 }; 10603 }); 10604 const markActivityResumeAnimationSuppressed = useStableCallback(() => { 10605 if (open && mounted && animationTypeRef.current === "css-animation") { 10606 shouldPreventActivityResumeAnimationRef.current = true; 10607 } 10608 }); 10609 useIsoLayoutEffect(() => { 10610 if (!forcePanelIdle || transitionStatus === "starting") { 10611 return; 10612 } 10613 setForcePanelIdle(false); 10614 }, [forcePanelIdle, transitionStatus]); 10615 React21.useEffect(() => { 10616 return () => { 10617 markActivityResumeAnimationSuppressed(); 10618 restorePendingTemporaryStyle(); 10619 }; 10620 }, [markActivityResumeAnimationSuppressed, restorePendingTemporaryStyle]); 10621 useIsoLayoutEffect(() => { 10622 const panel = panelRef.current; 10623 if (!panel) { 10624 return void 0; 10625 } 10626 if (!open && pendingTemporaryStyleRestoreRef.current) { 10627 restorePendingTemporaryStyle(); 10628 } 10629 const animationType = getAnimationType(panel, shouldPreventOpenAnimation); 10630 animationTypeRef.current = animationType; 10631 if (open && transitionStatus === "idle" && shouldPreventMountAnimationRef.current && animationType === "css-animation") { 10632 lastMeasuredDimensionsRef.current = getDimensions(panel); 10633 return void 0; 10634 } 10635 if (open && transitionStatus === "starting") { 10636 const skipNextOpen = shouldSkipNextOpenRef.current; 10637 shouldSkipNextOpenRef.current = false; 10638 if (animationType === "none") { 10639 setDimensions(getDimensions(panel)); 10640 setForcePanelIdle(true); 10641 return void 0; 10642 } 10643 if (animationType === "css-transition") { 10644 const restoreLayoutStyles = resetLayoutStyles(panel); 10645 setDimensions(getDimensions(panel)); 10646 if (!skipNextOpen) { 10647 return restoreLayoutStyles; 10648 } 10649 const restoreTransitionDuration = setTemporaryStyle(panel, "transition-duration", "0s"); 10650 setPendingTemporaryStyleRestore(restoreTransitionDuration); 10651 setForcePanelIdle(true); 10652 return restoreLayoutStyles; 10653 } 10654 if (animationType === "css-animation") { 10655 setDimensions(getDimensions(panel)); 10656 if (!skipNextOpen) { 10657 const restoreAnimationName2 = setTemporaryStyle(panel, "animation-name", "none"); 10658 restoreAnimationName2(); 10659 return void 0; 10660 } 10661 const restoreAnimationName = setTemporaryStyle(panel, "animation-name", "none"); 10662 const restoreAnimationDuration = setTemporaryStyle(panel, "animation-duration", "0s"); 10663 restoreAnimationName(); 10664 setPendingTemporaryStyleRestore(restoreAnimationDuration); 10665 setForcePanelIdle(true); 10666 return void 0; 10667 } 10668 } 10669 if (!open && mounted && (transitionStatus === "idle" || transitionStatus === "starting")) { 10670 shouldPreventMountAnimationRef.current = false; 10671 shouldPreventActivityResumeAnimationRef.current = false; 10672 if (animationType === "none") { 10673 setDimensions(EMPTY_DIMENSIONS, false); 10674 setMounted(false); 10675 return void 0; 10676 } 10677 setDimensions(getDimensions(panel)); 10678 return void 0; 10679 } 10680 if (transitionStatus !== "ending") { 10681 return void 0; 10682 } 10683 if (animationType === "none") { 10684 setMounted(false); 10685 return void 0; 10686 } 10687 const nextDimensions = getDimensions(panel); 10688 const hasMeasuredSize = (nextDimensions.height ?? 0) > 0 || (nextDimensions.width ?? 0) > 0; 10689 if (!hasMeasuredSize) { 10690 setMounted(false); 10691 return void 0; 10692 } 10693 setDimensions(nextDimensions); 10694 if (animationType === "css-animation") { 10695 const restoreAnimationName = setTemporaryStyle(panel, "animation-name", "none"); 10696 restoreAnimationName(); 10697 } 10698 return void 0; 10699 }, [mounted, open, restorePendingTemporaryStyle, setDimensions, setMounted, setPendingTemporaryStyleRestore, shouldPreventOpenAnimation, transitionStatus]); 10700 useOpenChangeComplete({ 10701 enabled: open && mounted && panelTransitionStatus === "idle", 10702 open: true, 10703 ref: panelRef, 10704 onComplete() { 10705 if (!open) { 10706 return; 10707 } 10708 setDimensions(EMPTY_DIMENSIONS, false); 10709 } 10710 }); 10711 React21.useEffect(() => { 10712 if (open || !mounted || panelTransitionStatus !== "ending") { 10713 return void 0; 10714 } 10715 const panel = panelRef.current; 10716 if (!panel) { 10717 return void 0; 10718 } 10719 const abortController = new AbortController(); 10720 let endingStyleFrame = -1; 10721 function handleComplete() { 10722 if (latestStateRef.current.open) { 10723 return; 10724 } 10725 setMounted(false); 10726 setDimensions(EMPTY_DIMENSIONS, false); 10727 } 10728 endingStyleFrame = AnimationFrame.request(() => { 10729 if (!abortController.signal.aborted) { 10730 runOnceCloseAnimationsFinish(handleComplete, abortController.signal); 10731 } 10732 }); 10733 return () => { 10734 AnimationFrame.cancel(endingStyleFrame); 10735 abortController.abort(); 10736 }; 10737 }, [latestStateRef, mounted, open, panelTransitionStatus, runOnceCloseAnimationsFinish, setDimensions, setMounted]); 10738 useIsoLayoutEffect(() => { 10739 const panel = panelRef.current; 10740 if (!panel || !hiddenUntilFound || !hidden) { 10741 return; 10742 } 10743 panel.setAttribute("hidden", "until-found"); 10744 }, [hidden, hiddenUntilFound]); 10745 React21.useEffect(function registerBeforeMatchListener() { 10746 const panel = panelRef.current; 10747 if (!panel) { 10748 return void 0; 10749 } 10750 function handleBeforeMatch(event) { 10751 const eventDetails = createChangeEventDetails(reason_parts_exports.none, event); 10752 onOpenChange(true, eventDetails); 10753 if (eventDetails.isCanceled) { 10754 return; 10755 } 10756 shouldSkipNextOpenRef.current = true; 10757 setOpen(true); 10758 } 10759 return addEventListener(panel, "beforematch", handleBeforeMatch); 10760 }, [onOpenChange, setOpen]); 10761 const shouldRender = keepMounted || hiddenUntilFound || mounted || open; 10762 return { 10763 height: renderedDimensions.height, 10764 props: { 10765 ...shouldPersistHiddenTransitionStyles ? { 10766 [CollapsiblePanelDataAttributes.startingStyle]: "" 10767 } : void 0, 10768 hidden, 10769 id: idParam 10770 }, 10771 ref: mergedPanelRef, 10772 shouldPreventOpenAnimation, 10773 shouldRender, 10774 transitionStatus: panelTransitionStatus, 10775 width: renderedDimensions.width 10776 }; 10777 } 10778 function getDimensions(element) { 10779 return { 10780 height: element.scrollHeight, 10781 width: element.scrollWidth 10782 }; 10783 } 10784 function getAnimationType(element, hasSuppressedMountAnimation = false) { 10785 const panelStyles = getWindow(element).getComputedStyle(element); 10786 const hasAnimation = (panelStyles.animationName.split(",").map((name2) => name2.trim()).some((name2) => name2 !== "" && name2 !== "none") || hasSuppressedMountAnimation) && hasNonZeroDuration(panelStyles.animationDuration); 10787 const hasTransition = hasNonZeroDuration(panelStyles.transitionDuration); 10788 if (hasAnimation && hasTransition) { 10789 if (true) { 10790 warn("CSS transitions and CSS animations both detected on Collapsible or Accordion panel.", "Only one of either animation type should be used."); 10791 } 10792 return "css-transition"; 10793 } 10794 if (hasTransition) { 10795 return "css-transition"; 10796 } 10797 if (hasAnimation) { 10798 return "css-animation"; 10799 } 10800 return "none"; 10801 } 10802 function hasNonZeroDuration(value) { 10803 return value.split(",").map((part) => part.trim()).some((part) => part !== "" && Number.parseFloat(part) > 0); 10804 } 10805 function setTemporaryStyle(element, property, value) { 10806 const previousValue = element.style.getPropertyValue(property); 10807 const previousPriority = element.style.getPropertyPriority(property); 10808 element.style.setProperty(property, value); 10809 return () => { 10810 if (previousValue === "") { 10811 element.style.removeProperty(property); 10812 return; 10813 } 10814 element.style.setProperty(property, previousValue, previousPriority); 10815 }; 10816 } 10817 function resetLayoutStyles(element) { 10818 const originalLayoutStyles = { 10819 "justify-content": element.style.justifyContent, 10820 "align-items": element.style.alignItems, 10821 "align-content": element.style.alignContent, 10822 "justify-items": element.style.justifyItems 10823 }; 10824 Object.keys(originalLayoutStyles).forEach((key) => { 10825 element.style.setProperty(key, "initial", "important"); 10826 }); 10827 function restoreLayoutStyles() { 10828 Object.entries(originalLayoutStyles).forEach(([key, value]) => { 10829 if (value === "") { 10830 element.style.removeProperty(key); 10831 return; 10832 } 10833 element.style.setProperty(key, value); 10834 }); 10835 } 10836 const frame = AnimationFrame.request(restoreLayoutStyles); 10837 return () => { 10838 AnimationFrame.cancel(frame); 10839 restoreLayoutStyles(); 10840 }; 10841 } 10842 10843 // node_modules/@base-ui/utils/useOnFirstRender.mjs 10844 var React22 = __toESM(require_react(), 1); 10845 function useOnFirstRender(fn) { 10846 const ref = React22.useRef(true); 10847 if (ref.current) { 10848 ref.current = false; 10849 fn(); 10850 } 10851 } 10852 10853 // node_modules/@base-ui/utils/platform/parts.mjs 10854 var parts_exports = {}; 10855 __export(parts_exports, { 10856 engine: () => engine_exports, 10857 env: () => env_exports, 10858 os: () => os_exports, 10859 screenReader: () => screen_reader_exports 10860 }); 10861 10862 // node_modules/@base-ui/utils/platform/os.mjs 10863 var os_exports = {}; 10864 __export(os_exports, { 10865 android: () => android, 10866 apple: () => apple, 10867 ios: () => ios, 10868 linux: () => linux, 10869 mac: () => mac, 10870 windows: () => windows 10871 }); 10872 10873 // node_modules/@base-ui/utils/platform/shared.mjs 10874 function readRawData() { 10875 if (typeof navigator === "undefined") { 10876 return { 10877 userAgent: "", 10878 platform: "", 10879 maxTouchPoints: 0 10880 }; 10881 } 10882 if (true) { 10883 const uaData = navigator.userAgentData; 10884 if (uaData && Array.isArray(uaData.brands)) { 10885 return { 10886 userAgent: uaData.brands.map(({ 10887 brand, 10888 version: version2 10889 }) => `$brand}/$version2}`).join(" "), 10890 platform: uaData.platform ?? navigator.platform ?? "", 10891 maxTouchPoints: navigator.maxTouchPoints ?? 0 10892 }; 10893 } 10894 } 10895 return { 10896 userAgent: navigator.userAgent, 10897 platform: navigator.platform ?? "", 10898 maxTouchPoints: navigator.maxTouchPoints ?? 0 10899 }; 10900 } 10901 var { 10902 userAgent, 10903 platform, 10904 maxTouchPoints 10905 } = readRawData(); 10906 var lowerUserAgent = userAgent.toLowerCase(); 10907 var lowerPlatform = platform.toLowerCase(); 10908 10909 // node_modules/@base-ui/utils/platform/os.mjs 10910 var ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === "macintel" && maxTouchPoints > 1; 10911 var ANDROID_STRING = "android"; 10912 var android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING); 10913 var mac = !ios && lowerPlatform.startsWith("mac"); 10914 var windows = lowerPlatform.startsWith("win"); 10915 var linux = !android && /^(linux|chrome os)/.test(lowerPlatform); 10916 var apple = mac || ios; 10917 10918 // node_modules/@base-ui/utils/platform/engine.mjs 10919 var engine_exports = {}; 10920 __export(engine_exports, { 10921 blink: () => blink, 10922 gecko: () => gecko, 10923 webkit: () => webkit 10924 }); 10925 var webkit = typeof CSS !== "undefined" && !!CSS.supports?.("-webkit-backdrop-filter:none"); 10926 var gecko = !webkit && lowerUserAgent.includes("firefox"); 10927 var blink = !webkit && lowerUserAgent.includes("chrom"); 10928 10929 // node_modules/@base-ui/utils/platform/screen-reader.mjs 10930 var screen_reader_exports = {}; 10931 __export(screen_reader_exports, { 10932 voiceOver: () => voiceOver 10933 }); 10934 var voiceOver = apple; 10935 10936 // node_modules/@base-ui/utils/platform/env.mjs 10937 var env_exports = {}; 10938 __export(env_exports, { 10939 jsdom: () => jsdom 10940 }); 10941 var jsdom = /jsdom|happydom/.test(lowerUserAgent); 10942 10943 // node_modules/@base-ui/utils/useTimeout.mjs 10944 var EMPTY3 = 0; 10945 var Timeout = class _Timeout { 10946 static create() { 10947 return new _Timeout(); 10948 } 10949 currentId = EMPTY3; 10950 /** 10951 * Executes `fn` after `delay`, clearing any previously scheduled call. 10952 */ 10953 start(delay, fn) { 10954 this.clear(); 10955 this.currentId = setTimeout(() => { 10956 this.currentId = EMPTY3; 10957 fn(); 10958 }, delay); 10959 } 10960 isStarted() { 10961 return this.currentId !== EMPTY3; 10962 } 10963 clear = () => { 10964 if (this.currentId !== EMPTY3) { 10965 clearTimeout(this.currentId); 10966 this.currentId = EMPTY3; 10967 } 10968 }; 10969 disposeEffect = () => { 10970 return this.clear; 10971 }; 10972 }; 10973 function useTimeout() { 10974 const timeout = useRefWithInit(Timeout.create).current; 10975 useOnMount(timeout.disposeEffect); 10976 return timeout; 10977 } 10978 10979 // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs 10980 var React23 = __toESM(require_react(), 1); 10981 10982 // node_modules/@base-ui/react/floating-ui-react/utils/event.mjs 10983 function isReactEvent(event) { 10984 return "nativeEvent" in event; 10985 } 10986 function isMouseLikePointerType(pointerType, strict) { 10987 const values = ["mouse", "pen"]; 10988 if (!strict) { 10989 values.push("", void 0); 10990 } 10991 return values.includes(pointerType); 10992 } 10993 function isClickLikeEvent(event) { 10994 const type = event.type; 10995 return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup"; 10996 } 10997 10998 // node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs 10999 var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable"; 11000 var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; 11001 11002 // node_modules/@base-ui/react/internals/shadowDom.mjs 11003 function activeElement(doc) { 11004 let element = doc.activeElement; 11005 while (element?.shadowRoot?.activeElement != null) { 11006 element = element.shadowRoot.activeElement; 11007 } 11008 return element; 11009 } 11010 function contains(parent, child) { 11011 if (!parent || !child) { 11012 return false; 11013 } 11014 const rootNode = child.getRootNode?.(); 11015 if (parent.contains(child)) { 11016 return true; 11017 } 11018 if (rootNode && isShadowRoot(rootNode)) { 11019 let next = child; 11020 while (next) { 11021 if (parent === next) { 11022 return true; 11023 } 11024 next = next.parentNode || next.host; 11025 } 11026 } 11027 return false; 11028 } 11029 function getTarget(event) { 11030 if ("composedPath" in event) { 11031 return event.composedPath()[0]; 11032 } 11033 return event.target; 11034 } 11035 11036 // node_modules/@base-ui/react/floating-ui-react/utils/element.mjs 11037 function isTargetInsideEnabledTrigger(target, triggerElements) { 11038 if (!isElement(target)) { 11039 return false; 11040 } 11041 const targetElement = target; 11042 if (triggerElements.hasElement(targetElement)) { 11043 return !targetElement.hasAttribute("data-trigger-disabled"); 11044 } 11045 for (const [, trigger] of triggerElements.entries()) { 11046 if (contains(trigger, targetElement)) { 11047 return !trigger.hasAttribute("data-trigger-disabled"); 11048 } 11049 } 11050 return false; 11051 } 11052 function isEventTargetWithin(event, node) { 11053 if (node == null) { 11054 return false; 11055 } 11056 if ("composedPath" in event) { 11057 return event.composedPath().includes(node); 11058 } 11059 const eventAgain = event; 11060 return eventAgain.target != null && node.contains(eventAgain.target); 11061 } 11062 function isRootElement(element) { 11063 return element.matches("html,body"); 11064 } 11065 function isTypeableElement(element) { 11066 return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR); 11067 } 11068 function isInteractiveElement(element) { 11069 return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),$TYPEABLE_SELECTOR}`) != null; 11070 } 11071 function matchesFocusVisible(element) { 11072 if (!element || parts_exports.env.jsdom) { 11073 return true; 11074 } 11075 try { 11076 return element.matches(":focus-visible"); 11077 } catch (_e) { 11078 return true; 11079 } 11080 } 11081 11082 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs 11083 function resolveValue(value, pointerType) { 11084 if (pointerType != null && !isMouseLikePointerType(pointerType)) { 11085 return 0; 11086 } 11087 if (typeof value === "function") { 11088 return value(); 11089 } 11090 return value; 11091 } 11092 function getDelay(value, prop, pointerType) { 11093 const result = resolveValue(value, pointerType); 11094 if (typeof result === "number") { 11095 return result; 11096 } 11097 return result?.[prop]; 11098 } 11099 function getRestMs(value) { 11100 if (typeof value === "function") { 11101 return value(); 11102 } 11103 return value; 11104 } 11105 function isClickLikeOpenEvent(openEventType, interactedInside) { 11106 return interactedInside || openEventType === "click" || openEventType === "mousedown"; 11107 } 11108 function isHoverOpenEvent(openEventType) { 11109 return openEventType?.includes("mouse") && openEventType !== "mousedown"; 11110 } 11111 11112 // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs 11113 var import_jsx_runtime98 = __toESM(require_jsx_runtime(), 1); 11114 var FloatingDelayGroupContext = /* @__PURE__ */ React23.createContext({ 11115 hasProvider: false, 11116 timeoutMs: 0, 11117 delayRef: { 11118 current: 0 11119 }, 11120 initialDelayRef: { 11121 current: 0 11122 }, 11123 timeout: new Timeout(), 11124 currentIdRef: { 11125 current: null 11126 }, 11127 currentContextRef: { 11128 current: null 11129 } 11130 }); 11131 if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext"; 11132 function resetDelayRef(delayRef, initialDelayRef) { 11133 delayRef.current = initialDelayRef.current; 11134 } 11135 function FloatingDelayGroup(props) { 11136 const { 11137 children, 11138 delay, 11139 timeoutMs = 0 11140 } = props; 11141 const delayRef = React23.useRef(delay); 11142 const initialDelayRef = React23.useRef(delay); 11143 const currentIdRef = React23.useRef(null); 11144 const currentContextRef = React23.useRef(null); 11145 const timeout = useTimeout(); 11146 useIsoLayoutEffect(() => { 11147 initialDelayRef.current = delay; 11148 if (!currentIdRef.current) { 11149 delayRef.current = delay; 11150 return; 11151 } 11152 delayRef.current = { 11153 open: getDelay(delayRef.current, "open"), 11154 close: getDelay(delay, "close") 11155 }; 11156 }, [delay, currentIdRef, delayRef, initialDelayRef]); 11157 return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(FloatingDelayGroupContext.Provider, { 11158 value: React23.useMemo(() => ({ 11159 hasProvider: true, 11160 delayRef, 11161 initialDelayRef, 11162 currentIdRef, 11163 timeoutMs, 11164 currentContextRef, 11165 timeout 11166 }), [timeoutMs, timeout]), 11167 children 11168 }); 11169 } 11170 function useDelayGroup(context, options = { 11171 open: false 11172 }) { 11173 const { 11174 open 11175 } = options; 11176 const store4 = "rootStore" in context ? context.rootStore : context; 11177 const floatingId = store4.useState("floatingId"); 11178 const groupContext = React23.useContext(FloatingDelayGroupContext); 11179 const { 11180 currentIdRef, 11181 delayRef, 11182 timeoutMs, 11183 initialDelayRef, 11184 currentContextRef, 11185 hasProvider, 11186 timeout 11187 } = groupContext; 11188 const [isInstantPhase, setIsInstantPhase] = React23.useState(false); 11189 const openRef = React23.useRef(open); 11190 const isUnmountedRef = React23.useRef(false); 11191 useIsoLayoutEffect(() => { 11192 openRef.current = open; 11193 }, [open]); 11194 useIsoLayoutEffect(() => { 11195 return () => { 11196 isUnmountedRef.current = true; 11197 }; 11198 }, []); 11199 useIsoLayoutEffect(() => { 11200 function unset() { 11201 if (!isUnmountedRef.current) { 11202 setIsInstantPhase(false); 11203 } 11204 currentContextRef.current?.setIsInstantPhase(false); 11205 currentIdRef.current = null; 11206 currentContextRef.current = null; 11207 delayRef.current = initialDelayRef.current; 11208 timeout.clear(); 11209 } 11210 if (!currentIdRef.current) { 11211 return void 0; 11212 } 11213 if (!open && currentIdRef.current === floatingId) { 11214 setIsInstantPhase(false); 11215 if (timeoutMs) { 11216 const closingId = floatingId; 11217 timeout.start(timeoutMs, () => { 11218 if (store4.select("open") || currentIdRef.current && currentIdRef.current !== closingId) { 11219 return; 11220 } 11221 unset(); 11222 }); 11223 return () => { 11224 if (openRef.current || currentIdRef.current !== closingId) { 11225 timeout.clear(); 11226 } 11227 }; 11228 } 11229 unset(); 11230 } 11231 return void 0; 11232 }, [open, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store4]); 11233 useIsoLayoutEffect(() => { 11234 if (!open) { 11235 return; 11236 } 11237 const prevContext = currentContextRef.current; 11238 const prevId = currentIdRef.current; 11239 timeout.clear(); 11240 currentContextRef.current = { 11241 onOpenChange: store4.setOpen, 11242 setIsInstantPhase 11243 }; 11244 currentIdRef.current = floatingId; 11245 delayRef.current = { 11246 open: 0, 11247 close: getDelay(initialDelayRef.current, "close") 11248 }; 11249 if (prevId !== null && prevId !== floatingId) { 11250 setIsInstantPhase(true); 11251 prevContext?.setIsInstantPhase(true); 11252 prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none)); 11253 } else { 11254 setIsInstantPhase(false); 11255 prevContext?.setIsInstantPhase(false); 11256 } 11257 }, [open, floatingId, store4, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]); 11258 useIsoLayoutEffect(() => { 11259 return () => { 11260 if (currentIdRef.current === floatingId) { 11261 currentContextRef.current = null; 11262 if (!openRef.current) { 11263 return; 11264 } 11265 currentIdRef.current = null; 11266 resetDelayRef(delayRef, initialDelayRef); 11267 timeout.clear(); 11268 } 11269 }; 11270 }, [currentContextRef, currentIdRef, delayRef, floatingId, initialDelayRef, timeout]); 11271 return React23.useMemo(() => ({ 11272 hasProvider, 11273 delayRef, 11274 isInstantPhase 11275 }), [hasProvider, delayRef, isInstantPhase]); 11276 } 11277 11278 // node_modules/@base-ui/utils/mergeCleanups.mjs 11279 function mergeCleanups(...cleanups) { 11280 return () => { 11281 for (let i3 = 0; i3 < cleanups.length; i3 += 1) { 11282 const cleanup = cleanups[i3]; 11283 if (cleanup) { 11284 cleanup(); 11285 } 11286 } 11287 }; 11288 } 11289 11290 // node_modules/@base-ui/react/utils/FocusGuard.mjs 11291 var React24 = __toESM(require_react(), 1); 11292 11293 // node_modules/@base-ui/utils/visuallyHidden.mjs 11294 var visuallyHiddenBase = { 11295 clipPath: "inset(50%)", 11296 overflow: "hidden", 11297 whiteSpace: "nowrap", 11298 border: 0, 11299 padding: 0, 11300 width: 1, 11301 height: 1, 11302 margin: -1 11303 }; 11304 var visuallyHidden = { 11305 ...visuallyHiddenBase, 11306 position: "fixed", 11307 top: 0, 11308 left: 0 11309 }; 11310 var visuallyHiddenInput = { 11311 ...visuallyHiddenBase, 11312 position: "absolute" 11313 }; 11314 11315 // node_modules/@base-ui/react/utils/FocusGuard.mjs 11316 var import_jsx_runtime99 = __toESM(require_jsx_runtime(), 1); 11317 var FocusGuard = /* @__PURE__ */ React24.forwardRef(function FocusGuard2(props, ref) { 11318 const [role, setRole] = React24.useState(); 11319 useIsoLayoutEffect(() => { 11320 if (parts_exports.screenReader.voiceOver && parts_exports.engine.webkit) { 11321 setRole("button"); 11322 } 11323 }, []); 11324 const restProps = { 11325 tabIndex: 0, 11326 // Role is only for VoiceOver 11327 role 11328 }; 11329 return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { 11330 ...props, 11331 ref, 11332 style: visuallyHidden, 11333 "aria-hidden": role ? void 0 : true, 11334 ...restProps, 11335 "data-base-ui-focus-guard": "" 11336 }); 11337 }); 11338 if (true) FocusGuard.displayName = "FocusGuard"; 11339 11340 // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs 11341 var sides = ["top", "right", "bottom", "left"]; 11342 var min = Math.min; 11343 var max = Math.max; 11344 var round = Math.round; 11345 var floor = Math.floor; 11346 var createCoords = (v3) => ({ 11347 x: v3, 11348 y: v3 11349 }); 11350 var oppositeSideMap = { 11351 left: "right", 11352 right: "left", 11353 bottom: "top", 11354 top: "bottom" 11355 }; 11356 function clamp(start2, value, end) { 11357 return max(start2, min(value, end)); 11358 } 11359 function evaluate(value, param) { 11360 return typeof value === "function" ? value(param) : value; 11361 } 11362 function getSide(placement) { 11363 return placement.split("-")[0]; 11364 } 11365 function getAlignment(placement) { 11366 return placement.split("-")[1]; 11367 } 11368 function getOppositeAxis(axis) { 11369 return axis === "x" ? "y" : "x"; 11370 } 11371 function getAxisLength(axis) { 11372 return axis === "y" ? "height" : "width"; 11373 } 11374 function getSideAxis(placement) { 11375 const firstChar = placement[0]; 11376 return firstChar === "t" || firstChar === "b" ? "y" : "x"; 11377 } 11378 function getAlignmentAxis(placement) { 11379 return getOppositeAxis(getSideAxis(placement)); 11380 } 11381 function getAlignmentSides(placement, rects, rtl) { 11382 if (rtl === void 0) { 11383 rtl = false; 11384 } 11385 const alignment = getAlignment(placement); 11386 const alignmentAxis = getAlignmentAxis(placement); 11387 const length2 = getAxisLength(alignmentAxis); 11388 let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; 11389 if (rects.reference[length2] > rects.floating[length2]) { 11390 mainAlignmentSide = getOppositePlacement(mainAlignmentSide); 11391 } 11392 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; 11393 } 11394 function getExpandedPlacements(placement) { 11395 const oppositePlacement = getOppositePlacement(placement); 11396 return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; 11397 } 11398 function getOppositeAlignmentPlacement(placement) { 11399 return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start"); 11400 } 11401 var lrPlacement = ["left", "right"]; 11402 var rlPlacement = ["right", "left"]; 11403 var tbPlacement = ["top", "bottom"]; 11404 var btPlacement = ["bottom", "top"]; 11405 function getSideList(side, isStart, rtl) { 11406 switch (side) { 11407 case "top": 11408 case "bottom": 11409 if (rtl) return isStart ? rlPlacement : lrPlacement; 11410 return isStart ? lrPlacement : rlPlacement; 11411 case "left": 11412 case "right": 11413 return isStart ? tbPlacement : btPlacement; 11414 default: 11415 return []; 11416 } 11417 } 11418 function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { 11419 const alignment = getAlignment(placement); 11420 let list = getSideList(getSide(placement), direction === "start", rtl); 11421 if (alignment) { 11422 list = list.map((side) => side + "-" + alignment); 11423 if (flipAlignment) { 11424 list = list.concat(list.map(getOppositeAlignmentPlacement)); 11425 } 11426 } 11427 return list; 11428 } 11429 function getOppositePlacement(placement) { 11430 const side = getSide(placement); 11431 return oppositeSideMap[side] + placement.slice(side.length); 11432 } 11433 function expandPaddingObject(padding) { 11434 return { 11435 top: 0, 11436 right: 0, 11437 bottom: 0, 11438 left: 0, 11439 ...padding 11440 }; 11441 } 11442 function getPaddingObject(padding) { 11443 return typeof padding !== "number" ? expandPaddingObject(padding) : { 11444 top: padding, 11445 right: padding, 11446 bottom: padding, 11447 left: padding 11448 }; 11449 } 11450 function rectToClientRect(rect) { 11451 const { 11452 x: x2, 11453 y: y3, 11454 width, 11455 height 11456 } = rect; 11457 return { 11458 width, 11459 height, 11460 top: y3, 11461 left: x2, 11462 right: x2 + width, 11463 bottom: y3 + height, 11464 x: x2, 11465 y: y3 11466 }; 11467 } 11468 11469 // node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs 11470 function isIndexOutOfListBounds(list, index2) { 11471 return index2 < 0 || index2 >= list.length; 11472 } 11473 function getMinListIndex(listRef, disabledIndices) { 11474 return findNonDisabledListIndex(listRef.current, { 11475 disabledIndices 11476 }); 11477 } 11478 function getMaxListIndex(listRef, disabledIndices) { 11479 return findNonDisabledListIndex(listRef.current, { 11480 decrement: true, 11481 startingIndex: listRef.current.length, 11482 disabledIndices 11483 }); 11484 } 11485 function findNonDisabledListIndex(list, { 11486 startingIndex = -1, 11487 decrement = false, 11488 disabledIndices, 11489 amount = 1 11490 } = {}) { 11491 let index2 = startingIndex; 11492 do { 11493 index2 += decrement ? -amount : amount; 11494 } while (index2 >= 0 && index2 <= list.length - 1 && isListIndexDisabled(list, index2, disabledIndices)); 11495 return index2; 11496 } 11497 function isListIndexDisabled(list, index2, disabledIndices) { 11498 const isExplicitlyDisabled = typeof disabledIndices === "function" ? disabledIndices(index2) : disabledIndices?.includes(index2) ?? false; 11499 if (isExplicitlyDisabled) { 11500 return true; 11501 } 11502 const element = list[index2]; 11503 if (!element) { 11504 return false; 11505 } 11506 if (!isElementVisible(element)) { 11507 return true; 11508 } 11509 return !disabledIndices && (element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true"); 11510 } 11511 function isHiddenByStyles(styles) { 11512 return styles.visibility === "hidden" || styles.visibility === "collapse"; 11513 } 11514 function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) { 11515 if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) { 11516 return false; 11517 } 11518 if (typeof element.checkVisibility === "function") { 11519 return element.checkVisibility(); 11520 } 11521 return styles.display !== "none" && styles.display !== "contents"; 11522 } 11523 11524 // node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs 11525 var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]'; 11526 function getParentElement(element) { 11527 const assignedSlot = element.assignedSlot; 11528 if (assignedSlot) { 11529 return assignedSlot; 11530 } 11531 if (element.parentElement) { 11532 return element.parentElement; 11533 } 11534 const rootNode = element.getRootNode(); 11535 return isShadowRoot(rootNode) ? rootNode.host : null; 11536 } 11537 function getDetailsSummary(details) { 11538 for (const child of Array.from(details.children)) { 11539 if (getNodeName(child) === "summary") { 11540 return child; 11541 } 11542 } 11543 return null; 11544 } 11545 function isWithinOpenDetailsSummary(element, details) { 11546 const summary = getDetailsSummary(details); 11547 return !!summary && (element === summary || contains(summary, element)); 11548 } 11549 function isFocusableCandidate(element) { 11550 const nodeName = element ? getNodeName(element) : ""; 11551 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"); 11552 } 11553 function isFocusableElement(element) { 11554 if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) { 11555 return false; 11556 } 11557 for (let current = element; current; current = getParentElement(current)) { 11558 const isAncestor = current !== element; 11559 const isSlot = getNodeName(current) === "slot"; 11560 if (current.hasAttribute("inert")) { 11561 return false; 11562 } 11563 if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) { 11564 return false; 11565 } 11566 } 11567 return true; 11568 } 11569 function isVisibleInTabbableTree(element, isAncestor) { 11570 const styles = getComputedStyle2(element); 11571 if (!isAncestor) { 11572 return isElementVisible(element, styles); 11573 } 11574 return styles.display !== "none"; 11575 } 11576 function getTabIndex(element) { 11577 const tabIndex = element.tabIndex; 11578 if (tabIndex < 0) { 11579 const nodeName = getNodeName(element); 11580 if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) { 11581 return 0; 11582 } 11583 } 11584 return tabIndex; 11585 } 11586 function getNamedRadioInput(element) { 11587 if (getNodeName(element) !== "input") { 11588 return null; 11589 } 11590 const input = element; 11591 return input.type === "radio" && input.name !== "" ? input : null; 11592 } 11593 function isTabbableRadio(element, candidates) { 11594 const input = getNamedRadioInput(element); 11595 if (!input) { 11596 return true; 11597 } 11598 const checkedRadio = candidates.find((candidate) => { 11599 const radio = getNamedRadioInput(candidate); 11600 return radio?.name === input.name && radio.form === input.form && radio.checked; 11601 }); 11602 if (checkedRadio) { 11603 return checkedRadio === input; 11604 } 11605 return candidates.find((candidate) => { 11606 const radio = getNamedRadioInput(candidate); 11607 return radio?.name === input.name && radio.form === input.form; 11608 }) === input; 11609 } 11610 function getComposedChildren(container) { 11611 if (isHTMLElement(container) && getNodeName(container) === "slot") { 11612 const assignedElements = container.assignedElements({ 11613 flatten: true 11614 }); 11615 if (assignedElements.length > 0) { 11616 return assignedElements; 11617 } 11618 } 11619 if (isHTMLElement(container) && container.shadowRoot) { 11620 return Array.from(container.shadowRoot.children); 11621 } 11622 return Array.from(container.children); 11623 } 11624 function appendCandidates(container, list) { 11625 getComposedChildren(container).forEach((child) => { 11626 if (isFocusableCandidate(child)) { 11627 list.push(child); 11628 } 11629 appendCandidates(child, list); 11630 }); 11631 } 11632 function appendMatchingElements(container, selector2, list) { 11633 getComposedChildren(container).forEach((child) => { 11634 if (isHTMLElement(child) && child.matches(selector2)) { 11635 list.push(child); 11636 } 11637 appendMatchingElements(child, selector2, list); 11638 }); 11639 } 11640 function focusable(container) { 11641 const candidates = []; 11642 appendCandidates(container, candidates); 11643 return candidates.filter(isFocusableElement); 11644 } 11645 function tabbable(container) { 11646 const candidates = focusable(container); 11647 return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates)); 11648 } 11649 function getTabbableIn(container, dir) { 11650 const list = tabbable(container); 11651 const len2 = list.length; 11652 if (len2 === 0) { 11653 return void 0; 11654 } 11655 const active = activeElement(ownerDocument(container)); 11656 const index2 = list.indexOf(active); 11657 const nextIndex = index2 === -1 ? dir === 1 ? 0 : len2 - 1 : index2 + dir; 11658 return list[nextIndex]; 11659 } 11660 function getNextTabbable(referenceElement) { 11661 return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement; 11662 } 11663 function getPreviousTabbable(referenceElement) { 11664 return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement; 11665 } 11666 function isOutsideEvent(event, container) { 11667 const containerElement = container || event.currentTarget; 11668 const relatedTarget = event.relatedTarget; 11669 return !relatedTarget || !contains(containerElement, relatedTarget); 11670 } 11671 function disableFocusInside(container) { 11672 const tabbableElements = tabbable(container); 11673 tabbableElements.forEach((element) => { 11674 element.dataset.tabindex = element.getAttribute("tabindex") || ""; 11675 element.setAttribute("tabindex", "-1"); 11676 }); 11677 } 11678 function enableFocusInside(container) { 11679 const elements2 = []; 11680 appendMatchingElements(container, "[data-tabindex]", elements2); 11681 elements2.forEach((element) => { 11682 const tabindex = element.dataset.tabindex; 11683 delete element.dataset.tabindex; 11684 if (tabindex) { 11685 element.setAttribute("tabindex", tabindex); 11686 } else { 11687 element.removeAttribute("tabindex"); 11688 } 11689 }); 11690 } 11691 11692 // node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs 11693 function getNodeChildren(nodes, id, onlyOpenChildren = true) { 11694 const directChildren = nodes.filter((node) => node.parentId === id); 11695 return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]); 11696 } 11697 11698 // node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs 11699 function createAttribute(name2) { 11700 return `data-base-ui-$name2}`; 11701 } 11702 11703 // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs 11704 var React25 = __toESM(require_react(), 1); 11705 var ReactDOM2 = __toESM(require_react_dom(), 1); 11706 11707 // node_modules/@base-ui/react/internals/constants.mjs 11708 var DISABLED_TRANSITIONS_STYLE = { 11709 style: { 11710 transition: "none" 11711 } 11712 }; 11713 var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore"; 11714 var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore"; 11715 var BASE_UI_SWIPE_IGNORE_SELECTOR = `[$BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`; 11716 var LEGACY_SWIPE_IGNORE_SELECTOR = `[$LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`; 11717 var POPUP_COLLISION_AVOIDANCE = { 11718 fallbackAxisSide: "end" 11719 }; 11720 var ownerVisuallyHidden = { 11721 clipPath: "inset(50%)", 11722 position: "fixed", 11723 top: 0, 11724 left: 0 11725 }; 11726 11727 // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs 11728 var import_jsx_runtime100 = __toESM(require_jsx_runtime(), 1); 11729 var PortalContext = /* @__PURE__ */ React25.createContext(null); 11730 if (true) PortalContext.displayName = "PortalContext"; 11731 var usePortalContext = () => React25.useContext(PortalContext); 11732 var attr = createAttribute("portal"); 11733 function useFloatingPortalNode(props = {}) { 11734 const { 11735 ref, 11736 container: containerProp, 11737 componentProps = EMPTY_OBJECT3, 11738 elementProps 11739 } = props; 11740 const uniqueId = useId(); 11741 const portalContext = usePortalContext(); 11742 const parentPortalNode = portalContext?.portalNode; 11743 const [containerElement, setContainerElement] = React25.useState(null); 11744 const [portalNode, setPortalNode] = React25.useState(null); 11745 const setPortalNodeRef = useStableCallback((node) => { 11746 if (node !== null) { 11747 setPortalNode(node); 11748 } 11749 }); 11750 const containerRef = React25.useRef(null); 11751 useIsoLayoutEffect(() => { 11752 if (containerProp === null) { 11753 if (containerRef.current) { 11754 containerRef.current = null; 11755 setPortalNode(null); 11756 setContainerElement(null); 11757 } 11758 return; 11759 } 11760 if (uniqueId == null) { 11761 return; 11762 } 11763 const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body; 11764 if (resolvedContainer == null) { 11765 if (containerRef.current) { 11766 containerRef.current = null; 11767 setPortalNode(null); 11768 setContainerElement(null); 11769 } 11770 return; 11771 } 11772 if (containerRef.current !== resolvedContainer) { 11773 containerRef.current = resolvedContainer; 11774 setPortalNode(null); 11775 setContainerElement(resolvedContainer); 11776 } 11777 }, [containerProp, parentPortalNode, uniqueId]); 11778 const portalElement = useRenderElement("div", componentProps, { 11779 ref: [ref, setPortalNodeRef], 11780 props: [{ 11781 id: uniqueId, 11782 [attr]: "" 11783 }, elementProps] 11784 }); 11785 const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null; 11786 return { 11787 portalNode, 11788 portalSubtree 11789 }; 11790 } 11791 var FloatingPortal = /* @__PURE__ */ React25.forwardRef(function FloatingPortal2(componentProps, forwardedRef) { 11792 const { 11793 render: render5, 11794 className, 11795 style, 11796 children, 11797 container, 11798 renderGuards, 11799 ...elementProps 11800 } = componentProps; 11801 const { 11802 portalNode, 11803 portalSubtree 11804 } = useFloatingPortalNode({ 11805 container, 11806 ref: forwardedRef, 11807 componentProps, 11808 elementProps 11809 }); 11810 const beforeOutsideRef = React25.useRef(null); 11811 const afterOutsideRef = React25.useRef(null); 11812 const beforeInsideRef = React25.useRef(null); 11813 const afterInsideRef = React25.useRef(null); 11814 const [focusManagerState, setFocusManagerState] = React25.useState(null); 11815 const focusInsideDisabledRef = React25.useRef(false); 11816 const modal = focusManagerState?.modal; 11817 const open = focusManagerState?.open; 11818 const shouldRenderGuards = typeof renderGuards === "boolean" ? renderGuards : !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode; 11819 React25.useEffect(() => { 11820 if (!portalNode || modal) { 11821 return void 0; 11822 } 11823 function onFocus(event) { 11824 if (portalNode && event.relatedTarget && isOutsideEvent(event)) { 11825 if (event.type === "focusin") { 11826 if (focusInsideDisabledRef.current) { 11827 enableFocusInside(portalNode); 11828 focusInsideDisabledRef.current = false; 11829 } 11830 } else { 11831 disableFocusInside(portalNode); 11832 focusInsideDisabledRef.current = true; 11833 } 11834 } 11835 } 11836 return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true)); 11837 }, [portalNode, modal]); 11838 useIsoLayoutEffect(() => { 11839 if (!portalNode || open !== true || !focusInsideDisabledRef.current) { 11840 return; 11841 } 11842 enableFocusInside(portalNode); 11843 focusInsideDisabledRef.current = false; 11844 }, [open, portalNode]); 11845 const portalContextValue = React25.useMemo(() => ({ 11846 beforeOutsideRef, 11847 afterOutsideRef, 11848 beforeInsideRef, 11849 afterInsideRef, 11850 portalNode, 11851 setFocusManagerState 11852 }), [portalNode]); 11853 return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(React25.Fragment, { 11854 children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(PortalContext.Provider, { 11855 value: portalContextValue, 11856 children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(FocusGuard, { 11857 "data-type": "outside", 11858 ref: beforeOutsideRef, 11859 onFocus: (event) => { 11860 if (isOutsideEvent(event, portalNode)) { 11861 beforeInsideRef.current?.focus(); 11862 } else { 11863 const domReference = focusManagerState ? focusManagerState.domReference : null; 11864 const prevTabbable = getPreviousTabbable(domReference); 11865 prevTabbable?.focus(); 11866 } 11867 } 11868 }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("span", { 11869 "aria-owns": portalNode.id, 11870 style: ownerVisuallyHidden 11871 }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(FocusGuard, { 11872 "data-type": "outside", 11873 ref: afterOutsideRef, 11874 onFocus: (event) => { 11875 if (isOutsideEvent(event, portalNode)) { 11876 afterInsideRef.current?.focus(); 11877 } else { 11878 const domReference = focusManagerState ? focusManagerState.domReference : null; 11879 const nextTabbable = getNextTabbable(domReference); 11880 nextTabbable?.focus(); 11881 if (focusManagerState?.closeOnFocusOut) { 11882 focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent)); 11883 } 11884 } 11885 } 11886 })] 11887 })] 11888 }); 11889 }); 11890 if (true) FloatingPortal.displayName = "FloatingPortal"; 11891 11892 // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs 11893 var React26 = __toESM(require_react(), 1); 11894 11895 // node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs 11896 function createEventEmitter() { 11897 const map = /* @__PURE__ */ new Map(); 11898 return { 11899 emit(event, data) { 11900 map.get(event)?.forEach((listener) => listener(data)); 11901 }, 11902 on(event, listener) { 11903 if (!map.has(event)) { 11904 map.set(event, /* @__PURE__ */ new Set()); 11905 } 11906 map.get(event).add(listener); 11907 }, 11908 off(event, listener) { 11909 map.get(event)?.delete(listener); 11910 } 11911 }; 11912 } 11913 11914 // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs 11915 var import_jsx_runtime101 = __toESM(require_jsx_runtime(), 1); 11916 var FloatingNodeContext = /* @__PURE__ */ React26.createContext(null); 11917 if (true) FloatingNodeContext.displayName = "FloatingNodeContext"; 11918 var FloatingTreeContext = /* @__PURE__ */ React26.createContext(null); 11919 if (true) FloatingTreeContext.displayName = "FloatingTreeContext"; 11920 var useFloatingParentNodeId = () => React26.useContext(FloatingNodeContext)?.id || null; 11921 var useFloatingTree = (externalTree) => { 11922 const contextTree = React26.useContext(FloatingTreeContext); 11923 return externalTree ?? contextTree; 11924 }; 11925 11926 // node_modules/@base-ui/react/floating-ui-react/hooks/useClientPoint.mjs 11927 var React27 = __toESM(require_react(), 1); 11928 function createVirtualElement(domElement, data) { 11929 let offsetX = null; 11930 let offsetY = null; 11931 let isAutoUpdateEvent = false; 11932 return { 11933 contextElement: domElement || void 0, 11934 getBoundingClientRect() { 11935 const domRect = domElement?.getBoundingClientRect() || { 11936 width: 0, 11937 height: 0, 11938 x: 0, 11939 y: 0 11940 }; 11941 const isXAxis = data.axis === "x" || data.axis === "both"; 11942 const isYAxis = data.axis === "y" || data.axis === "both"; 11943 const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch"; 11944 let width = domRect.width; 11945 let height = domRect.height; 11946 let x2 = domRect.x; 11947 let y3 = domRect.y; 11948 if (offsetX == null && data.x && isXAxis) { 11949 offsetX = domRect.x - data.x; 11950 } 11951 if (offsetY == null && data.y && isYAxis) { 11952 offsetY = domRect.y - data.y; 11953 } 11954 x2 -= offsetX || 0; 11955 y3 -= offsetY || 0; 11956 width = 0; 11957 height = 0; 11958 if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) { 11959 width = data.axis === "y" ? domRect.width : 0; 11960 height = data.axis === "x" ? domRect.height : 0; 11961 x2 = isXAxis && data.x != null ? data.x : x2; 11962 y3 = isYAxis && data.y != null ? data.y : y3; 11963 } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) { 11964 height = data.axis === "x" ? domRect.height : height; 11965 width = data.axis === "y" ? domRect.width : width; 11966 } 11967 isAutoUpdateEvent = true; 11968 return { 11969 width, 11970 height, 11971 x: x2, 11972 y: y3, 11973 top: y3, 11974 right: x2 + width, 11975 bottom: y3 + height, 11976 left: x2 11977 }; 11978 } 11979 }; 11980 } 11981 function isMouseBasedEvent(event) { 11982 return event != null && event.clientX != null; 11983 } 11984 function useClientPoint(context, props = {}) { 11985 const { 11986 enabled = true, 11987 axis = "both" 11988 } = props; 11989 const store4 = "rootStore" in context ? context.rootStore : context; 11990 const open = store4.useState("open"); 11991 const floating = store4.useState("floatingElement"); 11992 const domReference = store4.useState("domReferenceElement"); 11993 const dataRef = store4.context.dataRef; 11994 const initialRef = React27.useRef(false); 11995 const cleanupListenerRef = React27.useRef(null); 11996 const [pointerType, setPointerType] = React27.useState(); 11997 const [reactive, setReactive] = React27.useState([]); 11998 const resetReference = useStableCallback((reference2) => { 11999 store4.set("positionReference", reference2); 12000 }); 12001 const setReference = useStableCallback((newX, newY, referenceElement) => { 12002 if (initialRef.current) { 12003 return; 12004 } 12005 if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) { 12006 return; 12007 } 12008 store4.set("positionReference", createVirtualElement(referenceElement ?? domReference, { 12009 x: newX, 12010 y: newY, 12011 axis, 12012 dataRef, 12013 pointerType 12014 })); 12015 }); 12016 const handleReferenceEnterOrMove = useStableCallback((event) => { 12017 if (!open) { 12018 setReference(event.clientX, event.clientY, event.currentTarget); 12019 } else if (!cleanupListenerRef.current) { 12020 setReference(event.clientX, event.clientY, event.currentTarget); 12021 setReactive([]); 12022 } 12023 }); 12024 const openCheck = isMouseLikePointerType(pointerType) ? floating : open; 12025 React27.useEffect(() => { 12026 if (!enabled) { 12027 resetReference(domReference); 12028 return void 0; 12029 } 12030 if (!openCheck) { 12031 return void 0; 12032 } 12033 function cleanupListener() { 12034 cleanupListenerRef.current?.(); 12035 cleanupListenerRef.current = null; 12036 } 12037 const win = getWindow(floating); 12038 function handleMouseMove(event) { 12039 const target = getTarget(event); 12040 if (!contains(floating, target)) { 12041 setReference(event.clientX, event.clientY); 12042 } else { 12043 cleanupListener(); 12044 } 12045 } 12046 if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) { 12047 cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove); 12048 } else { 12049 resetReference(domReference); 12050 } 12051 return cleanupListener; 12052 }, [openCheck, enabled, floating, dataRef, domReference, store4, setReference, resetReference, reactive]); 12053 React27.useEffect(() => () => { 12054 store4.set("positionReference", null); 12055 }, [store4]); 12056 React27.useEffect(() => { 12057 if (enabled && !floating) { 12058 initialRef.current = false; 12059 } 12060 }, [enabled, floating]); 12061 React27.useEffect(() => { 12062 if (!enabled && open) { 12063 initialRef.current = true; 12064 } 12065 }, [enabled, open]); 12066 const reference = React27.useMemo(() => { 12067 function setPointerTypeRef(event) { 12068 setPointerType(event.pointerType); 12069 } 12070 return { 12071 onPointerDown: setPointerTypeRef, 12072 onPointerEnter: setPointerTypeRef, 12073 onMouseMove: handleReferenceEnterOrMove, 12074 onMouseEnter: handleReferenceEnterOrMove 12075 }; 12076 }, [handleReferenceEnterOrMove]); 12077 return React27.useMemo(() => enabled ? { 12078 reference, 12079 trigger: reference 12080 } : {}, [enabled, reference]); 12081 } 12082 12083 // node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs 12084 var React28 = __toESM(require_react(), 1); 12085 function alwaysFalse() { 12086 return false; 12087 } 12088 function normalizeProp(normalizable) { 12089 return { 12090 escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false, 12091 outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true 12092 }; 12093 } 12094 function useDismiss(context, props = {}) { 12095 const { 12096 enabled = true, 12097 escapeKey: escapeKey2 = true, 12098 outsidePress: outsidePressProp = true, 12099 outsidePressEvent = "sloppy", 12100 referencePress = alwaysFalse, 12101 bubbles, 12102 externalTree 12103 } = props; 12104 const store4 = "rootStore" in context ? context.rootStore : context; 12105 const open = store4.useState("open"); 12106 const floatingElement = store4.useState("floatingElement"); 12107 const { 12108 dataRef 12109 } = store4.context; 12110 const tree = useFloatingTree(externalTree); 12111 const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false); 12112 const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp; 12113 const outsidePressEnabled = outsidePress2 !== false; 12114 const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent); 12115 const { 12116 escapeKey: escapeKeyBubbles, 12117 outsidePress: outsidePressBubbles 12118 } = normalizeProp(bubbles); 12119 const pressStartedInsideRef = React28.useRef(false); 12120 const pressStartPreventedRef = React28.useRef(false); 12121 const suppressNextOutsideClickRef = React28.useRef(false); 12122 const isComposingRef = React28.useRef(false); 12123 const currentPointerTypeRef = React28.useRef(""); 12124 const touchStateRef = React28.useRef(null); 12125 const cancelDismissOnEndTimeout = useTimeout(); 12126 const clearInsideReactTreeTimeout = useTimeout(); 12127 const clearInsideReactTree = useStableCallback(() => { 12128 clearInsideReactTreeTimeout.clear(); 12129 dataRef.current.insideReactTree = false; 12130 }); 12131 const hasBlockingChild = useStableCallback((bubbleKey) => { 12132 const nodeId = dataRef.current.floatingContext?.nodeId; 12133 const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : []; 12134 return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]); 12135 }); 12136 const isEventWithinOwnElements = useStableCallback((event) => { 12137 return isEventTargetWithin(event, store4.select("floatingElement")) || isEventTargetWithin(event, store4.select("domReferenceElement")); 12138 }); 12139 const closeOnReferencePress = useStableCallback((event) => { 12140 if (!referencePress()) { 12141 return; 12142 } 12143 store4.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent)); 12144 }); 12145 const closeOnEscapeKeyDown = useStableCallback((event) => { 12146 if (!open || !enabled || !escapeKey2 || event.key !== "Escape") { 12147 return; 12148 } 12149 if (isComposingRef.current) { 12150 return; 12151 } 12152 if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) { 12153 return; 12154 } 12155 const native = isReactEvent(event) ? event.nativeEvent : event; 12156 const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native); 12157 store4.setOpen(false, eventDetails); 12158 if (!eventDetails.isCanceled) { 12159 event.preventDefault(); 12160 } 12161 if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) { 12162 event.stopPropagation(); 12163 } 12164 }); 12165 const markInsideReactTree = useStableCallback(() => { 12166 dataRef.current.insideReactTree = true; 12167 clearInsideReactTreeTimeout.start(0, clearInsideReactTree); 12168 }); 12169 const markPressStartedInsideReactTree = useStableCallback((event) => { 12170 if (!open || !enabled || event.button !== 0) { 12171 return; 12172 } 12173 const target = getTarget(event.nativeEvent); 12174 if (!contains(store4.select("floatingElement"), target)) { 12175 return; 12176 } 12177 if (!pressStartedInsideRef.current) { 12178 pressStartedInsideRef.current = true; 12179 pressStartPreventedRef.current = false; 12180 } 12181 }); 12182 const markInsidePressStartPrevented = useStableCallback((event) => { 12183 if (!open || !enabled) { 12184 return; 12185 } 12186 if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) { 12187 return; 12188 } 12189 if (pressStartedInsideRef.current) { 12190 pressStartPreventedRef.current = true; 12191 } 12192 }); 12193 React28.useEffect(() => { 12194 if (!open || !enabled) { 12195 return void 0; 12196 } 12197 dataRef.current.__escapeKeyBubbles = escapeKeyBubbles; 12198 dataRef.current.__outsidePressBubbles = outsidePressBubbles; 12199 const compositionTimeout = new Timeout(); 12200 const preventedPressSuppressionTimeout = new Timeout(); 12201 function handleCompositionStart() { 12202 compositionTimeout.clear(); 12203 isComposingRef.current = true; 12204 } 12205 function handleCompositionEnd() { 12206 compositionTimeout.start( 12207 // 0ms or 1ms don't work in Safari. 5ms appears to consistently work. 12208 // Only apply to WebKit for the test to remain 0ms. 12209 parts_exports.engine.webkit ? 5 : 0, 12210 () => { 12211 isComposingRef.current = false; 12212 } 12213 ); 12214 } 12215 function suppressImmediateOutsideClickAfterPreventedStart() { 12216 suppressNextOutsideClickRef.current = true; 12217 preventedPressSuppressionTimeout.start(0, () => { 12218 suppressNextOutsideClickRef.current = false; 12219 }); 12220 } 12221 function resetPressStartState() { 12222 pressStartedInsideRef.current = false; 12223 pressStartPreventedRef.current = false; 12224 } 12225 function getOutsidePressEvent() { 12226 const type = currentPointerTypeRef.current; 12227 const computedType = type === "pen" || !type ? "mouse" : type; 12228 const outsidePressEventValue = getOutsidePressEventProp(); 12229 const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue; 12230 if (typeof resolved === "string") { 12231 return resolved; 12232 } 12233 return resolved[computedType]; 12234 } 12235 function shouldIgnoreEvent(event) { 12236 const computedOutsidePressEvent = getOutsidePressEvent(); 12237 return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click"; 12238 } 12239 function isEventWithinFloatingTree(event) { 12240 const nodeId = dataRef.current.floatingContext?.nodeId; 12241 const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating)); 12242 return isEventWithinOwnElements(event) || targetIsInsideChildren; 12243 } 12244 function closeOnPressOutside(event) { 12245 if (shouldIgnoreEvent(event)) { 12246 if (event.type !== "click" && !isEventWithinOwnElements(event)) { 12247 preventedPressSuppressionTimeout.clear(); 12248 suppressNextOutsideClickRef.current = false; 12249 } 12250 clearInsideReactTree(); 12251 return; 12252 } 12253 if (dataRef.current.insideReactTree) { 12254 clearInsideReactTree(); 12255 return; 12256 } 12257 const target = getTarget(event); 12258 const inertSelector = `[$createAttribute("inert")}]`; 12259 const targetRoot = isElement(target) ? target.getRootNode() : null; 12260 const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store4.select("floatingElement"))).querySelectorAll(inertSelector)); 12261 const triggers = store4.context.triggerElements; 12262 if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) { 12263 return; 12264 } 12265 let targetRootAncestor = isElement(target) ? target : null; 12266 while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) { 12267 const nextParent = getParentNode(targetRootAncestor); 12268 if (isLastTraversableNode(nextParent) || !isElement(nextParent)) { 12269 break; 12270 } 12271 targetRootAncestor = nextParent; 12272 } 12273 if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay). 12274 !contains(target, store4.select("floatingElement")) && // If the target root element contains none of the markers, then the 12275 // element was injected after the floating element rendered. 12276 markers.every((marker) => !contains(targetRootAncestor, marker))) { 12277 return; 12278 } 12279 if (isHTMLElement(target) && !("touches" in event)) { 12280 const lastTraversableNode = isLastTraversableNode(target); 12281 const style = getComputedStyle2(target); 12282 const scrollRe = /auto|scroll/; 12283 const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX); 12284 const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY); 12285 const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth; 12286 const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight; 12287 const isRTL24 = style.direction === "rtl"; 12288 const pressedVerticalScrollbar = canScrollY && (isRTL24 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth); 12289 const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight; 12290 if (pressedVerticalScrollbar || pressedHorizontalScrollbar) { 12291 return; 12292 } 12293 } 12294 if (isEventWithinFloatingTree(event)) { 12295 return; 12296 } 12297 if (getOutsidePressEvent() === "intentional" && suppressNextOutsideClickRef.current) { 12298 preventedPressSuppressionTimeout.clear(); 12299 suppressNextOutsideClickRef.current = false; 12300 return; 12301 } 12302 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 12303 return; 12304 } 12305 if (hasBlockingChild("__outsidePressBubbles")) { 12306 return; 12307 } 12308 store4.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event)); 12309 clearInsideReactTree(); 12310 } 12311 function handlePointerDown(event) { 12312 if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store4.select("open") || !enabled || isEventWithinOwnElements(event)) { 12313 return; 12314 } 12315 closeOnPressOutside(event); 12316 } 12317 function handleTouchStart(event) { 12318 if (getOutsidePressEvent() !== "sloppy" || !store4.select("open") || !enabled || isEventWithinOwnElements(event)) { 12319 return; 12320 } 12321 const touch = event.touches[0]; 12322 if (touch) { 12323 touchStateRef.current = { 12324 startTime: Date.now(), 12325 startX: touch.clientX, 12326 startY: touch.clientY, 12327 dismissOnTouchEnd: false, 12328 dismissOnMouseDown: true 12329 }; 12330 cancelDismissOnEndTimeout.start(1e3, () => { 12331 if (touchStateRef.current) { 12332 touchStateRef.current.dismissOnTouchEnd = false; 12333 touchStateRef.current.dismissOnMouseDown = false; 12334 } 12335 }); 12336 } 12337 } 12338 function addTargetEventListenerOnce(event, listener) { 12339 const target = getTarget(event); 12340 if (!target) { 12341 return; 12342 } 12343 const unsubscribe2 = addEventListener(target, event.type, () => { 12344 listener(event); 12345 unsubscribe2(); 12346 }); 12347 } 12348 function handleTouchStartCapture(event) { 12349 currentPointerTypeRef.current = "touch"; 12350 addTargetEventListenerOnce(event, handleTouchStart); 12351 } 12352 function closeOnPressOutsideCapture(event) { 12353 cancelDismissOnEndTimeout.clear(); 12354 if (event.type === "pointerdown") { 12355 currentPointerTypeRef.current = event.pointerType; 12356 } 12357 if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) { 12358 return; 12359 } 12360 addTargetEventListenerOnce(event, (targetEvent) => { 12361 if (targetEvent.type === "pointerdown") { 12362 handlePointerDown(targetEvent); 12363 } else { 12364 closeOnPressOutside(targetEvent); 12365 } 12366 }); 12367 } 12368 function handlePressEndCapture(event) { 12369 if (!pressStartedInsideRef.current) { 12370 return; 12371 } 12372 const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current; 12373 resetPressStartState(); 12374 if (getOutsidePressEvent() !== "intentional") { 12375 return; 12376 } 12377 if (event.type === "pointercancel") { 12378 if (pressStartedInsideDefaultPrevented) { 12379 suppressImmediateOutsideClickAfterPreventedStart(); 12380 } 12381 return; 12382 } 12383 if (isEventWithinFloatingTree(event)) { 12384 return; 12385 } 12386 if (pressStartedInsideDefaultPrevented) { 12387 suppressImmediateOutsideClickAfterPreventedStart(); 12388 return; 12389 } 12390 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 12391 return; 12392 } 12393 preventedPressSuppressionTimeout.clear(); 12394 suppressNextOutsideClickRef.current = true; 12395 clearInsideReactTree(); 12396 } 12397 function handleTouchMove(event) { 12398 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { 12399 return; 12400 } 12401 const touch = event.touches[0]; 12402 if (!touch) { 12403 return; 12404 } 12405 const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX); 12406 const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY); 12407 const distance2 = Math.sqrt(deltaX * deltaX + deltaY * deltaY); 12408 if (distance2 > 5) { 12409 touchStateRef.current.dismissOnTouchEnd = true; 12410 } 12411 if (distance2 > 10) { 12412 closeOnPressOutside(event); 12413 cancelDismissOnEndTimeout.clear(); 12414 touchStateRef.current = null; 12415 } 12416 } 12417 function handleTouchMoveCapture(event) { 12418 addTargetEventListenerOnce(event, handleTouchMove); 12419 } 12420 function handleTouchEnd(event) { 12421 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { 12422 return; 12423 } 12424 if (touchStateRef.current.dismissOnTouchEnd) { 12425 closeOnPressOutside(event); 12426 } 12427 cancelDismissOnEndTimeout.clear(); 12428 touchStateRef.current = null; 12429 } 12430 function handleTouchEndCapture(event) { 12431 addTargetEventListenerOnce(event, handleTouchEnd); 12432 } 12433 const doc = ownerDocument(floatingElement); 12434 const unsubscribe = mergeCleanups(escapeKey2 && mergeCleanups(addEventListener(doc, "keydown", closeOnEscapeKeyDown), addEventListener(doc, "compositionstart", handleCompositionStart), addEventListener(doc, "compositionend", handleCompositionEnd)), outsidePressEnabled && mergeCleanups(addEventListener(doc, "click", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerdown", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerup", handlePressEndCapture, true), addEventListener(doc, "pointercancel", handlePressEndCapture, true), addEventListener(doc, "mousedown", closeOnPressOutsideCapture, true), addEventListener(doc, "mouseup", handlePressEndCapture, true), addEventListener(doc, "touchstart", handleTouchStartCapture, true), addEventListener(doc, "touchmove", handleTouchMoveCapture, true), addEventListener(doc, "touchend", handleTouchEndCapture, true))); 12435 return () => { 12436 unsubscribe(); 12437 compositionTimeout.clear(); 12438 preventedPressSuppressionTimeout.clear(); 12439 resetPressStartState(); 12440 suppressNextOutsideClickRef.current = false; 12441 }; 12442 }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store4, cancelDismissOnEndTimeout]); 12443 React28.useEffect(clearInsideReactTree, [outsidePress2, clearInsideReactTree]); 12444 const reference = React28.useMemo(() => ({ 12445 onKeyDown: closeOnEscapeKeyDown, 12446 onPointerDown: closeOnReferencePress, 12447 onClick: closeOnReferencePress 12448 }), [closeOnEscapeKeyDown, closeOnReferencePress]); 12449 const floating = React28.useMemo(() => ({ 12450 onKeyDown: closeOnEscapeKeyDown, 12451 // `onMouseDown` may be blocked if `event.preventDefault()` is called in 12452 // `onPointerDown`, such as with <NumberField.ScrubArea>. 12453 // See https://github.com/mui/base-ui/pull/3379 12454 onPointerDown: markInsidePressStartPrevented, 12455 onMouseDown: markInsidePressStartPrevented, 12456 onClickCapture: markInsideReactTree, 12457 onMouseDownCapture(event) { 12458 markInsideReactTree(); 12459 markPressStartedInsideReactTree(event); 12460 }, 12461 onPointerDownCapture(event) { 12462 markInsideReactTree(); 12463 markPressStartedInsideReactTree(event); 12464 }, 12465 onMouseUpCapture: markInsideReactTree, 12466 onTouchEndCapture: markInsideReactTree, 12467 onTouchMoveCapture: markInsideReactTree 12468 }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]); 12469 return React28.useMemo(() => enabled ? { 12470 reference, 12471 floating, 12472 trigger: reference 12473 } : {}, [enabled, reference, floating]); 12474 } 12475 12476 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs 12477 var React36 = __toESM(require_react(), 1); 12478 12479 // node_modules/@floating-ui/core/dist/floating-ui.core.mjs 12480 function computeCoordsFromPlacement(_ref, placement, rtl) { 12481 let { 12482 reference, 12483 floating 12484 } = _ref; 12485 const sideAxis = getSideAxis(placement); 12486 const alignmentAxis = getAlignmentAxis(placement); 12487 const alignLength = getAxisLength(alignmentAxis); 12488 const side = getSide(placement); 12489 const isVertical = sideAxis === "y"; 12490 const commonX = reference.x + reference.width / 2 - floating.width / 2; 12491 const commonY = reference.y + reference.height / 2 - floating.height / 2; 12492 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; 12493 let coords; 12494 switch (side) { 12495 case "top": 12496 coords = { 12497 x: commonX, 12498 y: reference.y - floating.height 12499 }; 12500 break; 12501 case "bottom": 12502 coords = { 12503 x: commonX, 12504 y: reference.y + reference.height 12505 }; 12506 break; 12507 case "right": 12508 coords = { 12509 x: reference.x + reference.width, 12510 y: commonY 12511 }; 12512 break; 12513 case "left": 12514 coords = { 12515 x: reference.x - floating.width, 12516 y: commonY 12517 }; 12518 break; 12519 default: 12520 coords = { 12521 x: reference.x, 12522 y: reference.y 12523 }; 12524 } 12525 switch (getAlignment(placement)) { 12526 case "start": 12527 coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); 12528 break; 12529 case "end": 12530 coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); 12531 break; 12532 } 12533 return coords; 12534 } 12535 async function detectOverflow(state2, options) { 12536 var _await$platform$isEle; 12537 if (options === void 0) { 12538 options = {}; 12539 } 12540 const { 12541 x: x2, 12542 y: y3, 12543 platform: platform3, 12544 rects, 12545 elements: elements2, 12546 strategy 12547 } = state2; 12548 const { 12549 boundary = "clippingAncestors", 12550 rootBoundary = "viewport", 12551 elementContext = "floating", 12552 altBoundary = false, 12553 padding = 0 12554 } = evaluate(options, state2); 12555 const paddingObject = getPaddingObject(padding); 12556 const altContext = elementContext === "floating" ? "reference" : "floating"; 12557 const element = elements2[altBoundary ? altContext : elementContext]; 12558 const clippingClientRect = rectToClientRect(await platform3.getClippingRect({ 12559 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(elements2.floating)), 12560 boundary, 12561 rootBoundary, 12562 strategy 12563 })); 12564 const rect = elementContext === "floating" ? { 12565 x: x2, 12566 y: y3, 12567 width: rects.floating.width, 12568 height: rects.floating.height 12569 } : rects.reference; 12570 const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements2.floating)); 12571 const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) ? await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || { 12572 x: 1, 12573 y: 1 12574 } : { 12575 x: 1, 12576 y: 1 12577 }; 12578 const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({ 12579 elements: elements2, 12580 rect, 12581 offsetParent, 12582 strategy 12583 }) : rect); 12584 return { 12585 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, 12586 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, 12587 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, 12588 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x 12589 }; 12590 } 12591 var MAX_RESET_COUNT = 50; 12592 var computePosition = async (reference, floating, config2) => { 12593 const { 12594 placement = "bottom", 12595 strategy = "absolute", 12596 middleware = [], 12597 platform: platform3 12598 } = config2; 12599 const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : { 12600 ...platform3, 12601 detectOverflow 12602 }; 12603 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating)); 12604 let rects = await platform3.getElementRects({ 12605 reference, 12606 floating, 12607 strategy 12608 }); 12609 let { 12610 x: x2, 12611 y: y3 12612 } = computeCoordsFromPlacement(rects, placement, rtl); 12613 let statefulPlacement = placement; 12614 let resetCount = 0; 12615 const middlewareData = {}; 12616 for (let i3 = 0; i3 < middleware.length; i3++) { 12617 const currentMiddleware = middleware[i3]; 12618 if (!currentMiddleware) { 12619 continue; 12620 } 12621 const { 12622 name: name2, 12623 fn 12624 } = currentMiddleware; 12625 const { 12626 x: nextX, 12627 y: nextY, 12628 data, 12629 reset 12630 } = await fn({ 12631 x: x2, 12632 y: y3, 12633 initialPlacement: placement, 12634 placement: statefulPlacement, 12635 strategy, 12636 middlewareData, 12637 rects, 12638 platform: platformWithDetectOverflow, 12639 elements: { 12640 reference, 12641 floating 12642 } 12643 }); 12644 x2 = nextX != null ? nextX : x2; 12645 y3 = nextY != null ? nextY : y3; 12646 middlewareData[name2] = { 12647 ...middlewareData[name2], 12648 ...data 12649 }; 12650 if (reset && resetCount < MAX_RESET_COUNT) { 12651 resetCount++; 12652 if (typeof reset === "object") { 12653 if (reset.placement) { 12654 statefulPlacement = reset.placement; 12655 } 12656 if (reset.rects) { 12657 rects = reset.rects === true ? await platform3.getElementRects({ 12658 reference, 12659 floating, 12660 strategy 12661 }) : reset.rects; 12662 } 12663 ({ 12664 x: x2, 12665 y: y3 12666 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); 12667 } 12668 i3 = -1; 12669 } 12670 } 12671 return { 12672 x: x2, 12673 y: y3, 12674 placement: statefulPlacement, 12675 strategy, 12676 middlewareData 12677 }; 12678 }; 12679 var flip = function(options) { 12680 if (options === void 0) { 12681 options = {}; 12682 } 12683 return { 12684 name: "flip", 12685 options, 12686 async fn(state2) { 12687 var _middlewareData$arrow, _middlewareData$flip; 12688 const { 12689 placement, 12690 middlewareData, 12691 rects, 12692 initialPlacement, 12693 platform: platform3, 12694 elements: elements2 12695 } = state2; 12696 const { 12697 mainAxis: checkMainAxis = true, 12698 crossAxis: checkCrossAxis = true, 12699 fallbackPlacements: specifiedFallbackPlacements, 12700 fallbackStrategy = "bestFit", 12701 fallbackAxisSideDirection = "none", 12702 flipAlignment = true, 12703 ...detectOverflowOptions 12704 } = evaluate(options, state2); 12705 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 12706 return {}; 12707 } 12708 const side = getSide(placement); 12709 const initialSideAxis = getSideAxis(initialPlacement); 12710 const isBasePlacement = getSide(initialPlacement) === initialPlacement; 12711 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements2.floating)); 12712 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); 12713 const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none"; 12714 if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { 12715 fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); 12716 } 12717 const placements2 = [initialPlacement, ...fallbackPlacements]; 12718 const overflow = await platform3.detectOverflow(state2, detectOverflowOptions); 12719 const overflows = []; 12720 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; 12721 if (checkMainAxis) { 12722 overflows.push(overflow[side]); 12723 } 12724 if (checkCrossAxis) { 12725 const sides3 = getAlignmentSides(placement, rects, rtl); 12726 overflows.push(overflow[sides3[0]], overflow[sides3[1]]); 12727 } 12728 overflowsData = [...overflowsData, { 12729 placement, 12730 overflows 12731 }]; 12732 if (!overflows.every((side2) => side2 <= 0)) { 12733 var _middlewareData$flip2, _overflowsData$filter; 12734 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; 12735 const nextPlacement = placements2[nextIndex]; 12736 if (nextPlacement) { 12737 const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false; 12738 if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis 12739 // overflows the main axis. 12740 overflowsData.every((d3) => getSideAxis(d3.placement) === initialSideAxis ? d3.overflows[0] > 0 : true)) { 12741 return { 12742 data: { 12743 index: nextIndex, 12744 overflows: overflowsData 12745 }, 12746 reset: { 12747 placement: nextPlacement 12748 } 12749 }; 12750 } 12751 } 12752 let resetPlacement = (_overflowsData$filter = overflowsData.filter((d3) => d3.overflows[0] <= 0).sort((a3, b3) => a3.overflows[1] - b3.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement; 12753 if (!resetPlacement) { 12754 switch (fallbackStrategy) { 12755 case "bestFit": { 12756 var _overflowsData$filter2; 12757 const placement2 = (_overflowsData$filter2 = overflowsData.filter((d3) => { 12758 if (hasFallbackAxisSideDirection) { 12759 const currentSideAxis = getSideAxis(d3.placement); 12760 return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal 12761 // reading directions favoring greater width. 12762 currentSideAxis === "y"; 12763 } 12764 return true; 12765 }).map((d3) => [d3.placement, d3.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a3, b3) => a3[1] - b3[1])[0]) == null ? void 0 : _overflowsData$filter2[0]; 12766 if (placement2) { 12767 resetPlacement = placement2; 12768 } 12769 break; 12770 } 12771 case "initialPlacement": 12772 resetPlacement = initialPlacement; 12773 break; 12774 } 12775 } 12776 if (placement !== resetPlacement) { 12777 return { 12778 reset: { 12779 placement: resetPlacement 12780 } 12781 }; 12782 } 12783 } 12784 return {}; 12785 } 12786 }; 12787 }; 12788 function getSideOffsets(overflow, rect) { 12789 return { 12790 top: overflow.top - rect.height, 12791 right: overflow.right - rect.width, 12792 bottom: overflow.bottom - rect.height, 12793 left: overflow.left - rect.width 12794 }; 12795 } 12796 function isAnySideFullyClipped(overflow) { 12797 return sides.some((side) => overflow[side] >= 0); 12798 } 12799 var hide = function(options) { 12800 if (options === void 0) { 12801 options = {}; 12802 } 12803 return { 12804 name: "hide", 12805 options, 12806 async fn(state2) { 12807 const { 12808 rects, 12809 platform: platform3 12810 } = state2; 12811 const { 12812 strategy = "referenceHidden", 12813 ...detectOverflowOptions 12814 } = evaluate(options, state2); 12815 switch (strategy) { 12816 case "referenceHidden": { 12817 const overflow = await platform3.detectOverflow(state2, { 12818 ...detectOverflowOptions, 12819 elementContext: "reference" 12820 }); 12821 const offsets = getSideOffsets(overflow, rects.reference); 12822 return { 12823 data: { 12824 referenceHiddenOffsets: offsets, 12825 referenceHidden: isAnySideFullyClipped(offsets) 12826 } 12827 }; 12828 } 12829 case "escaped": { 12830 const overflow = await platform3.detectOverflow(state2, { 12831 ...detectOverflowOptions, 12832 altBoundary: true 12833 }); 12834 const offsets = getSideOffsets(overflow, rects.floating); 12835 return { 12836 data: { 12837 escapedOffsets: offsets, 12838 escaped: isAnySideFullyClipped(offsets) 12839 } 12840 }; 12841 } 12842 default: { 12843 return {}; 12844 } 12845 } 12846 } 12847 }; 12848 }; 12849 var originSides = /* @__PURE__ */ new Set(["left", "top"]); 12850 async function convertValueToCoords(state2, options) { 12851 const { 12852 placement, 12853 platform: platform3, 12854 elements: elements2 12855 } = state2; 12856 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements2.floating)); 12857 const side = getSide(placement); 12858 const alignment = getAlignment(placement); 12859 const isVertical = getSideAxis(placement) === "y"; 12860 const mainAxisMulti = originSides.has(side) ? -1 : 1; 12861 const crossAxisMulti = rtl && isVertical ? -1 : 1; 12862 const rawValue = evaluate(options, state2); 12863 let { 12864 mainAxis, 12865 crossAxis, 12866 alignmentAxis 12867 } = typeof rawValue === "number" ? { 12868 mainAxis: rawValue, 12869 crossAxis: 0, 12870 alignmentAxis: null 12871 } : { 12872 mainAxis: rawValue.mainAxis || 0, 12873 crossAxis: rawValue.crossAxis || 0, 12874 alignmentAxis: rawValue.alignmentAxis 12875 }; 12876 if (alignment && typeof alignmentAxis === "number") { 12877 crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; 12878 } 12879 return isVertical ? { 12880 x: crossAxis * crossAxisMulti, 12881 y: mainAxis * mainAxisMulti 12882 } : { 12883 x: mainAxis * mainAxisMulti, 12884 y: crossAxis * crossAxisMulti 12885 }; 12886 } 12887 var offset = function(options) { 12888 if (options === void 0) { 12889 options = 0; 12890 } 12891 return { 12892 name: "offset", 12893 options, 12894 async fn(state2) { 12895 var _middlewareData$offse, _middlewareData$arrow; 12896 const { 12897 x: x2, 12898 y: y3, 12899 placement, 12900 middlewareData 12901 } = state2; 12902 const diffCoords = await convertValueToCoords(state2, options); 12903 if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 12904 return {}; 12905 } 12906 return { 12907 x: x2 + diffCoords.x, 12908 y: y3 + diffCoords.y, 12909 data: { 12910 ...diffCoords, 12911 placement 12912 } 12913 }; 12914 } 12915 }; 12916 }; 12917 var shift = function(options) { 12918 if (options === void 0) { 12919 options = {}; 12920 } 12921 return { 12922 name: "shift", 12923 options, 12924 async fn(state2) { 12925 const { 12926 x: x2, 12927 y: y3, 12928 placement, 12929 platform: platform3 12930 } = state2; 12931 const { 12932 mainAxis: checkMainAxis = true, 12933 crossAxis: checkCrossAxis = false, 12934 limiter = { 12935 fn: (_ref) => { 12936 let { 12937 x: x3, 12938 y: y4 12939 } = _ref; 12940 return { 12941 x: x3, 12942 y: y4 12943 }; 12944 } 12945 }, 12946 ...detectOverflowOptions 12947 } = evaluate(options, state2); 12948 const coords = { 12949 x: x2, 12950 y: y3 12951 }; 12952 const overflow = await platform3.detectOverflow(state2, detectOverflowOptions); 12953 const crossAxis = getSideAxis(getSide(placement)); 12954 const mainAxis = getOppositeAxis(crossAxis); 12955 let mainAxisCoord = coords[mainAxis]; 12956 let crossAxisCoord = coords[crossAxis]; 12957 if (checkMainAxis) { 12958 const minSide = mainAxis === "y" ? "top" : "left"; 12959 const maxSide = mainAxis === "y" ? "bottom" : "right"; 12960 const min3 = mainAxisCoord + overflow[minSide]; 12961 const max3 = mainAxisCoord - overflow[maxSide]; 12962 mainAxisCoord = clamp(min3, mainAxisCoord, max3); 12963 } 12964 if (checkCrossAxis) { 12965 const minSide = crossAxis === "y" ? "top" : "left"; 12966 const maxSide = crossAxis === "y" ? "bottom" : "right"; 12967 const min3 = crossAxisCoord + overflow[minSide]; 12968 const max3 = crossAxisCoord - overflow[maxSide]; 12969 crossAxisCoord = clamp(min3, crossAxisCoord, max3); 12970 } 12971 const limitedCoords = limiter.fn({ 12972 ...state2, 12973 [mainAxis]: mainAxisCoord, 12974 [crossAxis]: crossAxisCoord 12975 }); 12976 return { 12977 ...limitedCoords, 12978 data: { 12979 x: limitedCoords.x - x2, 12980 y: limitedCoords.y - y3, 12981 enabled: { 12982 [mainAxis]: checkMainAxis, 12983 [crossAxis]: checkCrossAxis 12984 } 12985 } 12986 }; 12987 } 12988 }; 12989 }; 12990 var limitShift = function(options) { 12991 if (options === void 0) { 12992 options = {}; 12993 } 12994 return { 12995 options, 12996 fn(state2) { 12997 const { 12998 x: x2, 12999 y: y3, 13000 placement, 13001 rects, 13002 middlewareData 13003 } = state2; 13004 const { 13005 offset: offset4 = 0, 13006 mainAxis: checkMainAxis = true, 13007 crossAxis: checkCrossAxis = true 13008 } = evaluate(options, state2); 13009 const coords = { 13010 x: x2, 13011 y: y3 13012 }; 13013 const crossAxis = getSideAxis(placement); 13014 const mainAxis = getOppositeAxis(crossAxis); 13015 let mainAxisCoord = coords[mainAxis]; 13016 let crossAxisCoord = coords[crossAxis]; 13017 const rawOffset = evaluate(offset4, state2); 13018 const computedOffset = typeof rawOffset === "number" ? { 13019 mainAxis: rawOffset, 13020 crossAxis: 0 13021 } : { 13022 mainAxis: 0, 13023 crossAxis: 0, 13024 ...rawOffset 13025 }; 13026 if (checkMainAxis) { 13027 const len2 = mainAxis === "y" ? "height" : "width"; 13028 const limitMin = rects.reference[mainAxis] - rects.floating[len2] + computedOffset.mainAxis; 13029 const limitMax = rects.reference[mainAxis] + rects.reference[len2] - computedOffset.mainAxis; 13030 if (mainAxisCoord < limitMin) { 13031 mainAxisCoord = limitMin; 13032 } else if (mainAxisCoord > limitMax) { 13033 mainAxisCoord = limitMax; 13034 } 13035 } 13036 if (checkCrossAxis) { 13037 var _middlewareData$offse, _middlewareData$offse2; 13038 const len2 = mainAxis === "y" ? "width" : "height"; 13039 const isOriginSide = originSides.has(getSide(placement)); 13040 const limitMin = rects.reference[crossAxis] - rects.floating[len2] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis); 13041 const limitMax = rects.reference[crossAxis] + rects.reference[len2] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0); 13042 if (crossAxisCoord < limitMin) { 13043 crossAxisCoord = limitMin; 13044 } else if (crossAxisCoord > limitMax) { 13045 crossAxisCoord = limitMax; 13046 } 13047 } 13048 return { 13049 [mainAxis]: mainAxisCoord, 13050 [crossAxis]: crossAxisCoord 13051 }; 13052 } 13053 }; 13054 }; 13055 var size = function(options) { 13056 if (options === void 0) { 13057 options = {}; 13058 } 13059 return { 13060 name: "size", 13061 options, 13062 async fn(state2) { 13063 var _state$middlewareData, _state$middlewareData2; 13064 const { 13065 placement, 13066 rects, 13067 platform: platform3, 13068 elements: elements2 13069 } = state2; 13070 const { 13071 apply = () => { 13072 }, 13073 ...detectOverflowOptions 13074 } = evaluate(options, state2); 13075 const overflow = await platform3.detectOverflow(state2, detectOverflowOptions); 13076 const side = getSide(placement); 13077 const alignment = getAlignment(placement); 13078 const isYAxis = getSideAxis(placement) === "y"; 13079 const { 13080 width, 13081 height 13082 } = rects.floating; 13083 let heightSide; 13084 let widthSide; 13085 if (side === "top" || side === "bottom") { 13086 heightSide = side; 13087 widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements2.floating)) ? "start" : "end") ? "left" : "right"; 13088 } else { 13089 widthSide = side; 13090 heightSide = alignment === "end" ? "top" : "bottom"; 13091 } 13092 const maximumClippingHeight = height - overflow.top - overflow.bottom; 13093 const maximumClippingWidth = width - overflow.left - overflow.right; 13094 const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight); 13095 const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth); 13096 const noShift = !state2.middlewareData.shift; 13097 let availableHeight = overflowAvailableHeight; 13098 let availableWidth = overflowAvailableWidth; 13099 if ((_state$middlewareData = state2.middlewareData.shift) != null && _state$middlewareData.enabled.x) { 13100 availableWidth = maximumClippingWidth; 13101 } 13102 if ((_state$middlewareData2 = state2.middlewareData.shift) != null && _state$middlewareData2.enabled.y) { 13103 availableHeight = maximumClippingHeight; 13104 } 13105 if (noShift && !alignment) { 13106 const xMin = max(overflow.left, 0); 13107 const xMax = max(overflow.right, 0); 13108 const yMin = max(overflow.top, 0); 13109 const yMax = max(overflow.bottom, 0); 13110 if (isYAxis) { 13111 availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right)); 13112 } else { 13113 availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom)); 13114 } 13115 } 13116 await apply({ 13117 ...state2, 13118 availableWidth, 13119 availableHeight 13120 }); 13121 const nextDimensions = await platform3.getDimensions(elements2.floating); 13122 if (width !== nextDimensions.width || height !== nextDimensions.height) { 13123 return { 13124 reset: { 13125 rects: true 13126 } 13127 }; 13128 } 13129 return {}; 13130 } 13131 }; 13132 }; 13133 13134 // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs 13135 function getCssDimensions(element) { 13136 const css = getComputedStyle2(element); 13137 let width = parseFloat(css.width) || 0; 13138 let height = parseFloat(css.height) || 0; 13139 const hasOffset = isHTMLElement(element); 13140 const offsetWidth = hasOffset ? element.offsetWidth : width; 13141 const offsetHeight = hasOffset ? element.offsetHeight : height; 13142 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 13143 if (shouldFallback) { 13144 width = offsetWidth; 13145 height = offsetHeight; 13146 } 13147 return { 13148 width, 13149 height, 13150 $: shouldFallback 13151 }; 13152 } 13153 function unwrapElement(element) { 13154 return !isElement(element) ? element.contextElement : element; 13155 } 13156 function getScale(element) { 13157 const domElement = unwrapElement(element); 13158 if (!isHTMLElement(domElement)) { 13159 return createCoords(1); 13160 } 13161 const rect = domElement.getBoundingClientRect(); 13162 const { 13163 width, 13164 height, 13165 $: $2 13166 } = getCssDimensions(domElement); 13167 let x2 = ($2 ? round(rect.width) : rect.width) / width; 13168 let y3 = ($2 ? round(rect.height) : rect.height) / height; 13169 if (!x2 || !Number.isFinite(x2)) { 13170 x2 = 1; 13171 } 13172 if (!y3 || !Number.isFinite(y3)) { 13173 y3 = 1; 13174 } 13175 return { 13176 x: x2, 13177 y: y3 13178 }; 13179 } 13180 var noOffsets = /* @__PURE__ */ createCoords(0); 13181 function getVisualOffsets(element) { 13182 const win = getWindow(element); 13183 if (!isWebKit() || !win.visualViewport) { 13184 return noOffsets; 13185 } 13186 return { 13187 x: win.visualViewport.offsetLeft, 13188 y: win.visualViewport.offsetTop 13189 }; 13190 } 13191 function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { 13192 if (isFixed === void 0) { 13193 isFixed = false; 13194 } 13195 if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) { 13196 return false; 13197 } 13198 return isFixed; 13199 } 13200 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { 13201 if (includeScale === void 0) { 13202 includeScale = false; 13203 } 13204 if (isFixedStrategy === void 0) { 13205 isFixedStrategy = false; 13206 } 13207 const clientRect = element.getBoundingClientRect(); 13208 const domElement = unwrapElement(element); 13209 let scale3 = createCoords(1); 13210 if (includeScale) { 13211 if (offsetParent) { 13212 if (isElement(offsetParent)) { 13213 scale3 = getScale(offsetParent); 13214 } 13215 } else { 13216 scale3 = getScale(element); 13217 } 13218 } 13219 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); 13220 let x2 = (clientRect.left + visualOffsets.x) / scale3.x; 13221 let y3 = (clientRect.top + visualOffsets.y) / scale3.y; 13222 let width = clientRect.width / scale3.x; 13223 let height = clientRect.height / scale3.y; 13224 if (domElement) { 13225 const win = getWindow(domElement); 13226 const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; 13227 let currentWin = win; 13228 let currentIFrame = getFrameElement(currentWin); 13229 while (currentIFrame && offsetParent && offsetWin !== currentWin) { 13230 const iframeScale = getScale(currentIFrame); 13231 const iframeRect = currentIFrame.getBoundingClientRect(); 13232 const css = getComputedStyle2(currentIFrame); 13233 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; 13234 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; 13235 x2 *= iframeScale.x; 13236 y3 *= iframeScale.y; 13237 width *= iframeScale.x; 13238 height *= iframeScale.y; 13239 x2 += left; 13240 y3 += top; 13241 currentWin = getWindow(currentIFrame); 13242 currentIFrame = getFrameElement(currentWin); 13243 } 13244 } 13245 return rectToClientRect({ 13246 width, 13247 height, 13248 x: x2, 13249 y: y3 13250 }); 13251 } 13252 function getWindowScrollBarX(element, rect) { 13253 const leftScroll = getNodeScroll(element).scrollLeft; 13254 if (!rect) { 13255 return getBoundingClientRect(getDocumentElement(element)).left + leftScroll; 13256 } 13257 return rect.left + leftScroll; 13258 } 13259 function getHTMLOffset(documentElement, scroll) { 13260 const htmlRect = documentElement.getBoundingClientRect(); 13261 const x2 = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect); 13262 const y3 = htmlRect.top + scroll.scrollTop; 13263 return { 13264 x: x2, 13265 y: y3 13266 }; 13267 } 13268 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { 13269 let { 13270 elements: elements2, 13271 rect, 13272 offsetParent, 13273 strategy 13274 } = _ref; 13275 const isFixed = strategy === "fixed"; 13276 const documentElement = getDocumentElement(offsetParent); 13277 const topLayer = elements2 ? isTopLayer(elements2.floating) : false; 13278 if (offsetParent === documentElement || topLayer && isFixed) { 13279 return rect; 13280 } 13281 let scroll = { 13282 scrollLeft: 0, 13283 scrollTop: 0 13284 }; 13285 let scale3 = createCoords(1); 13286 const offsets = createCoords(0); 13287 const isOffsetParentAnElement = isHTMLElement(offsetParent); 13288 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 13289 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 13290 scroll = getNodeScroll(offsetParent); 13291 } 13292 if (isOffsetParentAnElement) { 13293 const offsetRect = getBoundingClientRect(offsetParent); 13294 scale3 = getScale(offsetParent); 13295 offsets.x = offsetRect.x + offsetParent.clientLeft; 13296 offsets.y = offsetRect.y + offsetParent.clientTop; 13297 } 13298 } 13299 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 13300 return { 13301 width: rect.width * scale3.x, 13302 height: rect.height * scale3.y, 13303 x: rect.x * scale3.x - scroll.scrollLeft * scale3.x + offsets.x + htmlOffset.x, 13304 y: rect.y * scale3.y - scroll.scrollTop * scale3.y + offsets.y + htmlOffset.y 13305 }; 13306 } 13307 function getClientRects(element) { 13308 return Array.from(element.getClientRects()); 13309 } 13310 function getDocumentRect(element) { 13311 const html = getDocumentElement(element); 13312 const scroll = getNodeScroll(element); 13313 const body = element.ownerDocument.body; 13314 const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); 13315 const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); 13316 let x2 = -scroll.scrollLeft + getWindowScrollBarX(element); 13317 const y3 = -scroll.scrollTop; 13318 if (getComputedStyle2(body).direction === "rtl") { 13319 x2 += max(html.clientWidth, body.clientWidth) - width; 13320 } 13321 return { 13322 width, 13323 height, 13324 x: x2, 13325 y: y3 13326 }; 13327 } 13328 var SCROLLBAR_MAX = 25; 13329 function getViewportRect(element, strategy) { 13330 const win = getWindow(element); 13331 const html = getDocumentElement(element); 13332 const visualViewport = win.visualViewport; 13333 let width = html.clientWidth; 13334 let height = html.clientHeight; 13335 let x2 = 0; 13336 let y3 = 0; 13337 if (visualViewport) { 13338 width = visualViewport.width; 13339 height = visualViewport.height; 13340 const visualViewportBased = isWebKit(); 13341 if (!visualViewportBased || visualViewportBased && strategy === "fixed") { 13342 x2 = visualViewport.offsetLeft; 13343 y3 = visualViewport.offsetTop; 13344 } 13345 } 13346 const windowScrollbarX = getWindowScrollBarX(html); 13347 if (windowScrollbarX <= 0) { 13348 const doc = html.ownerDocument; 13349 const body = doc.body; 13350 const bodyStyles = getComputedStyle(body); 13351 const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0; 13352 const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline); 13353 if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) { 13354 width -= clippingStableScrollbarWidth; 13355 } 13356 } else if (windowScrollbarX <= SCROLLBAR_MAX) { 13357 width += windowScrollbarX; 13358 } 13359 return { 13360 width, 13361 height, 13362 x: x2, 13363 y: y3 13364 }; 13365 } 13366 function getInnerBoundingClientRect(element, strategy) { 13367 const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); 13368 const top = clientRect.top + element.clientTop; 13369 const left = clientRect.left + element.clientLeft; 13370 const scale3 = isHTMLElement(element) ? getScale(element) : createCoords(1); 13371 const width = element.clientWidth * scale3.x; 13372 const height = element.clientHeight * scale3.y; 13373 const x2 = left * scale3.x; 13374 const y3 = top * scale3.y; 13375 return { 13376 width, 13377 height, 13378 x: x2, 13379 y: y3 13380 }; 13381 } 13382 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { 13383 let rect; 13384 if (clippingAncestor === "viewport") { 13385 rect = getViewportRect(element, strategy); 13386 } else if (clippingAncestor === "document") { 13387 rect = getDocumentRect(getDocumentElement(element)); 13388 } else if (isElement(clippingAncestor)) { 13389 rect = getInnerBoundingClientRect(clippingAncestor, strategy); 13390 } else { 13391 const visualOffsets = getVisualOffsets(element); 13392 rect = { 13393 x: clippingAncestor.x - visualOffsets.x, 13394 y: clippingAncestor.y - visualOffsets.y, 13395 width: clippingAncestor.width, 13396 height: clippingAncestor.height 13397 }; 13398 } 13399 return rectToClientRect(rect); 13400 } 13401 function hasFixedPositionAncestor(element, stopNode) { 13402 const parentNode = getParentNode(element); 13403 if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) { 13404 return false; 13405 } 13406 return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode); 13407 } 13408 function getClippingElementAncestors(element, cache) { 13409 const cachedResult = cache.get(element); 13410 if (cachedResult) { 13411 return cachedResult; 13412 } 13413 let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); 13414 let currentContainingBlockComputedStyle = null; 13415 const elementIsFixed = getComputedStyle2(element).position === "fixed"; 13416 let currentNode = elementIsFixed ? getParentNode(element) : element; 13417 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { 13418 const computedStyle = getComputedStyle2(currentNode); 13419 const currentNodeIsContaining = isContainingBlock(currentNode); 13420 if (!currentNodeIsContaining && computedStyle.position === "fixed") { 13421 currentContainingBlockComputedStyle = null; 13422 } 13423 const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode); 13424 if (shouldDropCurrentNode) { 13425 result = result.filter((ancestor) => ancestor !== currentNode); 13426 } else { 13427 currentContainingBlockComputedStyle = computedStyle; 13428 } 13429 currentNode = getParentNode(currentNode); 13430 } 13431 cache.set(element, result); 13432 return result; 13433 } 13434 function getClippingRect(_ref) { 13435 let { 13436 element, 13437 boundary, 13438 rootBoundary, 13439 strategy 13440 } = _ref; 13441 const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary); 13442 const clippingAncestors = [...elementClippingAncestors, rootBoundary]; 13443 const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy); 13444 let top = firstRect.top; 13445 let right = firstRect.right; 13446 let bottom = firstRect.bottom; 13447 let left = firstRect.left; 13448 for (let i3 = 1; i3 < clippingAncestors.length; i3++) { 13449 const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i3], strategy); 13450 top = max(rect.top, top); 13451 right = min(rect.right, right); 13452 bottom = min(rect.bottom, bottom); 13453 left = max(rect.left, left); 13454 } 13455 return { 13456 width: right - left, 13457 height: bottom - top, 13458 x: left, 13459 y: top 13460 }; 13461 } 13462 function getDimensions2(element) { 13463 const { 13464 width, 13465 height 13466 } = getCssDimensions(element); 13467 return { 13468 width, 13469 height 13470 }; 13471 } 13472 function getRectRelativeToOffsetParent(element, offsetParent, strategy) { 13473 const isOffsetParentAnElement = isHTMLElement(offsetParent); 13474 const documentElement = getDocumentElement(offsetParent); 13475 const isFixed = strategy === "fixed"; 13476 const rect = getBoundingClientRect(element, true, isFixed, offsetParent); 13477 let scroll = { 13478 scrollLeft: 0, 13479 scrollTop: 0 13480 }; 13481 const offsets = createCoords(0); 13482 function setLeftRTLScrollbarOffset() { 13483 offsets.x = getWindowScrollBarX(documentElement); 13484 } 13485 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 13486 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 13487 scroll = getNodeScroll(offsetParent); 13488 } 13489 if (isOffsetParentAnElement) { 13490 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); 13491 offsets.x = offsetRect.x + offsetParent.clientLeft; 13492 offsets.y = offsetRect.y + offsetParent.clientTop; 13493 } else if (documentElement) { 13494 setLeftRTLScrollbarOffset(); 13495 } 13496 } 13497 if (isFixed && !isOffsetParentAnElement && documentElement) { 13498 setLeftRTLScrollbarOffset(); 13499 } 13500 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 13501 const x2 = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x; 13502 const y3 = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y; 13503 return { 13504 x: x2, 13505 y: y3, 13506 width: rect.width, 13507 height: rect.height 13508 }; 13509 } 13510 function isStaticPositioned(element) { 13511 return getComputedStyle2(element).position === "static"; 13512 } 13513 function getTrueOffsetParent(element, polyfill) { 13514 if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") { 13515 return null; 13516 } 13517 if (polyfill) { 13518 return polyfill(element); 13519 } 13520 let rawOffsetParent = element.offsetParent; 13521 if (getDocumentElement(element) === rawOffsetParent) { 13522 rawOffsetParent = rawOffsetParent.ownerDocument.body; 13523 } 13524 return rawOffsetParent; 13525 } 13526 function getOffsetParent(element, polyfill) { 13527 const win = getWindow(element); 13528 if (isTopLayer(element)) { 13529 return win; 13530 } 13531 if (!isHTMLElement(element)) { 13532 let svgOffsetParent = getParentNode(element); 13533 while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { 13534 if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { 13535 return svgOffsetParent; 13536 } 13537 svgOffsetParent = getParentNode(svgOffsetParent); 13538 } 13539 return win; 13540 } 13541 let offsetParent = getTrueOffsetParent(element, polyfill); 13542 while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) { 13543 offsetParent = getTrueOffsetParent(offsetParent, polyfill); 13544 } 13545 if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) { 13546 return win; 13547 } 13548 return offsetParent || getContainingBlock(element) || win; 13549 } 13550 var getElementRects = async function(data) { 13551 const getOffsetParentFn = this.getOffsetParent || getOffsetParent; 13552 const getDimensionsFn = this.getDimensions; 13553 const floatingDimensions = await getDimensionsFn(data.floating); 13554 return { 13555 reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), 13556 floating: { 13557 x: 0, 13558 y: 0, 13559 width: floatingDimensions.width, 13560 height: floatingDimensions.height 13561 } 13562 }; 13563 }; 13564 function isRTL(element) { 13565 return getComputedStyle2(element).direction === "rtl"; 13566 } 13567 var platform2 = { 13568 convertOffsetParentRelativeRectToViewportRelativeRect, 13569 getDocumentElement, 13570 getClippingRect, 13571 getOffsetParent, 13572 getElementRects, 13573 getClientRects, 13574 getDimensions: getDimensions2, 13575 getScale, 13576 isElement, 13577 isRTL 13578 }; 13579 function rectsAreEqual(a3, b3) { 13580 return a3.x === b3.x && a3.y === b3.y && a3.width === b3.width && a3.height === b3.height; 13581 } 13582 function observeMove(element, onMove) { 13583 let io = null; 13584 let timeoutId; 13585 const root = getDocumentElement(element); 13586 function cleanup() { 13587 var _io; 13588 clearTimeout(timeoutId); 13589 (_io = io) == null || _io.disconnect(); 13590 io = null; 13591 } 13592 function refresh(skip, threshold) { 13593 if (skip === void 0) { 13594 skip = false; 13595 } 13596 if (threshold === void 0) { 13597 threshold = 1; 13598 } 13599 cleanup(); 13600 const elementRectForRootMargin = element.getBoundingClientRect(); 13601 const { 13602 left, 13603 top, 13604 width, 13605 height 13606 } = elementRectForRootMargin; 13607 if (!skip) { 13608 onMove(); 13609 } 13610 if (!width || !height) { 13611 return; 13612 } 13613 const insetTop = floor(top); 13614 const insetRight = floor(root.clientWidth - (left + width)); 13615 const insetBottom = floor(root.clientHeight - (top + height)); 13616 const insetLeft = floor(left); 13617 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; 13618 const options = { 13619 rootMargin, 13620 threshold: max(0, min(1, threshold)) || 1 13621 }; 13622 let isFirstUpdate = true; 13623 function handleObserve(entries) { 13624 const ratio = entries[0].intersectionRatio; 13625 if (ratio !== threshold) { 13626 if (!isFirstUpdate) { 13627 return refresh(); 13628 } 13629 if (!ratio) { 13630 timeoutId = setTimeout(() => { 13631 refresh(false, 1e-7); 13632 }, 1e3); 13633 } else { 13634 refresh(false, ratio); 13635 } 13636 } 13637 if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) { 13638 refresh(); 13639 } 13640 isFirstUpdate = false; 13641 } 13642 try { 13643 io = new IntersectionObserver(handleObserve, { 13644 ...options, 13645 // Handle <iframe>s 13646 root: root.ownerDocument 13647 }); 13648 } catch (_e) { 13649 io = new IntersectionObserver(handleObserve, options); 13650 } 13651 io.observe(element); 13652 } 13653 refresh(true); 13654 return cleanup; 13655 } 13656 function autoUpdate(reference, floating, update4, options) { 13657 if (options === void 0) { 13658 options = {}; 13659 } 13660 const { 13661 ancestorScroll = true, 13662 ancestorResize = true, 13663 elementResize = typeof ResizeObserver === "function", 13664 layoutShift = typeof IntersectionObserver === "function", 13665 animationFrame = false 13666 } = options; 13667 const referenceEl = unwrapElement(reference); 13668 const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : []; 13669 ancestors.forEach((ancestor) => { 13670 ancestorScroll && ancestor.addEventListener("scroll", update4, { 13671 passive: true 13672 }); 13673 ancestorResize && ancestor.addEventListener("resize", update4); 13674 }); 13675 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update4) : null; 13676 let reobserveFrame = -1; 13677 let resizeObserver = null; 13678 if (elementResize) { 13679 resizeObserver = new ResizeObserver((_ref) => { 13680 let [firstEntry] = _ref; 13681 if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) { 13682 resizeObserver.unobserve(floating); 13683 cancelAnimationFrame(reobserveFrame); 13684 reobserveFrame = requestAnimationFrame(() => { 13685 var _resizeObserver; 13686 (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); 13687 }); 13688 } 13689 update4(); 13690 }); 13691 if (referenceEl && !animationFrame) { 13692 resizeObserver.observe(referenceEl); 13693 } 13694 if (floating) { 13695 resizeObserver.observe(floating); 13696 } 13697 } 13698 let frameId; 13699 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; 13700 if (animationFrame) { 13701 frameLoop2(); 13702 } 13703 function frameLoop2() { 13704 const nextRefRect = getBoundingClientRect(reference); 13705 if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) { 13706 update4(); 13707 } 13708 prevRefRect = nextRefRect; 13709 frameId = requestAnimationFrame(frameLoop2); 13710 } 13711 update4(); 13712 return () => { 13713 var _resizeObserver2; 13714 ancestors.forEach((ancestor) => { 13715 ancestorScroll && ancestor.removeEventListener("scroll", update4); 13716 ancestorResize && ancestor.removeEventListener("resize", update4); 13717 }); 13718 cleanupIo == null || cleanupIo(); 13719 (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); 13720 resizeObserver = null; 13721 if (animationFrame) { 13722 cancelAnimationFrame(frameId); 13723 } 13724 }; 13725 } 13726 var offset2 = offset; 13727 var shift2 = shift; 13728 var flip2 = flip; 13729 var size2 = size; 13730 var hide2 = hide; 13731 var limitShift2 = limitShift; 13732 var computePosition2 = (reference, floating, options) => { 13733 const cache = /* @__PURE__ */ new Map(); 13734 const mergedOptions = { 13735 platform: platform2, 13736 ...options 13737 }; 13738 const platformWithCache = { 13739 ...mergedOptions.platform, 13740 _c: cache 13741 }; 13742 return computePosition(reference, floating, { 13743 ...mergedOptions, 13744 platform: platformWithCache 13745 }); 13746 }; 13747 13748 // node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs 13749 var React29 = __toESM(require_react(), 1); 13750 var import_react2 = __toESM(require_react(), 1); 13751 var ReactDOM3 = __toESM(require_react_dom(), 1); 13752 var isClient = typeof document !== "undefined"; 13753 var noop3 = function noop4() { 13754 }; 13755 var index = isClient ? import_react2.useLayoutEffect : noop3; 13756 function deepEqual(a3, b3) { 13757 if (a3 === b3) { 13758 return true; 13759 } 13760 if (typeof a3 !== typeof b3) { 13761 return false; 13762 } 13763 if (typeof a3 === "function" && a3.toString() === b3.toString()) { 13764 return true; 13765 } 13766 let length2; 13767 let i3; 13768 let keys; 13769 if (a3 && b3 && typeof a3 === "object") { 13770 if (Array.isArray(a3)) { 13771 length2 = a3.length; 13772 if (length2 !== b3.length) return false; 13773 for (i3 = length2; i3-- !== 0; ) { 13774 if (!deepEqual(a3[i3], b3[i3])) { 13775 return false; 13776 } 13777 } 13778 return true; 13779 } 13780 keys = Object.keys(a3); 13781 length2 = keys.length; 13782 if (length2 !== Object.keys(b3).length) { 13783 return false; 13784 } 13785 for (i3 = length2; i3-- !== 0; ) { 13786 if (!{}.hasOwnProperty.call(b3, keys[i3])) { 13787 return false; 13788 } 13789 } 13790 for (i3 = length2; i3-- !== 0; ) { 13791 const key = keys[i3]; 13792 if (key === "_owner" && a3.$$typeof) { 13793 continue; 13794 } 13795 if (!deepEqual(a3[key], b3[key])) { 13796 return false; 13797 } 13798 } 13799 return true; 13800 } 13801 return a3 !== a3 && b3 !== b3; 13802 } 13803 function getDPR(element) { 13804 if (typeof window === "undefined") { 13805 return 1; 13806 } 13807 const win = element.ownerDocument.defaultView || window; 13808 return win.devicePixelRatio || 1; 13809 } 13810 function roundByDPR(element, value) { 13811 const dpr = getDPR(element); 13812 return Math.round(value * dpr) / dpr; 13813 } 13814 function useLatestRef(value) { 13815 const ref = React29.useRef(value); 13816 index(() => { 13817 ref.current = value; 13818 }); 13819 return ref; 13820 } 13821 function useFloating(options) { 13822 if (options === void 0) { 13823 options = {}; 13824 } 13825 const { 13826 placement = "bottom", 13827 strategy = "absolute", 13828 middleware = [], 13829 platform: platform3, 13830 elements: { 13831 reference: externalReference, 13832 floating: externalFloating 13833 } = {}, 13834 transform = true, 13835 whileElementsMounted, 13836 open 13837 } = options; 13838 const [data, setData] = React29.useState({ 13839 x: 0, 13840 y: 0, 13841 strategy, 13842 placement, 13843 middlewareData: {}, 13844 isPositioned: false 13845 }); 13846 const [latestMiddleware, setLatestMiddleware] = React29.useState(middleware); 13847 if (!deepEqual(latestMiddleware, middleware)) { 13848 setLatestMiddleware(middleware); 13849 } 13850 const [_reference, _setReference] = React29.useState(null); 13851 const [_floating, _setFloating] = React29.useState(null); 13852 const setReference = React29.useCallback((node) => { 13853 if (node !== referenceRef.current) { 13854 referenceRef.current = node; 13855 _setReference(node); 13856 } 13857 }, []); 13858 const setFloating = React29.useCallback((node) => { 13859 if (node !== floatingRef.current) { 13860 floatingRef.current = node; 13861 _setFloating(node); 13862 } 13863 }, []); 13864 const referenceEl = externalReference || _reference; 13865 const floatingEl = externalFloating || _floating; 13866 const referenceRef = React29.useRef(null); 13867 const floatingRef = React29.useRef(null); 13868 const dataRef = React29.useRef(data); 13869 const hasWhileElementsMounted = whileElementsMounted != null; 13870 const whileElementsMountedRef = useLatestRef(whileElementsMounted); 13871 const platformRef = useLatestRef(platform3); 13872 const openRef = useLatestRef(open); 13873 const update4 = React29.useCallback(() => { 13874 if (!referenceRef.current || !floatingRef.current) { 13875 return; 13876 } 13877 const config2 = { 13878 placement, 13879 strategy, 13880 middleware: latestMiddleware 13881 }; 13882 if (platformRef.current) { 13883 config2.platform = platformRef.current; 13884 } 13885 computePosition2(referenceRef.current, floatingRef.current, config2).then((data2) => { 13886 const fullData = { 13887 ...data2, 13888 // The floating element's position may be recomputed while it's closed 13889 // but still mounted (such as when transitioning out). To ensure 13890 // `isPositioned` will be `false` initially on the next open, avoid 13891 // setting it to `true` when `open === false` (must be specified). 13892 isPositioned: openRef.current !== false 13893 }; 13894 if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { 13895 dataRef.current = fullData; 13896 ReactDOM3.flushSync(() => { 13897 setData(fullData); 13898 }); 13899 } 13900 }); 13901 }, [latestMiddleware, placement, strategy, platformRef, openRef]); 13902 index(() => { 13903 if (open === false && dataRef.current.isPositioned) { 13904 dataRef.current.isPositioned = false; 13905 setData((data2) => ({ 13906 ...data2, 13907 isPositioned: false 13908 })); 13909 } 13910 }, [open]); 13911 const isMountedRef = React29.useRef(false); 13912 index(() => { 13913 isMountedRef.current = true; 13914 return () => { 13915 isMountedRef.current = false; 13916 }; 13917 }, []); 13918 index(() => { 13919 if (referenceEl) referenceRef.current = referenceEl; 13920 if (floatingEl) floatingRef.current = floatingEl; 13921 if (referenceEl && floatingEl) { 13922 if (whileElementsMountedRef.current) { 13923 return whileElementsMountedRef.current(referenceEl, floatingEl, update4); 13924 } 13925 update4(); 13926 } 13927 }, [referenceEl, floatingEl, update4, whileElementsMountedRef, hasWhileElementsMounted]); 13928 const refs = React29.useMemo(() => ({ 13929 reference: referenceRef, 13930 floating: floatingRef, 13931 setReference, 13932 setFloating 13933 }), [setReference, setFloating]); 13934 const elements2 = React29.useMemo(() => ({ 13935 reference: referenceEl, 13936 floating: floatingEl 13937 }), [referenceEl, floatingEl]); 13938 const floatingStyles = React29.useMemo(() => { 13939 const initialStyles = { 13940 position: strategy, 13941 left: 0, 13942 top: 0 13943 }; 13944 if (!elements2.floating) { 13945 return initialStyles; 13946 } 13947 const x2 = roundByDPR(elements2.floating, data.x); 13948 const y3 = roundByDPR(elements2.floating, data.y); 13949 if (transform) { 13950 return { 13951 ...initialStyles, 13952 transform: "translate(" + x2 + "px, " + y3 + "px)", 13953 ...getDPR(elements2.floating) >= 1.5 && { 13954 willChange: "transform" 13955 } 13956 }; 13957 } 13958 return { 13959 position: strategy, 13960 left: x2, 13961 top: y3 13962 }; 13963 }, [strategy, transform, elements2.floating, data.x, data.y]); 13964 return React29.useMemo(() => ({ 13965 ...data, 13966 update: update4, 13967 refs, 13968 elements: elements2, 13969 floatingStyles 13970 }), [data, update4, refs, elements2, floatingStyles]); 13971 } 13972 var offset3 = (options, deps) => { 13973 const result = offset2(options); 13974 return { 13975 name: result.name, 13976 fn: result.fn, 13977 options: [options, deps] 13978 }; 13979 }; 13980 var shift3 = (options, deps) => { 13981 const result = shift2(options); 13982 return { 13983 name: result.name, 13984 fn: result.fn, 13985 options: [options, deps] 13986 }; 13987 }; 13988 var limitShift3 = (options, deps) => { 13989 const result = limitShift2(options); 13990 return { 13991 fn: result.fn, 13992 options: [options, deps] 13993 }; 13994 }; 13995 var flip3 = (options, deps) => { 13996 const result = flip2(options); 13997 return { 13998 name: result.name, 13999 fn: result.fn, 14000 options: [options, deps] 14001 }; 14002 }; 14003 var size3 = (options, deps) => { 14004 const result = size2(options); 14005 return { 14006 name: result.name, 14007 fn: result.fn, 14008 options: [options, deps] 14009 }; 14010 }; 14011 var hide3 = (options, deps) => { 14012 const result = hide2(options); 14013 return { 14014 name: result.name, 14015 fn: result.fn, 14016 options: [options, deps] 14017 }; 14018 }; 14019 14020 // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs 14021 var React35 = __toESM(require_react(), 1); 14022 var ReactDOM4 = __toESM(require_react_dom(), 1); 14023 14024 // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs 14025 var React34 = __toESM(require_react(), 1); 14026 14027 // node_modules/@base-ui/utils/store/createSelector.mjs 14028 var createSelector3 = (a3, b3, c6, d3, e3, f3, ...other) => { 14029 if (other.length > 0) { 14030 throw new Error(true ? "Unsupported number of selectors" : formatErrorMessage_default(1)); 14031 } 14032 let selector2; 14033 if (a3 && b3 && c6 && d3 && e3 && f3) { 14034 selector2 = (state2, a1, a22, a32) => { 14035 const va = a3(state2, a1, a22, a32); 14036 const vb = b3(state2, a1, a22, a32); 14037 const vc = c6(state2, a1, a22, a32); 14038 const vd = d3(state2, a1, a22, a32); 14039 const ve = e3(state2, a1, a22, a32); 14040 return f3(va, vb, vc, vd, ve, a1, a22, a32); 14041 }; 14042 } else if (a3 && b3 && c6 && d3 && e3) { 14043 selector2 = (state2, a1, a22, a32) => { 14044 const va = a3(state2, a1, a22, a32); 14045 const vb = b3(state2, a1, a22, a32); 14046 const vc = c6(state2, a1, a22, a32); 14047 const vd = d3(state2, a1, a22, a32); 14048 return e3(va, vb, vc, vd, a1, a22, a32); 14049 }; 14050 } else if (a3 && b3 && c6 && d3) { 14051 selector2 = (state2, a1, a22, a32) => { 14052 const va = a3(state2, a1, a22, a32); 14053 const vb = b3(state2, a1, a22, a32); 14054 const vc = c6(state2, a1, a22, a32); 14055 return d3(va, vb, vc, a1, a22, a32); 14056 }; 14057 } else if (a3 && b3 && c6) { 14058 selector2 = (state2, a1, a22, a32) => { 14059 const va = a3(state2, a1, a22, a32); 14060 const vb = b3(state2, a1, a22, a32); 14061 return c6(va, vb, a1, a22, a32); 14062 }; 14063 } else if (a3 && b3) { 14064 selector2 = (state2, a1, a22, a32) => { 14065 const va = a3(state2, a1, a22, a32); 14066 return b3(va, a1, a22, a32); 14067 }; 14068 } else if (a3) { 14069 selector2 = a3; 14070 } else { 14071 throw ( 14072 /* minify-error-disabled */ 14073 new Error("Missing arguments") 14074 ); 14075 } 14076 return selector2; 14077 }; 14078 14079 // node_modules/@base-ui/utils/store/useStore.mjs 14080 var React31 = __toESM(require_react(), 1); 14081 var import_shim = __toESM(require_shim(), 1); 14082 var import_with_selector = __toESM(require_with_selector(), 1); 14083 14084 // node_modules/@base-ui/utils/fastHooks.mjs 14085 var React30 = __toESM(require_react(), 1); 14086 var hooks = []; 14087 var currentInstance = void 0; 14088 function getInstance() { 14089 return currentInstance; 14090 } 14091 function register(hook) { 14092 hooks.push(hook); 14093 } 14094 function fastComponent(fn) { 14095 const FastComponent = (props, forwardedRef) => { 14096 const instance = useRefWithInit(createInstance).current; 14097 let result; 14098 try { 14099 currentInstance = instance; 14100 for (const hook of hooks) { 14101 hook.before(instance); 14102 } 14103 result = fn(props, forwardedRef); 14104 for (const hook of hooks) { 14105 hook.after(instance); 14106 } 14107 instance.didInitialize = true; 14108 } finally { 14109 currentInstance = void 0; 14110 } 14111 return result; 14112 }; 14113 FastComponent.displayName = fn.displayName || fn.name; 14114 return FastComponent; 14115 } 14116 function fastComponentRef(fn) { 14117 return /* @__PURE__ */ React30.forwardRef(fastComponent(fn)); 14118 } 14119 function createInstance() { 14120 return { 14121 didInitialize: false 14122 }; 14123 } 14124 14125 // node_modules/@base-ui/utils/store/useStore.mjs 14126 var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19); 14127 var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy; 14128 function useStore(store4, selector2, a1, a22, a3) { 14129 return useStoreImplementation(store4, selector2, a1, a22, a3); 14130 } 14131 function useStoreR19(store4, selector2, a1, a22, a3) { 14132 const getSelection = React31.useCallback(() => selector2(store4.getSnapshot(), a1, a22, a3), [store4, selector2, a1, a22, a3]); 14133 return (0, import_shim.useSyncExternalStore)(store4.subscribe, getSelection, getSelection); 14134 } 14135 register({ 14136 before(instance) { 14137 instance.syncIndex = 0; 14138 if (!instance.didInitialize) { 14139 instance.syncTick = 1; 14140 instance.syncHooks = []; 14141 instance.didChangeStore = true; 14142 instance.getSnapshot = () => { 14143 let didChange2 = false; 14144 for (let i3 = 0; i3 < instance.syncHooks.length; i3 += 1) { 14145 const hook = instance.syncHooks[i3]; 14146 const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3); 14147 if (!Object.is(hook.value, value)) { 14148 didChange2 = true; 14149 hook.value = value; 14150 } 14151 } 14152 if (didChange2) { 14153 instance.syncTick += 1; 14154 } 14155 return instance.syncTick; 14156 }; 14157 } 14158 }, 14159 after(instance) { 14160 if (instance.syncHooks.length > 0) { 14161 if (instance.didChangeStore) { 14162 instance.didChangeStore = false; 14163 instance.subscribe = (onStoreChange) => { 14164 const stores = /* @__PURE__ */ new Set(); 14165 for (const hook of instance.syncHooks) { 14166 stores.add(hook.store); 14167 } 14168 const unsubscribes = []; 14169 for (const store4 of stores) { 14170 unsubscribes.push(store4.subscribe(onStoreChange)); 14171 } 14172 return () => { 14173 for (const unsubscribe of unsubscribes) { 14174 unsubscribe(); 14175 } 14176 }; 14177 }; 14178 } 14179 (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot); 14180 } 14181 } 14182 }); 14183 function useStoreFast(store4, selector2, a1, a22, a3) { 14184 const instance = getInstance(); 14185 if (!instance) { 14186 return useStoreR19(store4, selector2, a1, a22, a3); 14187 } 14188 const index2 = instance.syncIndex; 14189 instance.syncIndex += 1; 14190 let hook; 14191 if (!instance.didInitialize) { 14192 hook = { 14193 store: store4, 14194 selector: selector2, 14195 a1, 14196 a2: a22, 14197 a3, 14198 value: selector2(store4.getSnapshot(), a1, a22, a3) 14199 }; 14200 instance.syncHooks.push(hook); 14201 } else { 14202 hook = instance.syncHooks[index2]; 14203 if (hook.store !== store4 || hook.selector !== selector2 || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a22) || !Object.is(hook.a3, a3)) { 14204 if (hook.store !== store4) { 14205 instance.didChangeStore = true; 14206 } 14207 hook.store = store4; 14208 hook.selector = selector2; 14209 hook.a1 = a1; 14210 hook.a2 = a22; 14211 hook.a3 = a3; 14212 hook.value = selector2(store4.getSnapshot(), a1, a22, a3); 14213 } 14214 } 14215 return hook.value; 14216 } 14217 function useStoreLegacy(store4, selector2, a1, a22, a3) { 14218 return (0, import_with_selector.useSyncExternalStoreWithSelector)(store4.subscribe, store4.getSnapshot, store4.getSnapshot, (state2) => selector2(state2, a1, a22, a3)); 14219 } 14220 14221 // node_modules/@base-ui/utils/store/Store.mjs 14222 var Store = class { 14223 /** 14224 * The current state of the store. 14225 * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}. 14226 * 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). 14227 * The values can be used directly (to avoid subscribing to the store) in effects or event handlers. 14228 * 14229 * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification. 14230 */ 14231 // Internal state to handle recursive `setState()` calls 14232 constructor(state2) { 14233 this.state = state2; 14234 this.listeners = /* @__PURE__ */ new Set(); 14235 this.updateTick = 0; 14236 } 14237 /** 14238 * Registers a listener that will be called whenever the store's state changes. 14239 * 14240 * @param fn The listener function to be called on state changes. 14241 * @returns A function to unsubscribe the listener. 14242 */ 14243 subscribe = (fn) => { 14244 this.listeners.add(fn); 14245 return () => { 14246 this.listeners.delete(fn); 14247 }; 14248 }; 14249 /** 14250 * Returns the current state of the store. 14251 */ 14252 getSnapshot = () => { 14253 return this.state; 14254 }; 14255 /** 14256 * Updates the entire store's state and notifies all registered listeners. 14257 * 14258 * @param newState The new state to set for the store. 14259 */ 14260 setState(newState) { 14261 if (this.state === newState) { 14262 return; 14263 } 14264 this.state = newState; 14265 this.updateTick += 1; 14266 const currentTick = this.updateTick; 14267 for (const listener of this.listeners) { 14268 if (currentTick !== this.updateTick) { 14269 return; 14270 } 14271 listener(newState); 14272 } 14273 } 14274 /** 14275 * Merges the provided changes into the current state and notifies listeners if there are changes. 14276 * 14277 * @param changes An object containing the changes to apply to the current state. 14278 */ 14279 update(changes) { 14280 for (const key in changes) { 14281 if (!Object.is(this.state[key], changes[key])) { 14282 this.setState({ 14283 ...this.state, 14284 ...changes 14285 }); 14286 return; 14287 } 14288 } 14289 } 14290 /** 14291 * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed. 14292 * 14293 * @param key The key in the store's state to update. 14294 * @param value The new value to set for the specified key. 14295 */ 14296 set(key, value) { 14297 if (!Object.is(this.state[key], value)) { 14298 this.setState({ 14299 ...this.state, 14300 [key]: value 14301 }); 14302 } 14303 } 14304 /** 14305 * Gives the state a new reference and updates all registered listeners. 14306 */ 14307 notifyAll() { 14308 const newState = { 14309 ...this.state 14310 }; 14311 this.setState(newState); 14312 } 14313 use(selector2, a1, a22, a3) { 14314 return useStore(this, selector2, a1, a22, a3); 14315 } 14316 }; 14317 14318 // node_modules/@base-ui/utils/store/ReactStore.mjs 14319 var React32 = __toESM(require_react(), 1); 14320 var ReactStore = class extends Store { 14321 /** 14322 * Creates a new ReactStore instance. 14323 * 14324 * @param state Initial state of the store. 14325 * @param context Non-reactive context values. 14326 * @param selectors Optional selectors for use with `useState`. 14327 */ 14328 constructor(state2, context = {}, selectors3) { 14329 super(state2); 14330 this.context = context; 14331 this.selectors = selectors3; 14332 } 14333 /** 14334 * Non-reactive values such as refs, callbacks, etc. 14335 */ 14336 /** 14337 * Synchronizes a single external value into the store. 14338 * 14339 * Note that the while the value in `state` is updated immediately, the value returned 14340 * by `useState` is updated before the next render (similarly to React's `useState`). 14341 */ 14342 useSyncedValue(key, value) { 14343 React32.useDebugValue(key); 14344 const store4 = this; 14345 useIsoLayoutEffect(() => { 14346 if (store4.state[key] !== value) { 14347 store4.set(key, value); 14348 } 14349 }, [store4, key, value]); 14350 } 14351 /** 14352 * Synchronizes a single external value into the store and 14353 * cleans it up (sets to `undefined`) on unmount. 14354 * 14355 * Note that the while the value in `state` is updated immediately, the value returned 14356 * by `useState` is updated before the next render (similarly to React's `useState`). 14357 */ 14358 useSyncedValueWithCleanup(key, value) { 14359 const store4 = this; 14360 useIsoLayoutEffect(() => { 14361 if (store4.state[key] !== value) { 14362 store4.set(key, value); 14363 } 14364 return () => { 14365 store4.set(key, void 0); 14366 }; 14367 }, [store4, key, value]); 14368 } 14369 /** 14370 * Synchronizes multiple external values into the store. 14371 * 14372 * Note that the while the values in `state` are updated immediately, the values returned 14373 * by `useState` are updated before the next render (similarly to React's `useState`). 14374 */ 14375 useSyncedValues(statePart) { 14376 const store4 = this; 14377 if (true) { 14378 React32.useDebugValue(statePart, (p4) => Object.keys(p4)); 14379 const keys = React32.useRef(Object.keys(statePart)).current; 14380 const nextKeys = Object.keys(statePart); 14381 if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) { 14382 console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable."); 14383 } 14384 } 14385 const dependencies = Object.values(statePart); 14386 useIsoLayoutEffect(() => { 14387 store4.update(statePart); 14388 }, [store4, ...dependencies]); 14389 } 14390 /** 14391 * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled` 14392 * is non-undefined, the store's state at `key` is updated to match `controlled`. 14393 */ 14394 useControlledProp(key, controlled) { 14395 React32.useDebugValue(key); 14396 const store4 = this; 14397 const isControlled = controlled !== void 0; 14398 useIsoLayoutEffect(() => { 14399 if (isControlled && !Object.is(store4.state[key], controlled)) { 14400 store4.setState({ 14401 ...store4.state, 14402 [key]: controlled 14403 }); 14404 } 14405 }, [store4, key, controlled, isControlled]); 14406 if (true) { 14407 const cache = this.controlledValues ??= /* @__PURE__ */ new Map(); 14408 if (!cache.has(key)) { 14409 cache.set(key, isControlled); 14410 } 14411 const previouslyControlled = cache.get(key); 14412 if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) { 14413 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).`); 14414 } 14415 } 14416 } 14417 /** Gets the current value from the store using a selector with the provided key. 14418 * 14419 * @param key Key of the selector to use. 14420 */ 14421 select(key, a1, a22, a3) { 14422 const selector2 = this.selectors[key]; 14423 return selector2(this.state, a1, a22, a3); 14424 } 14425 /** 14426 * Returns a value from the store's state using a selector function. 14427 * Used to subscribe to specific parts of the state. 14428 * This methods causes a rerender whenever the selected state changes. 14429 * 14430 * @param key Key of the selector to use. 14431 */ 14432 useState(key, a1, a22, a3) { 14433 React32.useDebugValue(key); 14434 return useStore(this, this.selectors[key], a1, a22, a3); 14435 } 14436 /** 14437 * Wraps a function with `useStableCallback` to ensure it has a stable reference 14438 * and assigns it to the context. 14439 * 14440 * @param key Key of the event callback. Must be a function in the context. 14441 * @param fn Function to assign. 14442 */ 14443 useContextCallback(key, fn) { 14444 React32.useDebugValue(key); 14445 const stableFunction = useStableCallback(fn ?? NOOP); 14446 this.context[key] = stableFunction; 14447 } 14448 /** 14449 * Returns a stable setter function for a specific key in the store's state. 14450 * It's commonly used to pass as a ref callback to React elements. 14451 * 14452 * @param key Key of the state to set. 14453 */ 14454 useStateSetter(key) { 14455 const ref = React32.useRef(void 0); 14456 if (ref.current === void 0) { 14457 ref.current = (value) => { 14458 this.set(key, value); 14459 }; 14460 } 14461 return ref.current; 14462 } 14463 /** 14464 * Observes changes derived from the store's selectors and calls the listener when the selected value changes. 14465 * 14466 * @param key Key of the selector to observe. 14467 * @param listener Listener function called when the selector result changes. 14468 */ 14469 observe(selector2, listener) { 14470 let selectFn; 14471 if (typeof selector2 === "function") { 14472 selectFn = selector2; 14473 } else { 14474 selectFn = this.selectors[selector2]; 14475 } 14476 let prevValue = selectFn(this.state); 14477 listener(prevValue, prevValue, this); 14478 return this.subscribe((nextState) => { 14479 const nextValue = selectFn(nextState); 14480 if (!Object.is(prevValue, nextValue)) { 14481 const oldValue = prevValue; 14482 prevValue = nextValue; 14483 listener(nextValue, oldValue, this); 14484 } 14485 }); 14486 } 14487 }; 14488 14489 // node_modules/@base-ui/utils/useForcedRerendering.mjs 14490 var React33 = __toESM(require_react(), 1); 14491 function useForcedRerendering() { 14492 const [, setState] = React33.useState({}); 14493 return React33.useCallback(() => { 14494 setState({}); 14495 }, []); 14496 } 14497 14498 // node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs 14499 var selectors = { 14500 open: createSelector3((state2) => state2.open), 14501 transitionStatus: createSelector3((state2) => state2.transitionStatus), 14502 domReferenceElement: createSelector3((state2) => state2.domReferenceElement), 14503 referenceElement: createSelector3((state2) => state2.positionReference ?? state2.referenceElement), 14504 floatingElement: createSelector3((state2) => state2.floatingElement), 14505 floatingId: createSelector3((state2) => state2.floatingId) 14506 }; 14507 var FloatingRootStore = class extends ReactStore { 14508 constructor(options) { 14509 const { 14510 syncOnly, 14511 nested, 14512 onOpenChange, 14513 triggerElements, 14514 ...initialState 14515 } = options; 14516 super({ 14517 ...initialState, 14518 positionReference: initialState.referenceElement, 14519 domReferenceElement: initialState.referenceElement 14520 }, { 14521 onOpenChange, 14522 dataRef: { 14523 current: {} 14524 }, 14525 events: createEventEmitter(), 14526 nested, 14527 triggerElements 14528 }, selectors); 14529 this.syncOnly = syncOnly; 14530 } 14531 /** 14532 * Syncs the event used by hover logic to distinguish hover-open from click-like interaction. 14533 */ 14534 syncOpenEvent = (newOpen, event) => { 14535 if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing 14536 // click events to upgrade a hover-open. 14537 event != null && isClickLikeEvent(event)) { 14538 this.context.dataRef.current.openEvent = newOpen ? event : void 0; 14539 } 14540 }; 14541 /** 14542 * Runs the root-owned side effects for an open state change. 14543 */ 14544 dispatchOpenChange = (newOpen, eventDetails) => { 14545 this.syncOpenEvent(newOpen, eventDetails.event); 14546 const details = { 14547 open: newOpen, 14548 reason: eventDetails.reason, 14549 nativeEvent: eventDetails.event, 14550 nested: this.context.nested, 14551 triggerElement: eventDetails.trigger 14552 }; 14553 this.context.events.emit("openchange", details); 14554 }; 14555 /** 14556 * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments. 14557 * 14558 * @param newOpen The new open state. 14559 * @param eventDetails Details about the event that triggered the open state change. 14560 */ 14561 setOpen = (newOpen, eventDetails) => { 14562 if (this.syncOnly) { 14563 this.context.onOpenChange?.(newOpen, eventDetails); 14564 return; 14565 } 14566 this.dispatchOpenChange(newOpen, eventDetails); 14567 this.context.onOpenChange?.(newOpen, eventDetails); 14568 }; 14569 }; 14570 14571 // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs 14572 function useSyncedFloatingRootContext(options) { 14573 const { 14574 popupStore, 14575 treatPopupAsFloatingElement = false, 14576 floatingRootContext: floatingRootContextProp, 14577 floatingId, 14578 nested, 14579 onOpenChange 14580 } = options; 14581 const open = popupStore.useState("open"); 14582 const referenceElement = popupStore.useState("activeTriggerElement"); 14583 const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement"); 14584 const triggerElements = popupStore.context.triggerElements; 14585 const handleOpenChange = onOpenChange; 14586 const internalStoreRef = React34.useRef(null); 14587 if (floatingRootContextProp === void 0 && internalStoreRef.current === null) { 14588 internalStoreRef.current = new FloatingRootStore({ 14589 open, 14590 transitionStatus: void 0, 14591 referenceElement, 14592 floatingElement, 14593 triggerElements, 14594 onOpenChange: handleOpenChange, 14595 floatingId, 14596 syncOnly: true, 14597 nested 14598 }); 14599 } 14600 const store4 = floatingRootContextProp ?? internalStoreRef.current; 14601 popupStore.useSyncedValue("floatingId", floatingId); 14602 useIsoLayoutEffect(() => { 14603 const valuesToSync = { 14604 open, 14605 floatingId, 14606 referenceElement, 14607 floatingElement 14608 }; 14609 if (isElement(referenceElement)) { 14610 valuesToSync.domReferenceElement = referenceElement; 14611 } 14612 if (store4.state.positionReference === store4.state.referenceElement) { 14613 valuesToSync.positionReference = referenceElement; 14614 } 14615 store4.update(valuesToSync); 14616 }, [open, floatingId, referenceElement, floatingElement, store4]); 14617 store4.context.onOpenChange = handleOpenChange; 14618 store4.context.nested = nested; 14619 return store4; 14620 } 14621 14622 // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs 14623 var FOCUSABLE_POPUP_PROPS = { 14624 tabIndex: -1, 14625 [FOCUSABLE_ATTRIBUTE]: "" 14626 }; 14627 function usePopupStore(externalStore, createStore2, treatPopupAsFloatingElement = false) { 14628 const floatingId = useId(); 14629 const nested = useFloatingParentNodeId() != null; 14630 const internalStoreRef = React35.useRef(null); 14631 if (externalStore === void 0 && internalStoreRef.current === null) { 14632 internalStoreRef.current = createStore2(floatingId, nested); 14633 } 14634 const store4 = externalStore ?? internalStoreRef.current; 14635 useSyncedFloatingRootContext({ 14636 popupStore: store4, 14637 treatPopupAsFloatingElement, 14638 floatingRootContext: store4.state.floatingRootContext, 14639 floatingId, 14640 nested, 14641 onOpenChange: store4.setOpen 14642 }); 14643 return { 14644 store: store4, 14645 internalStore: internalStoreRef.current 14646 }; 14647 } 14648 function useTriggerRegistration(id, store4) { 14649 const registeredElementIdRef = React35.useRef(null); 14650 const registeredElementRef = React35.useRef(null); 14651 return React35.useCallback((element) => { 14652 if (id === void 0) { 14653 return; 14654 } 14655 let shouldSyncTriggerCount = false; 14656 if (registeredElementIdRef.current !== null) { 14657 const registeredId = registeredElementIdRef.current; 14658 const registeredElement = registeredElementRef.current; 14659 const currentElement = store4.context.triggerElements.getById(registeredId); 14660 if (registeredElement && currentElement === registeredElement) { 14661 store4.context.triggerElements.delete(registeredId); 14662 shouldSyncTriggerCount = true; 14663 } 14664 registeredElementIdRef.current = null; 14665 registeredElementRef.current = null; 14666 } 14667 if (element !== null) { 14668 registeredElementIdRef.current = id; 14669 registeredElementRef.current = element; 14670 store4.context.triggerElements.add(id, element); 14671 shouldSyncTriggerCount = true; 14672 } 14673 if (shouldSyncTriggerCount) { 14674 const triggerCount = store4.context.triggerElements.size; 14675 if (store4.select("open") && store4.state.triggerCount !== triggerCount) { 14676 store4.set("triggerCount", triggerCount); 14677 } 14678 } 14679 }, [store4, id]); 14680 } 14681 function setPopupOpenState(state2, open, trigger, preventUnmountOnClose = false) { 14682 if (open) { 14683 state2.preventUnmountingOnClose = false; 14684 } else if (preventUnmountOnClose) { 14685 state2.preventUnmountingOnClose = true; 14686 } 14687 const triggerId = trigger?.id ?? null; 14688 if (triggerId || open) { 14689 state2.activeTriggerId = triggerId; 14690 state2.activeTriggerElement = trigger ?? null; 14691 } 14692 } 14693 function attachPreventUnmountOnClose(eventDetails) { 14694 let preventUnmountOnClose = false; 14695 eventDetails.preventUnmountOnClose = () => { 14696 preventUnmountOnClose = true; 14697 }; 14698 return () => preventUnmountOnClose; 14699 } 14700 function applyPopupOpenChange(store4, nextOpen, eventDetails, options = {}) { 14701 const reason = eventDetails.reason; 14702 const isHover = reason === reason_parts_exports.triggerHover; 14703 const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus; 14704 const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey); 14705 const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails); 14706 store4.context.onOpenChange?.(nextOpen, eventDetails); 14707 if (eventDetails.isCanceled) { 14708 return; 14709 } 14710 options.onBeforeDispatch?.(); 14711 store4.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails); 14712 const changeState = () => { 14713 const updatedState = { 14714 ...options.extraState, 14715 open: nextOpen 14716 }; 14717 if (isFocusOpen) { 14718 updatedState.instantType = "focus"; 14719 } else if (isDismissClose) { 14720 updatedState.instantType = "dismiss"; 14721 } else if (isHover) { 14722 updatedState.instantType = void 0; 14723 } 14724 setPopupOpenState(updatedState, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose()); 14725 store4.update(updatedState); 14726 }; 14727 if (isHover) { 14728 ReactDOM4.flushSync(changeState); 14729 } else { 14730 changeState(); 14731 } 14732 } 14733 function useInitialOpenSync(store4, openProp, defaultOpen, defaultTriggerId) { 14734 useOnFirstRender(() => { 14735 if (openProp === void 0 && store4.state.open === false && defaultOpen) { 14736 store4.state = { 14737 ...store4.state, 14738 open: true, 14739 activeTriggerId: defaultTriggerId, 14740 preventUnmountingOnClose: false 14741 }; 14742 } 14743 }); 14744 } 14745 function useTriggerDataForwarding(triggerId, triggerElementRef, store4, stateUpdates) { 14746 const isMountedByThisTrigger = store4.useState("isMountedByTrigger", triggerId); 14747 const baseRegisterTrigger = useTriggerRegistration(triggerId, store4); 14748 const registerTrigger = useStableCallback((element) => { 14749 baseRegisterTrigger(element); 14750 if (!element) { 14751 return; 14752 } 14753 const open = store4.select("open"); 14754 const activeTriggerId = store4.select("activeTriggerId"); 14755 if (activeTriggerId === triggerId) { 14756 store4.update({ 14757 activeTriggerElement: element, 14758 ...open ? stateUpdates : null 14759 }); 14760 return; 14761 } 14762 if (activeTriggerId == null && open) { 14763 store4.update({ 14764 activeTriggerId: triggerId, 14765 activeTriggerElement: element, 14766 ...stateUpdates 14767 }); 14768 } 14769 }); 14770 useIsoLayoutEffect(() => { 14771 if (isMountedByThisTrigger) { 14772 store4.update({ 14773 activeTriggerElement: triggerElementRef.current, 14774 ...stateUpdates 14775 }); 14776 } 14777 }, [isMountedByThisTrigger, store4, triggerElementRef, ...Object.values(stateUpdates)]); 14778 return { 14779 registerTrigger, 14780 isMountedByThisTrigger 14781 }; 14782 } 14783 function useImplicitActiveTrigger(store4, options = {}) { 14784 const { 14785 closeOnActiveTriggerUnmount = false 14786 } = options; 14787 const open = store4.useState("open"); 14788 const reactiveTriggerCount = store4.useState("triggerCount"); 14789 useIsoLayoutEffect(() => { 14790 if (!open) { 14791 if (store4.state.triggerCount !== 0) { 14792 store4.set("triggerCount", 0); 14793 } 14794 return; 14795 } 14796 const triggerCount = store4.context.triggerElements.size; 14797 const stateUpdates = {}; 14798 if (store4.state.triggerCount !== triggerCount) { 14799 stateUpdates.triggerCount = triggerCount; 14800 } 14801 const activeTriggerId = store4.select("activeTriggerId"); 14802 let lostActiveTriggerId = null; 14803 if (activeTriggerId) { 14804 const activeTriggerElement = store4.context.triggerElements.getById(activeTriggerId); 14805 if (!activeTriggerElement) { 14806 lostActiveTriggerId = activeTriggerId; 14807 } else if (activeTriggerElement !== store4.state.activeTriggerElement) { 14808 stateUpdates.activeTriggerElement = activeTriggerElement; 14809 } 14810 } 14811 if (!lostActiveTriggerId && !activeTriggerId && triggerCount === 1) { 14812 const iteratorResult = store4.context.triggerElements.entries().next(); 14813 if (!iteratorResult.done) { 14814 const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value; 14815 stateUpdates.activeTriggerId = implicitTriggerId; 14816 stateUpdates.activeTriggerElement = implicitTriggerElement; 14817 } 14818 } 14819 if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0 || stateUpdates.activeTriggerElement !== void 0) { 14820 store4.update(stateUpdates); 14821 } 14822 if (lostActiveTriggerId) { 14823 if (closeOnActiveTriggerUnmount) { 14824 queueMicrotask(() => { 14825 if (store4.select("open") && store4.select("activeTriggerId") === lostActiveTriggerId && !store4.context.triggerElements.getById(lostActiveTriggerId)) { 14826 const eventDetails = createChangeEventDetails(reason_parts_exports.none); 14827 store4.setOpen(false, eventDetails); 14828 if (!eventDetails.isCanceled) { 14829 store4.update({ 14830 activeTriggerId: null, 14831 activeTriggerElement: null 14832 }); 14833 } 14834 } 14835 }); 14836 } 14837 } 14838 }, [open, store4, reactiveTriggerCount, closeOnActiveTriggerUnmount]); 14839 } 14840 function useOpenStateTransitions(open, store4, onUnmount) { 14841 const { 14842 mounted, 14843 setMounted, 14844 transitionStatus 14845 } = useTransitionStatus(open); 14846 const preventUnmountingOnClose = store4.useState("preventUnmountingOnClose"); 14847 const syncedPreventUnmountingOnClose = open ? false : preventUnmountingOnClose; 14848 store4.useSyncedValues({ 14849 mounted, 14850 transitionStatus, 14851 preventUnmountingOnClose: syncedPreventUnmountingOnClose 14852 }); 14853 const forceUnmount = useStableCallback(() => { 14854 setMounted(false); 14855 store4.update({ 14856 activeTriggerId: null, 14857 activeTriggerElement: null, 14858 mounted: false, 14859 preventUnmountingOnClose: false 14860 }); 14861 onUnmount?.(); 14862 store4.context.onOpenChangeComplete?.(false); 14863 }); 14864 useOpenChangeComplete({ 14865 enabled: mounted && !open && !syncedPreventUnmountingOnClose, 14866 open, 14867 ref: store4.context.popupRef, 14868 onComplete() { 14869 if (!open) { 14870 forceUnmount(); 14871 } 14872 } 14873 }); 14874 return { 14875 forceUnmount, 14876 transitionStatus 14877 }; 14878 } 14879 function usePopupInteractionProps(store4, statePart) { 14880 store4.useSyncedValues(statePart); 14881 useIsoLayoutEffect(() => () => { 14882 store4.update({ 14883 activeTriggerProps: EMPTY_OBJECT3, 14884 inactiveTriggerProps: EMPTY_OBJECT3, 14885 popupProps: EMPTY_OBJECT3 14886 }); 14887 }, [store4]); 14888 } 14889 14890 // node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs 14891 var PopupTriggerMap = class { 14892 constructor() { 14893 this.elementsSet = /* @__PURE__ */ new Set(); 14894 this.idMap = /* @__PURE__ */ new Map(); 14895 } 14896 /** 14897 * Adds a trigger element with the given ID. 14898 * 14899 * Note: The provided element is assumed to not be registered under multiple IDs. 14900 */ 14901 add(id, element) { 14902 const existingElement = this.idMap.get(id); 14903 if (existingElement === element) { 14904 return; 14905 } 14906 if (existingElement !== void 0) { 14907 this.elementsSet.delete(existingElement); 14908 } 14909 this.elementsSet.add(element); 14910 this.idMap.set(id, element); 14911 if (true) { 14912 if (this.elementsSet.size !== this.idMap.size) { 14913 throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap."); 14914 } 14915 } 14916 } 14917 /** 14918 * Removes the trigger element with the given ID. 14919 */ 14920 delete(id) { 14921 const element = this.idMap.get(id); 14922 if (element) { 14923 this.elementsSet.delete(element); 14924 this.idMap.delete(id); 14925 } 14926 } 14927 /** 14928 * Whether the given element is registered as a trigger. 14929 */ 14930 hasElement(element) { 14931 return this.elementsSet.has(element); 14932 } 14933 /** 14934 * Whether there is a registered trigger element matching the given predicate. 14935 */ 14936 hasMatchingElement(predicate) { 14937 for (const element of this.elementsSet) { 14938 if (predicate(element)) { 14939 return true; 14940 } 14941 } 14942 return false; 14943 } 14944 /** 14945 * Returns the trigger element associated with the given ID, or undefined if no such element exists. 14946 */ 14947 getById(id) { 14948 return this.idMap.get(id); 14949 } 14950 /** 14951 * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element]. 14952 */ 14953 entries() { 14954 return this.idMap.entries(); 14955 } 14956 /** 14957 * Returns an iterable of all registered trigger elements. 14958 */ 14959 elements() { 14960 return this.elementsSet.values(); 14961 } 14962 /** 14963 * Returns the number of registered trigger elements. 14964 */ 14965 get size() { 14966 return this.idMap.size; 14967 } 14968 }; 14969 14970 // node_modules/@base-ui/react/floating-ui-react/utils/getEmptyRootContext.mjs 14971 function getEmptyRootContext() { 14972 return new FloatingRootStore({ 14973 open: false, 14974 transitionStatus: void 0, 14975 floatingElement: null, 14976 referenceElement: null, 14977 triggerElements: new PopupTriggerMap(), 14978 floatingId: void 0, 14979 syncOnly: false, 14980 nested: false, 14981 onOpenChange: void 0 14982 }); 14983 } 14984 14985 // node_modules/@base-ui/react/utils/popups/store.mjs 14986 function createInitialPopupStoreState() { 14987 return { 14988 open: false, 14989 openProp: void 0, 14990 mounted: false, 14991 transitionStatus: void 0, 14992 floatingRootContext: getEmptyRootContext(), 14993 floatingId: void 0, 14994 triggerCount: 0, 14995 preventUnmountingOnClose: false, 14996 payload: void 0, 14997 activeTriggerId: null, 14998 activeTriggerElement: null, 14999 triggerIdProp: void 0, 15000 popupElement: null, 15001 positionerElement: null, 15002 activeTriggerProps: EMPTY_OBJECT3, 15003 inactiveTriggerProps: EMPTY_OBJECT3, 15004 popupProps: EMPTY_OBJECT3 15005 }; 15006 } 15007 function createPopupFloatingRootContext(triggerElements, floatingId, nested = false) { 15008 return new FloatingRootStore({ 15009 open: false, 15010 transitionStatus: void 0, 15011 floatingElement: null, 15012 referenceElement: null, 15013 triggerElements, 15014 floatingId, 15015 syncOnly: true, 15016 nested, 15017 onOpenChange: void 0 15018 }); 15019 } 15020 var activeTriggerIdSelector = createSelector3((state2) => state2.triggerIdProp ?? state2.activeTriggerId); 15021 var openSelector = createSelector3((state2) => state2.openProp ?? state2.open); 15022 var popupIdSelector = createSelector3((state2) => { 15023 const popupId = state2.popupElement?.id ?? state2.floatingId; 15024 return popupId || void 0; 15025 }); 15026 function triggerOwnsOpenPopup(state2, triggerId) { 15027 return triggerId !== void 0 && openSelector(state2) && activeTriggerIdSelector(state2) === triggerId; 15028 } 15029 function triggerOwnsOpenPopupOrIsOnlyTrigger(state2, triggerId) { 15030 if (triggerOwnsOpenPopup(state2, triggerId)) { 15031 return true; 15032 } 15033 return triggerId !== void 0 && openSelector(state2) && activeTriggerIdSelector(state2) == null && state2.triggerCount === 1; 15034 } 15035 var popupStoreSelectors = { 15036 open: openSelector, 15037 mounted: createSelector3((state2) => state2.mounted), 15038 transitionStatus: createSelector3((state2) => state2.transitionStatus), 15039 floatingRootContext: createSelector3((state2) => state2.floatingRootContext), 15040 triggerCount: createSelector3((state2) => state2.triggerCount), 15041 preventUnmountingOnClose: createSelector3((state2) => state2.preventUnmountingOnClose), 15042 payload: createSelector3((state2) => state2.payload), 15043 activeTriggerId: activeTriggerIdSelector, 15044 activeTriggerElement: createSelector3((state2) => state2.mounted ? state2.activeTriggerElement : null), 15045 popupId: popupIdSelector, 15046 /** 15047 * Whether the trigger with the given ID was used to open the popup. 15048 */ 15049 isTriggerActive: createSelector3((state2, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state2) === triggerId), 15050 /** 15051 * Whether the popup is open and was activated by a trigger with the given ID. 15052 */ 15053 isOpenedByTrigger: createSelector3((state2, triggerId) => triggerOwnsOpenPopup(state2, triggerId)), 15054 /** 15055 * Whether the popup is mounted and was activated by a trigger with the given ID. 15056 */ 15057 isMountedByTrigger: createSelector3((state2, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state2) === triggerId && state2.mounted), 15058 triggerProps: createSelector3((state2, isActive) => isActive ? state2.activeTriggerProps : state2.inactiveTriggerProps), 15059 /** 15060 * Popup id for the trigger that currently owns the open popup. 15061 */ 15062 triggerPopupId: createSelector3((state2, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state2, triggerId) ? popupIdSelector(state2) : void 0), 15063 popupProps: createSelector3((state2) => state2.popupProps), 15064 popupElement: createSelector3((state2) => state2.popupElement), 15065 positionerElement: createSelector3((state2) => state2.positionerElement) 15066 }; 15067 15068 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloatingRootContext.mjs 15069 function useFloatingRootContext(options) { 15070 const { 15071 open = false, 15072 onOpenChange, 15073 elements: elements2 = {} 15074 } = options; 15075 const floatingId = useId(); 15076 const nested = useFloatingParentNodeId() != null; 15077 if (true) { 15078 const optionDomReference = elements2.reference; 15079 if (optionDomReference && !isElement(optionDomReference)) { 15080 console.error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `context.setPositionReference()`", "instead."); 15081 } 15082 } 15083 const store4 = useRefWithInit(() => new FloatingRootStore({ 15084 open, 15085 transitionStatus: void 0, 15086 onOpenChange, 15087 referenceElement: elements2.reference ?? null, 15088 floatingElement: elements2.floating ?? null, 15089 triggerElements: new PopupTriggerMap(), 15090 floatingId, 15091 syncOnly: false, 15092 nested 15093 })).current; 15094 useIsoLayoutEffect(() => { 15095 const valuesToSync = { 15096 open, 15097 floatingId 15098 }; 15099 if (elements2.reference !== void 0) { 15100 valuesToSync.referenceElement = elements2.reference; 15101 valuesToSync.domReferenceElement = isElement(elements2.reference) ? elements2.reference : null; 15102 } 15103 if (elements2.floating !== void 0) { 15104 valuesToSync.floatingElement = elements2.floating; 15105 } 15106 store4.update(valuesToSync); 15107 }, [open, floatingId, elements2.reference, elements2.floating, store4]); 15108 store4.context.onOpenChange = onOpenChange; 15109 store4.context.nested = nested; 15110 return store4; 15111 } 15112 15113 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs 15114 function useFloating2(options = {}) { 15115 const { 15116 nodeId, 15117 externalTree 15118 } = options; 15119 const internalStore = useFloatingRootContext(options); 15120 const store4 = options.rootContext || internalStore; 15121 const referenceElement = store4.useState("referenceElement"); 15122 const floatingElement = store4.useState("floatingElement"); 15123 const domReferenceElement = store4.useState("domReferenceElement"); 15124 const open = store4.useState("open"); 15125 const floatingId = store4.useState("floatingId"); 15126 const [positionReference, setPositionReferenceRaw] = React36.useState(null); 15127 const [localDomReference, setLocalDomReference] = React36.useState(void 0); 15128 const [localFloatingElement, setLocalFloatingElement] = React36.useState(void 0); 15129 const domReferenceRef = React36.useRef(null); 15130 const tree = useFloatingTree(externalTree); 15131 const storeElements = React36.useMemo(() => ({ 15132 reference: referenceElement, 15133 floating: floatingElement, 15134 domReference: domReferenceElement 15135 }), [referenceElement, floatingElement, domReferenceElement]); 15136 const position = useFloating({ 15137 ...options, 15138 elements: { 15139 ...storeElements, 15140 ...positionReference && { 15141 reference: positionReference 15142 } 15143 } 15144 }); 15145 const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null; 15146 const syncedFloatingElement = localFloatingElement === void 0 ? store4.state.floatingElement : localFloatingElement; 15147 store4.useSyncedValue("referenceElement", localDomReference ?? null); 15148 store4.useSyncedValue("domReferenceElement", localDomReference === void 0 ? domReferenceElement : localDomReferenceElement); 15149 store4.useSyncedValue("floatingElement", syncedFloatingElement); 15150 const setPositionReference = React36.useCallback((node) => { 15151 const computedPositionReference = isElement(node) ? { 15152 getBoundingClientRect: () => node.getBoundingClientRect(), 15153 getClientRects: () => node.getClientRects(), 15154 contextElement: node 15155 } : node; 15156 setPositionReferenceRaw(computedPositionReference); 15157 position.refs.setReference(computedPositionReference); 15158 }, [position.refs]); 15159 const setReference = React36.useCallback((node) => { 15160 if (isElement(node) || node === null) { 15161 domReferenceRef.current = node; 15162 setLocalDomReference(node); 15163 } 15164 if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to 15165 // `null` to support `positionReference` + an unstable `reference` 15166 // callback ref. 15167 node !== null && !isElement(node)) { 15168 position.refs.setReference(node); 15169 } 15170 }, [position.refs, setLocalDomReference]); 15171 const setFloating = React36.useCallback((node) => { 15172 setLocalFloatingElement(node); 15173 position.refs.setFloating(node); 15174 }, [position.refs]); 15175 const refs = React36.useMemo(() => ({ 15176 ...position.refs, 15177 setReference, 15178 setFloating, 15179 setPositionReference, 15180 domReference: domReferenceRef 15181 }), [position.refs, setReference, setFloating, setPositionReference]); 15182 const elements2 = React36.useMemo(() => ({ 15183 ...position.elements, 15184 domReference: domReferenceElement 15185 }), [position.elements, domReferenceElement]); 15186 const context = React36.useMemo(() => ({ 15187 ...position, 15188 dataRef: store4.context.dataRef, 15189 open, 15190 onOpenChange: store4.setOpen, 15191 events: store4.context.events, 15192 floatingId, 15193 refs, 15194 elements: elements2, 15195 nodeId, 15196 rootStore: store4 15197 }), [position, refs, elements2, nodeId, store4, open, floatingId]); 15198 useIsoLayoutEffect(() => { 15199 if (domReferenceElement) { 15200 domReferenceRef.current = domReferenceElement; 15201 } 15202 }, [domReferenceElement]); 15203 useIsoLayoutEffect(() => { 15204 store4.context.dataRef.current.floatingContext = context; 15205 const node = tree?.nodesRef.current.find((n3) => n3.id === nodeId); 15206 if (node) { 15207 node.context = context; 15208 } 15209 }); 15210 return React36.useMemo(() => ({ 15211 ...position, 15212 context, 15213 refs, 15214 elements: elements2, 15215 rootStore: store4 15216 }), [position, refs, elements2, context, store4]); 15217 } 15218 15219 // node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs 15220 var React37 = __toESM(require_react(), 1); 15221 var isMacSafari = parts_exports.os.mac && parts_exports.engine.webkit; 15222 function useFocus(context, props = {}) { 15223 const { 15224 enabled = true, 15225 delay 15226 } = props; 15227 const store4 = "rootStore" in context ? context.rootStore : context; 15228 const { 15229 events, 15230 dataRef 15231 } = store4.context; 15232 const blockFocusRef = React37.useRef(false); 15233 const blockedReferenceRef = React37.useRef(null); 15234 const keyboardModalityRef = React37.useRef(true); 15235 const timeout = useTimeout(); 15236 React37.useEffect(() => { 15237 const domReference = store4.select("domReferenceElement"); 15238 if (!enabled) { 15239 return void 0; 15240 } 15241 const win = getWindow(domReference); 15242 function onBlur() { 15243 const currentDomReference = store4.select("domReferenceElement"); 15244 if (!store4.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) { 15245 blockFocusRef.current = true; 15246 } 15247 } 15248 function onKeyDown() { 15249 keyboardModalityRef.current = true; 15250 } 15251 function onPointerDown() { 15252 keyboardModalityRef.current = false; 15253 } 15254 return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true)); 15255 }, [store4, enabled]); 15256 React37.useEffect(() => { 15257 if (!enabled) { 15258 return void 0; 15259 } 15260 function onOpenChangeLocal(details) { 15261 if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) { 15262 const referenceElement = store4.select("domReferenceElement"); 15263 if (isElement(referenceElement)) { 15264 blockedReferenceRef.current = referenceElement; 15265 blockFocusRef.current = true; 15266 } 15267 } 15268 } 15269 events.on("openchange", onOpenChangeLocal); 15270 return () => { 15271 events.off("openchange", onOpenChangeLocal); 15272 }; 15273 }, [events, enabled, store4]); 15274 const reference = React37.useMemo(() => { 15275 function resetBlockedFocus() { 15276 blockFocusRef.current = false; 15277 blockedReferenceRef.current = null; 15278 } 15279 return { 15280 onMouseLeave() { 15281 resetBlockedFocus(); 15282 }, 15283 onFocus(event) { 15284 const focusTarget = event.currentTarget; 15285 if (blockFocusRef.current) { 15286 if (blockedReferenceRef.current === focusTarget) { 15287 return; 15288 } 15289 resetBlockedFocus(); 15290 } 15291 const target = getTarget(event.nativeEvent); 15292 if (isElement(target)) { 15293 if (isMacSafari && !event.relatedTarget) { 15294 if (!keyboardModalityRef.current && !isTypeableElement(target)) { 15295 return; 15296 } 15297 } else if (!matchesFocusVisible(target)) { 15298 return; 15299 } 15300 } 15301 const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store4.context.triggerElements); 15302 const { 15303 nativeEvent, 15304 currentTarget 15305 } = event; 15306 const delayValue = typeof delay === "function" ? delay() : delay; 15307 if (store4.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) { 15308 store4.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 15309 return; 15310 } 15311 timeout.start(delayValue, () => { 15312 if (blockFocusRef.current) { 15313 return; 15314 } 15315 store4.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 15316 }); 15317 }, 15318 onBlur(event) { 15319 resetBlockedFocus(); 15320 const relatedTarget = event.relatedTarget; 15321 const nativeEvent = event.nativeEvent; 15322 const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside"; 15323 timeout.start(0, () => { 15324 const domReference = store4.select("domReferenceElement"); 15325 const activeEl = activeElement(ownerDocument(domReference)); 15326 if (!relatedTarget && activeEl === domReference) { 15327 return; 15328 } 15329 if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) { 15330 return; 15331 } 15332 const nextFocusedElement = relatedTarget ?? activeEl; 15333 if (isTargetInsideEnabledTrigger(nextFocusedElement, store4.context.triggerElements)) { 15334 return; 15335 } 15336 store4.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent)); 15337 }); 15338 } 15339 }; 15340 }, [dataRef, delay, store4, timeout]); 15341 return React37.useMemo(() => enabled ? { 15342 reference, 15343 trigger: reference 15344 } : {}, [enabled, reference]); 15345 } 15346 15347 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs 15348 var React38 = __toESM(require_react(), 1); 15349 15350 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs 15351 var HoverInteraction = class _HoverInteraction { 15352 constructor() { 15353 this.pointerType = void 0; 15354 this.interactedInside = false; 15355 this.handler = void 0; 15356 this.blockMouseMove = true; 15357 this.performedPointerEventsMutation = false; 15358 this.pointerEventsScopeElement = null; 15359 this.pointerEventsReferenceElement = null; 15360 this.pointerEventsFloatingElement = null; 15361 this.restTimeoutPending = false; 15362 this.openChangeTimeout = new Timeout(); 15363 this.restTimeout = new Timeout(); 15364 this.handleCloseOptions = void 0; 15365 } 15366 static create() { 15367 return new _HoverInteraction(); 15368 } 15369 dispose = () => { 15370 this.openChangeTimeout.clear(); 15371 this.restTimeout.clear(); 15372 }; 15373 disposeEffect = () => { 15374 return this.dispose; 15375 }; 15376 }; 15377 var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap(); 15378 function clearSafePolygonPointerEventsMutation(instance) { 15379 if (!instance.performedPointerEventsMutation) { 15380 return; 15381 } 15382 const scopeElement = instance.pointerEventsScopeElement; 15383 if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) { 15384 instance.pointerEventsScopeElement?.style.removeProperty("pointer-events"); 15385 instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events"); 15386 instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events"); 15387 pointerEventsMutationOwnerByScopeElement.delete(scopeElement); 15388 } 15389 instance.performedPointerEventsMutation = false; 15390 instance.pointerEventsScopeElement = null; 15391 instance.pointerEventsReferenceElement = null; 15392 instance.pointerEventsFloatingElement = null; 15393 } 15394 function applySafePolygonPointerEventsMutation(instance, options) { 15395 const { 15396 scopeElement, 15397 referenceElement, 15398 floatingElement 15399 } = options; 15400 const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement); 15401 if (existingOwner && existingOwner !== instance) { 15402 clearSafePolygonPointerEventsMutation(existingOwner); 15403 } 15404 clearSafePolygonPointerEventsMutation(instance); 15405 instance.performedPointerEventsMutation = true; 15406 instance.pointerEventsScopeElement = scopeElement; 15407 instance.pointerEventsReferenceElement = referenceElement; 15408 instance.pointerEventsFloatingElement = floatingElement; 15409 pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance); 15410 scopeElement.style.pointerEvents = "none"; 15411 referenceElement.style.pointerEvents = "auto"; 15412 floatingElement.style.pointerEvents = "auto"; 15413 } 15414 function useHoverInteractionSharedState(store4) { 15415 const data = store4.context.dataRef.current; 15416 const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current; 15417 if (!data.hoverInteractionState) { 15418 data.hoverInteractionState = instance; 15419 } 15420 useOnMount(data.hoverInteractionState.disposeEffect); 15421 return data.hoverInteractionState; 15422 } 15423 15424 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs 15425 function useHoverFloatingInteraction(context, parameters = {}) { 15426 const { 15427 enabled = true, 15428 closeDelay: closeDelayProp = 0, 15429 nodeId: nodeIdProp 15430 } = parameters; 15431 const store4 = "rootStore" in context ? context.rootStore : context; 15432 const open = store4.useState("open"); 15433 const floatingElement = store4.useState("floatingElement"); 15434 const domReferenceElement = store4.useState("domReferenceElement"); 15435 const { 15436 dataRef 15437 } = store4.context; 15438 const tree = useFloatingTree(); 15439 const parentId = useFloatingParentNodeId(); 15440 const instance = useHoverInteractionSharedState(store4); 15441 const childClosedTimeout = useTimeout(); 15442 const isClickLikeOpenEvent2 = useStableCallback(() => { 15443 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 15444 }); 15445 const isHoverOpen = useStableCallback(() => { 15446 return isHoverOpenEvent(dataRef.current.openEvent?.type); 15447 }); 15448 const clearPointerEvents = useStableCallback(() => { 15449 clearSafePolygonPointerEventsMutation(instance); 15450 }); 15451 useIsoLayoutEffect(() => { 15452 if (!open) { 15453 instance.pointerType = void 0; 15454 instance.restTimeoutPending = false; 15455 instance.interactedInside = false; 15456 clearPointerEvents(); 15457 } 15458 }, [open, instance, clearPointerEvents]); 15459 React38.useEffect(() => { 15460 return clearPointerEvents; 15461 }, [clearPointerEvents]); 15462 useIsoLayoutEffect(() => { 15463 if (!enabled) { 15464 return void 0; 15465 } 15466 if (open && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) { 15467 const ref = domReferenceElement; 15468 const floatingEl = floatingElement; 15469 const doc = ownerDocument(floatingElement); 15470 const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating; 15471 if (parentFloating) { 15472 parentFloating.style.pointerEvents = ""; 15473 } 15474 const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null; 15475 const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null; 15476 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest("[data-rootownerid]") ?? doc.body; 15477 applySafePolygonPointerEventsMutation(instance, { 15478 scopeElement, 15479 referenceElement: ref, 15480 floatingElement: floatingEl 15481 }); 15482 return () => { 15483 clearPointerEvents(); 15484 }; 15485 } 15486 return void 0; 15487 }, [enabled, open, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]); 15488 React38.useEffect(() => { 15489 if (!enabled) { 15490 return void 0; 15491 } 15492 function hasParentChildren() { 15493 return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0); 15494 } 15495 function closeWithDelay(event) { 15496 const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType); 15497 const close = () => { 15498 store4.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 15499 tree?.events.emit("floating.closed", event); 15500 }; 15501 if (closeDelay) { 15502 instance.openChangeTimeout.start(closeDelay, close); 15503 } else { 15504 instance.openChangeTimeout.clear(); 15505 close(); 15506 } 15507 } 15508 function handleInteractInside(event) { 15509 const target = getTarget(event); 15510 if (!isInteractiveElement(target)) { 15511 instance.interactedInside = false; 15512 return; 15513 } 15514 instance.interactedInside = target?.closest("[aria-haspopup]") != null; 15515 } 15516 function onFloatingMouseEnter() { 15517 instance.openChangeTimeout.clear(); 15518 childClosedTimeout.clear(); 15519 tree?.events.off("floating.closed", onNodeClosed); 15520 clearPointerEvents(); 15521 } 15522 function onFloatingMouseLeave(event) { 15523 if (hasParentChildren() && tree) { 15524 tree.events.on("floating.closed", onNodeClosed); 15525 return; 15526 } 15527 if (isTargetInsideEnabledTrigger(event.relatedTarget, store4.context.triggerElements)) { 15528 return; 15529 } 15530 const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp; 15531 const relatedTarget = event.relatedTarget; 15532 const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget)); 15533 if (isMovingIntoDescendantFloating) { 15534 return; 15535 } 15536 if (instance.handler) { 15537 instance.handler(event); 15538 return; 15539 } 15540 clearPointerEvents(); 15541 if (isHoverOpen() && !isClickLikeOpenEvent2()) { 15542 closeWithDelay(event); 15543 } 15544 } 15545 function onNodeClosed(event) { 15546 if (!tree || !parentId || hasParentChildren()) { 15547 return; 15548 } 15549 childClosedTimeout.start(0, () => { 15550 tree.events.off("floating.closed", onNodeClosed); 15551 store4.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 15552 tree.events.emit("floating.closed", event); 15553 }); 15554 } 15555 const floating = floatingElement; 15556 return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => { 15557 tree?.events.off("floating.closed", onNodeClosed); 15558 }); 15559 }, [enabled, floatingElement, store4, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]); 15560 } 15561 15562 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs 15563 var React39 = __toESM(require_react(), 1); 15564 var ReactDOM5 = __toESM(require_react_dom(), 1); 15565 var EMPTY_REF = { 15566 current: null 15567 }; 15568 function useHoverReferenceInteraction(context, props = {}) { 15569 const { 15570 enabled = true, 15571 delay = 0, 15572 handleClose = null, 15573 mouseOnly = false, 15574 restMs = 0, 15575 move = true, 15576 triggerElementRef = EMPTY_REF, 15577 externalTree, 15578 isActiveTrigger = true, 15579 getHandleCloseContext, 15580 isClosing, 15581 shouldOpen: shouldOpenProp 15582 } = props; 15583 const store4 = "rootStore" in context ? context.rootStore : context; 15584 const { 15585 dataRef, 15586 events 15587 } = store4.context; 15588 const tree = useFloatingTree(externalTree); 15589 const instance = useHoverInteractionSharedState(store4); 15590 const isHoverCloseActiveRef = React39.useRef(false); 15591 const handleCloseRef = useValueAsRef(handleClose); 15592 const delayRef = useValueAsRef(delay); 15593 const restMsRef = useValueAsRef(restMs); 15594 const enabledRef = useValueAsRef(enabled); 15595 const shouldOpenRef = useValueAsRef(shouldOpenProp); 15596 const isClosingRef = useValueAsRef(isClosing); 15597 const isClickLikeOpenEvent2 = useStableCallback(() => { 15598 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 15599 }); 15600 const checkShouldOpen = useStableCallback(() => { 15601 return shouldOpenRef.current?.() !== false; 15602 }); 15603 const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => { 15604 const allTriggers = store4.context.triggerElements; 15605 if (allTriggers.hasElement(currentTarget)) { 15606 return !currentDomReference || !contains(currentDomReference, currentTarget); 15607 } 15608 if (!isElement(target)) { 15609 return false; 15610 } 15611 const targetElement = target; 15612 return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement)); 15613 }); 15614 const cleanupMouseMoveHandler = useStableCallback(() => { 15615 if (!instance.handler) { 15616 return; 15617 } 15618 const doc = ownerDocument(store4.select("domReferenceElement")); 15619 doc.removeEventListener("mousemove", instance.handler); 15620 instance.handler = void 0; 15621 }); 15622 const clearPointerEvents = useStableCallback(() => { 15623 clearSafePolygonPointerEventsMutation(instance); 15624 }); 15625 if (isActiveTrigger) { 15626 instance.handleCloseOptions = handleCloseRef.current?.__options; 15627 } 15628 React39.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]); 15629 React39.useEffect(() => { 15630 if (!enabled) { 15631 return void 0; 15632 } 15633 function onOpenChangeLocal(details) { 15634 if (!details.open) { 15635 isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover; 15636 cleanupMouseMoveHandler(); 15637 instance.openChangeTimeout.clear(); 15638 instance.restTimeout.clear(); 15639 instance.blockMouseMove = true; 15640 instance.restTimeoutPending = false; 15641 } else { 15642 isHoverCloseActiveRef.current = false; 15643 } 15644 } 15645 events.on("openchange", onOpenChangeLocal); 15646 return () => { 15647 events.off("openchange", onOpenChangeLocal); 15648 }; 15649 }, [enabled, events, instance, cleanupMouseMoveHandler]); 15650 React39.useEffect(() => { 15651 if (!enabled) { 15652 return void 0; 15653 } 15654 function closeWithDelay(event, runElseBranch = true) { 15655 const closeDelay = getDelay(delayRef.current, "close", instance.pointerType); 15656 if (closeDelay) { 15657 instance.openChangeTimeout.start(closeDelay, () => { 15658 store4.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 15659 tree?.events.emit("floating.closed", event); 15660 }); 15661 } else if (runElseBranch) { 15662 instance.openChangeTimeout.clear(); 15663 store4.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 15664 tree?.events.emit("floating.closed", event); 15665 } 15666 } 15667 const trigger = triggerElementRef.current ?? (isActiveTrigger ? store4.select("domReferenceElement") : null); 15668 if (!isElement(trigger)) { 15669 return void 0; 15670 } 15671 function onMouseEnter(event) { 15672 instance.openChangeTimeout.clear(); 15673 instance.blockMouseMove = false; 15674 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 15675 return; 15676 } 15677 const restMsValue = getRestMs(restMsRef.current); 15678 const openDelay = getDelay(delayRef.current, "open", instance.pointerType); 15679 const eventTarget = getTarget(event); 15680 const currentTarget = event.currentTarget ?? null; 15681 const currentDomReference = store4.select("domReferenceElement"); 15682 let triggerNode = currentTarget; 15683 if (isElement(eventTarget) && !store4.context.triggerElements.hasElement(eventTarget)) { 15684 for (const triggerElement of store4.context.triggerElements.elements()) { 15685 if (contains(triggerElement, eventTarget)) { 15686 triggerNode = triggerElement; 15687 break; 15688 } 15689 } 15690 } 15691 if (isElement(currentTarget) && isElement(currentDomReference) && !store4.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) { 15692 triggerNode = currentDomReference; 15693 } 15694 const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget); 15695 const isOpen2 = store4.select("open"); 15696 const isInClosingTransition = isClosingRef.current?.() ?? store4.select("transitionStatus") === "ending"; 15697 const isHoverCloseTransition = !isOpen2 && isInClosingTransition && isHoverCloseActiveRef.current; 15698 const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition; 15699 const isRestOnlyDelay = restMsValue > 0 && !openDelay; 15700 const shouldOpenImmediately = isOverInactive && (isOpen2 || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition; 15701 const shouldOpen = !isOpen2 || isOverInactive; 15702 if (shouldOpenImmediately) { 15703 if (checkShouldOpen()) { 15704 store4.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 15705 } 15706 return; 15707 } 15708 if (isRestOnlyDelay) { 15709 return; 15710 } 15711 if (openDelay) { 15712 instance.openChangeTimeout.start(openDelay, () => { 15713 if (shouldOpen && checkShouldOpen()) { 15714 store4.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 15715 } 15716 }); 15717 } else if (shouldOpen) { 15718 if (checkShouldOpen()) { 15719 store4.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 15720 } 15721 } 15722 } 15723 function onMouseLeave(event) { 15724 if (isClickLikeOpenEvent2()) { 15725 clearPointerEvents(); 15726 return; 15727 } 15728 cleanupMouseMoveHandler(); 15729 const domReferenceElement = store4.select("domReferenceElement"); 15730 const doc = ownerDocument(domReferenceElement); 15731 instance.restTimeout.clear(); 15732 instance.restTimeoutPending = false; 15733 const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.(); 15734 if (isTargetInsideEnabledTrigger(event.relatedTarget, store4.context.triggerElements)) { 15735 return; 15736 } 15737 if (handleCloseRef.current && handleCloseContextBase) { 15738 if (!store4.select("open")) { 15739 instance.openChangeTimeout.clear(); 15740 } 15741 const currentTrigger = triggerElementRef.current; 15742 instance.handler = handleCloseRef.current({ 15743 ...handleCloseContextBase, 15744 tree, 15745 x: event.clientX, 15746 y: event.clientY, 15747 onClose() { 15748 clearPointerEvents(); 15749 cleanupMouseMoveHandler(); 15750 if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store4.select("domReferenceElement")) { 15751 closeWithDelay(event, true); 15752 } 15753 } 15754 }); 15755 doc.addEventListener("mousemove", instance.handler); 15756 instance.handler(event); 15757 return; 15758 } 15759 const shouldClose = instance.pointerType === "touch" ? !contains(store4.select("floatingElement"), event.relatedTarget) : true; 15760 if (shouldClose) { 15761 closeWithDelay(event); 15762 } 15763 } 15764 if (move) { 15765 return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, { 15766 once: true 15767 }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave)); 15768 } 15769 return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave)); 15770 }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store4, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen]); 15771 return React39.useMemo(() => { 15772 if (!enabled) { 15773 return void 0; 15774 } 15775 function setPointerRef(event) { 15776 instance.pointerType = event.pointerType; 15777 } 15778 return { 15779 onPointerDown: setPointerRef, 15780 onPointerEnter: setPointerRef, 15781 onMouseMove(event) { 15782 const { 15783 nativeEvent 15784 } = event; 15785 const trigger = event.currentTarget; 15786 const currentDomReference = store4.select("domReferenceElement"); 15787 const currentOpen = store4.select("open"); 15788 const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target); 15789 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 15790 return; 15791 } 15792 if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) { 15793 const floatingElement = store4.select("floatingElement"); 15794 if (floatingElement) { 15795 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body; 15796 applySafePolygonPointerEventsMutation(instance, { 15797 scopeElement, 15798 referenceElement: trigger, 15799 floatingElement 15800 }); 15801 } 15802 } 15803 const restMsValue = getRestMs(restMsRef.current); 15804 if (currentOpen && !isOverInactive || restMsValue === 0) { 15805 return; 15806 } 15807 if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) { 15808 return; 15809 } 15810 instance.restTimeout.clear(); 15811 function handleMouseMove() { 15812 instance.restTimeoutPending = false; 15813 if (isClickLikeOpenEvent2()) { 15814 return; 15815 } 15816 const latestOpen = store4.select("open"); 15817 if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) { 15818 store4.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger)); 15819 } 15820 } 15821 if (instance.pointerType === "touch") { 15822 ReactDOM5.flushSync(() => { 15823 handleMouseMove(); 15824 }); 15825 } else if (isOverInactive && currentOpen) { 15826 handleMouseMove(); 15827 } else { 15828 instance.restTimeoutPending = true; 15829 instance.restTimeout.start(restMsValue, handleMouseMove); 15830 } 15831 } 15832 }; 15833 }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store4, restMsRef, checkShouldOpen]); 15834 } 15835 15836 // node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs 15837 var CURSOR_SPEED_THRESHOLD = 0.1; 15838 var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD; 15839 var POLYGON_BUFFER = 0.5; 15840 function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) { 15841 return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi; 15842 } 15843 function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y22, x3, y3, x4, y4) { 15844 let isInsideValue = false; 15845 if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y22)) { 15846 isInsideValue = !isInsideValue; 15847 } 15848 if (hasIntersectingEdge(pointX, pointY, x2, y22, x3, y3)) { 15849 isInsideValue = !isInsideValue; 15850 } 15851 if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) { 15852 isInsideValue = !isInsideValue; 15853 } 15854 if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) { 15855 isInsideValue = !isInsideValue; 15856 } 15857 return isInsideValue; 15858 } 15859 function isInsideRect(pointX, pointY, rect) { 15860 return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height; 15861 } 15862 function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y22) { 15863 const minX = Math.min(x1, x2); 15864 const maxX = Math.max(x1, x2); 15865 const minY = Math.min(y1, y22); 15866 const maxY = Math.max(y1, y22); 15867 return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY; 15868 } 15869 function safePolygon(options = {}) { 15870 const { 15871 blockPointerEvents = false 15872 } = options; 15873 const timeout = new Timeout(); 15874 const fn = ({ 15875 x: x2, 15876 y: y3, 15877 placement, 15878 elements: elements2, 15879 onClose, 15880 nodeId, 15881 tree 15882 }) => { 15883 const side = placement?.split("-")[0]; 15884 let hasLanded = false; 15885 let lastX = null; 15886 let lastY = null; 15887 let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0; 15888 function isCursorMovingSlowly(nextX, nextY) { 15889 const currentTime = performance.now(); 15890 const elapsedTime = currentTime - lastCursorTime; 15891 if (lastX === null || lastY === null || elapsedTime === 0) { 15892 lastX = nextX; 15893 lastY = nextY; 15894 lastCursorTime = currentTime; 15895 return false; 15896 } 15897 const deltaX = nextX - lastX; 15898 const deltaY = nextY - lastY; 15899 const distanceSquared = deltaX * deltaX + deltaY * deltaY; 15900 const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED; 15901 lastX = nextX; 15902 lastY = nextY; 15903 lastCursorTime = currentTime; 15904 return distanceSquared < thresholdSquared; 15905 } 15906 function close() { 15907 timeout.clear(); 15908 onClose(); 15909 } 15910 return function onMouseMove(event) { 15911 timeout.clear(); 15912 const domReference = elements2.domReference; 15913 const floating = elements2.floating; 15914 if (!domReference || !floating || side == null || x2 == null || y3 == null) { 15915 return void 0; 15916 } 15917 const { 15918 clientX, 15919 clientY 15920 } = event; 15921 const target = getTarget(event); 15922 const isLeave = event.type === "mouseleave"; 15923 const isOverFloatingEl = contains(floating, target); 15924 const isOverReferenceEl = contains(domReference, target); 15925 if (isOverFloatingEl) { 15926 hasLanded = true; 15927 if (!isLeave) { 15928 return void 0; 15929 } 15930 } 15931 if (isOverReferenceEl) { 15932 hasLanded = false; 15933 if (!isLeave) { 15934 hasLanded = true; 15935 return void 0; 15936 } 15937 } 15938 if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) { 15939 return void 0; 15940 } 15941 function hasOpenChildNode() { 15942 return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0); 15943 } 15944 function closeIfNoOpenChild() { 15945 if (!hasOpenChildNode()) { 15946 close(); 15947 } 15948 } 15949 if (hasOpenChildNode()) { 15950 return void 0; 15951 } 15952 const refRect = domReference.getBoundingClientRect(); 15953 const rect = floating.getBoundingClientRect(); 15954 const cursorLeaveFromRight = x2 > rect.right - rect.width / 2; 15955 const cursorLeaveFromBottom = y3 > rect.bottom - rect.height / 2; 15956 const isFloatingWider = rect.width > refRect.width; 15957 const isFloatingTaller = rect.height > refRect.height; 15958 const left = (isFloatingWider ? refRect : rect).left; 15959 const right = (isFloatingWider ? refRect : rect).right; 15960 const top = (isFloatingTaller ? refRect : rect).top; 15961 const bottom = (isFloatingTaller ? refRect : rect).bottom; 15962 if (side === "top" && y3 >= refRect.bottom - 1 || side === "bottom" && y3 <= refRect.top + 1 || side === "left" && x2 >= refRect.right - 1 || side === "right" && x2 <= refRect.left + 1) { 15963 closeIfNoOpenChild(); 15964 return void 0; 15965 } 15966 let isInsideTroughRect = false; 15967 switch (side) { 15968 case "top": 15969 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1); 15970 break; 15971 case "bottom": 15972 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1); 15973 break; 15974 case "left": 15975 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top); 15976 break; 15977 case "right": 15978 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top); 15979 break; 15980 default: 15981 } 15982 if (isInsideTroughRect) { 15983 return void 0; 15984 } 15985 if (hasLanded && !isInsideRect(clientX, clientY, refRect)) { 15986 closeIfNoOpenChild(); 15987 return void 0; 15988 } 15989 if (!isLeave && isCursorMovingSlowly(clientX, clientY)) { 15990 closeIfNoOpenChild(); 15991 return void 0; 15992 } 15993 let isInsidePolygon = false; 15994 switch (side) { 15995 case "top": { 15996 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 15997 const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 15998 const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 15999 const cursorPointY = y3 + POLYGON_BUFFER + 1; 16000 const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top; 16001 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER; 16002 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 16003 break; 16004 } 16005 case "bottom": { 16006 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 16007 const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 16008 const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 16009 const cursorPointY = y3 - POLYGON_BUFFER; 16010 const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom; 16011 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER; 16012 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 16013 break; 16014 } 16015 case "left": { 16016 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 16017 const cursorPointOneY = isFloatingTaller ? y3 + cursorYOffset : cursorLeaveFromBottom ? y3 + cursorYOffset : y3 - cursorYOffset; 16018 const cursorPointTwoY = isFloatingTaller ? y3 - cursorYOffset : cursorLeaveFromBottom ? y3 + cursorYOffset : y3 - cursorYOffset; 16019 const cursorPointX = x2 + POLYGON_BUFFER + 1; 16020 const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left; 16021 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER; 16022 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY); 16023 break; 16024 } 16025 case "right": { 16026 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 16027 const cursorPointOneY = isFloatingTaller ? y3 + cursorYOffset : cursorLeaveFromBottom ? y3 + cursorYOffset : y3 - cursorYOffset; 16028 const cursorPointTwoY = isFloatingTaller ? y3 - cursorYOffset : cursorLeaveFromBottom ? y3 + cursorYOffset : y3 - cursorYOffset; 16029 const cursorPointX = x2 - POLYGON_BUFFER; 16030 const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right; 16031 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER; 16032 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom); 16033 break; 16034 } 16035 default: 16036 } 16037 if (!isInsidePolygon) { 16038 closeIfNoOpenChild(); 16039 } else if (!hasLanded) { 16040 timeout.start(40, closeIfNoOpenChild); 16041 } 16042 return void 0; 16043 }; 16044 }; 16045 fn.__options = { 16046 ...options, 16047 blockPointerEvents 16048 }; 16049 return fn; 16050 } 16051 16052 // node_modules/@base-ui/react/utils/popupStateMapping.mjs 16053 var CommonPopupDataAttributes = (function(CommonPopupDataAttributes2) { 16054 CommonPopupDataAttributes2["open"] = "data-open"; 16055 CommonPopupDataAttributes2["closed"] = "data-closed"; 16056 CommonPopupDataAttributes2[CommonPopupDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle"; 16057 CommonPopupDataAttributes2[CommonPopupDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle"; 16058 CommonPopupDataAttributes2["anchorHidden"] = "data-anchor-hidden"; 16059 CommonPopupDataAttributes2["side"] = "data-side"; 16060 CommonPopupDataAttributes2["align"] = "data-align"; 16061 return CommonPopupDataAttributes2; 16062 })({}); 16063 var CommonTriggerDataAttributes = /* @__PURE__ */ (function(CommonTriggerDataAttributes2) { 16064 CommonTriggerDataAttributes2["popupOpen"] = "data-popup-open"; 16065 CommonTriggerDataAttributes2["pressed"] = "data-pressed"; 16066 return CommonTriggerDataAttributes2; 16067 })({}); 16068 var TRIGGER_HOOK = { 16069 [CommonTriggerDataAttributes.popupOpen]: "" 16070 }; 16071 var PRESSABLE_TRIGGER_HOOK = { 16072 [CommonTriggerDataAttributes.popupOpen]: "", 16073 [CommonTriggerDataAttributes.pressed]: "" 16074 }; 16075 var POPUP_OPEN_HOOK = { 16076 [CommonPopupDataAttributes.open]: "" 16077 }; 16078 var POPUP_CLOSED_HOOK = { 16079 [CommonPopupDataAttributes.closed]: "" 16080 }; 16081 var ANCHOR_HIDDEN_HOOK = { 16082 [CommonPopupDataAttributes.anchorHidden]: "" 16083 }; 16084 var triggerOpenStateMapping2 = { 16085 open(value) { 16086 if (value) { 16087 return TRIGGER_HOOK; 16088 } 16089 return null; 16090 } 16091 }; 16092 var popupStateMapping = { 16093 open(value) { 16094 if (value) { 16095 return POPUP_OPEN_HOOK; 16096 } 16097 return POPUP_CLOSED_HOOK; 16098 }, 16099 anchorHidden(value) { 16100 if (value) { 16101 return ANCHOR_HIDDEN_HOOK; 16102 } 16103 return null; 16104 } 16105 }; 16106 16107 // node_modules/@base-ui/react/internals/composite/composite.mjs 16108 var ARROW_UP = "ArrowUp"; 16109 var ARROW_DOWN = "ArrowDown"; 16110 var ARROW_LEFT = "ArrowLeft"; 16111 var ARROW_RIGHT = "ArrowRight"; 16112 var HOME = "Home"; 16113 var END = "End"; 16114 var HORIZONTAL_KEYS = /* @__PURE__ */ new Set([ARROW_LEFT, ARROW_RIGHT]); 16115 var HORIZONTAL_KEYS_WITH_EXTRA_KEYS = /* @__PURE__ */ new Set([ARROW_LEFT, ARROW_RIGHT, HOME, END]); 16116 var VERTICAL_KEYS = /* @__PURE__ */ new Set([ARROW_UP, ARROW_DOWN]); 16117 var VERTICAL_KEYS_WITH_EXTRA_KEYS = /* @__PURE__ */ new Set([ARROW_UP, ARROW_DOWN, HOME, END]); 16118 var ARROW_KEYS = /* @__PURE__ */ new Set([...HORIZONTAL_KEYS, ...VERTICAL_KEYS]); 16119 var COMPOSITE_KEYS = /* @__PURE__ */ new Set([...ARROW_KEYS, HOME, END]); 16120 var SHIFT = "Shift"; 16121 var CONTROL = "Control"; 16122 var ALT = "Alt"; 16123 var META = "Meta"; 16124 var MODIFIER_KEYS = /* @__PURE__ */ new Set([SHIFT, CONTROL, ALT, META]); 16125 function isInputElement(element) { 16126 return isHTMLElement(element) && element.tagName === "INPUT"; 16127 } 16128 function isNativeInput(element) { 16129 if (isInputElement(element) && element.selectionStart != null) { 16130 return true; 16131 } 16132 if (isHTMLElement(element) && element.tagName === "TEXTAREA") { 16133 return true; 16134 } 16135 return false; 16136 } 16137 function scrollIntoViewIfNeeded(scrollContainer, element, direction, orientation) { 16138 if (!scrollContainer || !element || !element.scrollTo) { 16139 return; 16140 } 16141 let targetX = scrollContainer.scrollLeft; 16142 let targetY = scrollContainer.scrollTop; 16143 const isOverflowingX = scrollContainer.clientWidth < scrollContainer.scrollWidth; 16144 const isOverflowingY = scrollContainer.clientHeight < scrollContainer.scrollHeight; 16145 if (isOverflowingX && orientation !== "vertical") { 16146 const elementOffsetLeft = getOffset(scrollContainer, element, "left"); 16147 const containerStyles = getStyles(scrollContainer); 16148 const elementStyles = getStyles(element); 16149 if (direction === "ltr") { 16150 if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) { 16151 targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight; 16152 } else if (elementOffsetLeft - elementStyles.scrollMarginLeft < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) { 16153 targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft; 16154 } 16155 } 16156 if (direction === "rtl") { 16157 if (elementOffsetLeft - elementStyles.scrollMarginRight < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) { 16158 targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft; 16159 } else if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) { 16160 targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight; 16161 } 16162 } 16163 } 16164 if (isOverflowingY && orientation !== "horizontal") { 16165 const elementOffsetTop = getOffset(scrollContainer, element, "top"); 16166 const containerStyles = getStyles(scrollContainer); 16167 const elementStyles = getStyles(element); 16168 if (elementOffsetTop - elementStyles.scrollMarginTop < scrollContainer.scrollTop + containerStyles.scrollPaddingTop) { 16169 targetY = elementOffsetTop - elementStyles.scrollMarginTop - containerStyles.scrollPaddingTop; 16170 } else if (elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom > scrollContainer.scrollTop + scrollContainer.clientHeight - containerStyles.scrollPaddingBottom) { 16171 targetY = elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom - scrollContainer.clientHeight + containerStyles.scrollPaddingBottom; 16172 } 16173 } 16174 scrollContainer.scrollTo({ 16175 left: targetX, 16176 top: targetY, 16177 behavior: "auto" 16178 }); 16179 } 16180 function getOffset(ancestor, element, side) { 16181 const propName = side === "left" ? "offsetLeft" : "offsetTop"; 16182 let result = 0; 16183 while (element.offsetParent) { 16184 result += element[propName]; 16185 if (element.offsetParent === ancestor) { 16186 break; 16187 } 16188 element = element.offsetParent; 16189 } 16190 return result; 16191 } 16192 function getStyles(element) { 16193 const styles = getComputedStyle(element); 16194 return { 16195 scrollMarginTop: parseFloat(styles.scrollMarginTop) || 0, 16196 scrollMarginRight: parseFloat(styles.scrollMarginRight) || 0, 16197 scrollMarginBottom: parseFloat(styles.scrollMarginBottom) || 0, 16198 scrollMarginLeft: parseFloat(styles.scrollMarginLeft) || 0, 16199 scrollPaddingTop: parseFloat(styles.scrollPaddingTop) || 0, 16200 scrollPaddingRight: parseFloat(styles.scrollPaddingRight) || 0, 16201 scrollPaddingBottom: parseFloat(styles.scrollPaddingBottom) || 0, 16202 scrollPaddingLeft: parseFloat(styles.scrollPaddingLeft) || 0 16203 }; 16204 } 16205 16206 // node_modules/@base-ui/utils/inertValue.mjs 16207 function inertValue(value) { 16208 if (isReactVersionAtLeast(19)) { 16209 return value; 16210 } 16211 return value ? "true" : void 0; 16212 } 16213 16214 // node_modules/@base-ui/react/utils/useAnchorPositioning.mjs 16215 var React40 = __toESM(require_react(), 1); 16216 16217 // node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs 16218 var baseArrow = (options) => ({ 16219 name: "arrow", 16220 options, 16221 async fn(state2) { 16222 const { 16223 x: x2, 16224 y: y3, 16225 placement, 16226 rects, 16227 platform: platform3, 16228 elements: elements2, 16229 middlewareData 16230 } = state2; 16231 const { 16232 element, 16233 padding = 0, 16234 offsetParent = "real" 16235 } = evaluate(options, state2) || {}; 16236 if (element == null) { 16237 return {}; 16238 } 16239 const paddingObject = getPaddingObject(padding); 16240 const coords = { 16241 x: x2, 16242 y: y3 16243 }; 16244 const axis = getAlignmentAxis(placement); 16245 const length2 = getAxisLength(axis); 16246 const arrowDimensions = await platform3.getDimensions(element); 16247 const isYAxis = axis === "y"; 16248 const minProp = isYAxis ? "top" : "left"; 16249 const maxProp = isYAxis ? "bottom" : "right"; 16250 const clientProp = isYAxis ? "clientHeight" : "clientWidth"; 16251 const endDiff = rects.reference[length2] + rects.reference[axis] - coords[axis] - rects.floating[length2]; 16252 const startDiff = coords[axis] - rects.reference[axis]; 16253 const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements2.floating; 16254 let clientSize = elements2.floating[clientProp] || rects.floating[length2]; 16255 if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) { 16256 clientSize = elements2.floating[clientProp] || rects.floating[length2]; 16257 } 16258 const centerToReference = endDiff / 2 - startDiff / 2; 16259 const largestPossiblePadding = clientSize / 2 - arrowDimensions[length2] / 2 - 1; 16260 const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding); 16261 const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding); 16262 const min3 = minPadding; 16263 const max3 = clientSize - arrowDimensions[length2] - maxPadding; 16264 const center = clientSize / 2 - arrowDimensions[length2] / 2 + centerToReference; 16265 const offset4 = clamp(min3, center, max3); 16266 const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length2] / 2 - (center < min3 ? minPadding : maxPadding) - arrowDimensions[length2] / 2 < 0; 16267 const alignmentOffset = shouldAddOffset ? center < min3 ? center - min3 : center - max3 : 0; 16268 return { 16269 [axis]: coords[axis] + alignmentOffset, 16270 data: { 16271 [axis]: offset4, 16272 centerOffset: center - offset4 - alignmentOffset, 16273 ...shouldAddOffset && { 16274 alignmentOffset 16275 } 16276 }, 16277 reset: shouldAddOffset 16278 }; 16279 } 16280 }); 16281 var arrow4 = (options, deps) => ({ 16282 ...baseArrow(options), 16283 options: [options, deps] 16284 }); 16285 16286 // node_modules/@base-ui/react/utils/hideMiddleware.mjs 16287 var nativeHideFn = hide3().fn; 16288 var hide4 = { 16289 name: "hide", 16290 async fn(state2) { 16291 const { 16292 width, 16293 height, 16294 x: x2, 16295 y: y3 16296 } = state2.rects.reference; 16297 const anchorHidden = width === 0 && height === 0 && x2 === 0 && y3 === 0; 16298 const nativeHideResult = await nativeHideFn(state2); 16299 return { 16300 data: { 16301 referenceHidden: nativeHideResult.data?.referenceHidden || anchorHidden 16302 } 16303 }; 16304 } 16305 }; 16306 16307 // node_modules/@base-ui/react/utils/adaptiveOriginMiddleware.mjs 16308 var DEFAULT_SIDES = { 16309 sideX: "left", 16310 sideY: "top" 16311 }; 16312 var adaptiveOrigin = { 16313 name: "adaptiveOrigin", 16314 async fn(state2) { 16315 const { 16316 x: rawX, 16317 y: rawY, 16318 rects: { 16319 floating: floatRect 16320 }, 16321 elements: { 16322 floating 16323 }, 16324 platform: platform3, 16325 strategy, 16326 placement 16327 } = state2; 16328 const win = getWindow(floating); 16329 const styles = win.getComputedStyle(floating); 16330 const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== ""; 16331 if (!hasTransition) { 16332 return { 16333 x: rawX, 16334 y: rawY, 16335 data: DEFAULT_SIDES 16336 }; 16337 } 16338 const offsetParent = await platform3.getOffsetParent?.(floating); 16339 let offsetDimensions = { 16340 width: 0, 16341 height: 0 16342 }; 16343 if (strategy === "fixed" && win?.visualViewport) { 16344 offsetDimensions = { 16345 width: win.visualViewport.width, 16346 height: win.visualViewport.height 16347 }; 16348 } else if (offsetParent === win) { 16349 const doc = ownerDocument(floating); 16350 offsetDimensions = { 16351 width: doc.documentElement.clientWidth, 16352 height: doc.documentElement.clientHeight 16353 }; 16354 } else if (await platform3.isElement?.(offsetParent)) { 16355 offsetDimensions = await platform3.getDimensions(offsetParent); 16356 } 16357 const currentSide = getSide(placement); 16358 let x2 = rawX; 16359 let y3 = rawY; 16360 if (currentSide === "left") { 16361 x2 = offsetDimensions.width - (rawX + floatRect.width); 16362 } 16363 if (currentSide === "top") { 16364 y3 = offsetDimensions.height - (rawY + floatRect.height); 16365 } 16366 const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX; 16367 const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY; 16368 return { 16369 x: x2, 16370 y: y3, 16371 data: { 16372 sideX, 16373 sideY 16374 } 16375 }; 16376 } 16377 }; 16378 16379 // node_modules/@base-ui/react/utils/useAnchorPositioning.mjs 16380 function getLogicalSide(sideParam, renderedSide, isRtl) { 16381 const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end"; 16382 const logicalRight = isRtl ? "inline-start" : "inline-end"; 16383 const logicalLeft = isRtl ? "inline-end" : "inline-start"; 16384 return { 16385 top: "top", 16386 right: isLogicalSideParam ? logicalRight : "right", 16387 bottom: "bottom", 16388 left: isLogicalSideParam ? logicalLeft : "left" 16389 }[renderedSide]; 16390 } 16391 function getOffsetData(state2, sideParam, isRtl) { 16392 const { 16393 rects, 16394 placement 16395 } = state2; 16396 const data = { 16397 side: getLogicalSide(sideParam, getSide(placement), isRtl), 16398 align: getAlignment(placement) || "center", 16399 anchor: { 16400 width: rects.reference.width, 16401 height: rects.reference.height 16402 }, 16403 positioner: { 16404 width: rects.floating.width, 16405 height: rects.floating.height 16406 } 16407 }; 16408 return data; 16409 } 16410 function useAnchorPositioning(params) { 16411 const { 16412 // Public parameters 16413 anchor, 16414 positionMethod = "absolute", 16415 side: sideParam = "bottom", 16416 sideOffset = 0, 16417 align = "center", 16418 alignOffset = 0, 16419 collisionBoundary, 16420 collisionPadding: collisionPaddingParam = 5, 16421 sticky = false, 16422 arrowPadding = 5, 16423 disableAnchorTracking = false, 16424 inline: inlineMiddleware, 16425 // Private parameters 16426 keepMounted = false, 16427 floatingRootContext, 16428 mounted, 16429 collisionAvoidance, 16430 shiftCrossAxis = false, 16431 nodeId, 16432 adaptiveOrigin: adaptiveOrigin2, 16433 lazyFlip = false, 16434 externalTree 16435 } = params; 16436 const [mountSide, setMountSide] = React40.useState(null); 16437 if (!mounted && mountSide !== null) { 16438 setMountSide(null); 16439 } 16440 const collisionAvoidanceSide = collisionAvoidance.side || "flip"; 16441 const collisionAvoidanceAlign = collisionAvoidance.align || "flip"; 16442 const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end"; 16443 const anchorFn = typeof anchor === "function" ? anchor : void 0; 16444 const anchorFnCallback = useStableCallback(anchorFn); 16445 const anchorDep = anchorFn ? anchorFnCallback : anchor; 16446 const anchorValueRef = useValueAsRef(anchor); 16447 const mountedRef = useValueAsRef(mounted); 16448 const direction = useDirection(); 16449 const isRtl = direction === "rtl"; 16450 const side = mountSide || { 16451 top: "top", 16452 right: "right", 16453 bottom: "bottom", 16454 left: "left", 16455 "inline-end": isRtl ? "left" : "right", 16456 "inline-start": isRtl ? "right" : "left" 16457 }[sideParam]; 16458 const placement = align === "center" ? side : `$side}-$align}`; 16459 let collisionPadding = collisionPaddingParam; 16460 const bias = 1; 16461 const biasTop = sideParam === "bottom" ? bias : 0; 16462 const biasBottom = sideParam === "top" ? bias : 0; 16463 const biasLeft = sideParam === "right" ? bias : 0; 16464 const biasRight = sideParam === "left" ? bias : 0; 16465 if (typeof collisionPadding === "number") { 16466 collisionPadding = { 16467 top: collisionPadding + biasTop, 16468 right: collisionPadding + biasRight, 16469 bottom: collisionPadding + biasBottom, 16470 left: collisionPadding + biasLeft 16471 }; 16472 } else if (collisionPadding) { 16473 collisionPadding = { 16474 top: (collisionPadding.top || 0) + biasTop, 16475 right: (collisionPadding.right || 0) + biasRight, 16476 bottom: (collisionPadding.bottom || 0) + biasBottom, 16477 left: (collisionPadding.left || 0) + biasLeft 16478 }; 16479 } 16480 const commonCollisionProps = { 16481 boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary, 16482 padding: collisionPadding 16483 }; 16484 const arrowRef = React40.useRef(null); 16485 const sideOffsetRef = useValueAsRef(sideOffset); 16486 const alignOffsetRef = useValueAsRef(alignOffset); 16487 const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0; 16488 const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0; 16489 const middleware = []; 16490 if (inlineMiddleware) { 16491 middleware.push(inlineMiddleware); 16492 } 16493 middleware.push(offset3((state2) => { 16494 const data = getOffsetData(state2, sideParam, isRtl); 16495 const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current; 16496 const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current; 16497 return { 16498 mainAxis: sideAxis, 16499 crossAxis: alignAxis, 16500 alignmentAxis: alignAxis 16501 }; 16502 }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam])); 16503 const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift"; 16504 const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift"); 16505 const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({ 16506 ...commonCollisionProps, 16507 // Ensure the popup flips if it's been limited by its --available-height and it resizes. 16508 // Since the size() padding is smaller than the flip() padding, flip() will take precedence. 16509 padding: { 16510 top: collisionPadding.top + bias, 16511 right: collisionPadding.right + bias, 16512 bottom: collisionPadding.bottom + bias, 16513 left: collisionPadding.left + bias 16514 }, 16515 mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip", 16516 crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false, 16517 fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide 16518 }); 16519 const shiftMiddleware = shiftDisabled ? null : shift3((data) => { 16520 const html = ownerDocument(data.elements.floating).documentElement; 16521 return { 16522 ...commonCollisionProps, 16523 // Use the Layout Viewport to avoid shifting around when pinch-zooming 16524 // for context menus. 16525 rootBoundary: shiftCrossAxis ? { 16526 x: 0, 16527 y: 0, 16528 width: html.clientWidth, 16529 height: html.clientHeight 16530 } : void 0, 16531 mainAxis: collisionAvoidanceAlign !== "none", 16532 crossAxis: crossAxisShiftEnabled, 16533 limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => { 16534 if (!arrowRef.current) { 16535 return {}; 16536 } 16537 const { 16538 width, 16539 height 16540 } = arrowRef.current.getBoundingClientRect(); 16541 const sideAxis = getSideAxis(getSide(limitData.placement)); 16542 const arrowSize = sideAxis === "y" ? width : height; 16543 const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom; 16544 return { 16545 offset: arrowSize / 2 + offsetAmount / 2 16546 }; 16547 }) 16548 }; 16549 }, [commonCollisionProps, sticky, shiftCrossAxis, collisionPadding, collisionAvoidanceAlign]); 16550 if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") { 16551 middleware.push(shiftMiddleware, flipMiddleware); 16552 } else { 16553 middleware.push(flipMiddleware, shiftMiddleware); 16554 } 16555 middleware.push(size3({ 16556 ...commonCollisionProps, 16557 apply({ 16558 elements: { 16559 floating 16560 }, 16561 availableWidth, 16562 availableHeight, 16563 rects 16564 }) { 16565 if (!mountedRef.current) { 16566 return; 16567 } 16568 const floatingStyle = floating.style; 16569 floatingStyle.setProperty("--available-width", `$availableWidth}px`); 16570 floatingStyle.setProperty("--available-height", `$availableHeight}px`); 16571 const dpr = getWindow(floating).devicePixelRatio || 1; 16572 const { 16573 x: x3, 16574 y: y4, 16575 width, 16576 height 16577 } = rects.reference; 16578 const anchorWidth = (Math.round((x3 + width) * dpr) - Math.round(x3 * dpr)) / dpr; 16579 const anchorHeight = (Math.round((y4 + height) * dpr) - Math.round(y4 * dpr)) / dpr; 16580 floatingStyle.setProperty("--anchor-width", `$anchorWidth}px`); 16581 floatingStyle.setProperty("--anchor-height", `$anchorHeight}px`); 16582 } 16583 }), arrow4((state2) => ({ 16584 // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set, 16585 // we'll create a fake element. 16586 element: arrowRef.current || ownerDocument(state2.elements.floating).createElement("div"), 16587 padding: arrowPadding, 16588 offsetParent: "floating" 16589 }), [arrowPadding]), { 16590 name: "transformOrigin", 16591 fn(state2) { 16592 const { 16593 elements: elements3, 16594 middlewareData: middlewareData2, 16595 placement: renderedPlacement2, 16596 rects, 16597 y: y4 16598 } = state2; 16599 const currentRenderedSide = getSide(renderedPlacement2); 16600 const currentRenderedAxis = getSideAxis(currentRenderedSide); 16601 const arrowEl = arrowRef.current; 16602 const arrowX = middlewareData2.arrow?.x || 0; 16603 const arrowY = middlewareData2.arrow?.y || 0; 16604 const arrowWidth = arrowEl?.clientWidth || 0; 16605 const arrowHeight = arrowEl?.clientHeight || 0; 16606 const transformX = arrowX + arrowWidth / 2; 16607 const transformY = arrowY + arrowHeight / 2; 16608 const shiftY = Math.abs(middlewareData2.shift?.y || 0); 16609 const halfAnchorHeight = rects.reference.height / 2; 16610 const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state2, sideParam, isRtl)) : sideOffset; 16611 const isOverlappingAnchor = shiftY > sideOffsetValue; 16612 const adjacentTransformOrigin = { 16613 top: `$transformX}px calc(100% + $sideOffsetValue}px)`, 16614 bottom: `$transformX}px ${-sideOffsetValue}px`, 16615 left: `calc(100% + $sideOffsetValue}px) $transformY}px`, 16616 right: `${-sideOffsetValue}px $transformY}px` 16617 }[currentRenderedSide]; 16618 const overlapTransformOrigin = `$transformX}px $rects.reference.y + halfAnchorHeight - y4}px`; 16619 elements3.floating.style.setProperty("--transform-origin", crossAxisShiftEnabled && currentRenderedAxis === "y" && isOverlappingAnchor ? overlapTransformOrigin : adjacentTransformOrigin); 16620 return {}; 16621 } 16622 }, hide4, adaptiveOrigin2); 16623 useIsoLayoutEffect(() => { 16624 if (!mounted && floatingRootContext) { 16625 floatingRootContext.update({ 16626 referenceElement: null, 16627 floatingElement: null, 16628 domReferenceElement: null, 16629 positionReference: null 16630 }); 16631 } 16632 }, [mounted, floatingRootContext]); 16633 const autoUpdateOptions = React40.useMemo(() => ({ 16634 elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined", 16635 layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined" 16636 }), [disableAnchorTracking]); 16637 const { 16638 refs, 16639 elements: elements2, 16640 x: x2, 16641 y: y3, 16642 middlewareData, 16643 update: update4, 16644 placement: renderedPlacement, 16645 context, 16646 isPositioned, 16647 floatingStyles: originalFloatingStyles 16648 } = useFloating2({ 16649 rootContext: floatingRootContext, 16650 open: keepMounted ? mounted : void 0, 16651 placement, 16652 middleware, 16653 strategy: positionMethod, 16654 whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions), 16655 nodeId, 16656 externalTree 16657 }); 16658 const { 16659 sideX, 16660 sideY 16661 } = middlewareData.adaptiveOrigin || DEFAULT_SIDES; 16662 const resolvedPosition = isPositioned ? positionMethod : "fixed"; 16663 const floatingStyles = React40.useMemo(() => { 16664 const base = adaptiveOrigin2 ? { 16665 position: resolvedPosition, 16666 [sideX]: x2, 16667 [sideY]: y3 16668 } : { 16669 position: resolvedPosition, 16670 ...originalFloatingStyles 16671 }; 16672 if (!isPositioned) { 16673 base.opacity = 0; 16674 } 16675 return base; 16676 }, [adaptiveOrigin2, resolvedPosition, sideX, x2, sideY, y3, originalFloatingStyles, isPositioned]); 16677 const registeredPositionReferenceRef = React40.useRef(null); 16678 useIsoLayoutEffect(() => { 16679 if (!mounted) { 16680 return; 16681 } 16682 const anchorValue = anchorValueRef.current; 16683 const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue; 16684 const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null; 16685 const finalAnchor = unwrappedElement || null; 16686 if (finalAnchor !== registeredPositionReferenceRef.current) { 16687 refs.setPositionReference(finalAnchor); 16688 registeredPositionReferenceRef.current = finalAnchor; 16689 } 16690 }, [mounted, refs, anchorDep, anchorValueRef]); 16691 React40.useEffect(() => { 16692 if (!mounted) { 16693 return; 16694 } 16695 const anchorValue = anchorValueRef.current; 16696 if (typeof anchorValue === "function") { 16697 return; 16698 } 16699 if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) { 16700 refs.setPositionReference(anchorValue.current); 16701 registeredPositionReferenceRef.current = anchorValue.current; 16702 } 16703 }, [mounted, refs, anchorDep, anchorValueRef]); 16704 React40.useEffect(() => { 16705 if (keepMounted && mounted && elements2.reference && elements2.floating) { 16706 return autoUpdate(elements2.reference, elements2.floating, update4, autoUpdateOptions); 16707 } 16708 return void 0; 16709 }, [keepMounted, mounted, elements2, update4, autoUpdateOptions]); 16710 const renderedSide = getSide(renderedPlacement); 16711 const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl); 16712 const renderedAlign = getAlignment(renderedPlacement) || "center"; 16713 const anchorHidden = Boolean(middlewareData.hide?.referenceHidden); 16714 useIsoLayoutEffect(() => { 16715 if (lazyFlip && mounted && isPositioned) { 16716 setMountSide(renderedSide); 16717 } 16718 }, [lazyFlip, mounted, isPositioned, renderedSide]); 16719 const arrowStyles = React40.useMemo(() => ({ 16720 position: "absolute", 16721 top: middlewareData.arrow?.y, 16722 left: middlewareData.arrow?.x 16723 }), [middlewareData.arrow]); 16724 const arrowUncentered = middlewareData.arrow?.centerOffset !== 0; 16725 return React40.useMemo(() => ({ 16726 positionerStyles: floatingStyles, 16727 arrowStyles, 16728 arrowRef, 16729 arrowUncentered, 16730 side: logicalRenderedSide, 16731 align: renderedAlign, 16732 physicalSide: renderedSide, 16733 anchorHidden, 16734 refs, 16735 context, 16736 isPositioned, 16737 update: update4 16738 }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden, refs, context, isPositioned, update4]); 16739 } 16740 function isRef(param) { 16741 return param != null && "current" in param; 16742 } 16743 16744 // node_modules/@base-ui/react/utils/getDisabledMountTransitionStyles.mjs 16745 function getDisabledMountTransitionStyles(transitionStatus) { 16746 return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT3; 16747 } 16748 16749 // node_modules/@base-ui/react/utils/usePositioner.mjs 16750 function usePositioner(componentProps, state2, { 16751 styles, 16752 transitionStatus, 16753 props, 16754 refs, 16755 hidden, 16756 inert = false 16757 }) { 16758 const style = { 16759 ...styles 16760 }; 16761 if (inert) { 16762 style.pointerEvents = "none"; 16763 } 16764 return useRenderElement("div", componentProps, { 16765 state: state2, 16766 ref: refs, 16767 props: [{ 16768 role: "presentation", 16769 hidden, 16770 style 16771 }, getDisabledMountTransitionStyles(transitionStatus), props], 16772 stateAttributesMapping: popupStateMapping 16773 }); 16774 } 16775 16776 // node_modules/@base-ui/react/button/Button.mjs 16777 var React41 = __toESM(require_react(), 1); 16778 var Button2 = /* @__PURE__ */ React41.forwardRef(function Button3(componentProps, forwardedRef) { 16779 const { 16780 render: render5, 16781 className, 16782 disabled: disabled2 = false, 16783 focusableWhenDisabled = false, 16784 nativeButton = true, 16785 style, 16786 ...elementProps 16787 } = componentProps; 16788 const { 16789 getButtonProps, 16790 buttonRef 16791 } = useButton({ 16792 disabled: disabled2, 16793 focusableWhenDisabled, 16794 native: nativeButton 16795 }); 16796 const state2 = { 16797 disabled: disabled2 16798 }; 16799 return useRenderElement("button", componentProps, { 16800 state: state2, 16801 ref: [forwardedRef, buttonRef], 16802 props: [elementProps, getButtonProps] 16803 }); 16804 }); 16805 if (true) Button2.displayName = "Button"; 16806 16807 // node_modules/@base-ui/react/collapsible/index.parts.mjs 16808 var index_parts_exports = {}; 16809 __export(index_parts_exports, { 16810 Panel: () => CollapsiblePanel, 16811 Root: () => CollapsibleRoot, 16812 Trigger: () => CollapsibleTrigger 16813 }); 16814 16815 // node_modules/@base-ui/react/collapsible/root/CollapsibleRoot.mjs 16816 var React42 = __toESM(require_react(), 1); 16817 16818 // node_modules/@base-ui/react/collapsible/root/stateAttributesMapping.mjs 16819 var collapsibleStateAttributesMapping = { 16820 ...collapsibleOpenStateMapping, 16821 ...transitionStatusMapping 16822 }; 16823 16824 // node_modules/@base-ui/react/collapsible/root/CollapsibleRoot.mjs 16825 var import_jsx_runtime102 = __toESM(require_jsx_runtime(), 1); 16826 var CollapsibleRoot = /* @__PURE__ */ React42.forwardRef(function CollapsibleRoot2(componentProps, forwardedRef) { 16827 const { 16828 render: render5, 16829 className, 16830 defaultOpen = false, 16831 disabled: disabled2 = false, 16832 onOpenChange: onOpenChangeProp, 16833 open, 16834 style, 16835 ...elementProps 16836 } = componentProps; 16837 const onOpenChange = useStableCallback(onOpenChangeProp); 16838 const collapsible = useCollapsibleRoot({ 16839 open, 16840 defaultOpen, 16841 onOpenChange, 16842 disabled: disabled2 16843 }); 16844 const state2 = React42.useMemo(() => ({ 16845 open: collapsible.open, 16846 disabled: collapsible.disabled, 16847 transitionStatus: collapsible.transitionStatus 16848 }), [collapsible.open, collapsible.disabled, collapsible.transitionStatus]); 16849 const contextValue = React42.useMemo(() => ({ 16850 ...collapsible, 16851 onOpenChange, 16852 state: state2 16853 }), [collapsible, onOpenChange, state2]); 16854 const element = useRenderElement("div", componentProps, { 16855 state: state2, 16856 ref: forwardedRef, 16857 props: elementProps, 16858 stateAttributesMapping: collapsibleStateAttributesMapping 16859 }); 16860 return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(CollapsibleRootContext.Provider, { 16861 value: contextValue, 16862 children: element 16863 }); 16864 }); 16865 if (true) CollapsibleRoot.displayName = "CollapsibleRoot"; 16866 16867 // node_modules/@base-ui/react/collapsible/trigger/CollapsibleTrigger.mjs 16868 var React43 = __toESM(require_react(), 1); 16869 var stateAttributesMapping = { 16870 ...triggerOpenStateMapping, 16871 ...transitionStatusMapping 16872 }; 16873 var CollapsibleTrigger = /* @__PURE__ */ React43.forwardRef(function CollapsibleTrigger2(componentProps, forwardedRef) { 16874 const { 16875 panelId, 16876 open, 16877 handleTrigger, 16878 state: state2, 16879 disabled: contextDisabled 16880 } = useCollapsibleRootContext(); 16881 const { 16882 className, 16883 disabled: disabled2 = contextDisabled, 16884 render: render5, 16885 nativeButton = true, 16886 style, 16887 ...elementProps 16888 } = componentProps; 16889 const { 16890 getButtonProps, 16891 buttonRef 16892 } = useButton({ 16893 disabled: disabled2, 16894 focusableWhenDisabled: true, 16895 native: nativeButton 16896 }); 16897 const element = useRenderElement("button", componentProps, { 16898 state: state2, 16899 ref: [forwardedRef, buttonRef], 16900 props: [{ 16901 "aria-controls": open ? panelId : void 0, 16902 "aria-expanded": open, 16903 onClick: handleTrigger 16904 }, elementProps, getButtonProps], 16905 stateAttributesMapping 16906 }); 16907 return element; 16908 }); 16909 if (true) CollapsibleTrigger.displayName = "CollapsibleTrigger"; 16910 16911 // node_modules/@base-ui/react/collapsible/panel/CollapsiblePanel.mjs 16912 var React44 = __toESM(require_react(), 1); 16913 16914 // node_modules/@base-ui/react/collapsible/panel/CollapsiblePanelCssVars.mjs 16915 var CollapsiblePanelCssVars = /* @__PURE__ */ (function(CollapsiblePanelCssVars2) { 16916 CollapsiblePanelCssVars2["collapsiblePanelHeight"] = "--collapsible-panel-height"; 16917 CollapsiblePanelCssVars2["collapsiblePanelWidth"] = "--collapsible-panel-width"; 16918 return CollapsiblePanelCssVars2; 16919 })({}); 16920 16921 // node_modules/@base-ui/react/collapsible/panel/CollapsiblePanel.mjs 16922 var CollapsiblePanel = /* @__PURE__ */ React44.forwardRef(function CollapsiblePanel2(componentProps, forwardedRef) { 16923 const { 16924 className, 16925 hiddenUntilFound: hiddenUntilFoundProp, 16926 keepMounted: keepMountedProp, 16927 render: render5, 16928 id: idProp, 16929 style, 16930 ...elementProps 16931 } = componentProps; 16932 if (true) { 16933 useIsoLayoutEffect(() => { 16934 if (hiddenUntilFoundProp && keepMountedProp === false) { 16935 warn("The `keepMounted={false}` prop on `Collapsible.Panel` is ignored when `hiddenUntilFound` is enabled, since the panel must remain mounted while closed."); 16936 } 16937 }, [hiddenUntilFoundProp, keepMountedProp]); 16938 } 16939 const { 16940 mounted, 16941 onOpenChange, 16942 open, 16943 panelId, 16944 setMounted, 16945 setPanelIdState, 16946 setOpen, 16947 state: state2, 16948 transitionStatus 16949 } = useCollapsibleRootContext(); 16950 const hiddenUntilFound = hiddenUntilFoundProp ?? false; 16951 const keepMounted = keepMountedProp ?? false; 16952 useIsoLayoutEffect(() => { 16953 if (idProp) { 16954 setPanelIdState(idProp); 16955 return () => { 16956 setPanelIdState(void 0); 16957 }; 16958 } 16959 return void 0; 16960 }, [idProp, setPanelIdState]); 16961 const { 16962 height, 16963 props, 16964 ref, 16965 shouldPreventOpenAnimation, 16966 shouldRender, 16967 transitionStatus: panelTransitionStatus, 16968 width 16969 } = useCollapsiblePanel({ 16970 externalRef: forwardedRef, 16971 hiddenUntilFound, 16972 id: panelId, 16973 keepMounted, 16974 mounted, 16975 onOpenChange, 16976 open, 16977 setMounted, 16978 setOpen, 16979 transitionStatus 16980 }); 16981 const panelState = { 16982 ...state2, 16983 transitionStatus: panelTransitionStatus 16984 }; 16985 const resolvedStyle = resolveStyle2(style, panelState); 16986 const element = useRenderElement("div", { 16987 ...componentProps, 16988 style: void 0 16989 }, { 16990 state: panelState, 16991 ref, 16992 props: [ 16993 props, 16994 { 16995 style: { 16996 [CollapsiblePanelCssVars.collapsiblePanelHeight]: height === void 0 ? "auto" : `$height}px`, 16997 [CollapsiblePanelCssVars.collapsiblePanelWidth]: width === void 0 ? "auto" : `$width}px` 16998 } 16999 }, 17000 elementProps, 17001 resolvedStyle ? { 17002 style: resolvedStyle 17003 } : void 0, 17004 // Resolve the public `style` prop so temporary `animationName: 'none'` 17005 // can still win after user's inline styles have been merged. 17006 shouldPreventOpenAnimation ? { 17007 style: { 17008 animationName: "none" 17009 } 17010 } : void 0 17011 ], 17012 stateAttributesMapping: collapsibleStateAttributesMapping 17013 }); 17014 if (!shouldRender) { 17015 return null; 17016 } 17017 return element; 17018 }); 17019 if (true) CollapsiblePanel.displayName = "CollapsiblePanel"; 17020 17021 // node_modules/@base-ui/react/internals/composite/item/useCompositeItem.mjs 17022 var React45 = __toESM(require_react(), 1); 17023 function useCompositeItem(params = {}) { 17024 const { 17025 highlightItemOnHover, 17026 highlightedIndex, 17027 onHighlightedIndexChange 17028 } = useCompositeRootContext(); 17029 const { 17030 ref, 17031 index: index2 17032 } = useCompositeListItem(params); 17033 const isHighlighted = highlightedIndex === index2; 17034 const itemRef = React45.useRef(null); 17035 const mergedRef = useMergedRefs(ref, itemRef); 17036 const compositeProps = { 17037 tabIndex: isHighlighted ? 0 : -1, 17038 onFocus() { 17039 onHighlightedIndexChange(index2); 17040 }, 17041 onMouseMove() { 17042 const item = itemRef.current; 17043 if (!highlightItemOnHover || !item) { 17044 return; 17045 } 17046 const disabled2 = item.hasAttribute("disabled") || item.ariaDisabled === "true"; 17047 if (!isHighlighted && !disabled2) { 17048 item.focus(); 17049 } 17050 } 17051 }; 17052 return { 17053 compositeProps, 17054 compositeRef: mergedRef, 17055 index: index2 17056 }; 17057 } 17058 17059 // node_modules/@base-ui/react/utils/usePopupViewport.mjs 17060 var React48 = __toESM(require_react(), 1); 17061 var ReactDOM6 = __toESM(require_react_dom(), 1); 17062 17063 // node_modules/@base-ui/utils/usePreviousValue.mjs 17064 var React46 = __toESM(require_react(), 1); 17065 function usePreviousValue(value) { 17066 const [state2, setState] = React46.useState({ 17067 current: value, 17068 previous: null 17069 }); 17070 if (value !== state2.current) { 17071 setState({ 17072 current: value, 17073 previous: state2.current 17074 }); 17075 } 17076 return state2.previous; 17077 } 17078 17079 // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs 17080 var React47 = __toESM(require_react(), 1); 17081 17082 // node_modules/@base-ui/react/utils/getCssDimensions.mjs 17083 function getCssDimensions2(element) { 17084 const css = getComputedStyle2(element); 17085 let width = parseFloat(css.width) || 0; 17086 let height = parseFloat(css.height) || 0; 17087 const hasOffset = isHTMLElement(element); 17088 const offsetWidth = hasOffset ? element.offsetWidth : width; 17089 const offsetHeight = hasOffset ? element.offsetHeight : height; 17090 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 17091 if (shouldFallback) { 17092 width = offsetWidth; 17093 height = offsetHeight; 17094 } 17095 return { 17096 width, 17097 height 17098 }; 17099 } 17100 17101 // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs 17102 function usePopupAutoResize(parameters) { 17103 const { 17104 popupElement, 17105 positionerElement, 17106 content, 17107 mounted, 17108 onMeasureLayout: onMeasureLayoutParam, 17109 onMeasureLayoutComplete: onMeasureLayoutCompleteParam, 17110 side, 17111 direction 17112 } = parameters; 17113 const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true, false); 17114 const animationFrame = useAnimationFrame(); 17115 const committedDimensionsRef = React47.useRef(null); 17116 const isInitialRenderRef = React47.useRef(true); 17117 const restoreAnchoringStylesRef = React47.useRef(NOOP); 17118 const onMeasureLayout = useStableCallback(onMeasureLayoutParam); 17119 const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam); 17120 const anchoringStyles = React47.useMemo(() => { 17121 let isOriginSide = side === "top"; 17122 let isPhysicalLeft = side === "left"; 17123 if (direction === "rtl") { 17124 isOriginSide = isOriginSide || side === "inline-end"; 17125 isPhysicalLeft = isPhysicalLeft || side === "inline-end"; 17126 } else { 17127 isOriginSide = isOriginSide || side === "inline-start"; 17128 isPhysicalLeft = isPhysicalLeft || side === "inline-start"; 17129 } 17130 return isOriginSide ? { 17131 position: "absolute", 17132 [side === "top" ? "bottom" : "top"]: "0", 17133 [isPhysicalLeft ? "right" : "left"]: "0" 17134 } : EMPTY_OBJECT3; 17135 }, [side, direction]); 17136 useIsoLayoutEffect(() => { 17137 if (!mounted) { 17138 restoreAnchoringStylesRef.current = NOOP; 17139 isInitialRenderRef.current = true; 17140 committedDimensionsRef.current = null; 17141 return void 0; 17142 } 17143 if (!popupElement || !positionerElement) { 17144 return void 0; 17145 } 17146 restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles); 17147 setPopupCssSize(popupElement, "auto"); 17148 const restorePopupPosition = overrideElementStyle(popupElement, "position", "static"); 17149 const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none"); 17150 const restorePopupScale = overrideElementStyle(popupElement, "scale", "1"); 17151 const restorePositionerAvailableSize = applyElementStyles(positionerElement, { 17152 "--available-width": "max-content", 17153 "--available-height": "max-content" 17154 }); 17155 function restoreMeasurementOverrides() { 17156 restorePopupPosition(); 17157 restorePopupTransform(); 17158 restorePositionerAvailableSize(); 17159 } 17160 function restoreMeasurementOverridesIncludingScale() { 17161 restoreMeasurementOverrides(); 17162 restorePopupScale(); 17163 } 17164 onMeasureLayout?.(); 17165 if (isInitialRenderRef.current || committedDimensionsRef.current === null) { 17166 setPositionerCssSize(positionerElement, "max-content"); 17167 const dimensions = getCssDimensions2(popupElement); 17168 committedDimensionsRef.current = dimensions; 17169 setPositionerCssSize(positionerElement, dimensions); 17170 restoreMeasurementOverridesIncludingScale(); 17171 onMeasureLayoutComplete?.(null, dimensions); 17172 isInitialRenderRef.current = false; 17173 return () => { 17174 restoreAnchoringStylesRef.current(); 17175 restoreAnchoringStylesRef.current = NOOP; 17176 }; 17177 } 17178 setPositionerCssSize(positionerElement, "max-content"); 17179 const previousDimensions = committedDimensionsRef.current; 17180 const newDimensions = getCssDimensions2(popupElement); 17181 committedDimensionsRef.current = newDimensions; 17182 setPopupCssSize(popupElement, previousDimensions); 17183 restoreMeasurementOverridesIncludingScale(); 17184 onMeasureLayoutComplete?.(previousDimensions, newDimensions); 17185 setPositionerCssSize(positionerElement, newDimensions); 17186 const abortController = new AbortController(); 17187 animationFrame.request(() => { 17188 setPopupCssSize(popupElement, newDimensions); 17189 runOnceAnimationsFinish(() => { 17190 popupElement.style.setProperty("--popup-width", "auto"); 17191 popupElement.style.setProperty("--popup-height", "auto"); 17192 }, abortController.signal); 17193 }); 17194 return () => { 17195 abortController.abort(); 17196 animationFrame.cancel(); 17197 restoreAnchoringStylesRef.current(); 17198 restoreAnchoringStylesRef.current = NOOP; 17199 }; 17200 }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]); 17201 } 17202 function overrideElementStyle(element, property, value) { 17203 const originalValue = element.style.getPropertyValue(property); 17204 element.style.setProperty(property, value); 17205 return () => { 17206 element.style.setProperty(property, originalValue); 17207 }; 17208 } 17209 function applyElementStyles(element, styles) { 17210 const restorers = []; 17211 for (const [key, value] of Object.entries(styles)) { 17212 restorers.push(overrideElementStyle(element, key, value)); 17213 } 17214 return restorers.length ? () => { 17215 restorers.forEach((restore) => restore()); 17216 } : NOOP; 17217 } 17218 function setPopupCssSize(popupElement, size4) { 17219 const width = size4 === "auto" ? "auto" : `$size4.width}px`; 17220 const height = size4 === "auto" ? "auto" : `$size4.height}px`; 17221 popupElement.style.setProperty("--popup-width", width); 17222 popupElement.style.setProperty("--popup-height", height); 17223 } 17224 function setPositionerCssSize(positionerElement, size4) { 17225 const width = size4 === "max-content" ? "max-content" : `$size4.width}px`; 17226 const height = size4 === "max-content" ? "max-content" : `$size4.height}px`; 17227 positionerElement.style.setProperty("--positioner-width", width); 17228 positionerElement.style.setProperty("--positioner-height", height); 17229 } 17230 17231 // node_modules/@base-ui/react/utils/usePopupViewport.mjs 17232 var import_jsx_runtime103 = __toESM(require_jsx_runtime(), 1); 17233 function usePopupViewport(parameters) { 17234 const { 17235 store: store4, 17236 side, 17237 cssVars, 17238 children 17239 } = parameters; 17240 const direction = useDirection(); 17241 const activeTrigger = store4.useState("activeTriggerElement"); 17242 const activeTriggerId = store4.useState("activeTriggerId"); 17243 const open = store4.useState("open"); 17244 const payload = store4.useState("payload"); 17245 const mounted = store4.useState("mounted"); 17246 const popupElement = store4.useState("popupElement"); 17247 const positionerElement = store4.useState("positionerElement"); 17248 const previousActiveTrigger = usePreviousValue(open ? activeTrigger : null); 17249 const currentContentKey = usePopupContentKey(activeTriggerId, payload); 17250 const capturedNodeRef = React48.useRef(null); 17251 const [previousContentNode, setPreviousContentNode] = React48.useState(null); 17252 const [newTriggerOffset, setNewTriggerOffset] = React48.useState(null); 17253 const currentContainerRef = React48.useRef(null); 17254 const previousContainerRef = React48.useRef(null); 17255 const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true, false); 17256 const cleanupFrame = useAnimationFrame(); 17257 const [previousContentDimensions, setPreviousContentDimensions] = React48.useState(null); 17258 const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React48.useState(false); 17259 useIsoLayoutEffect(() => { 17260 store4.set("hasViewport", true); 17261 return () => { 17262 store4.set("hasViewport", false); 17263 }; 17264 }, [store4]); 17265 const handleMeasureLayout = useStableCallback(() => { 17266 currentContainerRef.current?.style.setProperty("animation", "none"); 17267 currentContainerRef.current?.style.setProperty("transition", "none"); 17268 previousContainerRef.current?.style.setProperty("display", "none"); 17269 }); 17270 const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => { 17271 currentContainerRef.current?.style.removeProperty("animation"); 17272 currentContainerRef.current?.style.removeProperty("transition"); 17273 previousContainerRef.current?.style.removeProperty("display"); 17274 if (previousDimensions) { 17275 setPreviousContentDimensions(previousDimensions); 17276 } 17277 }); 17278 const lastHandledTriggerRef = React48.useRef(null); 17279 useIsoLayoutEffect(() => { 17280 if (!open || !mounted) { 17281 lastHandledTriggerRef.current = null; 17282 } 17283 }, [open, mounted]); 17284 useIsoLayoutEffect(() => { 17285 if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) { 17286 setPreviousContentNode(capturedNodeRef.current); 17287 setShowStartingStyleAttribute(true); 17288 const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger); 17289 setNewTriggerOffset(offset4); 17290 cleanupFrame.request(() => { 17291 ReactDOM6.flushSync(() => { 17292 setShowStartingStyleAttribute(false); 17293 }); 17294 onAnimationsFinished(() => { 17295 setPreviousContentNode(null); 17296 setPreviousContentDimensions(null); 17297 capturedNodeRef.current = null; 17298 }); 17299 }); 17300 lastHandledTriggerRef.current = activeTrigger; 17301 } 17302 }, [activeTrigger, previousActiveTrigger, previousContentNode, onAnimationsFinished, cleanupFrame]); 17303 useIsoLayoutEffect(() => { 17304 const source = currentContainerRef.current; 17305 if (!source) { 17306 return; 17307 } 17308 const wrapper = ownerDocument(source).createElement("div"); 17309 for (const child of Array.from(source.childNodes)) { 17310 wrapper.appendChild(child.cloneNode(true)); 17311 } 17312 capturedNodeRef.current = wrapper; 17313 }); 17314 const isTransitioning = previousContentNode != null; 17315 let childrenToRender; 17316 if (!isTransitioning) { 17317 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { 17318 "data-current": true, 17319 ref: currentContainerRef, 17320 children 17321 }, currentContentKey); 17322 } else { 17323 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(React48.Fragment, { 17324 children: [/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { 17325 "data-previous": true, 17326 inert: inertValue(true), 17327 ref: previousContainerRef, 17328 style: { 17329 ...previousContentDimensions ? { 17330 [cssVars.popupWidth]: `$previousContentDimensions.width}px`, 17331 [cssVars.popupHeight]: `$previousContentDimensions.height}px` 17332 } : null, 17333 position: "absolute" 17334 }, 17335 "data-ending-style": showStartingStyleAttribute ? void 0 : "" 17336 }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { 17337 "data-current": true, 17338 ref: currentContainerRef, 17339 "data-starting-style": showStartingStyleAttribute ? "" : void 0, 17340 children 17341 }, currentContentKey)] 17342 }); 17343 } 17344 useIsoLayoutEffect(() => { 17345 const container = previousContainerRef.current; 17346 if (!container || !previousContentNode) { 17347 return; 17348 } 17349 container.replaceChildren(...Array.from(previousContentNode.childNodes)); 17350 }, [previousContentNode]); 17351 usePopupAutoResize({ 17352 popupElement, 17353 positionerElement, 17354 mounted, 17355 content: payload, 17356 onMeasureLayout: handleMeasureLayout, 17357 onMeasureLayoutComplete: handleMeasureLayoutComplete, 17358 side, 17359 direction 17360 }); 17361 const state2 = { 17362 activationDirection: getActivationDirection(newTriggerOffset), 17363 transitioning: isTransitioning 17364 }; 17365 return { 17366 children: childrenToRender, 17367 state: state2 17368 }; 17369 } 17370 function getActivationDirection(offset4) { 17371 if (!offset4) { 17372 return void 0; 17373 } 17374 return `$getValueWithTolerance(offset4.horizontal, 5, "right", "left")} $getValueWithTolerance(offset4.vertical, 5, "down", "up")}`; 17375 } 17376 function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) { 17377 if (value > tolerance) { 17378 return positiveLabel; 17379 } 17380 if (value < -tolerance) { 17381 return negativeLabel; 17382 } 17383 return ""; 17384 } 17385 function calculateRelativePosition(from, to2) { 17386 const fromRect = from.getBoundingClientRect(); 17387 const toRect = to2.getBoundingClientRect(); 17388 const fromCenter = { 17389 x: fromRect.left + fromRect.width / 2, 17390 y: fromRect.top + fromRect.height / 2 17391 }; 17392 const toCenter = { 17393 x: toRect.left + toRect.width / 2, 17394 y: toRect.top + toRect.height / 2 17395 }; 17396 return { 17397 horizontal: toCenter.x - fromCenter.x, 17398 vertical: toCenter.y - fromCenter.y 17399 }; 17400 } 17401 function usePopupContentKey(activeTriggerId, payload) { 17402 const [contentKey, setContentKey] = React48.useState(0); 17403 const previousActiveTriggerIdRef = React48.useRef(activeTriggerId); 17404 const previousPayloadRef = React48.useRef(payload); 17405 const pendingPayloadUpdateRef = React48.useRef(false); 17406 useIsoLayoutEffect(() => { 17407 const previousActiveTriggerId = previousActiveTriggerIdRef.current; 17408 const previousPayload = previousPayloadRef.current; 17409 const triggerIdChanged = activeTriggerId !== previousActiveTriggerId; 17410 const payloadChanged = payload !== previousPayload; 17411 if (triggerIdChanged) { 17412 setContentKey((value) => value + 1); 17413 pendingPayloadUpdateRef.current = !payloadChanged; 17414 } else if (pendingPayloadUpdateRef.current && payloadChanged) { 17415 setContentKey((value) => value + 1); 17416 pendingPayloadUpdateRef.current = false; 17417 } 17418 previousActiveTriggerIdRef.current = activeTriggerId; 17419 previousPayloadRef.current = payload; 17420 }, [activeTriggerId, payload]); 17421 return `$activeTriggerId ?? "current"}-$contentKey}`; 17422 } 17423 17424 // node_modules/@base-ui/utils/isElementDisabled.mjs 17425 function isElementDisabled(element) { 17426 return element == null || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true"; 17427 } 17428 17429 // node_modules/@base-ui/react/internals/csp-context/CSPContext.mjs 17430 var React49 = __toESM(require_react(), 1); 17431 var CSPContext = /* @__PURE__ */ React49.createContext(void 0); 17432 if (true) CSPContext.displayName = "CSPContext"; 17433 var DEFAULT_CSP_CONTEXT_VALUE = { 17434 disableStyleElements: false 17435 }; 17436 function useCSPContext() { 17437 return React49.useContext(CSPContext) ?? DEFAULT_CSP_CONTEXT_VALUE; 17438 } 17439 17440 // node_modules/@base-ui/react/internals/composite/root/CompositeRoot.mjs 17441 var React51 = __toESM(require_react(), 1); 17442 17443 // node_modules/@base-ui/react/internals/composite/root/useCompositeRoot.mjs 17444 var React50 = __toESM(require_react(), 1); 17445 17446 // node_modules/@base-ui/react/internals/composite/constants.mjs 17447 var ACTIVE_COMPOSITE_ITEM = "data-composite-item-active"; 17448 17449 // node_modules/@base-ui/react/internals/composite/root/useCompositeRoot.mjs 17450 var EMPTY_ARRAY4 = []; 17451 function useCompositeRoot(params) { 17452 const { 17453 loopFocus = true, 17454 orientation = "both", 17455 grid, 17456 onLoop, 17457 direction, 17458 highlightedIndex: externalHighlightedIndex, 17459 onHighlightedIndexChange: externalSetHighlightedIndex, 17460 rootRef: externalRef, 17461 enableHomeAndEndKeys = false, 17462 stopEventPropagation = false, 17463 disabledIndices, 17464 modifierKeys = EMPTY_ARRAY4 17465 } = params; 17466 const [internalHighlightedIndex, internalSetHighlightedIndex] = React50.useState(0); 17467 const isGrid2 = grid != null; 17468 const rootRef = React50.useRef(null); 17469 const mergedRef = useMergedRefs(rootRef, externalRef); 17470 const elementsRef = React50.useRef([]); 17471 const hasSetDefaultIndexRef = React50.useRef(false); 17472 const highlightedIndex = externalHighlightedIndex ?? internalHighlightedIndex; 17473 const onHighlightedIndexChange = useStableCallback((index2, shouldScrollIntoView = false) => { 17474 (externalSetHighlightedIndex ?? internalSetHighlightedIndex)(index2); 17475 if (shouldScrollIntoView) { 17476 const newActiveItem = elementsRef.current[index2]; 17477 scrollIntoViewIfNeeded(rootRef.current, newActiveItem, direction, orientation); 17478 } 17479 }); 17480 const onMapChange = useStableCallback((map) => { 17481 if (map.size === 0 || hasSetDefaultIndexRef.current) { 17482 return; 17483 } 17484 hasSetDefaultIndexRef.current = true; 17485 const sortedElements = Array.from(map.keys()); 17486 const activeItem = sortedElements.find((compositeElement) => compositeElement?.hasAttribute(ACTIVE_COMPOSITE_ITEM)) ?? null; 17487 const activeIndex = activeItem ? sortedElements.indexOf(activeItem) : -1; 17488 if (activeIndex !== -1) { 17489 onHighlightedIndexChange(activeIndex); 17490 } else if (isListIndexDisabled(sortedElements, highlightedIndex, disabledIndices)) { 17491 const firstEnabledIndex = findNonDisabledListIndex(sortedElements, { 17492 disabledIndices 17493 }); 17494 if (!isIndexOutOfListBounds(sortedElements, firstEnabledIndex)) { 17495 onHighlightedIndexChange(firstEnabledIndex); 17496 } 17497 } 17498 scrollIntoViewIfNeeded(rootRef.current, activeItem, direction, orientation); 17499 }); 17500 useIsoLayoutEffect(() => { 17501 if (disabledIndices == null || externalHighlightedIndex != null || !hasSetDefaultIndexRef.current) { 17502 return; 17503 } 17504 const elements2 = elementsRef.current; 17505 if (isListIndexDisabled(elements2, highlightedIndex, disabledIndices)) { 17506 const firstEnabledIndex = findNonDisabledListIndex(elements2, { 17507 disabledIndices 17508 }); 17509 if (!isIndexOutOfListBounds(elements2, firstEnabledIndex)) { 17510 onHighlightedIndexChange(firstEnabledIndex); 17511 } 17512 } 17513 }, [disabledIndices, externalHighlightedIndex, highlightedIndex, elementsRef, onHighlightedIndexChange]); 17514 const wrappedOnLoop = useStableCallback((event, prevIndex, nextIndex) => { 17515 if (!onLoop) { 17516 return nextIndex; 17517 } 17518 return onLoop(event, prevIndex, nextIndex, elementsRef); 17519 }); 17520 const onKeyDown = useStableCallback((event) => { 17521 const RELEVANT_KEYS = enableHomeAndEndKeys ? COMPOSITE_KEYS : ARROW_KEYS; 17522 if (!RELEVANT_KEYS.has(event.key)) { 17523 return; 17524 } 17525 if (isModifierKeySet(event, modifierKeys)) { 17526 return; 17527 } 17528 const element = rootRef.current; 17529 if (!element) { 17530 return; 17531 } 17532 const isRtl = direction === "rtl"; 17533 const horizontalForwardKey = isRtl ? ARROW_LEFT : ARROW_RIGHT; 17534 const forwardKey = { 17535 horizontal: horizontalForwardKey, 17536 vertical: ARROW_DOWN, 17537 both: horizontalForwardKey 17538 }[orientation]; 17539 const horizontalBackwardKey = isRtl ? ARROW_RIGHT : ARROW_LEFT; 17540 const backwardKey = { 17541 horizontal: horizontalBackwardKey, 17542 vertical: ARROW_UP, 17543 both: horizontalBackwardKey 17544 }[orientation]; 17545 const target = getTarget(event.nativeEvent); 17546 if (target != null && isNativeInput(target) && !isElementDisabled(target)) { 17547 const selectionStart = target.selectionStart; 17548 const selectionEnd = target.selectionEnd; 17549 const textContent = target.value ?? ""; 17550 if (selectionStart == null || event.shiftKey || selectionStart !== selectionEnd) { 17551 return; 17552 } 17553 if (event.key !== backwardKey && selectionStart < textContent.length) { 17554 return; 17555 } 17556 if (event.key !== forwardKey && selectionStart > 0) { 17557 return; 17558 } 17559 } 17560 let nextIndex = highlightedIndex; 17561 const minIndex = getMinListIndex(elementsRef, disabledIndices); 17562 const maxIndex = getMaxListIndex(elementsRef, disabledIndices); 17563 if (grid != null) { 17564 nextIndex = grid({ 17565 disabledIndices, 17566 elementsRef, 17567 event, 17568 highlightedIndex, 17569 loopFocus, 17570 maxIndex, 17571 minIndex, 17572 onLoop: wrappedOnLoop, 17573 orientation, 17574 rtl: isRtl 17575 }); 17576 } 17577 const forwardKeys = { 17578 horizontal: [horizontalForwardKey], 17579 vertical: [ARROW_DOWN], 17580 both: [horizontalForwardKey, ARROW_DOWN] 17581 }[orientation]; 17582 const backwardKeys = { 17583 horizontal: [horizontalBackwardKey], 17584 vertical: [ARROW_UP], 17585 both: [horizontalBackwardKey, ARROW_UP] 17586 }[orientation]; 17587 const preventedKeys = isGrid2 ? RELEVANT_KEYS : { 17588 horizontal: enableHomeAndEndKeys ? HORIZONTAL_KEYS_WITH_EXTRA_KEYS : HORIZONTAL_KEYS, 17589 vertical: enableHomeAndEndKeys ? VERTICAL_KEYS_WITH_EXTRA_KEYS : VERTICAL_KEYS, 17590 both: RELEVANT_KEYS 17591 }[orientation]; 17592 if (enableHomeAndEndKeys) { 17593 if (event.key === HOME) { 17594 nextIndex = minIndex; 17595 } else if (event.key === END) { 17596 nextIndex = maxIndex; 17597 } 17598 } 17599 if (nextIndex === highlightedIndex && (forwardKeys.includes(event.key) || backwardKeys.includes(event.key))) { 17600 if (loopFocus && nextIndex === maxIndex && forwardKeys.includes(event.key)) { 17601 nextIndex = minIndex; 17602 if (onLoop) { 17603 nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef); 17604 } 17605 } else if (loopFocus && nextIndex === minIndex && backwardKeys.includes(event.key)) { 17606 nextIndex = maxIndex; 17607 if (onLoop) { 17608 nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef); 17609 } 17610 } else { 17611 nextIndex = findNonDisabledListIndex(elementsRef.current, { 17612 startingIndex: nextIndex, 17613 decrement: backwardKeys.includes(event.key), 17614 disabledIndices 17615 }); 17616 } 17617 } 17618 if (nextIndex !== highlightedIndex && !isIndexOutOfListBounds(elementsRef.current, nextIndex)) { 17619 if (stopEventPropagation) { 17620 event.stopPropagation(); 17621 } 17622 if (preventedKeys.has(event.key)) { 17623 event.preventDefault(); 17624 } 17625 onHighlightedIndexChange(nextIndex, true); 17626 queueMicrotask(() => { 17627 elementsRef.current[nextIndex]?.focus(); 17628 }); 17629 } 17630 }); 17631 const props = { 17632 ref: mergedRef, 17633 onFocus(event) { 17634 const element = rootRef.current; 17635 const target = getTarget(event.nativeEvent); 17636 if (!element || target == null || !isNativeInput(target)) { 17637 return; 17638 } 17639 target.setSelectionRange(0, target.value.length ?? 0); 17640 }, 17641 onKeyDown 17642 }; 17643 return { 17644 props, 17645 highlightedIndex, 17646 onHighlightedIndexChange, 17647 elementsRef, 17648 disabledIndices, 17649 onMapChange, 17650 relayKeyboardEvent: onKeyDown 17651 }; 17652 } 17653 function isModifierKeySet(event, ignoredModifierKeys) { 17654 for (const key of MODIFIER_KEYS.values()) { 17655 if (ignoredModifierKeys.includes(key)) { 17656 continue; 17657 } 17658 if (event.getModifierState(key)) { 17659 return true; 17660 } 17661 } 17662 return false; 17663 } 17664 17665 // node_modules/@base-ui/react/internals/composite/root/CompositeRoot.mjs 17666 var import_jsx_runtime104 = __toESM(require_jsx_runtime(), 1); 17667 function CompositeRoot(componentProps) { 17668 const { 17669 render: render5, 17670 className, 17671 style, 17672 refs = EMPTY_ARRAY3, 17673 props = EMPTY_ARRAY3, 17674 state: state2 = EMPTY_OBJECT3, 17675 stateAttributesMapping: stateAttributesMapping6, 17676 highlightedIndex: highlightedIndexProp, 17677 onHighlightedIndexChange: onHighlightedIndexChangeProp, 17678 orientation, 17679 grid, 17680 loopFocus, 17681 onLoop, 17682 enableHomeAndEndKeys, 17683 onMapChange: onMapChangeProp, 17684 stopEventPropagation = true, 17685 rootRef, 17686 disabledIndices, 17687 modifierKeys, 17688 highlightItemOnHover = false, 17689 tag = "div", 17690 ...elementProps 17691 } = componentProps; 17692 const direction = useDirection(); 17693 const { 17694 props: defaultProps, 17695 highlightedIndex, 17696 onHighlightedIndexChange, 17697 elementsRef, 17698 onMapChange: onMapChangeUnwrapped, 17699 relayKeyboardEvent 17700 } = useCompositeRoot({ 17701 grid, 17702 loopFocus, 17703 onLoop, 17704 orientation, 17705 highlightedIndex: highlightedIndexProp, 17706 onHighlightedIndexChange: onHighlightedIndexChangeProp, 17707 rootRef, 17708 stopEventPropagation, 17709 enableHomeAndEndKeys, 17710 direction, 17711 disabledIndices, 17712 modifierKeys 17713 }); 17714 const element = useRenderElement(tag, componentProps, { 17715 state: state2, 17716 ref: refs, 17717 props: [defaultProps, ...props, elementProps], 17718 stateAttributesMapping: stateAttributesMapping6 17719 }); 17720 const contextValue = React51.useMemo(() => ({ 17721 highlightedIndex, 17722 onHighlightedIndexChange, 17723 highlightItemOnHover, 17724 relayKeyboardEvent 17725 }), [highlightedIndex, onHighlightedIndexChange, highlightItemOnHover, relayKeyboardEvent]); 17726 return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(CompositeRootContext.Provider, { 17727 value: contextValue, 17728 children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(CompositeList, { 17729 elementsRef, 17730 onMapChange: (newMap) => { 17731 onMapChangeProp?.(newMap); 17732 onMapChangeUnwrapped(newMap); 17733 }, 17734 children: element 17735 }) 17736 }); 17737 } 17738 17739 // node_modules/@base-ui/react/utils/FloatingPortalLite.mjs 17740 var React52 = __toESM(require_react(), 1); 17741 var ReactDOM7 = __toESM(require_react_dom(), 1); 17742 var import_jsx_runtime105 = __toESM(require_jsx_runtime(), 1); 17743 var FloatingPortalLite = /* @__PURE__ */ React52.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) { 17744 const { 17745 children, 17746 container, 17747 className, 17748 render: render5, 17749 style, 17750 ...elementProps 17751 } = componentProps; 17752 const { 17753 portalNode, 17754 portalSubtree 17755 } = useFloatingPortalNode({ 17756 container, 17757 ref: forwardedRef, 17758 componentProps, 17759 elementProps 17760 }); 17761 if (!portalSubtree && !portalNode) { 17762 return null; 17763 } 17764 return /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(React52.Fragment, { 17765 children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM7.createPortal(children, portalNode)] 17766 }); 17767 }); 17768 if (true) FloatingPortalLite.displayName = "FloatingPortalLite"; 17769 17770 // node_modules/@base-ui/react/utils/useIsHydrating.mjs 17771 var import_shim2 = __toESM(require_shim(), 1); 17772 function subscribe2() { 17773 return NOOP; 17774 } 17775 function getSnapshot() { 17776 return false; 17777 } 17778 function getServerSnapshot() { 17779 return true; 17780 } 17781 function useIsHydrating() { 17782 return (0, import_shim2.useSyncExternalStore)(subscribe2, getSnapshot, getServerSnapshot); 17783 } 17784 17785 // node_modules/@base-ui/react/tabs/index.parts.mjs 17786 var index_parts_exports2 = {}; 17787 __export(index_parts_exports2, { 17788 Indicator: () => TabsIndicator, 17789 List: () => TabsList, 17790 Panel: () => TabsPanel, 17791 Root: () => TabsRoot, 17792 Tab: () => TabsTab 17793 }); 17794 17795 // node_modules/@base-ui/react/tabs/root/TabsRoot.mjs 17796 var React54 = __toESM(require_react(), 1); 17797 17798 // node_modules/@base-ui/react/tabs/root/TabsRootContext.mjs 17799 var React53 = __toESM(require_react(), 1); 17800 var TabsRootContext = /* @__PURE__ */ React53.createContext(void 0); 17801 if (true) TabsRootContext.displayName = "TabsRootContext"; 17802 function useTabsRootContext() { 17803 const context = React53.useContext(TabsRootContext); 17804 if (context === void 0) { 17805 throw new Error(true ? "Base UI: TabsRootContext is missing. Tabs parts must be placed within <Tabs.Root>." : formatErrorMessage_default(64)); 17806 } 17807 return context; 17808 } 17809 17810 // node_modules/@base-ui/react/tabs/root/TabsRootDataAttributes.mjs 17811 var TabsRootDataAttributes = /* @__PURE__ */ (function(TabsRootDataAttributes2) { 17812 TabsRootDataAttributes2["activationDirection"] = "data-activation-direction"; 17813 TabsRootDataAttributes2["orientation"] = "data-orientation"; 17814 return TabsRootDataAttributes2; 17815 })({}); 17816 17817 // node_modules/@base-ui/react/tabs/root/stateAttributesMapping.mjs 17818 var tabsStateAttributesMapping = { 17819 tabActivationDirection: (dir) => ({ 17820 [TabsRootDataAttributes.activationDirection]: dir 17821 }) 17822 }; 17823 17824 // node_modules/@base-ui/react/tabs/root/TabsRoot.mjs 17825 var import_jsx_runtime106 = __toESM(require_jsx_runtime(), 1); 17826 var TabsRoot = /* @__PURE__ */ React54.forwardRef(function TabsRoot2(componentProps, forwardedRef) { 17827 const { 17828 className, 17829 defaultValue: defaultValueProp = 0, 17830 onValueChange: onValueChangeProp, 17831 orientation = "horizontal", 17832 render: render5, 17833 value: valueProp, 17834 style, 17835 ...elementProps 17836 } = componentProps; 17837 const hasExplicitDefaultValueProp = componentProps.defaultValue !== void 0; 17838 const tabPanelRefs = React54.useRef([]); 17839 const [mountedTabPanels, setMountedTabPanels] = React54.useState(() => /* @__PURE__ */ new Map()); 17840 const [value, setValue] = useControlled({ 17841 controlled: valueProp, 17842 default: defaultValueProp, 17843 name: "Tabs", 17844 state: "value" 17845 }); 17846 const isControlled = valueProp !== void 0; 17847 const [tabMap, setTabMap] = React54.useState(() => /* @__PURE__ */ new Map()); 17848 const lastKnownTabElementRef = React54.useRef(void 0); 17849 const getTabElementBySelectedValue = React54.useCallback((selectedValue) => { 17850 if (selectedValue === void 0) { 17851 return null; 17852 } 17853 for (const [tabElement, tabMetadata] of tabMap.entries()) { 17854 if (tabMetadata != null && selectedValue === (tabMetadata.value ?? tabMetadata.index)) { 17855 return tabElement; 17856 } 17857 } 17858 return null; 17859 }, [tabMap]); 17860 const [activationDirectionState, setActivationDirectionState] = React54.useState(() => ({ 17861 previousValue: value, 17862 tabActivationDirection: "none" 17863 })); 17864 const { 17865 previousValue, 17866 tabActivationDirection: committedTabActivationDirection 17867 } = activationDirectionState; 17868 let tabActivationDirection = committedTabActivationDirection; 17869 let directionComputationIncomplete = false; 17870 if (previousValue !== value) { 17871 tabActivationDirection = computeActivationDirection(previousValue, value, orientation, tabMap); 17872 directionComputationIncomplete = previousValue != null && value != null && getTabElementBySelectedValue(value) == null; 17873 } 17874 const nextPreviousValue = directionComputationIncomplete ? previousValue : value; 17875 const shouldSyncActivationDirectionState = previousValue !== nextPreviousValue || committedTabActivationDirection !== tabActivationDirection; 17876 useIsoLayoutEffect(() => { 17877 if (!shouldSyncActivationDirectionState) { 17878 return; 17879 } 17880 setActivationDirectionState({ 17881 previousValue: nextPreviousValue, 17882 tabActivationDirection 17883 }); 17884 }, [nextPreviousValue, shouldSyncActivationDirectionState, tabActivationDirection]); 17885 const onValueChange = useStableCallback((newValue, eventDetails) => { 17886 const activationDirection = computeActivationDirection(value, newValue, orientation, tabMap); 17887 eventDetails.activationDirection = activationDirection; 17888 onValueChangeProp?.(newValue, eventDetails); 17889 if (eventDetails.isCanceled) { 17890 return; 17891 } 17892 setValue(newValue); 17893 }); 17894 const notifyAutomaticValueChange = useStableCallback((nextValue, reason) => { 17895 onValueChangeProp?.(nextValue, createChangeEventDetails(reason, void 0, void 0, { 17896 activationDirection: "none" 17897 })); 17898 }); 17899 const registerMountedTabPanel = useStableCallback((panelValue, panelId) => { 17900 setMountedTabPanels((prev) => { 17901 if (prev.get(panelValue) === panelId) { 17902 return prev; 17903 } 17904 const next = new Map(prev); 17905 next.set(panelValue, panelId); 17906 return next; 17907 }); 17908 }); 17909 const unregisterMountedTabPanel = useStableCallback((panelValue, panelId) => { 17910 setMountedTabPanels((prev) => { 17911 if (!prev.has(panelValue) || prev.get(panelValue) !== panelId) { 17912 return prev; 17913 } 17914 const next = new Map(prev); 17915 next.delete(panelValue); 17916 return next; 17917 }); 17918 }); 17919 const getTabPanelIdByValue = React54.useCallback((tabValue) => { 17920 return mountedTabPanels.get(tabValue); 17921 }, [mountedTabPanels]); 17922 const getTabIdByPanelValue = React54.useCallback((tabPanelValue) => { 17923 for (const tabMetadata of tabMap.values()) { 17924 if (tabPanelValue === tabMetadata?.value) { 17925 return tabMetadata?.id; 17926 } 17927 } 17928 return void 0; 17929 }, [tabMap]); 17930 const tabsContextValue = React54.useMemo(() => ({ 17931 getTabElementBySelectedValue, 17932 getTabIdByPanelValue, 17933 getTabPanelIdByValue, 17934 onValueChange, 17935 orientation, 17936 registerMountedTabPanel, 17937 setTabMap, 17938 unregisterMountedTabPanel, 17939 tabActivationDirection, 17940 value 17941 }), [getTabElementBySelectedValue, getTabIdByPanelValue, getTabPanelIdByValue, onValueChange, orientation, registerMountedTabPanel, setTabMap, unregisterMountedTabPanel, tabActivationDirection, value]); 17942 const selectedTabMetadata = React54.useMemo(() => { 17943 for (const tabMetadata of tabMap.values()) { 17944 if (tabMetadata != null && tabMetadata.value === value) { 17945 return tabMetadata; 17946 } 17947 } 17948 return void 0; 17949 }, [tabMap, value]); 17950 const firstEnabledTabValue = React54.useMemo(() => { 17951 for (const tabMetadata of tabMap.values()) { 17952 if (tabMetadata != null && !tabMetadata.disabled) { 17953 return tabMetadata.value; 17954 } 17955 } 17956 return void 0; 17957 }, [tabMap]); 17958 const shouldNotifyInitialValueChangeRef = React54.useRef(!hasExplicitDefaultValueProp); 17959 const initialDefaultValueRef = React54.useRef(defaultValueProp); 17960 const shouldHonorDisabledDefaultValueRef = React54.useRef(hasExplicitDefaultValueProp); 17961 const didRegisterTabsRef = React54.useRef(false); 17962 useIsoLayoutEffect(() => { 17963 if (isControlled) { 17964 return; 17965 } 17966 function commitAutomaticValueChange(fallbackValue, fallbackReason) { 17967 setValue(fallbackValue); 17968 setActivationDirectionState((prev) => { 17969 if (prev.previousValue === fallbackValue && prev.tabActivationDirection === "none") { 17970 return prev; 17971 } 17972 return { 17973 previousValue: fallbackValue, 17974 tabActivationDirection: "none" 17975 }; 17976 }); 17977 notifyAutomaticValueChange(fallbackValue, fallbackReason); 17978 shouldNotifyInitialValueChangeRef.current = false; 17979 } 17980 if (tabMap.size === 0) { 17981 if (didRegisterTabsRef.current && value !== null && !lastKnownTabElementRef.current?.isConnected) { 17982 commitAutomaticValueChange(null, reason_parts_exports.missing); 17983 } 17984 return; 17985 } 17986 didRegisterTabsRef.current = true; 17987 lastKnownTabElementRef.current = tabMap.keys().next().value; 17988 const selectionIsDisabled = selectedTabMetadata?.disabled; 17989 const selectionIsMissing = selectedTabMetadata == null && value !== null; 17990 if (!selectionIsDisabled && value === initialDefaultValueRef.current) { 17991 shouldHonorDisabledDefaultValueRef.current = false; 17992 } 17993 if (shouldHonorDisabledDefaultValueRef.current && selectionIsDisabled && value === initialDefaultValueRef.current) { 17994 return; 17995 } 17996 const shouldNotifyInitialValueChange = shouldNotifyInitialValueChangeRef.current; 17997 if (selectionIsDisabled || selectionIsMissing) { 17998 const fallbackValue = firstEnabledTabValue ?? null; 17999 if (value === fallbackValue) { 18000 shouldNotifyInitialValueChangeRef.current = false; 18001 return; 18002 } 18003 let fallbackReason = reason_parts_exports.missing; 18004 if (shouldNotifyInitialValueChange) { 18005 fallbackReason = reason_parts_exports.initial; 18006 } else if (selectionIsDisabled) { 18007 fallbackReason = reason_parts_exports.disabled; 18008 } 18009 commitAutomaticValueChange(fallbackValue, fallbackReason); 18010 return; 18011 } 18012 if (shouldNotifyInitialValueChange && selectedTabMetadata != null) { 18013 notifyAutomaticValueChange(value, reason_parts_exports.initial); 18014 shouldNotifyInitialValueChangeRef.current = false; 18015 } 18016 }, [firstEnabledTabValue, isControlled, notifyAutomaticValueChange, selectedTabMetadata, setValue, tabMap, value]); 18017 const state2 = { 18018 orientation, 18019 tabActivationDirection 18020 }; 18021 const element = useRenderElement("div", componentProps, { 18022 state: state2, 18023 ref: forwardedRef, 18024 props: elementProps, 18025 stateAttributesMapping: tabsStateAttributesMapping 18026 }); 18027 return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(TabsRootContext.Provider, { 18028 value: tabsContextValue, 18029 children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(CompositeList, { 18030 elementsRef: tabPanelRefs, 18031 children: element 18032 }) 18033 }); 18034 }); 18035 if (true) TabsRoot.displayName = "TabsRoot"; 18036 function computeActivationDirection(oldValue, newValue, orientation, tabMap) { 18037 if (oldValue == null || newValue == null) { 18038 return "none"; 18039 } 18040 let oldTab = null; 18041 let newTab = null; 18042 for (const [tabElement, tabMetadata] of tabMap.entries()) { 18043 if (tabMetadata == null) { 18044 continue; 18045 } 18046 const tabValue = tabMetadata.value ?? tabMetadata.index; 18047 if (oldValue === tabValue) { 18048 oldTab = tabElement; 18049 } 18050 if (newValue === tabValue) { 18051 newTab = tabElement; 18052 } 18053 if (oldTab != null && newTab != null) { 18054 break; 18055 } 18056 } 18057 if (oldTab == null || newTab == null) { 18058 if (oldTab !== newTab && (typeof oldValue === "number" || typeof oldValue === "string") && typeof oldValue === typeof newValue) { 18059 if (orientation === "horizontal") { 18060 return newValue > oldValue ? "right" : "left"; 18061 } 18062 return newValue > oldValue ? "down" : "up"; 18063 } 18064 return "none"; 18065 } 18066 const oldRect = oldTab.getBoundingClientRect(); 18067 const newRect = newTab.getBoundingClientRect(); 18068 if (orientation === "horizontal") { 18069 if (newRect.left < oldRect.left) { 18070 return "left"; 18071 } 18072 if (newRect.left > oldRect.left) { 18073 return "right"; 18074 } 18075 } else { 18076 if (newRect.top < oldRect.top) { 18077 return "up"; 18078 } 18079 if (newRect.top > oldRect.top) { 18080 return "down"; 18081 } 18082 } 18083 return "none"; 18084 } 18085 18086 // node_modules/@base-ui/react/tabs/tab/TabsTab.mjs 18087 var React56 = __toESM(require_react(), 1); 18088 18089 // node_modules/@base-ui/react/tabs/list/TabsListContext.mjs 18090 var React55 = __toESM(require_react(), 1); 18091 var TabsListContext = /* @__PURE__ */ React55.createContext(void 0); 18092 if (true) TabsListContext.displayName = "TabsListContext"; 18093 function useTabsListContext() { 18094 const context = React55.useContext(TabsListContext); 18095 if (context === void 0) { 18096 throw new Error(true ? "Base UI: TabsListContext is missing. TabsList parts must be placed within <Tabs.List>." : formatErrorMessage_default(65)); 18097 } 18098 return context; 18099 } 18100 18101 // node_modules/@base-ui/react/tabs/tab/TabsTab.mjs 18102 var TabsTab = /* @__PURE__ */ React56.forwardRef(function TabsTab2(componentProps, forwardedRef) { 18103 const { 18104 className, 18105 disabled: disabled2 = false, 18106 render: render5, 18107 value, 18108 id: idProp, 18109 nativeButton = true, 18110 style, 18111 ...elementProps 18112 } = componentProps; 18113 const { 18114 value: activeTabValue, 18115 getTabPanelIdByValue, 18116 orientation, 18117 tabActivationDirection 18118 } = useTabsRootContext(); 18119 const { 18120 activateOnFocus, 18121 highlightedTabIndex, 18122 onTabActivation, 18123 registerTabResizeObserverElement, 18124 setHighlightedTabIndex, 18125 tabsListElement 18126 } = useTabsListContext(); 18127 const id = useBaseUiId(idProp); 18128 const tabMetadata = React56.useMemo(() => ({ 18129 disabled: disabled2, 18130 id, 18131 value 18132 }), [disabled2, id, value]); 18133 const { 18134 compositeProps, 18135 compositeRef, 18136 index: index2 18137 // hook is used instead of the CompositeItem component 18138 // because the index is needed for Tab internals 18139 } = useCompositeItem({ 18140 metadata: tabMetadata 18141 }); 18142 const active = value === activeTabValue; 18143 const isNavigatingRef = React56.useRef(false); 18144 const tabElementRef = React56.useRef(null); 18145 useIsoLayoutEffect(() => { 18146 const tabElement = tabElementRef.current; 18147 if (!tabElement) { 18148 return void 0; 18149 } 18150 return registerTabResizeObserverElement(tabElement); 18151 }, [registerTabResizeObserverElement]); 18152 useIsoLayoutEffect(() => { 18153 if (isNavigatingRef.current) { 18154 isNavigatingRef.current = false; 18155 return; 18156 } 18157 if (!(active && index2 > -1 && highlightedTabIndex !== index2)) { 18158 return; 18159 } 18160 const listElement = tabsListElement; 18161 if (listElement != null) { 18162 const activeEl = activeElement(ownerDocument(listElement)); 18163 if (activeEl && contains(listElement, activeEl)) { 18164 return; 18165 } 18166 } 18167 if (!disabled2) { 18168 setHighlightedTabIndex(index2); 18169 } 18170 }, [active, index2, highlightedTabIndex, setHighlightedTabIndex, disabled2, tabsListElement]); 18171 const { 18172 getButtonProps, 18173 buttonRef 18174 } = useButton({ 18175 disabled: disabled2, 18176 native: nativeButton, 18177 focusableWhenDisabled: true 18178 }); 18179 const tabPanelId = getTabPanelIdByValue(value); 18180 const isPressingRef = React56.useRef(false); 18181 const isMainButtonRef = React56.useRef(false); 18182 function onClick(event) { 18183 if (active || disabled2) { 18184 return; 18185 } 18186 onTabActivation(value, createChangeEventDetails(reason_parts_exports.none, event.nativeEvent, void 0, { 18187 activationDirection: "none" 18188 })); 18189 } 18190 function onFocus(event) { 18191 if (active) { 18192 return; 18193 } 18194 if (index2 > -1 && !disabled2) { 18195 setHighlightedTabIndex(index2); 18196 } 18197 if (disabled2) { 18198 return; 18199 } 18200 if (activateOnFocus && (!isPressingRef.current || // keyboard or touch focus 18201 isPressingRef.current && isMainButtonRef.current)) { 18202 onTabActivation(value, createChangeEventDetails(reason_parts_exports.none, event.nativeEvent, void 0, { 18203 activationDirection: "none" 18204 })); 18205 } 18206 } 18207 function onPointerDown(event) { 18208 if (active || disabled2) { 18209 return; 18210 } 18211 isPressingRef.current = true; 18212 function handlePointerUp() { 18213 isPressingRef.current = false; 18214 isMainButtonRef.current = false; 18215 } 18216 if (!event.button || event.button === 0) { 18217 isMainButtonRef.current = true; 18218 const doc = ownerDocument(event.currentTarget); 18219 doc.addEventListener("pointerup", handlePointerUp, { 18220 once: true 18221 }); 18222 } 18223 } 18224 const state2 = { 18225 disabled: disabled2, 18226 active, 18227 orientation, 18228 tabActivationDirection 18229 }; 18230 const element = useRenderElement("button", componentProps, { 18231 state: state2, 18232 ref: [forwardedRef, buttonRef, compositeRef, tabElementRef], 18233 props: [compositeProps, { 18234 role: "tab", 18235 "aria-controls": tabPanelId, 18236 "aria-selected": active, 18237 id, 18238 onClick, 18239 onFocus, 18240 onPointerDown, 18241 [ACTIVE_COMPOSITE_ITEM]: active ? "" : void 0, 18242 onKeyDownCapture() { 18243 isNavigatingRef.current = true; 18244 } 18245 }, elementProps, getButtonProps], 18246 stateAttributesMapping: tabsStateAttributesMapping 18247 }); 18248 return element; 18249 }); 18250 if (true) TabsTab.displayName = "TabsTab"; 18251 18252 // node_modules/@base-ui/react/tabs/indicator/TabsIndicator.mjs 18253 var React57 = __toESM(require_react(), 1); 18254 18255 // node_modules/@base-ui/react/tabs/indicator/prehydrationScript.min.mjs 18256 var script = '!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const i=e.querySelector("[data-active]");if(!i)return;if(0===i.offsetWidth||0===e.offsetWidth)return;let o=0,n=0,h=0,l=0,r=0,f=0;function s(t){const e=getComputedStyle(t);let i=parseFloat(e.width)||0,o=parseFloat(e.height)||0;return(Math.round(i)!==t.offsetWidth||Math.round(o)!==t.offsetHeight)&&(i=t.offsetWidth,o=t.offsetHeight),{width:i,height:o}}if(null!=i&&null!=e){const{width:t,height:c}=s(i),{width:u,height:d}=s(e),a=i.getBoundingClientRect(),g=e.getBoundingClientRect(),p=u>0?g.width/u:1,b=d>0?g.height/d:1;if(Math.abs(p)>Number.EPSILON&&Math.abs(b)>Number.EPSILON){const t=a.left-g.left,i=a.top-g.top;o=t/p+e.scrollLeft-e.clientLeft,h=i/b+e.scrollTop-e.clientTop}else o=i.offsetLeft,h=i.offsetTop;r=t,f=c,n=e.scrollWidth-o-r,l=e.scrollHeight-h-f}function c(e,i){t.style.setProperty(`--active-tab-$e}`,`$i}px`)}c("left",o),c("right",n),c("top",h),c("bottom",l),c("width",r),c("height",f),r>0&&f>0&&t.removeAttribute("hidden")}();'; 18257 18258 // node_modules/@base-ui/react/tabs/indicator/TabsIndicatorCssVars.mjs 18259 var TabsIndicatorCssVars = /* @__PURE__ */ (function(TabsIndicatorCssVars2) { 18260 TabsIndicatorCssVars2["activeTabLeft"] = "--active-tab-left"; 18261 TabsIndicatorCssVars2["activeTabRight"] = "--active-tab-right"; 18262 TabsIndicatorCssVars2["activeTabTop"] = "--active-tab-top"; 18263 TabsIndicatorCssVars2["activeTabBottom"] = "--active-tab-bottom"; 18264 TabsIndicatorCssVars2["activeTabWidth"] = "--active-tab-width"; 18265 TabsIndicatorCssVars2["activeTabHeight"] = "--active-tab-height"; 18266 return TabsIndicatorCssVars2; 18267 })({}); 18268 18269 // node_modules/@base-ui/react/tabs/indicator/TabsIndicator.mjs 18270 var import_jsx_runtime107 = __toESM(require_jsx_runtime(), 1); 18271 var stateAttributesMapping2 = { 18272 ...tabsStateAttributesMapping, 18273 activeTabPosition: () => null, 18274 activeTabSize: () => null 18275 }; 18276 var TabsIndicator = /* @__PURE__ */ React57.forwardRef(function TabsIndicator2(componentProps, forwardedRef) { 18277 const { 18278 className, 18279 render: render5, 18280 renderBeforeHydration = false, 18281 style: styleProp, 18282 ...elementProps 18283 } = componentProps; 18284 const { 18285 nonce 18286 } = useCSPContext(); 18287 const { 18288 getTabElementBySelectedValue, 18289 orientation, 18290 tabActivationDirection, 18291 value 18292 } = useTabsRootContext(); 18293 const { 18294 tabsListElement, 18295 registerIndicatorUpdateListener 18296 } = useTabsListContext(); 18297 const isHydrating = useIsHydrating(); 18298 const rerender = useForcedRerendering(); 18299 React57.useEffect(() => { 18300 return registerIndicatorUpdateListener(rerender); 18301 }, [registerIndicatorUpdateListener, rerender]); 18302 let left = 0; 18303 let right = 0; 18304 let top = 0; 18305 let bottom = 0; 18306 let width = 0; 18307 let height = 0; 18308 let isTabSelected = false; 18309 if (value != null && tabsListElement != null) { 18310 const activeTab = getTabElementBySelectedValue(value); 18311 if (activeTab != null) { 18312 isTabSelected = true; 18313 const { 18314 width: computedWidth, 18315 height: computedHeight 18316 } = getCssDimensions2(activeTab); 18317 const { 18318 width: tabListWidth, 18319 height: tabListHeight 18320 } = getCssDimensions2(tabsListElement); 18321 const tabRect = activeTab.getBoundingClientRect(); 18322 const tabsListRect = tabsListElement.getBoundingClientRect(); 18323 const scaleX = tabListWidth > 0 ? tabsListRect.width / tabListWidth : 1; 18324 const scaleY = tabListHeight > 0 ? tabsListRect.height / tabListHeight : 1; 18325 const hasNonZeroScale = Math.abs(scaleX) > Number.EPSILON && Math.abs(scaleY) > Number.EPSILON; 18326 if (hasNonZeroScale) { 18327 const tabLeftDelta = tabRect.left - tabsListRect.left; 18328 const tabTopDelta = tabRect.top - tabsListRect.top; 18329 left = tabLeftDelta / scaleX + tabsListElement.scrollLeft - tabsListElement.clientLeft; 18330 top = tabTopDelta / scaleY + tabsListElement.scrollTop - tabsListElement.clientTop; 18331 } else { 18332 left = activeTab.offsetLeft; 18333 top = activeTab.offsetTop; 18334 } 18335 width = computedWidth; 18336 height = computedHeight; 18337 right = tabsListElement.scrollWidth - left - width; 18338 bottom = tabsListElement.scrollHeight - top - height; 18339 } 18340 } 18341 const activeTabPosition = isTabSelected ? { 18342 left, 18343 right, 18344 top, 18345 bottom 18346 } : null; 18347 const activeTabSize = isTabSelected ? { 18348 width, 18349 height 18350 } : null; 18351 const style = isTabSelected ? { 18352 [TabsIndicatorCssVars.activeTabLeft]: `$left}px`, 18353 [TabsIndicatorCssVars.activeTabRight]: `$right}px`, 18354 [TabsIndicatorCssVars.activeTabTop]: `$top}px`, 18355 [TabsIndicatorCssVars.activeTabBottom]: `$bottom}px`, 18356 [TabsIndicatorCssVars.activeTabWidth]: `$width}px`, 18357 [TabsIndicatorCssVars.activeTabHeight]: `$height}px` 18358 } : void 0; 18359 const displayIndicator = isTabSelected && width > 0 && height > 0; 18360 const state2 = { 18361 orientation, 18362 activeTabPosition, 18363 activeTabSize, 18364 tabActivationDirection 18365 }; 18366 const element = useRenderElement("span", componentProps, { 18367 state: state2, 18368 ref: forwardedRef, 18369 props: [{ 18370 role: "presentation", 18371 style, 18372 hidden: !displayIndicator 18373 // do not display the indicator before the layout is settled 18374 }, elementProps, { 18375 suppressHydrationWarning: true 18376 }], 18377 stateAttributesMapping: stateAttributesMapping2 18378 }); 18379 if (value == null) { 18380 return null; 18381 } 18382 return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(React57.Fragment, { 18383 children: [element, isHydrating && renderBeforeHydration && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("script", { 18384 nonce, 18385 dangerouslySetInnerHTML: { 18386 __html: script 18387 }, 18388 suppressHydrationWarning: true 18389 })] 18390 }); 18391 }); 18392 if (true) TabsIndicator.displayName = "TabsIndicator"; 18393 18394 // node_modules/@base-ui/react/tabs/panel/TabsPanel.mjs 18395 var React58 = __toESM(require_react(), 1); 18396 18397 // node_modules/@base-ui/react/tabs/panel/TabsPanelDataAttributes.mjs 18398 var TabsPanelDataAttributes = (function(TabsPanelDataAttributes2) { 18399 TabsPanelDataAttributes2["index"] = "data-index"; 18400 TabsPanelDataAttributes2["activationDirection"] = "data-activation-direction"; 18401 TabsPanelDataAttributes2["orientation"] = "data-orientation"; 18402 TabsPanelDataAttributes2["hidden"] = "data-hidden"; 18403 TabsPanelDataAttributes2[TabsPanelDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle"; 18404 TabsPanelDataAttributes2[TabsPanelDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle"; 18405 return TabsPanelDataAttributes2; 18406 })({}); 18407 18408 // node_modules/@base-ui/react/tabs/panel/TabsPanel.mjs 18409 var stateAttributesMapping3 = { 18410 ...tabsStateAttributesMapping, 18411 ...transitionStatusMapping 18412 }; 18413 var TabsPanel = /* @__PURE__ */ React58.forwardRef(function TabsPanel2(componentProps, forwardedRef) { 18414 const { 18415 className, 18416 value, 18417 render: render5, 18418 keepMounted = false, 18419 style, 18420 ...elementProps 18421 } = componentProps; 18422 const { 18423 value: selectedValue, 18424 getTabIdByPanelValue, 18425 orientation, 18426 tabActivationDirection, 18427 registerMountedTabPanel, 18428 unregisterMountedTabPanel 18429 } = useTabsRootContext(); 18430 const id = useBaseUiId(); 18431 const metadata = React58.useMemo(() => ({ 18432 id, 18433 value 18434 }), [id, value]); 18435 const { 18436 ref: listItemRef, 18437 index: index2 18438 } = useCompositeListItem({ 18439 metadata 18440 }); 18441 const open = value === selectedValue; 18442 const { 18443 mounted, 18444 transitionStatus, 18445 setMounted 18446 } = useTransitionStatus(open); 18447 const hidden = !mounted; 18448 const correspondingTabId = getTabIdByPanelValue(value); 18449 const state2 = { 18450 hidden, 18451 orientation, 18452 tabActivationDirection, 18453 transitionStatus 18454 }; 18455 const panelRef = React58.useRef(null); 18456 const element = useRenderElement("div", componentProps, { 18457 state: state2, 18458 ref: [forwardedRef, listItemRef, panelRef], 18459 props: [{ 18460 "aria-labelledby": correspondingTabId, 18461 hidden, 18462 id, 18463 role: "tabpanel", 18464 tabIndex: open ? 0 : -1, 18465 inert: inertValue(!open), 18466 [TabsPanelDataAttributes.index]: index2 18467 }, elementProps], 18468 stateAttributesMapping: stateAttributesMapping3 18469 }); 18470 useOpenChangeComplete({ 18471 open, 18472 ref: panelRef, 18473 onComplete() { 18474 if (!open) { 18475 setMounted(false); 18476 } 18477 } 18478 }); 18479 useIsoLayoutEffect(() => { 18480 if (hidden && !keepMounted) { 18481 return void 0; 18482 } 18483 if (id == null) { 18484 return void 0; 18485 } 18486 registerMountedTabPanel(value, id); 18487 return () => { 18488 unregisterMountedTabPanel(value, id); 18489 }; 18490 }, [hidden, keepMounted, value, id, registerMountedTabPanel, unregisterMountedTabPanel]); 18491 const shouldRender = keepMounted || mounted; 18492 if (!shouldRender) { 18493 return null; 18494 } 18495 return element; 18496 }); 18497 if (true) TabsPanel.displayName = "TabsPanel"; 18498 18499 // node_modules/@base-ui/react/tabs/list/TabsList.mjs 18500 var React59 = __toESM(require_react(), 1); 18501 var import_jsx_runtime108 = __toESM(require_jsx_runtime(), 1); 18502 var TabsList = /* @__PURE__ */ React59.forwardRef(function TabsList2(componentProps, forwardedRef) { 18503 const { 18504 activateOnFocus = false, 18505 className, 18506 loopFocus = true, 18507 render: render5, 18508 style, 18509 ...elementProps 18510 } = componentProps; 18511 const { 18512 onValueChange, 18513 orientation, 18514 value, 18515 setTabMap, 18516 tabActivationDirection 18517 } = useTabsRootContext(); 18518 const [highlightedTabIndex, setHighlightedTabIndex] = React59.useState(0); 18519 const [tabsListElement, setTabsListElement] = React59.useState(null); 18520 const indicatorUpdateListenersRef = React59.useRef(/* @__PURE__ */ new Set()); 18521 const tabResizeObserverElementsRef = React59.useRef(/* @__PURE__ */ new Set()); 18522 const resizeObserverRef = React59.useRef(null); 18523 useIsoLayoutEffect(() => { 18524 if (typeof ResizeObserver === "undefined") { 18525 return void 0; 18526 } 18527 const resizeObserver = new ResizeObserver(() => { 18528 indicatorUpdateListenersRef.current.forEach((listener) => { 18529 listener(); 18530 }); 18531 }); 18532 resizeObserverRef.current = resizeObserver; 18533 if (tabsListElement) { 18534 resizeObserver.observe(tabsListElement); 18535 } 18536 tabResizeObserverElementsRef.current.forEach((element) => { 18537 resizeObserver.observe(element); 18538 }); 18539 return () => { 18540 resizeObserver.disconnect(); 18541 resizeObserverRef.current = null; 18542 }; 18543 }, [tabsListElement]); 18544 const registerIndicatorUpdateListener = useStableCallback((listener) => { 18545 indicatorUpdateListenersRef.current.add(listener); 18546 return () => { 18547 indicatorUpdateListenersRef.current.delete(listener); 18548 }; 18549 }); 18550 const registerTabResizeObserverElement = useStableCallback((element) => { 18551 tabResizeObserverElementsRef.current.add(element); 18552 resizeObserverRef.current?.observe(element); 18553 return () => { 18554 tabResizeObserverElementsRef.current.delete(element); 18555 resizeObserverRef.current?.unobserve(element); 18556 }; 18557 }); 18558 const onTabActivation = useStableCallback((newValue, eventDetails) => { 18559 if (newValue !== value) { 18560 onValueChange(newValue, eventDetails); 18561 } 18562 }); 18563 const state2 = { 18564 orientation, 18565 tabActivationDirection 18566 }; 18567 const defaultProps = { 18568 "aria-orientation": orientation === "vertical" ? "vertical" : void 0, 18569 role: "tablist" 18570 }; 18571 const tabsListContextValue = React59.useMemo(() => ({ 18572 activateOnFocus, 18573 highlightedTabIndex, 18574 registerIndicatorUpdateListener, 18575 registerTabResizeObserverElement, 18576 onTabActivation, 18577 setHighlightedTabIndex, 18578 tabsListElement 18579 }), [activateOnFocus, highlightedTabIndex, registerIndicatorUpdateListener, registerTabResizeObserverElement, onTabActivation, setHighlightedTabIndex, tabsListElement]); 18580 return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(TabsListContext.Provider, { 18581 value: tabsListContextValue, 18582 children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(CompositeRoot, { 18583 render: render5, 18584 className, 18585 style, 18586 state: state2, 18587 refs: [forwardedRef, setTabsListElement], 18588 props: [defaultProps, elementProps], 18589 stateAttributesMapping: tabsStateAttributesMapping, 18590 highlightedIndex: highlightedTabIndex, 18591 enableHomeAndEndKeys: true, 18592 loopFocus, 18593 orientation, 18594 onHighlightedIndexChange: setHighlightedTabIndex, 18595 onMapChange: setTabMap, 18596 disabledIndices: EMPTY_ARRAY3 18597 }) 18598 }); 18599 }); 18600 if (true) TabsList.displayName = "TabsList"; 18601 18602 // node_modules/@base-ui/react/tooltip/index.parts.mjs 18603 var index_parts_exports3 = {}; 18604 __export(index_parts_exports3, { 18605 Arrow: () => TooltipArrow, 18606 Handle: () => TooltipHandle, 18607 Popup: () => TooltipPopup, 18608 Portal: () => TooltipPortal, 18609 Positioner: () => TooltipPositioner, 18610 Provider: () => TooltipProvider, 18611 Root: () => TooltipRoot, 18612 Trigger: () => TooltipTrigger, 18613 Viewport: () => TooltipViewport, 18614 createHandle: () => createTooltipHandle 18615 }); 18616 18617 // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs 18618 var React62 = __toESM(require_react(), 1); 18619 18620 // node_modules/@base-ui/react/tooltip/root/TooltipRootContext.mjs 18621 var React60 = __toESM(require_react(), 1); 18622 var TooltipRootContext = /* @__PURE__ */ React60.createContext(void 0); 18623 if (true) TooltipRootContext.displayName = "TooltipRootContext"; 18624 function useTooltipRootContext(optional) { 18625 const context = React60.useContext(TooltipRootContext); 18626 if (context === void 0 && !optional) { 18627 throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72)); 18628 } 18629 return context; 18630 } 18631 18632 // node_modules/@base-ui/react/tooltip/store/TooltipStore.mjs 18633 var React61 = __toESM(require_react(), 1); 18634 var selectors2 = { 18635 ...popupStoreSelectors, 18636 disabled: createSelector3((state2) => state2.disabled), 18637 instantType: createSelector3((state2) => state2.instantType), 18638 isInstantPhase: createSelector3((state2) => state2.isInstantPhase), 18639 trackCursorAxis: createSelector3((state2) => state2.trackCursorAxis), 18640 disableHoverablePopup: createSelector3((state2) => state2.disableHoverablePopup), 18641 lastOpenChangeReason: createSelector3((state2) => state2.openChangeReason), 18642 closeOnClick: createSelector3((state2) => state2.closeOnClick), 18643 closeDelay: createSelector3((state2) => state2.closeDelay), 18644 hasViewport: createSelector3((state2) => state2.hasViewport) 18645 }; 18646 var TooltipStore = class _TooltipStore extends ReactStore { 18647 constructor(initialState, floatingId, nested = false) { 18648 const triggerElements = new PopupTriggerMap(); 18649 const state2 = { 18650 ...createInitialState(), 18651 ...initialState 18652 }; 18653 state2.floatingRootContext = createPopupFloatingRootContext(triggerElements, floatingId, nested); 18654 super(state2, { 18655 popupRef: /* @__PURE__ */ React61.createRef(), 18656 onOpenChange: void 0, 18657 onOpenChangeComplete: void 0, 18658 triggerElements 18659 }, selectors2); 18660 } 18661 setOpen = (nextOpen, eventDetails) => { 18662 applyPopupOpenChange(this, nextOpen, eventDetails, { 18663 extraState: { 18664 openChangeReason: eventDetails.reason 18665 } 18666 }); 18667 }; 18668 // Used by trigger clicks to clear a delayed hover open without reporting a public open-state change. 18669 cancelPendingOpen(event) { 18670 this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event)); 18671 } 18672 static useStore(externalStore, initialState) { 18673 const store4 = usePopupStore(externalStore, (floatingId, nested) => new _TooltipStore(initialState, floatingId, nested)).store; 18674 return store4; 18675 } 18676 }; 18677 function createInitialState() { 18678 return { 18679 ...createInitialPopupStoreState(), 18680 disabled: false, 18681 instantType: void 0, 18682 isInstantPhase: false, 18683 trackCursorAxis: "none", 18684 disableHoverablePopup: false, 18685 openChangeReason: null, 18686 closeOnClick: true, 18687 closeDelay: 0, 18688 hasViewport: false 18689 }; 18690 } 18691 18692 // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs 18693 var import_jsx_runtime109 = __toESM(require_jsx_runtime(), 1); 18694 var TooltipRoot = fastComponent(function TooltipRoot2(props) { 18695 const { 18696 disabled: disabled2 = false, 18697 defaultOpen = false, 18698 open: openProp, 18699 disableHoverablePopup = false, 18700 trackCursorAxis = "none", 18701 actionsRef, 18702 onOpenChange, 18703 onOpenChangeComplete, 18704 handle, 18705 triggerId: triggerIdProp, 18706 defaultTriggerId: defaultTriggerIdProp = null, 18707 children 18708 } = props; 18709 const store4 = TooltipStore.useStore(handle?.store, { 18710 open: defaultOpen, 18711 openProp, 18712 activeTriggerId: defaultTriggerIdProp, 18713 triggerIdProp 18714 }); 18715 useInitialOpenSync(store4, openProp, defaultOpen, defaultTriggerIdProp); 18716 store4.useControlledProp("openProp", openProp); 18717 store4.useControlledProp("triggerIdProp", triggerIdProp); 18718 store4.useContextCallback("onOpenChange", onOpenChange); 18719 store4.useContextCallback("onOpenChangeComplete", onOpenChangeComplete); 18720 const openState = store4.useState("open"); 18721 const open = !disabled2 && openState; 18722 const activeTriggerId = store4.useState("activeTriggerId"); 18723 const mounted = store4.useState("mounted"); 18724 const payload = store4.useState("payload"); 18725 store4.useSyncedValues({ 18726 trackCursorAxis, 18727 disableHoverablePopup 18728 }); 18729 store4.useSyncedValue("disabled", disabled2); 18730 useImplicitActiveTrigger(store4, { 18731 closeOnActiveTriggerUnmount: true 18732 }); 18733 const { 18734 forceUnmount, 18735 transitionStatus 18736 } = useOpenStateTransitions(open, store4); 18737 const isInstantPhase = store4.useState("isInstantPhase"); 18738 const instantType = store4.useState("instantType"); 18739 const lastOpenChangeReason = store4.useState("lastOpenChangeReason"); 18740 const previousInstantTypeRef = React62.useRef(null); 18741 useIsoLayoutEffect(() => { 18742 if (openState && disabled2) { 18743 store4.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled)); 18744 } 18745 }, [openState, disabled2, store4]); 18746 useIsoLayoutEffect(() => { 18747 if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) { 18748 if (instantType !== "delay") { 18749 previousInstantTypeRef.current = instantType; 18750 } 18751 store4.set("instantType", "delay"); 18752 } else if (previousInstantTypeRef.current !== null) { 18753 store4.set("instantType", previousInstantTypeRef.current); 18754 previousInstantTypeRef.current = null; 18755 } 18756 }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store4]); 18757 useIsoLayoutEffect(() => { 18758 if (open) { 18759 if (activeTriggerId == null) { 18760 store4.set("payload", void 0); 18761 } 18762 } 18763 }, [store4, activeTriggerId, open]); 18764 const handleImperativeClose = React62.useCallback(() => { 18765 store4.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)); 18766 }, [store4]); 18767 React62.useImperativeHandle(actionsRef, () => ({ 18768 unmount: forceUnmount, 18769 close: handleImperativeClose 18770 }), [forceUnmount, handleImperativeClose]); 18771 const shouldRenderInteractions = open || mounted || !disabled2 && trackCursorAxis !== "none"; 18772 return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(TooltipRootContext.Provider, { 18773 value: store4, 18774 children: [shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(TooltipInteractions, { 18775 store: store4, 18776 disabled: disabled2, 18777 trackCursorAxis 18778 }), typeof children === "function" ? children({ 18779 payload 18780 }) : children] 18781 }); 18782 }); 18783 if (true) TooltipRoot.displayName = "TooltipRoot"; 18784 function TooltipInteractions({ 18785 store: store4, 18786 disabled: disabled2, 18787 trackCursorAxis 18788 }) { 18789 const floatingRootContext = store4.useState("floatingRootContext"); 18790 const dismiss = useDismiss(floatingRootContext, { 18791 enabled: !disabled2, 18792 referencePress: () => store4.select("closeOnClick") 18793 }); 18794 const clientPoint = useClientPoint(floatingRootContext, { 18795 enabled: !disabled2 && trackCursorAxis !== "none", 18796 axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis 18797 }); 18798 const activeTriggerProps = React62.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]); 18799 const inactiveTriggerProps = React62.useMemo(() => mergeProps(clientPoint.trigger, dismiss.trigger), [clientPoint.trigger, dismiss.trigger]); 18800 const popupProps = React62.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, clientPoint.floating, dismiss.floating), [clientPoint.floating, dismiss.floating]); 18801 usePopupInteractionProps(store4, { 18802 activeTriggerProps, 18803 inactiveTriggerProps, 18804 popupProps 18805 }); 18806 return null; 18807 } 18808 18809 // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs 18810 var React64 = __toESM(require_react(), 1); 18811 18812 // node_modules/@base-ui/react/tooltip/provider/TooltipProviderContext.mjs 18813 var React63 = __toESM(require_react(), 1); 18814 var TooltipProviderContext = /* @__PURE__ */ React63.createContext(void 0); 18815 if (true) TooltipProviderContext.displayName = "TooltipProviderContext"; 18816 function useTooltipProviderContext() { 18817 return React63.useContext(TooltipProviderContext); 18818 } 18819 18820 // node_modules/@base-ui/react/tooltip/trigger/TooltipTriggerDataAttributes.mjs 18821 var TooltipTriggerDataAttributes = (function(TooltipTriggerDataAttributes2) { 18822 TooltipTriggerDataAttributes2[TooltipTriggerDataAttributes2["popupOpen"] = CommonTriggerDataAttributes.popupOpen] = "popupOpen"; 18823 TooltipTriggerDataAttributes2["triggerDisabled"] = "data-trigger-disabled"; 18824 return TooltipTriggerDataAttributes2; 18825 })({}); 18826 18827 // node_modules/@base-ui/react/tooltip/utils/constants.mjs 18828 var OPEN_DELAY = 600; 18829 18830 // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs 18831 var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger"; 18832 function getTargetElement(event) { 18833 if ("composedPath" in event) { 18834 const path = event.composedPath(); 18835 for (let i3 = 0; i3 < path.length; i3 += 1) { 18836 const element = path[i3]; 18837 if (isElement(element)) { 18838 return element; 18839 } 18840 } 18841 } 18842 const target = event.target; 18843 if (isElement(target)) { 18844 return target; 18845 } 18846 return null; 18847 } 18848 function closestEnabledTooltipTrigger(element) { 18849 let current = element; 18850 while (current) { 18851 if (current.hasAttribute(TOOLTIP_TRIGGER_IDENTIFIER)) { 18852 return current; 18853 } 18854 const parentElement = current.parentElement; 18855 if (parentElement) { 18856 current = parentElement; 18857 continue; 18858 } 18859 const root = current.getRootNode(); 18860 current = "host" in root && isElement(root.host) ? root.host : null; 18861 } 18862 return null; 18863 } 18864 var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) { 18865 const { 18866 render: render5, 18867 className, 18868 style, 18869 handle, 18870 payload, 18871 disabled: disabledProp, 18872 delay, 18873 closeOnClick = true, 18874 closeDelay, 18875 id: idProp, 18876 ...elementProps 18877 } = componentProps; 18878 const rootContext = useTooltipRootContext(true); 18879 const store4 = handle?.store ?? rootContext; 18880 if (!store4) { 18881 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)); 18882 } 18883 const thisTriggerId = useBaseUiId(idProp); 18884 const isTriggerActive = store4.useState("isTriggerActive", thisTriggerId); 18885 const isOpenedByThisTrigger = store4.useState("isOpenedByTrigger", thisTriggerId); 18886 const floatingRootContext = store4.useState("floatingRootContext"); 18887 const triggerElementRef = React64.useRef(null); 18888 const delayWithDefault = delay ?? OPEN_DELAY; 18889 const closeDelayWithDefault = closeDelay ?? 0; 18890 const { 18891 registerTrigger, 18892 isMountedByThisTrigger 18893 } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store4, { 18894 payload, 18895 closeOnClick, 18896 closeDelay: closeDelayWithDefault 18897 }); 18898 const providerContext = useTooltipProviderContext(); 18899 const { 18900 delayRef, 18901 isInstantPhase, 18902 hasProvider 18903 } = useDelayGroup(floatingRootContext, { 18904 open: isOpenedByThisTrigger 18905 }); 18906 const hoverInteraction = useHoverInteractionSharedState(floatingRootContext); 18907 store4.useSyncedValue("isInstantPhase", isInstantPhase); 18908 const rootDisabled = store4.useState("disabled"); 18909 const disabled2 = disabledProp ?? rootDisabled; 18910 const disabledRef = useValueAsRef(disabled2); 18911 const trackCursorAxis = store4.useState("trackCursorAxis"); 18912 const disableHoverablePopup = store4.useState("disableHoverablePopup"); 18913 const isNestedTriggerHoveredRef = React64.useRef(false); 18914 const nestedTriggerOpenTimeout = useTimeout(); 18915 const pointerTypeRef = React64.useRef(void 0); 18916 function getOpenDelay() { 18917 const providerDelay = providerContext?.delay; 18918 const groupOpenValue = typeof delayRef.current === "object" ? delayRef.current.open : void 0; 18919 let computedOpenDelay = delayWithDefault; 18920 if (hasProvider) { 18921 if (groupOpenValue !== 0) { 18922 computedOpenDelay = delay ?? providerDelay ?? delayWithDefault; 18923 } else { 18924 computedOpenDelay = 0; 18925 } 18926 } 18927 return computedOpenDelay; 18928 } 18929 function isEnabledNestedTriggerTarget(target) { 18930 const triggerEl = triggerElementRef.current; 18931 if (!triggerEl || !target) { 18932 return false; 18933 } 18934 const nearestTrigger = closestEnabledTooltipTrigger(target); 18935 return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger); 18936 } 18937 function detectNestedTriggerHover(target) { 18938 const nestedTriggerHovered = isEnabledNestedTriggerTarget(target); 18939 isNestedTriggerHoveredRef.current = nestedTriggerHovered; 18940 if (nestedTriggerHovered) { 18941 hoverInteraction.openChangeTimeout.clear(); 18942 hoverInteraction.restTimeout.clear(); 18943 hoverInteraction.restTimeoutPending = false; 18944 nestedTriggerOpenTimeout.clear(); 18945 } 18946 return nestedTriggerHovered; 18947 } 18948 const hoverProps = useHoverReferenceInteraction(floatingRootContext, { 18949 enabled: !disabled2, 18950 mouseOnly: true, 18951 move: false, 18952 handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null, 18953 restMs: getOpenDelay, 18954 delay() { 18955 const closeValue = typeof delayRef.current === "object" ? delayRef.current.close : void 0; 18956 let computedCloseDelay = closeDelayWithDefault; 18957 if (closeDelay == null && hasProvider) { 18958 computedCloseDelay = closeValue; 18959 } 18960 return { 18961 close: computedCloseDelay 18962 }; 18963 }, 18964 triggerElementRef, 18965 isActiveTrigger: isTriggerActive, 18966 isClosing: () => store4.select("transitionStatus") === "ending", 18967 shouldOpen() { 18968 return !isNestedTriggerHoveredRef.current; 18969 } 18970 }); 18971 const focusProps = useFocus(floatingRootContext, { 18972 enabled: !disabled2 18973 }).reference; 18974 const handleNestedTriggerHover = (event) => { 18975 const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current; 18976 const target = getTargetElement(event); 18977 const nestedTriggerHovered = detectNestedTriggerHover(target); 18978 const triggerEl = triggerElementRef.current; 18979 const targetInsideTrigger = triggerEl && target && contains(triggerEl, target); 18980 if (nestedTriggerHovered && store4.select("open") && store4.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) { 18981 store4.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 18982 return; 18983 } 18984 if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store4.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences. 18985 isMouseLikePointerType(pointerTypeRef.current)) { 18986 const open = () => { 18987 if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store4.select("open")) { 18988 store4.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl)); 18989 } 18990 }; 18991 const openDelay = getOpenDelay(); 18992 if (openDelay === 0) { 18993 nestedTriggerOpenTimeout.clear(); 18994 open(); 18995 } else { 18996 nestedTriggerOpenTimeout.start(openDelay, open); 18997 } 18998 } 18999 }; 19000 const rootTriggerProps = store4.useState("triggerProps", isMountedByThisTrigger); 19001 const shouldApplyRootTriggerProps = isMountedByThisTrigger || trackCursorAxis !== "none"; 19002 const state2 = { 19003 open: isOpenedByThisTrigger 19004 }; 19005 const element = useRenderElement("button", componentProps, { 19006 state: state2, 19007 ref: [forwardedRef, registerTrigger, triggerElementRef], 19008 props: [hoverProps, focusProps, shouldApplyRootTriggerProps ? rootTriggerProps : void 0, { 19009 onMouseOver(event) { 19010 handleNestedTriggerHover(event.nativeEvent); 19011 }, 19012 onFocus(event) { 19013 if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) { 19014 event.preventBaseUIHandler(); 19015 } 19016 }, 19017 onMouseLeave() { 19018 isNestedTriggerHoveredRef.current = false; 19019 nestedTriggerOpenTimeout.clear(); 19020 pointerTypeRef.current = void 0; 19021 }, 19022 onPointerEnter(event) { 19023 pointerTypeRef.current = event.pointerType; 19024 }, 19025 onPointerDown(event) { 19026 pointerTypeRef.current = event.pointerType; 19027 store4.set("closeOnClick", closeOnClick); 19028 if (closeOnClick && !store4.select("open")) { 19029 store4.cancelPendingOpen(event.nativeEvent); 19030 } 19031 }, 19032 onClick(event) { 19033 if (closeOnClick && !store4.select("open")) { 19034 store4.cancelPendingOpen(event.nativeEvent); 19035 } 19036 }, 19037 id: thisTriggerId, 19038 [TooltipTriggerDataAttributes.triggerDisabled]: disabled2 ? "" : void 0, 19039 [TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : "" 19040 }, elementProps], 19041 stateAttributesMapping: triggerOpenStateMapping2 19042 }); 19043 return element; 19044 }); 19045 if (true) TooltipTrigger.displayName = "TooltipTrigger"; 19046 19047 // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs 19048 var React66 = __toESM(require_react(), 1); 19049 19050 // node_modules/@base-ui/react/tooltip/portal/TooltipPortalContext.mjs 19051 var React65 = __toESM(require_react(), 1); 19052 var TooltipPortalContext = /* @__PURE__ */ React65.createContext(void 0); 19053 if (true) TooltipPortalContext.displayName = "TooltipPortalContext"; 19054 function useTooltipPortalContext() { 19055 const value = React65.useContext(TooltipPortalContext); 19056 if (value === void 0) { 19057 throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70)); 19058 } 19059 return value; 19060 } 19061 19062 // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs 19063 var import_jsx_runtime110 = __toESM(require_jsx_runtime(), 1); 19064 var TooltipPortal = /* @__PURE__ */ React66.forwardRef(function TooltipPortal2(props, forwardedRef) { 19065 const { 19066 keepMounted = false, 19067 ...portalProps 19068 } = props; 19069 const store4 = useTooltipRootContext(); 19070 const mounted = store4.useState("mounted"); 19071 const shouldRender = mounted || keepMounted; 19072 if (!shouldRender) { 19073 return null; 19074 } 19075 return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(TooltipPortalContext.Provider, { 19076 value: keepMounted, 19077 children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(FloatingPortalLite, { 19078 ref: forwardedRef, 19079 ...portalProps 19080 }) 19081 }); 19082 }); 19083 if (true) TooltipPortal.displayName = "TooltipPortal"; 19084 19085 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs 19086 var React68 = __toESM(require_react(), 1); 19087 19088 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositionerContext.mjs 19089 var React67 = __toESM(require_react(), 1); 19090 var TooltipPositionerContext = /* @__PURE__ */ React67.createContext(void 0); 19091 if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext"; 19092 function useTooltipPositionerContext() { 19093 const context = React67.useContext(TooltipPositionerContext); 19094 if (context === void 0) { 19095 throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71)); 19096 } 19097 return context; 19098 } 19099 19100 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs 19101 var import_jsx_runtime111 = __toESM(require_jsx_runtime(), 1); 19102 var TooltipPositioner = /* @__PURE__ */ React68.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) { 19103 const { 19104 render: render5, 19105 className, 19106 anchor, 19107 positionMethod = "absolute", 19108 side = "top", 19109 align = "center", 19110 sideOffset = 0, 19111 alignOffset = 0, 19112 collisionBoundary = "clipping-ancestors", 19113 collisionPadding = 5, 19114 arrowPadding = 5, 19115 sticky = false, 19116 disableAnchorTracking = false, 19117 collisionAvoidance = POPUP_COLLISION_AVOIDANCE, 19118 style, 19119 ...elementProps 19120 } = componentProps; 19121 const store4 = useTooltipRootContext(); 19122 const keepMounted = useTooltipPortalContext(); 19123 const open = store4.useState("open"); 19124 const mounted = store4.useState("mounted"); 19125 const trackCursorAxis = store4.useState("trackCursorAxis"); 19126 const disableHoverablePopup = store4.useState("disableHoverablePopup"); 19127 const floatingRootContext = store4.useState("floatingRootContext"); 19128 const instantType = store4.useState("instantType"); 19129 const transitionStatus = store4.useState("transitionStatus"); 19130 const hasViewport = store4.useState("hasViewport"); 19131 const positioning = useAnchorPositioning({ 19132 anchor, 19133 positionMethod, 19134 floatingRootContext, 19135 mounted, 19136 side, 19137 sideOffset, 19138 align, 19139 alignOffset, 19140 collisionBoundary, 19141 collisionPadding, 19142 sticky, 19143 arrowPadding, 19144 disableAnchorTracking, 19145 keepMounted, 19146 collisionAvoidance, 19147 adaptiveOrigin: hasViewport ? adaptiveOrigin : void 0 19148 }); 19149 const state2 = React68.useMemo(() => ({ 19150 open, 19151 side: positioning.side, 19152 align: positioning.align, 19153 anchorHidden: positioning.anchorHidden, 19154 instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType 19155 }), [open, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]); 19156 const element = usePositioner(componentProps, state2, { 19157 styles: positioning.positionerStyles, 19158 transitionStatus, 19159 props: elementProps, 19160 refs: [forwardedRef, store4.useStateSetter("positionerElement")], 19161 hidden: !mounted, 19162 inert: !open || trackCursorAxis === "both" || disableHoverablePopup 19163 }); 19164 return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(TooltipPositionerContext.Provider, { 19165 value: positioning, 19166 children: element 19167 }); 19168 }); 19169 if (true) TooltipPositioner.displayName = "TooltipPositioner"; 19170 19171 // node_modules/@base-ui/react/tooltip/popup/TooltipPopup.mjs 19172 var React69 = __toESM(require_react(), 1); 19173 var stateAttributesMapping4 = { 19174 ...popupStateMapping, 19175 ...transitionStatusMapping 19176 }; 19177 var TooltipPopup = /* @__PURE__ */ React69.forwardRef(function TooltipPopup2(componentProps, forwardedRef) { 19178 const { 19179 render: render5, 19180 className, 19181 style, 19182 ...elementProps 19183 } = componentProps; 19184 const store4 = useTooltipRootContext(); 19185 const { 19186 side, 19187 align 19188 } = useTooltipPositionerContext(); 19189 const open = store4.useState("open"); 19190 const instantType = store4.useState("instantType"); 19191 const transitionStatus = store4.useState("transitionStatus"); 19192 const popupProps = store4.useState("popupProps"); 19193 const floatingContext = store4.useState("floatingRootContext"); 19194 const disabled2 = store4.useState("disabled"); 19195 const closeDelay = store4.useState("closeDelay"); 19196 useOpenChangeComplete({ 19197 open, 19198 ref: store4.context.popupRef, 19199 onComplete() { 19200 if (open) { 19201 store4.context.onOpenChangeComplete?.(true); 19202 } 19203 } 19204 }); 19205 useHoverFloatingInteraction(floatingContext, { 19206 enabled: !disabled2, 19207 closeDelay 19208 }); 19209 const setPopupElement = store4.useStateSetter("popupElement"); 19210 const state2 = { 19211 open, 19212 side, 19213 align, 19214 instant: instantType, 19215 transitionStatus 19216 }; 19217 const element = useRenderElement("div", componentProps, { 19218 state: state2, 19219 ref: [forwardedRef, store4.context.popupRef, setPopupElement], 19220 props: [popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps], 19221 stateAttributesMapping: stateAttributesMapping4 19222 }); 19223 return element; 19224 }); 19225 if (true) TooltipPopup.displayName = "TooltipPopup"; 19226 19227 // node_modules/@base-ui/react/tooltip/arrow/TooltipArrow.mjs 19228 var React70 = __toESM(require_react(), 1); 19229 var TooltipArrow = /* @__PURE__ */ React70.forwardRef(function TooltipArrow2(componentProps, forwardedRef) { 19230 const { 19231 render: render5, 19232 className, 19233 style, 19234 ...elementProps 19235 } = componentProps; 19236 const store4 = useTooltipRootContext(); 19237 const { 19238 arrowRef, 19239 side, 19240 align, 19241 arrowUncentered, 19242 arrowStyles 19243 } = useTooltipPositionerContext(); 19244 const open = store4.useState("open"); 19245 const instantType = store4.useState("instantType"); 19246 const state2 = { 19247 open, 19248 side, 19249 align, 19250 uncentered: arrowUncentered, 19251 instant: instantType 19252 }; 19253 const element = useRenderElement("div", componentProps, { 19254 state: state2, 19255 ref: [forwardedRef, arrowRef], 19256 props: [{ 19257 style: arrowStyles, 19258 "aria-hidden": true 19259 }, elementProps], 19260 stateAttributesMapping: popupStateMapping 19261 }); 19262 return element; 19263 }); 19264 if (true) TooltipArrow.displayName = "TooltipArrow"; 19265 19266 // node_modules/@base-ui/react/tooltip/provider/TooltipProvider.mjs 19267 var React71 = __toESM(require_react(), 1); 19268 var import_jsx_runtime112 = __toESM(require_jsx_runtime(), 1); 19269 var TooltipProvider = function TooltipProvider2(props) { 19270 const { 19271 delay, 19272 closeDelay, 19273 timeout = 400 19274 } = props; 19275 const contextValue = React71.useMemo(() => ({ 19276 delay, 19277 closeDelay 19278 }), [delay, closeDelay]); 19279 const delayValue = React71.useMemo(() => ({ 19280 open: delay, 19281 close: closeDelay 19282 }), [delay, closeDelay]); 19283 return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(TooltipProviderContext.Provider, { 19284 value: contextValue, 19285 children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(FloatingDelayGroup, { 19286 delay: delayValue, 19287 timeoutMs: timeout, 19288 children: props.children 19289 }) 19290 }); 19291 }; 19292 if (true) TooltipProvider.displayName = "TooltipProvider"; 19293 19294 // node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs 19295 var React72 = __toESM(require_react(), 1); 19296 19297 // node_modules/@base-ui/react/tooltip/viewport/TooltipViewportCssVars.mjs 19298 var TooltipViewportCssVars = /* @__PURE__ */ (function(TooltipViewportCssVars2) { 19299 TooltipViewportCssVars2["popupWidth"] = "--popup-width"; 19300 TooltipViewportCssVars2["popupHeight"] = "--popup-height"; 19301 return TooltipViewportCssVars2; 19302 })({}); 19303 19304 // node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs 19305 var stateAttributesMapping5 = { 19306 activationDirection: (value) => value ? { 19307 "data-activation-direction": value 19308 } : null 19309 }; 19310 var TooltipViewport = /* @__PURE__ */ React72.forwardRef(function TooltipViewport2(componentProps, forwardedRef) { 19311 const { 19312 render: render5, 19313 className, 19314 style, 19315 children, 19316 ...elementProps 19317 } = componentProps; 19318 const store4 = useTooltipRootContext(); 19319 const positioner = useTooltipPositionerContext(); 19320 const instantType = store4.useState("instantType"); 19321 const { 19322 children: childrenToRender, 19323 state: viewportState 19324 } = usePopupViewport({ 19325 store: store4, 19326 side: positioner.side, 19327 cssVars: TooltipViewportCssVars, 19328 children 19329 }); 19330 const state2 = { 19331 activationDirection: viewportState.activationDirection, 19332 transitioning: viewportState.transitioning, 19333 instant: instantType 19334 }; 19335 return useRenderElement("div", componentProps, { 19336 state: state2, 19337 ref: forwardedRef, 19338 props: [elementProps, { 19339 children: childrenToRender 19340 }], 19341 stateAttributesMapping: stateAttributesMapping5 19342 }); 19343 }); 19344 if (true) TooltipViewport.displayName = "TooltipViewport"; 19345 19346 // node_modules/@base-ui/react/tooltip/store/TooltipHandle.mjs 19347 var TooltipHandle = class { 19348 /** 19349 * Internal store holding the tooltip state. 19350 * @internal 19351 */ 19352 constructor() { 19353 this.store = new TooltipStore(); 19354 } 19355 /** 19356 * Opens the tooltip and associates it with the trigger with the given ID. 19357 * The trigger must be a Tooltip.Trigger component with this handle passed as a prop. 19358 * 19359 * This method should only be called in an event handler or an effect (not during rendering). 19360 * 19361 * @param triggerId ID of the trigger to associate with the tooltip. 19362 */ 19363 open(triggerId) { 19364 const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : void 0; 19365 if (triggerId && !triggerElement) { 19366 throw new Error(true ? `Base UI: TooltipHandle.open: No trigger found with id "$triggerId}".` : formatErrorMessage_default(81, triggerId)); 19367 } 19368 this.store.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement)); 19369 } 19370 /** 19371 * Closes the tooltip. 19372 */ 19373 close() { 19374 this.store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, void 0)); 19375 } 19376 /** 19377 * Indicates whether the tooltip is currently open. 19378 */ 19379 get isOpen() { 19380 return this.store.select("open"); 19381 } 19382 }; 19383 function createTooltipHandle() { 19384 return new TooltipHandle(); 19385 } 19386 19387 // node_modules/@base-ui/react/use-render/useRender.mjs 19388 function useRender(params) { 19389 return useRenderElement(params.defaultTagName ?? "div", params, params); 19390 } 19391 19392 // packages/ui/build-module/text/text.mjs 19393 var import_element14 = __toESM(require_element(), 1); 19394 var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; 19395 function getRuntime() { 19396 const globalScope = globalThis; 19397 if (globalScope.__wpStyleRuntime) { 19398 return globalScope.__wpStyleRuntime; 19399 } 19400 globalScope.__wpStyleRuntime = { 19401 documents: /* @__PURE__ */ new Map(), 19402 styles: /* @__PURE__ */ new Map(), 19403 injectedStyles: /* @__PURE__ */ new WeakMap() 19404 }; 19405 if (typeof document !== "undefined") { 19406 registerDocument(document); 19407 } 19408 return globalScope.__wpStyleRuntime; 19409 } 19410 function documentContainsStyleHash(targetDocument, hash) { 19411 if (!targetDocument.head) { 19412 return false; 19413 } 19414 for (const style of targetDocument.head.querySelectorAll( 19415 `style[$STYLE_HASH_ATTRIBUTE}]` 19416 )) { 19417 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) { 19418 return true; 19419 } 19420 } 19421 return false; 19422 } 19423 function injectStyle(targetDocument, hash, css) { 19424 if (!targetDocument.head) { 19425 return; 19426 } 19427 const runtime = getRuntime(); 19428 let injectedStyles = runtime.injectedStyles.get(targetDocument); 19429 if (!injectedStyles) { 19430 injectedStyles = /* @__PURE__ */ new Set(); 19431 runtime.injectedStyles.set(targetDocument, injectedStyles); 19432 } 19433 if (injectedStyles.has(hash)) { 19434 return; 19435 } 19436 if (documentContainsStyleHash(targetDocument, hash)) { 19437 injectedStyles.add(hash); 19438 return; 19439 } 19440 const style = targetDocument.createElement("style"); 19441 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash); 19442 style.appendChild(targetDocument.createTextNode(css)); 19443 targetDocument.head.appendChild(style); 19444 injectedStyles.add(hash); 19445 } 19446 function registerDocument(targetDocument) { 19447 const runtime = getRuntime(); 19448 runtime.documents.set( 19449 targetDocument, 19450 (runtime.documents.get(targetDocument) ?? 0) + 1 19451 ); 19452 for (const [hash, css] of runtime.styles) { 19453 injectStyle(targetDocument, hash, css); 19454 } 19455 return () => { 19456 const count = runtime.documents.get(targetDocument); 19457 if (count === void 0) { 19458 return; 19459 } 19460 if (count <= 1) { 19461 runtime.documents.delete(targetDocument); 19462 return; 19463 } 19464 runtime.documents.set(targetDocument, count - 1); 19465 }; 19466 } 19467 function registerStyle(hash, css) { 19468 const runtime = getRuntime(); 19469 runtime.styles.set(hash, css); 19470 for (const targetDocument of runtime.documents.keys()) { 19471 injectStyle(targetDocument, hash, css); 19472 } 19473 } 19474 if (typeof process === "undefined" || true) { 19475 registerStyle("a495f9d138", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._83ed8a8da5dd50ea__text{margin:0}._14437cfb77831647__heading-2xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-p-line-height:var(--wpds-typography-line-height-2xl,40px);font-size:var(--wpds-typography-font-size-2xl,32px);line-height:var(--wpds-typography-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-md,24px)}.aa58f227716bcde2__heading-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-xl,32px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-lg,15px);line-height:var(--wpds-typography-line-height-md,24px)}._131101940be12424__body-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}'); 19476 } 19477 var style_default = { "text": "_83ed8a8da5dd50ea__text", "heading-2xl": "_14437cfb77831647__heading-2xl", "heading-xl": "_3c78b7fa9b4072dd__heading-xl", "heading-lg": "aa58f227716bcde2__heading-lg", "heading-md": "fc4da56d8dfe52c4__heading-md", "heading-sm": "a9b78c7c82e8dff7__heading-sm", "body-xl": "_305ff559e52180d5__body-xl", "body-lg": "ca1aa3fc2029e958__body-lg", "body-md": "_131101940be12424__body-md", "body-sm": "_0e8d87a42c1f75fa__body-sm" }; 19478 if (typeof process === "undefined" || true) { 19479 registerStyle("af6d9984a6", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-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))}&::placeholder{color:var(--_gcd-input-placeholder-color,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)}"); 19480 } 19481 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" }; 19482 var Text = (0, import_element14.forwardRef)(function Text2({ variant = "body-md", render: render5, className, ...props }, ref) { 19483 const element = useRender({ 19484 render: render5, 19485 defaultTagName: "span", 19486 ref, 19487 props: mergeProps(props, { 19488 className: clsx_default( 19489 style_default.text, 19490 global_css_defense_default.heading, 19491 global_css_defense_default.p, 19492 style_default[variant], 19493 className 19494 ) 19495 }) 19496 }); 19497 return element; 19498 }); 19499 19500 // packages/ui/build-module/badge/badge.mjs 19501 var import_jsx_runtime113 = __toESM(require_jsx_runtime(), 1); 19502 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash"; 19503 function getRuntime2() { 19504 const globalScope = globalThis; 19505 if (globalScope.__wpStyleRuntime) { 19506 return globalScope.__wpStyleRuntime; 19507 } 19508 globalScope.__wpStyleRuntime = { 19509 documents: /* @__PURE__ */ new Map(), 19510 styles: /* @__PURE__ */ new Map(), 19511 injectedStyles: /* @__PURE__ */ new WeakMap() 19512 }; 19513 if (typeof document !== "undefined") { 19514 registerDocument2(document); 19515 } 19516 return globalScope.__wpStyleRuntime; 19517 } 19518 function documentContainsStyleHash2(targetDocument, hash) { 19519 if (!targetDocument.head) { 19520 return false; 19521 } 19522 for (const style of targetDocument.head.querySelectorAll( 19523 `style[$STYLE_HASH_ATTRIBUTE2}]` 19524 )) { 19525 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) { 19526 return true; 19527 } 19528 } 19529 return false; 19530 } 19531 function injectStyle2(targetDocument, hash, css) { 19532 if (!targetDocument.head) { 19533 return; 19534 } 19535 const runtime = getRuntime2(); 19536 let injectedStyles = runtime.injectedStyles.get(targetDocument); 19537 if (!injectedStyles) { 19538 injectedStyles = /* @__PURE__ */ new Set(); 19539 runtime.injectedStyles.set(targetDocument, injectedStyles); 19540 } 19541 if (injectedStyles.has(hash)) { 19542 return; 19543 } 19544 if (documentContainsStyleHash2(targetDocument, hash)) { 19545 injectedStyles.add(hash); 19546 return; 19547 } 19548 const style = targetDocument.createElement("style"); 19549 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash); 19550 style.appendChild(targetDocument.createTextNode(css)); 19551 targetDocument.head.appendChild(style); 19552 injectedStyles.add(hash); 19553 } 19554 function registerDocument2(targetDocument) { 19555 const runtime = getRuntime2(); 19556 runtime.documents.set( 19557 targetDocument, 19558 (runtime.documents.get(targetDocument) ?? 0) + 1 19559 ); 19560 for (const [hash, css] of runtime.styles) { 19561 injectStyle2(targetDocument, hash, css); 19562 } 19563 return () => { 19564 const count = runtime.documents.get(targetDocument); 19565 if (count === void 0) { 19566 return; 19567 } 19568 if (count <= 1) { 19569 runtime.documents.delete(targetDocument); 19570 return; 19571 } 19572 runtime.documents.set(targetDocument, count - 1); 19573 }; 19574 } 19575 function registerStyle2(hash, css) { 19576 const runtime = getRuntime2(); 19577 runtime.styles.set(hash, css); 19578 for (const targetDocument of runtime.documents.keys()) { 19579 injectStyle2(targetDocument, hash, css); 19580 } 19581 } 19582 if (typeof process === "undefined" || true) { 19583 registerStyle2("9db2873e7f", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._96e6251aad1a6136__badge{border-radius:var(--wpds-border-radius-lg,8px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wpds-dimension-padding-sm,8px)}._99f7158cb520f750__is-high-intent{background-color:var(--wpds-color-background-surface-error,#f6e6e3);color:var(--wpds-color-foreground-content-error,#470000)}.c20ebef2365bc8b7__is-medium-intent{background-color:var(--wpds-color-background-surface-warning,#fde6be);color:var(--wpds-color-foreground-content-warning,#2e1900)}._365e1626c6202e52__is-low-intent{background-color:var(--wpds-color-background-surface-caution,#fee995);color:var(--wpds-color-foreground-content-caution,#281d00)}._33f8198127ddf4ef__is-stable-intent{background-color:var(--wpds-color-background-surface-success,#c6f7cd);color:var(--wpds-color-foreground-content-success,#002900)}._04c1aca8fc449412__is-informational-intent{background-color:var(--wpds-color-background-surface-info,#deebfa);color:var(--wpds-color-foreground-content-info,#001b4f)}._90726e69d495ec19__is-draft-intent{background-color:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);color:var(--wpds-color-foreground-content-neutral,#1e1e1e)}._898f4a544993bd39__is-none-intent{background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);padding-block:calc(var(--wpds-dimension-padding-xs, 4px) - var(--wpds-border-width-xs, 1px));padding-inline:calc(var(--wpds-dimension-padding-sm, 8px) - var(--wpds-border-width-xs, 1px))}}}"); 19584 } 19585 var style_default2 = { "badge": "_96e6251aad1a6136__badge", "is-high-intent": "_99f7158cb520f750__is-high-intent", "is-medium-intent": "c20ebef2365bc8b7__is-medium-intent", "is-low-intent": "_365e1626c6202e52__is-low-intent", "is-stable-intent": "_33f8198127ddf4ef__is-stable-intent", "is-informational-intent": "_04c1aca8fc449412__is-informational-intent", "is-draft-intent": "_90726e69d495ec19__is-draft-intent", "is-none-intent": "_898f4a544993bd39__is-none-intent" }; 19586 var Badge = (0, import_element15.forwardRef)(function Badge2({ intent = "none", className, ...props }, ref) { 19587 return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)( 19588 Text, 19589 { 19590 ref, 19591 className: clsx_default( 19592 style_default2.badge, 19593 style_default2[`is-$intent}-intent`], 19594 className 19595 ), 19596 ...props, 19597 variant: "body-sm" 19598 } 19599 ); 19600 }); 19601 19602 // packages/ui/build-module/button/button.mjs 19603 var import_a11y = __toESM(require_a11y(), 1); 19604 var import_element16 = __toESM(require_element(), 1); 19605 var import_i18n11 = __toESM(require_i18n(), 1); 19606 var import_jsx_runtime114 = __toESM(require_jsx_runtime(), 1); 19607 var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash"; 19608 function getRuntime3() { 19609 const globalScope = globalThis; 19610 if (globalScope.__wpStyleRuntime) { 19611 return globalScope.__wpStyleRuntime; 19612 } 19613 globalScope.__wpStyleRuntime = { 19614 documents: /* @__PURE__ */ new Map(), 19615 styles: /* @__PURE__ */ new Map(), 19616 injectedStyles: /* @__PURE__ */ new WeakMap() 19617 }; 19618 if (typeof document !== "undefined") { 19619 registerDocument3(document); 19620 } 19621 return globalScope.__wpStyleRuntime; 19622 } 19623 function documentContainsStyleHash3(targetDocument, hash) { 19624 if (!targetDocument.head) { 19625 return false; 19626 } 19627 for (const style of targetDocument.head.querySelectorAll( 19628 `style[$STYLE_HASH_ATTRIBUTE3}]` 19629 )) { 19630 if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) { 19631 return true; 19632 } 19633 } 19634 return false; 19635 } 19636 function injectStyle3(targetDocument, hash, css) { 19637 if (!targetDocument.head) { 19638 return; 19639 } 19640 const runtime = getRuntime3(); 19641 let injectedStyles = runtime.injectedStyles.get(targetDocument); 19642 if (!injectedStyles) { 19643 injectedStyles = /* @__PURE__ */ new Set(); 19644 runtime.injectedStyles.set(targetDocument, injectedStyles); 19645 } 19646 if (injectedStyles.has(hash)) { 19647 return; 19648 } 19649 if (documentContainsStyleHash3(targetDocument, hash)) { 19650 injectedStyles.add(hash); 19651 return; 19652 } 19653 const style = targetDocument.createElement("style"); 19654 style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash); 19655 style.appendChild(targetDocument.createTextNode(css)); 19656 targetDocument.head.appendChild(style); 19657 injectedStyles.add(hash); 19658 } 19659 function registerDocument3(targetDocument) { 19660 const runtime = getRuntime3(); 19661 runtime.documents.set( 19662 targetDocument, 19663 (runtime.documents.get(targetDocument) ?? 0) + 1 19664 ); 19665 for (const [hash, css] of runtime.styles) { 19666 injectStyle3(targetDocument, hash, css); 19667 } 19668 return () => { 19669 const count = runtime.documents.get(targetDocument); 19670 if (count === void 0) { 19671 return; 19672 } 19673 if (count <= 1) { 19674 runtime.documents.delete(targetDocument); 19675 return; 19676 } 19677 runtime.documents.set(targetDocument, count - 1); 19678 }; 19679 } 19680 function registerStyle3(hash, css) { 19681 const runtime = getRuntime3(); 19682 runtime.styles.set(hash, css); 19683 for (const targetDocument of runtime.documents.keys()) { 19684 injectStyle3(targetDocument, hash, css); 19685 } 19686 } 19687 if (typeof process === "undefined" || true) { 19688 registerStyle3("b74f1ac304", '@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);inset-inline-start:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}@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)}}}'); 19689 } 19690 var style_default3 = { "button": "_97b0fc33c028be1a__button", "is-unstyled": "abbb272e2ce49bd6__is-unstyled", "is-loading": "_914b42f315c0e580__is-loading", "is-small": "_908205475f9f2a92__is-small", "icon": "_9f6fc6553aeb36fe__icon", "is-brand": "dd460c965226cc77__is-brand", "is-outline": "_62d5a778b7b258ee__is-outline", "is-minimal": "ad0619a3217c6a5b__is-minimal", "is-neutral": "e722a8f96726aa99__is-neutral", "is-solid": "b50b3358c5fb4d0b__is-solid", "is-compact": "cf59cf1b69629838__is-compact", "loading-animation": "_5a1d53da6f830c8d__loading-animation" }; 19691 if (typeof process === "undefined" || true) { 19692 registerStyle3("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 19693 } 19694 var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 19695 if (typeof process === "undefined" || true) { 19696 registerStyle3("da99a163ac", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._08e8a2e44959f892__outset-ring--focus:focus,.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._970d04df7376df67__outset-ring--focus-within-except-active:focus-within,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus{outline:none}._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active){@include mixins.focus-ring()}}}"); 19697 } 19698 var focus_default = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active" }; 19699 if (typeof process === "undefined" || true) { 19700 registerStyle3("af6d9984a6", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-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))}&::placeholder{color:var(--_gcd-input-placeholder-color,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)}"); 19701 } 19702 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" }; 19703 var Button4 = (0, import_element16.forwardRef)( 19704 function Button22({ 19705 tone = "brand", 19706 variant = "solid", 19707 size: size4 = "default", 19708 className, 19709 focusableWhenDisabled = true, 19710 disabled: disabled2, 19711 loading, 19712 loadingAnnouncement = (0, import_i18n11.__)("Loading"), 19713 children, 19714 ...props 19715 }, ref) { 19716 const mergedClassName = clsx_default( 19717 global_css_defense_default2.button, 19718 resets_default["box-sizing"], 19719 focus_default["outset-ring--focus-except-active"], 19720 variant !== "unstyled" && style_default3.button, 19721 style_default3[`is-$tone}`], 19722 style_default3[`is-$variant}`], 19723 style_default3[`is-$size4}`], 19724 loading && style_default3["is-loading"], 19725 className 19726 ); 19727 (0, import_element16.useEffect)(() => { 19728 if (loading && loadingAnnouncement) { 19729 (0, import_a11y.speak)(loadingAnnouncement); 19730 } 19731 }, [loading, loadingAnnouncement]); 19732 return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)( 19733 Button2, 19734 { 19735 ref, 19736 className: mergedClassName, 19737 focusableWhenDisabled, 19738 disabled: disabled2 ?? loading, 19739 ...props, 19740 children 19741 } 19742 ); 19743 } 19744 ); 19745 19746 // packages/ui/build-module/button/icon.mjs 19747 var import_element18 = __toESM(require_element(), 1); 19748 19749 // packages/ui/build-module/icon/icon.mjs 19750 var import_element17 = __toESM(require_element(), 1); 19751 var import_primitives94 = __toESM(require_primitives(), 1); 19752 var import_jsx_runtime115 = __toESM(require_jsx_runtime(), 1); 19753 var Icon = (0, import_element17.forwardRef)(function Icon2({ icon, size: size4 = 24, ...restProps }, ref) { 19754 return /* @__PURE__ */ (0, import_jsx_runtime115.jsx)( 19755 import_primitives94.SVG, 19756 { 19757 ref, 19758 ...icon.props, 19759 ...restProps, 19760 width: size4, 19761 height: size4 19762 } 19763 ); 19764 }); 19765 19766 // packages/ui/build-module/button/icon.mjs 19767 var import_jsx_runtime116 = __toESM(require_jsx_runtime(), 1); 19768 var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash"; 19769 function getRuntime4() { 19770 const globalScope = globalThis; 19771 if (globalScope.__wpStyleRuntime) { 19772 return globalScope.__wpStyleRuntime; 19773 } 19774 globalScope.__wpStyleRuntime = { 19775 documents: /* @__PURE__ */ new Map(), 19776 styles: /* @__PURE__ */ new Map(), 19777 injectedStyles: /* @__PURE__ */ new WeakMap() 19778 }; 19779 if (typeof document !== "undefined") { 19780 registerDocument4(document); 19781 } 19782 return globalScope.__wpStyleRuntime; 19783 } 19784 function documentContainsStyleHash4(targetDocument, hash) { 19785 if (!targetDocument.head) { 19786 return false; 19787 } 19788 for (const style of targetDocument.head.querySelectorAll( 19789 `style[$STYLE_HASH_ATTRIBUTE4}]` 19790 )) { 19791 if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) { 19792 return true; 19793 } 19794 } 19795 return false; 19796 } 19797 function injectStyle4(targetDocument, hash, css) { 19798 if (!targetDocument.head) { 19799 return; 19800 } 19801 const runtime = getRuntime4(); 19802 let injectedStyles = runtime.injectedStyles.get(targetDocument); 19803 if (!injectedStyles) { 19804 injectedStyles = /* @__PURE__ */ new Set(); 19805 runtime.injectedStyles.set(targetDocument, injectedStyles); 19806 } 19807 if (injectedStyles.has(hash)) { 19808 return; 19809 } 19810 if (documentContainsStyleHash4(targetDocument, hash)) { 19811 injectedStyles.add(hash); 19812 return; 19813 } 19814 const style = targetDocument.createElement("style"); 19815 style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash); 19816 style.appendChild(targetDocument.createTextNode(css)); 19817 targetDocument.head.appendChild(style); 19818 injectedStyles.add(hash); 19819 } 19820 function registerDocument4(targetDocument) { 19821 const runtime = getRuntime4(); 19822 runtime.documents.set( 19823 targetDocument, 19824 (runtime.documents.get(targetDocument) ?? 0) + 1 19825 ); 19826 for (const [hash, css] of runtime.styles) { 19827 injectStyle4(targetDocument, hash, css); 19828 } 19829 return () => { 19830 const count = runtime.documents.get(targetDocument); 19831 if (count === void 0) { 19832 return; 19833 } 19834 if (count <= 1) { 19835 runtime.documents.delete(targetDocument); 19836 return; 19837 } 19838 runtime.documents.set(targetDocument, count - 1); 19839 }; 19840 } 19841 function registerStyle4(hash, css) { 19842 const runtime = getRuntime4(); 19843 runtime.styles.set(hash, css); 19844 for (const targetDocument of runtime.documents.keys()) { 19845 injectStyle4(targetDocument, hash, css); 19846 } 19847 } 19848 if (typeof process === "undefined" || true) { 19849 registerStyle4("b74f1ac304", '@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);inset-inline-start:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}@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)}}}'); 19850 } 19851 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" }; 19852 var ButtonIcon = (0, import_element18.forwardRef)( 19853 function ButtonIcon2({ className, icon, ...props }, ref) { 19854 return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)( 19855 Icon, 19856 { 19857 ref, 19858 icon, 19859 className: clsx_default(style_default4.icon, className), 19860 size: 24, 19861 ...props 19862 } 19863 ); 19864 } 19865 ); 19866 19867 // packages/ui/build-module/button/index.mjs 19868 ButtonIcon.displayName = "Button.Icon"; 19869 var Button5 = Object.assign(Button4, { 19870 /** 19871 * An icon component specifically designed to work well when rendered inside 19872 * a `Button` component. 19873 */ 19874 Icon: ButtonIcon 19875 }); 19876 19877 // packages/ui/build-module/card/index.mjs 19878 var card_exports = {}; 19879 __export(card_exports, { 19880 Content: () => Content, 19881 FullBleed: () => FullBleed, 19882 Header: () => Header, 19883 Root: () => Root, 19884 Title: () => Title 19885 }); 19886 19887 // packages/ui/build-module/card/root.mjs 19888 var import_element19 = __toESM(require_element(), 1); 19889 var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash"; 19890 function getRuntime5() { 19891 const globalScope = globalThis; 19892 if (globalScope.__wpStyleRuntime) { 19893 return globalScope.__wpStyleRuntime; 19894 } 19895 globalScope.__wpStyleRuntime = { 19896 documents: /* @__PURE__ */ new Map(), 19897 styles: /* @__PURE__ */ new Map(), 19898 injectedStyles: /* @__PURE__ */ new WeakMap() 19899 }; 19900 if (typeof document !== "undefined") { 19901 registerDocument5(document); 19902 } 19903 return globalScope.__wpStyleRuntime; 19904 } 19905 function documentContainsStyleHash5(targetDocument, hash) { 19906 if (!targetDocument.head) { 19907 return false; 19908 } 19909 for (const style of targetDocument.head.querySelectorAll( 19910 `style[$STYLE_HASH_ATTRIBUTE5}]` 19911 )) { 19912 if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) { 19913 return true; 19914 } 19915 } 19916 return false; 19917 } 19918 function injectStyle5(targetDocument, hash, css) { 19919 if (!targetDocument.head) { 19920 return; 19921 } 19922 const runtime = getRuntime5(); 19923 let injectedStyles = runtime.injectedStyles.get(targetDocument); 19924 if (!injectedStyles) { 19925 injectedStyles = /* @__PURE__ */ new Set(); 19926 runtime.injectedStyles.set(targetDocument, injectedStyles); 19927 } 19928 if (injectedStyles.has(hash)) { 19929 return; 19930 } 19931 if (documentContainsStyleHash5(targetDocument, hash)) { 19932 injectedStyles.add(hash); 19933 return; 19934 } 19935 const style = targetDocument.createElement("style"); 19936 style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash); 19937 style.appendChild(targetDocument.createTextNode(css)); 19938 targetDocument.head.appendChild(style); 19939 injectedStyles.add(hash); 19940 } 19941 function registerDocument5(targetDocument) { 19942 const runtime = getRuntime5(); 19943 runtime.documents.set( 19944 targetDocument, 19945 (runtime.documents.get(targetDocument) ?? 0) + 1 19946 ); 19947 for (const [hash, css] of runtime.styles) { 19948 injectStyle5(targetDocument, hash, css); 19949 } 19950 return () => { 19951 const count = runtime.documents.get(targetDocument); 19952 if (count === void 0) { 19953 return; 19954 } 19955 if (count <= 1) { 19956 runtime.documents.delete(targetDocument); 19957 return; 19958 } 19959 runtime.documents.set(targetDocument, count - 1); 19960 }; 19961 } 19962 function registerStyle5(hash, css) { 19963 const runtime = getRuntime5(); 19964 runtime.styles.set(hash, css); 19965 for (const targetDocument of runtime.documents.keys()) { 19966 injectStyle5(targetDocument, hash, css); 19967 } 19968 } 19969 if (typeof process === "undefined" || true) { 19970 registerStyle5("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 19971 } 19972 var resets_default2 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 19973 if (typeof process === "undefined" || true) { 19974 registerStyle5("5d38cbdd27", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._02872bf298eadc43__root{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);--wp-ui-card-header-content-gap:var(--wpds-dimension-gap-xl,24px);--wp-ui-card-header-content-margin:calc(var(--wp-ui-card-header-content-gap) - var(--wp-ui-card-padding));background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-direction:column;overflow:clip}._5dffdaf2a6e669ac__content,.bbccc92e6ba5662d__header{padding:var(--wp-ui-card-padding);&:not(:first-child):not(:last-child){padding-block-end:0}}.bbccc92e6ba5662d__header+._5dffdaf2a6e669ac__content{margin-block-start:var(--wp-ui-card-header-content-margin);padding-block-start:0}.c1fa192587e1b4a6__fullbleed{margin-inline:calc(var(--wp-ui-card-padding)*-1);width:calc(100% + var(--wp-ui-card-padding)*2)}._02872bf298eadc43__root>:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):first-child>.c1fa192587e1b4a6__fullbleed:first-child{margin-block-start:calc(var(--wp-ui-card-padding)*-1)}:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):last-child>.c1fa192587e1b4a6__fullbleed:last-child{margin-block-end:calc(var(--wp-ui-card-padding)*-1)}}}"); 19975 } 19976 var style_default5 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; 19977 var Root = (0, import_element19.forwardRef)(function Card({ render: render5, ...restProps }, ref) { 19978 const mergedClassName = clsx_default(style_default5.root, resets_default2["box-sizing"]); 19979 const element = useRender({ 19980 defaultTagName: "div", 19981 render: render5, 19982 ref, 19983 props: mergeProps({ className: mergedClassName }, restProps) 19984 }); 19985 return element; 19986 }); 19987 19988 // packages/ui/build-module/card/header.mjs 19989 var import_element20 = __toESM(require_element(), 1); 19990 var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash"; 19991 function getRuntime6() { 19992 const globalScope = globalThis; 19993 if (globalScope.__wpStyleRuntime) { 19994 return globalScope.__wpStyleRuntime; 19995 } 19996 globalScope.__wpStyleRuntime = { 19997 documents: /* @__PURE__ */ new Map(), 19998 styles: /* @__PURE__ */ new Map(), 19999 injectedStyles: /* @__PURE__ */ new WeakMap() 20000 }; 20001 if (typeof document !== "undefined") { 20002 registerDocument6(document); 20003 } 20004 return globalScope.__wpStyleRuntime; 20005 } 20006 function documentContainsStyleHash6(targetDocument, hash) { 20007 if (!targetDocument.head) { 20008 return false; 20009 } 20010 for (const style of targetDocument.head.querySelectorAll( 20011 `style[$STYLE_HASH_ATTRIBUTE6}]` 20012 )) { 20013 if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) { 20014 return true; 20015 } 20016 } 20017 return false; 20018 } 20019 function injectStyle6(targetDocument, hash, css) { 20020 if (!targetDocument.head) { 20021 return; 20022 } 20023 const runtime = getRuntime6(); 20024 let injectedStyles = runtime.injectedStyles.get(targetDocument); 20025 if (!injectedStyles) { 20026 injectedStyles = /* @__PURE__ */ new Set(); 20027 runtime.injectedStyles.set(targetDocument, injectedStyles); 20028 } 20029 if (injectedStyles.has(hash)) { 20030 return; 20031 } 20032 if (documentContainsStyleHash6(targetDocument, hash)) { 20033 injectedStyles.add(hash); 20034 return; 20035 } 20036 const style = targetDocument.createElement("style"); 20037 style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash); 20038 style.appendChild(targetDocument.createTextNode(css)); 20039 targetDocument.head.appendChild(style); 20040 injectedStyles.add(hash); 20041 } 20042 function registerDocument6(targetDocument) { 20043 const runtime = getRuntime6(); 20044 runtime.documents.set( 20045 targetDocument, 20046 (runtime.documents.get(targetDocument) ?? 0) + 1 20047 ); 20048 for (const [hash, css] of runtime.styles) { 20049 injectStyle6(targetDocument, hash, css); 20050 } 20051 return () => { 20052 const count = runtime.documents.get(targetDocument); 20053 if (count === void 0) { 20054 return; 20055 } 20056 if (count <= 1) { 20057 runtime.documents.delete(targetDocument); 20058 return; 20059 } 20060 runtime.documents.set(targetDocument, count - 1); 20061 }; 20062 } 20063 function registerStyle6(hash, css) { 20064 const runtime = getRuntime6(); 20065 runtime.styles.set(hash, css); 20066 for (const targetDocument of runtime.documents.keys()) { 20067 injectStyle6(targetDocument, hash, css); 20068 } 20069 } 20070 if (typeof process === "undefined" || true) { 20071 registerStyle6("5d38cbdd27", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._02872bf298eadc43__root{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);--wp-ui-card-header-content-gap:var(--wpds-dimension-gap-xl,24px);--wp-ui-card-header-content-margin:calc(var(--wp-ui-card-header-content-gap) - var(--wp-ui-card-padding));background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-direction:column;overflow:clip}._5dffdaf2a6e669ac__content,.bbccc92e6ba5662d__header{padding:var(--wp-ui-card-padding);&:not(:first-child):not(:last-child){padding-block-end:0}}.bbccc92e6ba5662d__header+._5dffdaf2a6e669ac__content{margin-block-start:var(--wp-ui-card-header-content-margin);padding-block-start:0}.c1fa192587e1b4a6__fullbleed{margin-inline:calc(var(--wp-ui-card-padding)*-1);width:calc(100% + var(--wp-ui-card-padding)*2)}._02872bf298eadc43__root>:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):first-child>.c1fa192587e1b4a6__fullbleed:first-child{margin-block-start:calc(var(--wp-ui-card-padding)*-1)}:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):last-child>.c1fa192587e1b4a6__fullbleed:last-child{margin-block-end:calc(var(--wp-ui-card-padding)*-1)}}}"); 20072 } 20073 var style_default6 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; 20074 var Header = (0, import_element20.forwardRef)( 20075 function CardHeader({ render: render5, ...props }, ref) { 20076 const element = useRender({ 20077 defaultTagName: "div", 20078 render: render5, 20079 ref, 20080 props: mergeProps({ className: style_default6.header }, props) 20081 }); 20082 return element; 20083 } 20084 ); 20085 20086 // packages/ui/build-module/card/content.mjs 20087 var import_element21 = __toESM(require_element(), 1); 20088 var STYLE_HASH_ATTRIBUTE7 = "data-wp-hash"; 20089 function getRuntime7() { 20090 const globalScope = globalThis; 20091 if (globalScope.__wpStyleRuntime) { 20092 return globalScope.__wpStyleRuntime; 20093 } 20094 globalScope.__wpStyleRuntime = { 20095 documents: /* @__PURE__ */ new Map(), 20096 styles: /* @__PURE__ */ new Map(), 20097 injectedStyles: /* @__PURE__ */ new WeakMap() 20098 }; 20099 if (typeof document !== "undefined") { 20100 registerDocument7(document); 20101 } 20102 return globalScope.__wpStyleRuntime; 20103 } 20104 function documentContainsStyleHash7(targetDocument, hash) { 20105 if (!targetDocument.head) { 20106 return false; 20107 } 20108 for (const style of targetDocument.head.querySelectorAll( 20109 `style[$STYLE_HASH_ATTRIBUTE7}]` 20110 )) { 20111 if (style.getAttribute(STYLE_HASH_ATTRIBUTE7) === hash) { 20112 return true; 20113 } 20114 } 20115 return false; 20116 } 20117 function injectStyle7(targetDocument, hash, css) { 20118 if (!targetDocument.head) { 20119 return; 20120 } 20121 const runtime = getRuntime7(); 20122 let injectedStyles = runtime.injectedStyles.get(targetDocument); 20123 if (!injectedStyles) { 20124 injectedStyles = /* @__PURE__ */ new Set(); 20125 runtime.injectedStyles.set(targetDocument, injectedStyles); 20126 } 20127 if (injectedStyles.has(hash)) { 20128 return; 20129 } 20130 if (documentContainsStyleHash7(targetDocument, hash)) { 20131 injectedStyles.add(hash); 20132 return; 20133 } 20134 const style = targetDocument.createElement("style"); 20135 style.setAttribute(STYLE_HASH_ATTRIBUTE7, hash); 20136 style.appendChild(targetDocument.createTextNode(css)); 20137 targetDocument.head.appendChild(style); 20138 injectedStyles.add(hash); 20139 } 20140 function registerDocument7(targetDocument) { 20141 const runtime = getRuntime7(); 20142 runtime.documents.set( 20143 targetDocument, 20144 (runtime.documents.get(targetDocument) ?? 0) + 1 20145 ); 20146 for (const [hash, css] of runtime.styles) { 20147 injectStyle7(targetDocument, hash, css); 20148 } 20149 return () => { 20150 const count = runtime.documents.get(targetDocument); 20151 if (count === void 0) { 20152 return; 20153 } 20154 if (count <= 1) { 20155 runtime.documents.delete(targetDocument); 20156 return; 20157 } 20158 runtime.documents.set(targetDocument, count - 1); 20159 }; 20160 } 20161 function registerStyle7(hash, css) { 20162 const runtime = getRuntime7(); 20163 runtime.styles.set(hash, css); 20164 for (const targetDocument of runtime.documents.keys()) { 20165 injectStyle7(targetDocument, hash, css); 20166 } 20167 } 20168 if (typeof process === "undefined" || true) { 20169 registerStyle7("5d38cbdd27", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._02872bf298eadc43__root{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);--wp-ui-card-header-content-gap:var(--wpds-dimension-gap-xl,24px);--wp-ui-card-header-content-margin:calc(var(--wp-ui-card-header-content-gap) - var(--wp-ui-card-padding));background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-direction:column;overflow:clip}._5dffdaf2a6e669ac__content,.bbccc92e6ba5662d__header{padding:var(--wp-ui-card-padding);&:not(:first-child):not(:last-child){padding-block-end:0}}.bbccc92e6ba5662d__header+._5dffdaf2a6e669ac__content{margin-block-start:var(--wp-ui-card-header-content-margin);padding-block-start:0}.c1fa192587e1b4a6__fullbleed{margin-inline:calc(var(--wp-ui-card-padding)*-1);width:calc(100% + var(--wp-ui-card-padding)*2)}._02872bf298eadc43__root>:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):first-child>.c1fa192587e1b4a6__fullbleed:first-child{margin-block-start:calc(var(--wp-ui-card-padding)*-1)}:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):last-child>.c1fa192587e1b4a6__fullbleed:last-child{margin-block-end:calc(var(--wp-ui-card-padding)*-1)}}}"); 20170 } 20171 var style_default7 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; 20172 var Content = (0, import_element21.forwardRef)( 20173 function CardContent({ render: render5, ...props }, ref) { 20174 const element = useRender({ 20175 defaultTagName: "div", 20176 render: render5, 20177 ref, 20178 props: mergeProps({ className: style_default7.content }, props) 20179 }); 20180 return element; 20181 } 20182 ); 20183 20184 // packages/ui/build-module/card/full-bleed.mjs 20185 var import_element22 = __toESM(require_element(), 1); 20186 var STYLE_HASH_ATTRIBUTE8 = "data-wp-hash"; 20187 function getRuntime8() { 20188 const globalScope = globalThis; 20189 if (globalScope.__wpStyleRuntime) { 20190 return globalScope.__wpStyleRuntime; 20191 } 20192 globalScope.__wpStyleRuntime = { 20193 documents: /* @__PURE__ */ new Map(), 20194 styles: /* @__PURE__ */ new Map(), 20195 injectedStyles: /* @__PURE__ */ new WeakMap() 20196 }; 20197 if (typeof document !== "undefined") { 20198 registerDocument8(document); 20199 } 20200 return globalScope.__wpStyleRuntime; 20201 } 20202 function documentContainsStyleHash8(targetDocument, hash) { 20203 if (!targetDocument.head) { 20204 return false; 20205 } 20206 for (const style of targetDocument.head.querySelectorAll( 20207 `style[$STYLE_HASH_ATTRIBUTE8}]` 20208 )) { 20209 if (style.getAttribute(STYLE_HASH_ATTRIBUTE8) === hash) { 20210 return true; 20211 } 20212 } 20213 return false; 20214 } 20215 function injectStyle8(targetDocument, hash, css) { 20216 if (!targetDocument.head) { 20217 return; 20218 } 20219 const runtime = getRuntime8(); 20220 let injectedStyles = runtime.injectedStyles.get(targetDocument); 20221 if (!injectedStyles) { 20222 injectedStyles = /* @__PURE__ */ new Set(); 20223 runtime.injectedStyles.set(targetDocument, injectedStyles); 20224 } 20225 if (injectedStyles.has(hash)) { 20226 return; 20227 } 20228 if (documentContainsStyleHash8(targetDocument, hash)) { 20229 injectedStyles.add(hash); 20230 return; 20231 } 20232 const style = targetDocument.createElement("style"); 20233 style.setAttribute(STYLE_HASH_ATTRIBUTE8, hash); 20234 style.appendChild(targetDocument.createTextNode(css)); 20235 targetDocument.head.appendChild(style); 20236 injectedStyles.add(hash); 20237 } 20238 function registerDocument8(targetDocument) { 20239 const runtime = getRuntime8(); 20240 runtime.documents.set( 20241 targetDocument, 20242 (runtime.documents.get(targetDocument) ?? 0) + 1 20243 ); 20244 for (const [hash, css] of runtime.styles) { 20245 injectStyle8(targetDocument, hash, css); 20246 } 20247 return () => { 20248 const count = runtime.documents.get(targetDocument); 20249 if (count === void 0) { 20250 return; 20251 } 20252 if (count <= 1) { 20253 runtime.documents.delete(targetDocument); 20254 return; 20255 } 20256 runtime.documents.set(targetDocument, count - 1); 20257 }; 20258 } 20259 function registerStyle8(hash, css) { 20260 const runtime = getRuntime8(); 20261 runtime.styles.set(hash, css); 20262 for (const targetDocument of runtime.documents.keys()) { 20263 injectStyle8(targetDocument, hash, css); 20264 } 20265 } 20266 if (typeof process === "undefined" || true) { 20267 registerStyle8("5d38cbdd27", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._02872bf298eadc43__root{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);--wp-ui-card-header-content-gap:var(--wpds-dimension-gap-xl,24px);--wp-ui-card-header-content-margin:calc(var(--wp-ui-card-header-content-gap) - var(--wp-ui-card-padding));background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-direction:column;overflow:clip}._5dffdaf2a6e669ac__content,.bbccc92e6ba5662d__header{padding:var(--wp-ui-card-padding);&:not(:first-child):not(:last-child){padding-block-end:0}}.bbccc92e6ba5662d__header+._5dffdaf2a6e669ac__content{margin-block-start:var(--wp-ui-card-header-content-margin);padding-block-start:0}.c1fa192587e1b4a6__fullbleed{margin-inline:calc(var(--wp-ui-card-padding)*-1);width:calc(100% + var(--wp-ui-card-padding)*2)}._02872bf298eadc43__root>:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):first-child>.c1fa192587e1b4a6__fullbleed:first-child{margin-block-start:calc(var(--wp-ui-card-padding)*-1)}:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):last-child>.c1fa192587e1b4a6__fullbleed:last-child{margin-block-end:calc(var(--wp-ui-card-padding)*-1)}}}"); 20268 } 20269 var style_default8 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; 20270 var FullBleed = (0, import_element22.forwardRef)( 20271 function CardFullBleed({ render: render5, ...props }, ref) { 20272 const element = useRender({ 20273 defaultTagName: "div", 20274 render: render5, 20275 ref, 20276 props: mergeProps( 20277 { className: style_default8.fullbleed }, 20278 props 20279 ) 20280 }); 20281 return element; 20282 } 20283 ); 20284 20285 // packages/ui/build-module/card/title.mjs 20286 var import_element23 = __toESM(require_element(), 1); 20287 var import_jsx_runtime117 = __toESM(require_jsx_runtime(), 1); 20288 var DEFAULT_TAG = /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", {}); 20289 var Title = (0, import_element23.forwardRef)( 20290 function CardTitle({ render: render5 = DEFAULT_TAG, children, ...props }, ref) { 20291 return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)( 20292 Text, 20293 { 20294 ref, 20295 variant: "heading-lg", 20296 render: render5, 20297 ...props, 20298 children 20299 } 20300 ); 20301 } 20302 ); 20303 20304 // packages/ui/build-module/collapsible/panel.mjs 20305 var import_element24 = __toESM(require_element(), 1); 20306 var import_jsx_runtime118 = __toESM(require_jsx_runtime(), 1); 20307 var Panel = (0, import_element24.forwardRef)( 20308 function CollapsiblePanel3(props, forwardedRef) { 20309 return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(index_parts_exports.Panel, { ref: forwardedRef, ...props }); 20310 } 20311 ); 20312 20313 // packages/ui/build-module/collapsible/root.mjs 20314 var import_element25 = __toESM(require_element(), 1); 20315 var import_jsx_runtime119 = __toESM(require_jsx_runtime(), 1); 20316 var Root2 = (0, import_element25.forwardRef)( 20317 function CollapsibleRoot3(props, forwardedRef) { 20318 return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(index_parts_exports.Root, { ref: forwardedRef, ...props }); 20319 } 20320 ); 20321 20322 // packages/ui/build-module/collapsible/trigger.mjs 20323 var import_element26 = __toESM(require_element(), 1); 20324 var import_jsx_runtime120 = __toESM(require_jsx_runtime(), 1); 20325 var Trigger = (0, import_element26.forwardRef)( 20326 function CollapsibleTrigger3(props, forwardedRef) { 20327 return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(index_parts_exports.Trigger, { ref: forwardedRef, ...props }); 20328 } 20329 ); 20330 20331 // packages/ui/build-module/collapsible-card/index.mjs 20332 var collapsible_card_exports = {}; 20333 __export(collapsible_card_exports, { 20334 Content: () => Content2, 20335 Header: () => Header2, 20336 HeaderDescription: () => HeaderDescription, 20337 Root: () => Root3 20338 }); 20339 20340 // packages/ui/build-module/collapsible-card/root.mjs 20341 var import_element27 = __toESM(require_element(), 1); 20342 var import_jsx_runtime121 = __toESM(require_jsx_runtime(), 1); 20343 var Root3 = (0, import_element27.forwardRef)( 20344 function CollapsibleCardRoot({ render: render5, ...restProps }, ref) { 20345 return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)( 20346 Root2, 20347 { 20348 ref, 20349 render: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Root, { render: render5 }), 20350 ...restProps 20351 } 20352 ); 20353 } 20354 ); 20355 20356 // packages/ui/build-module/collapsible-card/header.mjs 20357 var import_element29 = __toESM(require_element(), 1); 20358 20359 // packages/ui/build-module/collapsible-card/context.mjs 20360 var import_element28 = __toESM(require_element(), 1); 20361 var HeaderDescriptionIdContext = (0, import_element28.createContext)({ 20362 setDescriptionId: () => { 20363 } 20364 }); 20365 20366 // packages/ui/build-module/collapsible-card/header.mjs 20367 var import_jsx_runtime122 = __toESM(require_jsx_runtime(), 1); 20368 var STYLE_HASH_ATTRIBUTE9 = "data-wp-hash"; 20369 function getRuntime9() { 20370 const globalScope = globalThis; 20371 if (globalScope.__wpStyleRuntime) { 20372 return globalScope.__wpStyleRuntime; 20373 } 20374 globalScope.__wpStyleRuntime = { 20375 documents: /* @__PURE__ */ new Map(), 20376 styles: /* @__PURE__ */ new Map(), 20377 injectedStyles: /* @__PURE__ */ new WeakMap() 20378 }; 20379 if (typeof document !== "undefined") { 20380 registerDocument9(document); 20381 } 20382 return globalScope.__wpStyleRuntime; 20383 } 20384 function documentContainsStyleHash9(targetDocument, hash) { 20385 if (!targetDocument.head) { 20386 return false; 20387 } 20388 for (const style of targetDocument.head.querySelectorAll( 20389 `style[$STYLE_HASH_ATTRIBUTE9}]` 20390 )) { 20391 if (style.getAttribute(STYLE_HASH_ATTRIBUTE9) === hash) { 20392 return true; 20393 } 20394 } 20395 return false; 20396 } 20397 function injectStyle9(targetDocument, hash, css) { 20398 if (!targetDocument.head) { 20399 return; 20400 } 20401 const runtime = getRuntime9(); 20402 let injectedStyles = runtime.injectedStyles.get(targetDocument); 20403 if (!injectedStyles) { 20404 injectedStyles = /* @__PURE__ */ new Set(); 20405 runtime.injectedStyles.set(targetDocument, injectedStyles); 20406 } 20407 if (injectedStyles.has(hash)) { 20408 return; 20409 } 20410 if (documentContainsStyleHash9(targetDocument, hash)) { 20411 injectedStyles.add(hash); 20412 return; 20413 } 20414 const style = targetDocument.createElement("style"); 20415 style.setAttribute(STYLE_HASH_ATTRIBUTE9, hash); 20416 style.appendChild(targetDocument.createTextNode(css)); 20417 targetDocument.head.appendChild(style); 20418 injectedStyles.add(hash); 20419 } 20420 function registerDocument9(targetDocument) { 20421 const runtime = getRuntime9(); 20422 runtime.documents.set( 20423 targetDocument, 20424 (runtime.documents.get(targetDocument) ?? 0) + 1 20425 ); 20426 for (const [hash, css] of runtime.styles) { 20427 injectStyle9(targetDocument, hash, css); 20428 } 20429 return () => { 20430 const count = runtime.documents.get(targetDocument); 20431 if (count === void 0) { 20432 return; 20433 } 20434 if (count <= 1) { 20435 runtime.documents.delete(targetDocument); 20436 return; 20437 } 20438 runtime.documents.set(targetDocument, count - 1); 20439 }; 20440 } 20441 function registerStyle9(hash, css) { 20442 const runtime = getRuntime9(); 20443 runtime.styles.set(hash, css); 20444 for (const targetDocument of runtime.documents.keys()) { 20445 injectStyle9(targetDocument, hash, css); 20446 } 20447 } 20448 if (typeof process === "undefined" || true) { 20449 registerStyle9("78199613cf", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._626190151275d6d3__heading-wrapper{--_gcd-heading-color:inherit;--_gcd-heading-font-size:inherit;--_gcd-heading-font-weight:inherit;--_gcd-heading-margin:0;font-family:inherit;line-height:inherit}.cab17c7a373cb60d__header-content{flex:1;min-width:0}.dd89d27c4f15912d__header-trigger-positioner{align-self:center;flex-shrink:0;max-height:0;overflow:visible}.bcfab5f2448bafef__header-trigger-wrapper{border-radius:var(--wpds-border-radius-sm,2px);display:flex;translate:0 -50%}._3106f8d2b0330faa__header-trigger{@media not (prefers-reduced-motion){transition:rotate .15s ease-out}}._5d2dfcb4085c6d0f__header[data-panel-open] ._3106f8d2b0330faa__header-trigger{rotate:180deg}._5d2dfcb4085c6d0f__header[data-disabled] ._3106f8d2b0330faa__header-trigger{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}.e34cf37ccd0d81e0__content{height:var(--collapsible-panel-height);margin-block-start:var(--wp-ui-card-header-content-margin);overflow:hidden;&._03cfdbcd710393c9__overflow-visible{overflow:visible}&[hidden]:not([hidden=until-found]){display:none}&[data-ending-style],&[data-starting-style]{height:0}@media not (prefers-reduced-motion){transition:all .15s ease-out}}}@layer compositions{._41bfdbf7b6c087c2__content-inner{padding-block-start:0}._5d2dfcb4085c6d0f__header{align-items:stretch;display:flex;flex-direction:row;gap:var(--wpds-dimension-gap-sm,8px);outline:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}}}}"); 20450 } 20451 var style_default9 = { "heading-wrapper": "_626190151275d6d3__heading-wrapper", "header-content": "cab17c7a373cb60d__header-content", "header-trigger-positioner": "dd89d27c4f15912d__header-trigger-positioner", "header-trigger-wrapper": "bcfab5f2448bafef__header-trigger-wrapper", "header-trigger": "_3106f8d2b0330faa__header-trigger", "header": "_5d2dfcb4085c6d0f__header", "content": "e34cf37ccd0d81e0__content", "overflow-visible": "_03cfdbcd710393c9__overflow-visible", "content-inner": "_41bfdbf7b6c087c2__content-inner" }; 20452 if (typeof process === "undefined" || true) { 20453 registerStyle9("af6d9984a6", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-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))}&::placeholder{color:var(--_gcd-input-placeholder-color,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)}"); 20454 } 20455 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" }; 20456 if (typeof process === "undefined" || true) { 20457 registerStyle9("da99a163ac", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._08e8a2e44959f892__outset-ring--focus:focus,.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._970d04df7376df67__outset-ring--focus-within-except-active:focus-within,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus{outline:none}._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active){@include mixins.focus-ring()}}}"); 20458 } 20459 var focus_default2 = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active" }; 20460 var Header2 = (0, import_element29.forwardRef)( 20461 function CollapsibleCardHeader({ children, className, render: render5, ...restProps }, ref) { 20462 const [descriptionId, setDescriptionId] = (0, import_element29.useState)(); 20463 const contextValue = (0, import_element29.useMemo)( 20464 () => ({ setDescriptionId }), 20465 [setDescriptionId] 20466 ); 20467 return useRender({ 20468 defaultTagName: "div", 20469 render: render5, 20470 ref, 20471 props: mergeProps(restProps, { 20472 className: clsx_default( 20473 global_css_defense_default3.heading, 20474 style_default9["heading-wrapper"], 20475 className 20476 ), 20477 children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(HeaderDescriptionIdContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)( 20478 Trigger, 20479 { 20480 className: style_default9.header, 20481 render: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Header, {}), 20482 nativeButton: false, 20483 "aria-describedby": descriptionId, 20484 children: [ 20485 /* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { className: style_default9["header-content"], children }), 20486 /* @__PURE__ */ (0, import_jsx_runtime122.jsx)( 20487 "div", 20488 { 20489 className: clsx_default( 20490 style_default9["header-trigger-positioner"] 20491 ), 20492 children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)( 20493 "div", 20494 { 20495 className: clsx_default( 20496 style_default9["header-trigger-wrapper"], 20497 global_css_defense_default3.div, 20498 // While the interactive trigger element is the whole header, 20499 // the focus ring will be displayed only on the icon to visually 20500 // emulate it being the button. 20501 focus_default2["outset-ring--focus-parent-visible"] 20502 ), 20503 children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)( 20504 Icon, 20505 { 20506 icon: chevron_down_default, 20507 className: style_default9["header-trigger"] 20508 } 20509 ) 20510 } 20511 ) 20512 } 20513 ) 20514 ] 20515 } 20516 ) }) 20517 }) 20518 }); 20519 } 20520 ); 20521 20522 // packages/ui/build-module/collapsible-card/header-description.mjs 20523 var import_element30 = __toESM(require_element(), 1); 20524 var import_jsx_runtime123 = __toESM(require_jsx_runtime(), 1); 20525 var HeaderDescription = (0, import_element30.forwardRef)(function CollapsibleCardHeaderDescription({ children, className, ...restProps }, ref) { 20526 const descriptionId = (0, import_element30.useId)(); 20527 const { setDescriptionId } = (0, import_element30.useContext)(HeaderDescriptionIdContext); 20528 (0, import_element30.useEffect)(() => { 20529 setDescriptionId(descriptionId); 20530 return () => setDescriptionId(void 0); 20531 }, [descriptionId, setDescriptionId]); 20532 return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)( 20533 "div", 20534 { 20535 ref, 20536 id: descriptionId, 20537 "aria-hidden": "true", 20538 className, 20539 ...restProps, 20540 children 20541 } 20542 ); 20543 }); 20544 20545 // packages/ui/build-module/collapsible-card/content.mjs 20546 var import_element31 = __toESM(require_element(), 1); 20547 var import_jsx_runtime124 = __toESM(require_jsx_runtime(), 1); 20548 var STYLE_HASH_ATTRIBUTE10 = "data-wp-hash"; 20549 function getRuntime10() { 20550 const globalScope = globalThis; 20551 if (globalScope.__wpStyleRuntime) { 20552 return globalScope.__wpStyleRuntime; 20553 } 20554 globalScope.__wpStyleRuntime = { 20555 documents: /* @__PURE__ */ new Map(), 20556 styles: /* @__PURE__ */ new Map(), 20557 injectedStyles: /* @__PURE__ */ new WeakMap() 20558 }; 20559 if (typeof document !== "undefined") { 20560 registerDocument10(document); 20561 } 20562 return globalScope.__wpStyleRuntime; 20563 } 20564 function documentContainsStyleHash10(targetDocument, hash) { 20565 if (!targetDocument.head) { 20566 return false; 20567 } 20568 for (const style of targetDocument.head.querySelectorAll( 20569 `style[$STYLE_HASH_ATTRIBUTE10}]` 20570 )) { 20571 if (style.getAttribute(STYLE_HASH_ATTRIBUTE10) === hash) { 20572 return true; 20573 } 20574 } 20575 return false; 20576 } 20577 function injectStyle10(targetDocument, hash, css) { 20578 if (!targetDocument.head) { 20579 return; 20580 } 20581 const runtime = getRuntime10(); 20582 let injectedStyles = runtime.injectedStyles.get(targetDocument); 20583 if (!injectedStyles) { 20584 injectedStyles = /* @__PURE__ */ new Set(); 20585 runtime.injectedStyles.set(targetDocument, injectedStyles); 20586 } 20587 if (injectedStyles.has(hash)) { 20588 return; 20589 } 20590 if (documentContainsStyleHash10(targetDocument, hash)) { 20591 injectedStyles.add(hash); 20592 return; 20593 } 20594 const style = targetDocument.createElement("style"); 20595 style.setAttribute(STYLE_HASH_ATTRIBUTE10, hash); 20596 style.appendChild(targetDocument.createTextNode(css)); 20597 targetDocument.head.appendChild(style); 20598 injectedStyles.add(hash); 20599 } 20600 function registerDocument10(targetDocument) { 20601 const runtime = getRuntime10(); 20602 runtime.documents.set( 20603 targetDocument, 20604 (runtime.documents.get(targetDocument) ?? 0) + 1 20605 ); 20606 for (const [hash, css] of runtime.styles) { 20607 injectStyle10(targetDocument, hash, css); 20608 } 20609 return () => { 20610 const count = runtime.documents.get(targetDocument); 20611 if (count === void 0) { 20612 return; 20613 } 20614 if (count <= 1) { 20615 runtime.documents.delete(targetDocument); 20616 return; 20617 } 20618 runtime.documents.set(targetDocument, count - 1); 20619 }; 20620 } 20621 function registerStyle10(hash, css) { 20622 const runtime = getRuntime10(); 20623 runtime.styles.set(hash, css); 20624 for (const targetDocument of runtime.documents.keys()) { 20625 injectStyle10(targetDocument, hash, css); 20626 } 20627 } 20628 if (typeof process === "undefined" || true) { 20629 registerStyle10("78199613cf", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._626190151275d6d3__heading-wrapper{--_gcd-heading-color:inherit;--_gcd-heading-font-size:inherit;--_gcd-heading-font-weight:inherit;--_gcd-heading-margin:0;font-family:inherit;line-height:inherit}.cab17c7a373cb60d__header-content{flex:1;min-width:0}.dd89d27c4f15912d__header-trigger-positioner{align-self:center;flex-shrink:0;max-height:0;overflow:visible}.bcfab5f2448bafef__header-trigger-wrapper{border-radius:var(--wpds-border-radius-sm,2px);display:flex;translate:0 -50%}._3106f8d2b0330faa__header-trigger{@media not (prefers-reduced-motion){transition:rotate .15s ease-out}}._5d2dfcb4085c6d0f__header[data-panel-open] ._3106f8d2b0330faa__header-trigger{rotate:180deg}._5d2dfcb4085c6d0f__header[data-disabled] ._3106f8d2b0330faa__header-trigger{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}.e34cf37ccd0d81e0__content{height:var(--collapsible-panel-height);margin-block-start:var(--wp-ui-card-header-content-margin);overflow:hidden;&._03cfdbcd710393c9__overflow-visible{overflow:visible}&[hidden]:not([hidden=until-found]){display:none}&[data-ending-style],&[data-starting-style]{height:0}@media not (prefers-reduced-motion){transition:all .15s ease-out}}}@layer compositions{._41bfdbf7b6c087c2__content-inner{padding-block-start:0}._5d2dfcb4085c6d0f__header{align-items:stretch;display:flex;flex-direction:row;gap:var(--wpds-dimension-gap-sm,8px);outline:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}}}}"); 20630 } 20631 var style_default10 = { "heading-wrapper": "_626190151275d6d3__heading-wrapper", "header-content": "cab17c7a373cb60d__header-content", "header-trigger-positioner": "dd89d27c4f15912d__header-trigger-positioner", "header-trigger-wrapper": "bcfab5f2448bafef__header-trigger-wrapper", "header-trigger": "_3106f8d2b0330faa__header-trigger", "header": "_5d2dfcb4085c6d0f__header", "content": "e34cf37ccd0d81e0__content", "overflow-visible": "_03cfdbcd710393c9__overflow-visible", "content-inner": "_41bfdbf7b6c087c2__content-inner" }; 20632 var Content2 = (0, import_element31.forwardRef)( 20633 function CollapsibleCardContent({ className, render: render5, children, hiddenUntilFound = true, ...restProps }, ref) { 20634 return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 20635 Panel, 20636 { 20637 ref, 20638 className: (state2) => clsx_default( 20639 style_default10.content, 20640 state2.open && state2.transitionStatus === "idle" && style_default10["overflow-visible"], 20641 className 20642 ), 20643 hiddenUntilFound, 20644 ...restProps, 20645 children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 20646 Content, 20647 { 20648 className: style_default10["content-inner"], 20649 render: render5, 20650 children 20651 } 20652 ) 20653 } 20654 ); 20655 } 20656 ); 20657 20658 // packages/ui/build-module/utils/render-slot-with-children.mjs 20659 var import_element32 = __toESM(require_element(), 1); 20660 function renderSlotWithChildren(slot, defaultSlot, children) { 20661 return (0, import_element32.cloneElement)(slot ?? defaultSlot, { children }); 20662 } 20663 20664 // packages/ui/build-module/utils/theme-provider.mjs 20665 var theme = __toESM(require_theme(), 1); 20666 20667 // packages/ui/build-module/lock-unlock.mjs 20668 var import_private_apis5 = __toESM(require_private_apis(), 1); 20669 var { lock: lock4, unlock: unlock4 } = (0, import_private_apis5.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 20670 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 20671 "@wordpress/ui" 20672 ); 20673 20674 // packages/ui/build-module/utils/theme-provider.mjs 20675 function getThemeProvider() { 20676 const themePackage = theme; 20677 if (themePackage.ThemeProvider) { 20678 return themePackage.ThemeProvider; 20679 } 20680 if (!themePackage.privateApis) { 20681 throw new Error( 20682 "@wordpress/ui: @wordpress/theme must expose `ThemeProvider` or `privateApis.ThemeProvider`." 20683 ); 20684 } 20685 return unlock4( 20686 themePackage.privateApis 20687 ).ThemeProvider; 20688 } 20689 var ThemeProvider = getThemeProvider(); 20690 20691 // packages/ui/build-module/stack/stack.mjs 20692 var import_element33 = __toESM(require_element(), 1); 20693 var STYLE_HASH_ATTRIBUTE11 = "data-wp-hash"; 20694 function getRuntime11() { 20695 const globalScope = globalThis; 20696 if (globalScope.__wpStyleRuntime) { 20697 return globalScope.__wpStyleRuntime; 20698 } 20699 globalScope.__wpStyleRuntime = { 20700 documents: /* @__PURE__ */ new Map(), 20701 styles: /* @__PURE__ */ new Map(), 20702 injectedStyles: /* @__PURE__ */ new WeakMap() 20703 }; 20704 if (typeof document !== "undefined") { 20705 registerDocument11(document); 20706 } 20707 return globalScope.__wpStyleRuntime; 20708 } 20709 function documentContainsStyleHash11(targetDocument, hash) { 20710 if (!targetDocument.head) { 20711 return false; 20712 } 20713 for (const style of targetDocument.head.querySelectorAll( 20714 `style[$STYLE_HASH_ATTRIBUTE11}]` 20715 )) { 20716 if (style.getAttribute(STYLE_HASH_ATTRIBUTE11) === hash) { 20717 return true; 20718 } 20719 } 20720 return false; 20721 } 20722 function injectStyle11(targetDocument, hash, css) { 20723 if (!targetDocument.head) { 20724 return; 20725 } 20726 const runtime = getRuntime11(); 20727 let injectedStyles = runtime.injectedStyles.get(targetDocument); 20728 if (!injectedStyles) { 20729 injectedStyles = /* @__PURE__ */ new Set(); 20730 runtime.injectedStyles.set(targetDocument, injectedStyles); 20731 } 20732 if (injectedStyles.has(hash)) { 20733 return; 20734 } 20735 if (documentContainsStyleHash11(targetDocument, hash)) { 20736 injectedStyles.add(hash); 20737 return; 20738 } 20739 const style = targetDocument.createElement("style"); 20740 style.setAttribute(STYLE_HASH_ATTRIBUTE11, hash); 20741 style.appendChild(targetDocument.createTextNode(css)); 20742 targetDocument.head.appendChild(style); 20743 injectedStyles.add(hash); 20744 } 20745 function registerDocument11(targetDocument) { 20746 const runtime = getRuntime11(); 20747 runtime.documents.set( 20748 targetDocument, 20749 (runtime.documents.get(targetDocument) ?? 0) + 1 20750 ); 20751 for (const [hash, css] of runtime.styles) { 20752 injectStyle11(targetDocument, hash, css); 20753 } 20754 return () => { 20755 const count = runtime.documents.get(targetDocument); 20756 if (count === void 0) { 20757 return; 20758 } 20759 if (count <= 1) { 20760 runtime.documents.delete(targetDocument); 20761 return; 20762 } 20763 runtime.documents.set(targetDocument, count - 1); 20764 }; 20765 } 20766 function registerStyle11(hash, css) { 20767 const runtime = getRuntime11(); 20768 runtime.styles.set(hash, css); 20769 for (const targetDocument of runtime.documents.keys()) { 20770 injectStyle11(targetDocument, hash, css); 20771 } 20772 } 20773 if (typeof process === "undefined" || true) { 20774 registerStyle11("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}"); 20775 } 20776 var style_default11 = { "stack": "_19ce0419607e1896__stack" }; 20777 var gapTokens = { 20778 xs: "var(--wpds-dimension-gap-xs, 4px)", 20779 sm: "var(--wpds-dimension-gap-sm, 8px)", 20780 md: "var(--wpds-dimension-gap-md, 12px)", 20781 lg: "var(--wpds-dimension-gap-lg, 16px)", 20782 xl: "var(--wpds-dimension-gap-xl, 24px)", 20783 "2xl": "var(--wpds-dimension-gap-2xl, 32px)", 20784 "3xl": "var(--wpds-dimension-gap-3xl, 40px)" 20785 }; 20786 var Stack = (0, import_element33.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render: render5, ...props }, ref) { 20787 const style = { 20788 gap: gap && gapTokens[gap], 20789 alignItems: align, 20790 justifyContent: justify, 20791 flexDirection: direction, 20792 flexWrap: wrap 20793 }; 20794 const element = useRender({ 20795 render: render5, 20796 ref, 20797 props: mergeProps(props, { style, className: style_default11.stack }) 20798 }); 20799 return element; 20800 }); 20801 20802 // packages/ui/build-module/tooltip/index.mjs 20803 var tooltip_exports = {}; 20804 __export(tooltip_exports, { 20805 Popup: () => Popup, 20806 Portal: () => Portal, 20807 Positioner: () => Positioner, 20808 Provider: () => Provider, 20809 Root: () => Root4, 20810 Trigger: () => Trigger2 20811 }); 20812 20813 // packages/ui/build-module/tooltip/popup.mjs 20814 var import_element36 = __toESM(require_element(), 1); 20815 20816 // packages/ui/build-module/tooltip/portal.mjs 20817 var import_element34 = __toESM(require_element(), 1); 20818 20819 // packages/ui/build-module/utils/wp-compat-overlay-slot.mjs 20820 var STYLE_HASH_ATTRIBUTE12 = "data-wp-hash"; 20821 function getRuntime12() { 20822 const globalScope = globalThis; 20823 if (globalScope.__wpStyleRuntime) { 20824 return globalScope.__wpStyleRuntime; 20825 } 20826 globalScope.__wpStyleRuntime = { 20827 documents: /* @__PURE__ */ new Map(), 20828 styles: /* @__PURE__ */ new Map(), 20829 injectedStyles: /* @__PURE__ */ new WeakMap() 20830 }; 20831 if (typeof document !== "undefined") { 20832 registerDocument12(document); 20833 } 20834 return globalScope.__wpStyleRuntime; 20835 } 20836 function documentContainsStyleHash12(targetDocument, hash) { 20837 if (!targetDocument.head) { 20838 return false; 20839 } 20840 for (const style of targetDocument.head.querySelectorAll( 20841 `style[$STYLE_HASH_ATTRIBUTE12}]` 20842 )) { 20843 if (style.getAttribute(STYLE_HASH_ATTRIBUTE12) === hash) { 20844 return true; 20845 } 20846 } 20847 return false; 20848 } 20849 function injectStyle12(targetDocument, hash, css) { 20850 if (!targetDocument.head) { 20851 return; 20852 } 20853 const runtime = getRuntime12(); 20854 let injectedStyles = runtime.injectedStyles.get(targetDocument); 20855 if (!injectedStyles) { 20856 injectedStyles = /* @__PURE__ */ new Set(); 20857 runtime.injectedStyles.set(targetDocument, injectedStyles); 20858 } 20859 if (injectedStyles.has(hash)) { 20860 return; 20861 } 20862 if (documentContainsStyleHash12(targetDocument, hash)) { 20863 injectedStyles.add(hash); 20864 return; 20865 } 20866 const style = targetDocument.createElement("style"); 20867 style.setAttribute(STYLE_HASH_ATTRIBUTE12, hash); 20868 style.appendChild(targetDocument.createTextNode(css)); 20869 targetDocument.head.appendChild(style); 20870 injectedStyles.add(hash); 20871 } 20872 function registerDocument12(targetDocument) { 20873 const runtime = getRuntime12(); 20874 runtime.documents.set( 20875 targetDocument, 20876 (runtime.documents.get(targetDocument) ?? 0) + 1 20877 ); 20878 for (const [hash, css] of runtime.styles) { 20879 injectStyle12(targetDocument, hash, css); 20880 } 20881 return () => { 20882 const count = runtime.documents.get(targetDocument); 20883 if (count === void 0) { 20884 return; 20885 } 20886 if (count <= 1) { 20887 runtime.documents.delete(targetDocument); 20888 return; 20889 } 20890 runtime.documents.set(targetDocument, count - 1); 20891 }; 20892 } 20893 function registerStyle12(hash, css) { 20894 const runtime = getRuntime12(); 20895 runtime.styles.set(hash, css); 20896 for (const targetDocument of runtime.documents.keys()) { 20897 injectStyle12(targetDocument, hash, css); 20898 } 20899 } 20900 if (typeof process === "undefined" || true) { 20901 registerStyle12("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}}}"); 20902 } 20903 var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" }; 20904 var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot"; 20905 function resolveOwnerDocument() { 20906 return typeof document === "undefined" ? null : document; 20907 } 20908 function isInWordPressEnvironment() { 20909 let topWp; 20910 try { 20911 topWp = window.top?.wp; 20912 } catch { 20913 } 20914 const wp = topWp ?? window.wp; 20915 return typeof wp?.components === "object" && wp.components !== null; 20916 } 20917 var cachedSlot = null; 20918 function ensureSlotIsAccessible(element) { 20919 element.setAttribute("aria-hidden", "false"); 20920 return element; 20921 } 20922 function createSlot(ownerDocument2) { 20923 const element = ownerDocument2.createElement("div"); 20924 element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, ""); 20925 if (wp_compat_overlay_slot_default.slot) { 20926 element.classList.add(wp_compat_overlay_slot_default.slot); 20927 } 20928 ownerDocument2.body.appendChild(element); 20929 return element; 20930 } 20931 function getWpCompatOverlaySlot() { 20932 if (typeof window === "undefined") { 20933 return void 0; 20934 } 20935 if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) { 20936 return void 0; 20937 } 20938 const ownerDocument2 = resolveOwnerDocument(); 20939 if (!ownerDocument2 || !ownerDocument2.body) { 20940 return void 0; 20941 } 20942 if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) { 20943 return ensureSlotIsAccessible(cachedSlot); 20944 } 20945 const existing = ownerDocument2.querySelector( 20946 `[$WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]` 20947 ); 20948 if (existing instanceof HTMLDivElement) { 20949 cachedSlot = ensureSlotIsAccessible(existing); 20950 return cachedSlot; 20951 } 20952 if (cachedSlot?.isConnected) { 20953 cachedSlot.remove(); 20954 } 20955 cachedSlot = ensureSlotIsAccessible(createSlot(ownerDocument2)); 20956 return cachedSlot; 20957 } 20958 20959 // packages/ui/build-module/tooltip/portal.mjs 20960 var import_jsx_runtime125 = __toESM(require_jsx_runtime(), 1); 20961 var Portal = (0, import_element34.forwardRef)( 20962 function TooltipPortal3({ container, ...restProps }, ref) { 20963 return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)( 20964 index_parts_exports3.Portal, 20965 { 20966 container: container ?? getWpCompatOverlaySlot(), 20967 ...restProps, 20968 ref 20969 } 20970 ); 20971 } 20972 ); 20973 20974 // packages/ui/build-module/tooltip/positioner.mjs 20975 var import_element35 = __toESM(require_element(), 1); 20976 var import_jsx_runtime126 = __toESM(require_jsx_runtime(), 1); 20977 var STYLE_HASH_ATTRIBUTE13 = "data-wp-hash"; 20978 function getRuntime13() { 20979 const globalScope = globalThis; 20980 if (globalScope.__wpStyleRuntime) { 20981 return globalScope.__wpStyleRuntime; 20982 } 20983 globalScope.__wpStyleRuntime = { 20984 documents: /* @__PURE__ */ new Map(), 20985 styles: /* @__PURE__ */ new Map(), 20986 injectedStyles: /* @__PURE__ */ new WeakMap() 20987 }; 20988 if (typeof document !== "undefined") { 20989 registerDocument13(document); 20990 } 20991 return globalScope.__wpStyleRuntime; 20992 } 20993 function documentContainsStyleHash13(targetDocument, hash) { 20994 if (!targetDocument.head) { 20995 return false; 20996 } 20997 for (const style of targetDocument.head.querySelectorAll( 20998 `style[$STYLE_HASH_ATTRIBUTE13}]` 20999 )) { 21000 if (style.getAttribute(STYLE_HASH_ATTRIBUTE13) === hash) { 21001 return true; 21002 } 21003 } 21004 return false; 21005 } 21006 function injectStyle13(targetDocument, hash, css) { 21007 if (!targetDocument.head) { 21008 return; 21009 } 21010 const runtime = getRuntime13(); 21011 let injectedStyles = runtime.injectedStyles.get(targetDocument); 21012 if (!injectedStyles) { 21013 injectedStyles = /* @__PURE__ */ new Set(); 21014 runtime.injectedStyles.set(targetDocument, injectedStyles); 21015 } 21016 if (injectedStyles.has(hash)) { 21017 return; 21018 } 21019 if (documentContainsStyleHash13(targetDocument, hash)) { 21020 injectedStyles.add(hash); 21021 return; 21022 } 21023 const style = targetDocument.createElement("style"); 21024 style.setAttribute(STYLE_HASH_ATTRIBUTE13, hash); 21025 style.appendChild(targetDocument.createTextNode(css)); 21026 targetDocument.head.appendChild(style); 21027 injectedStyles.add(hash); 21028 } 21029 function registerDocument13(targetDocument) { 21030 const runtime = getRuntime13(); 21031 runtime.documents.set( 21032 targetDocument, 21033 (runtime.documents.get(targetDocument) ?? 0) + 1 21034 ); 21035 for (const [hash, css] of runtime.styles) { 21036 injectStyle13(targetDocument, hash, css); 21037 } 21038 return () => { 21039 const count = runtime.documents.get(targetDocument); 21040 if (count === void 0) { 21041 return; 21042 } 21043 if (count <= 1) { 21044 runtime.documents.delete(targetDocument); 21045 return; 21046 } 21047 runtime.documents.set(targetDocument, count - 1); 21048 }; 21049 } 21050 function registerStyle13(hash, css) { 21051 const runtime = getRuntime13(); 21052 runtime.styles.set(hash, css); 21053 for (const targetDocument of runtime.documents.keys()) { 21054 injectStyle13(targetDocument, hash, css); 21055 } 21056 } 21057 if (typeof process === "undefined" || true) { 21058 registerStyle13("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 21059 } 21060 var resets_default3 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 21061 if (typeof process === "undefined" || true) { 21062 registerStyle13("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}}}}'); 21063 } 21064 var style_default12 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 21065 var Positioner = (0, import_element35.forwardRef)( 21066 function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) { 21067 return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)( 21068 index_parts_exports3.Positioner, 21069 { 21070 ref, 21071 align, 21072 side, 21073 sideOffset, 21074 ...props, 21075 className: clsx_default( 21076 resets_default3["box-sizing"], 21077 style_default12.positioner, 21078 className 21079 ) 21080 } 21081 ); 21082 } 21083 ); 21084 21085 // packages/ui/build-module/tooltip/popup.mjs 21086 var import_jsx_runtime127 = __toESM(require_jsx_runtime(), 1); 21087 var STYLE_HASH_ATTRIBUTE14 = "data-wp-hash"; 21088 function getRuntime14() { 21089 const globalScope = globalThis; 21090 if (globalScope.__wpStyleRuntime) { 21091 return globalScope.__wpStyleRuntime; 21092 } 21093 globalScope.__wpStyleRuntime = { 21094 documents: /* @__PURE__ */ new Map(), 21095 styles: /* @__PURE__ */ new Map(), 21096 injectedStyles: /* @__PURE__ */ new WeakMap() 21097 }; 21098 if (typeof document !== "undefined") { 21099 registerDocument14(document); 21100 } 21101 return globalScope.__wpStyleRuntime; 21102 } 21103 function documentContainsStyleHash14(targetDocument, hash) { 21104 if (!targetDocument.head) { 21105 return false; 21106 } 21107 for (const style of targetDocument.head.querySelectorAll( 21108 `style[$STYLE_HASH_ATTRIBUTE14}]` 21109 )) { 21110 if (style.getAttribute(STYLE_HASH_ATTRIBUTE14) === hash) { 21111 return true; 21112 } 21113 } 21114 return false; 21115 } 21116 function injectStyle14(targetDocument, hash, css) { 21117 if (!targetDocument.head) { 21118 return; 21119 } 21120 const runtime = getRuntime14(); 21121 let injectedStyles = runtime.injectedStyles.get(targetDocument); 21122 if (!injectedStyles) { 21123 injectedStyles = /* @__PURE__ */ new Set(); 21124 runtime.injectedStyles.set(targetDocument, injectedStyles); 21125 } 21126 if (injectedStyles.has(hash)) { 21127 return; 21128 } 21129 if (documentContainsStyleHash14(targetDocument, hash)) { 21130 injectedStyles.add(hash); 21131 return; 21132 } 21133 const style = targetDocument.createElement("style"); 21134 style.setAttribute(STYLE_HASH_ATTRIBUTE14, hash); 21135 style.appendChild(targetDocument.createTextNode(css)); 21136 targetDocument.head.appendChild(style); 21137 injectedStyles.add(hash); 21138 } 21139 function registerDocument14(targetDocument) { 21140 const runtime = getRuntime14(); 21141 runtime.documents.set( 21142 targetDocument, 21143 (runtime.documents.get(targetDocument) ?? 0) + 1 21144 ); 21145 for (const [hash, css] of runtime.styles) { 21146 injectStyle14(targetDocument, hash, css); 21147 } 21148 return () => { 21149 const count = runtime.documents.get(targetDocument); 21150 if (count === void 0) { 21151 return; 21152 } 21153 if (count <= 1) { 21154 runtime.documents.delete(targetDocument); 21155 return; 21156 } 21157 runtime.documents.set(targetDocument, count - 1); 21158 }; 21159 } 21160 function registerStyle14(hash, css) { 21161 const runtime = getRuntime14(); 21162 runtime.styles.set(hash, css); 21163 for (const targetDocument of runtime.documents.keys()) { 21164 injectStyle14(targetDocument, hash, css); 21165 } 21166 } 21167 if (typeof process === "undefined" || true) { 21168 registerStyle14("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}}}}'); 21169 } 21170 var style_default13 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 21171 var POPUP_COLOR = { background: "#1e1e1e" }; 21172 var Popup = (0, import_element36.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) { 21173 const popupContent = /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 21174 index_parts_exports3.Popup, 21175 { 21176 ref, 21177 className: clsx_default(style_default13.popup, className), 21178 ...props, 21179 children 21180 } 21181 ) }); 21182 const positionedPopup = renderSlotWithChildren( 21183 positioner, 21184 /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(Positioner, {}), 21185 popupContent 21186 ); 21187 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(Portal, {}), positionedPopup); 21188 }); 21189 21190 // packages/ui/build-module/tooltip/trigger.mjs 21191 var import_element37 = __toESM(require_element(), 1); 21192 var import_jsx_runtime128 = __toESM(require_jsx_runtime(), 1); 21193 var Trigger2 = (0, import_element37.forwardRef)( 21194 function TooltipTrigger3(props, ref) { 21195 return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(index_parts_exports3.Trigger, { ref, ...props }); 21196 } 21197 ); 21198 21199 // packages/ui/build-module/tooltip/root.mjs 21200 var import_jsx_runtime129 = __toESM(require_jsx_runtime(), 1); 21201 function Root4(props) { 21202 return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(index_parts_exports3.Root, { ...props }); 21203 } 21204 21205 // packages/ui/build-module/tooltip/provider.mjs 21206 var import_jsx_runtime130 = __toESM(require_jsx_runtime(), 1); 21207 function Provider({ ...props }) { 21208 return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(index_parts_exports3.Provider, { ...props }); 21209 } 21210 21211 // packages/ui/build-module/utils/use-schedule-validation.mjs 21212 var import_element38 = __toESM(require_element(), 1); 21213 function useScheduleValidation(validate) { 21214 const validateRef = (0, import_element38.useRef)(validate); 21215 validateRef.current = validate; 21216 const timerRef = (0, import_element38.useRef)(null); 21217 const unmountedRef = (0, import_element38.useRef)(false); 21218 const scheduleValidation = (0, import_element38.useCallback)(() => { 21219 if (unmountedRef.current) { 21220 return; 21221 } 21222 if (timerRef.current) { 21223 clearTimeout(timerRef.current); 21224 } 21225 timerRef.current = setTimeout(() => { 21226 validateRef.current(); 21227 timerRef.current = null; 21228 }, 0); 21229 }, []); 21230 (0, import_element38.useEffect)(() => { 21231 unmountedRef.current = false; 21232 return () => { 21233 unmountedRef.current = true; 21234 if (timerRef.current) { 21235 clearTimeout(timerRef.current); 21236 } 21237 }; 21238 }, []); 21239 return scheduleValidation; 21240 } 21241 21242 // packages/ui/build-module/visually-hidden/visually-hidden.mjs 21243 var import_element39 = __toESM(require_element(), 1); 21244 var STYLE_HASH_ATTRIBUTE15 = "data-wp-hash"; 21245 function getRuntime15() { 21246 const globalScope = globalThis; 21247 if (globalScope.__wpStyleRuntime) { 21248 return globalScope.__wpStyleRuntime; 21249 } 21250 globalScope.__wpStyleRuntime = { 21251 documents: /* @__PURE__ */ new Map(), 21252 styles: /* @__PURE__ */ new Map(), 21253 injectedStyles: /* @__PURE__ */ new WeakMap() 21254 }; 21255 if (typeof document !== "undefined") { 21256 registerDocument15(document); 21257 } 21258 return globalScope.__wpStyleRuntime; 21259 } 21260 function documentContainsStyleHash15(targetDocument, hash) { 21261 if (!targetDocument.head) { 21262 return false; 21263 } 21264 for (const style of targetDocument.head.querySelectorAll( 21265 `style[$STYLE_HASH_ATTRIBUTE15}]` 21266 )) { 21267 if (style.getAttribute(STYLE_HASH_ATTRIBUTE15) === hash) { 21268 return true; 21269 } 21270 } 21271 return false; 21272 } 21273 function injectStyle15(targetDocument, hash, css) { 21274 if (!targetDocument.head) { 21275 return; 21276 } 21277 const runtime = getRuntime15(); 21278 let injectedStyles = runtime.injectedStyles.get(targetDocument); 21279 if (!injectedStyles) { 21280 injectedStyles = /* @__PURE__ */ new Set(); 21281 runtime.injectedStyles.set(targetDocument, injectedStyles); 21282 } 21283 if (injectedStyles.has(hash)) { 21284 return; 21285 } 21286 if (documentContainsStyleHash15(targetDocument, hash)) { 21287 injectedStyles.add(hash); 21288 return; 21289 } 21290 const style = targetDocument.createElement("style"); 21291 style.setAttribute(STYLE_HASH_ATTRIBUTE15, hash); 21292 style.appendChild(targetDocument.createTextNode(css)); 21293 targetDocument.head.appendChild(style); 21294 injectedStyles.add(hash); 21295 } 21296 function registerDocument15(targetDocument) { 21297 const runtime = getRuntime15(); 21298 runtime.documents.set( 21299 targetDocument, 21300 (runtime.documents.get(targetDocument) ?? 0) + 1 21301 ); 21302 for (const [hash, css] of runtime.styles) { 21303 injectStyle15(targetDocument, hash, css); 21304 } 21305 return () => { 21306 const count = runtime.documents.get(targetDocument); 21307 if (count === void 0) { 21308 return; 21309 } 21310 if (count <= 1) { 21311 runtime.documents.delete(targetDocument); 21312 return; 21313 } 21314 runtime.documents.set(targetDocument, count - 1); 21315 }; 21316 } 21317 function registerStyle15(hash, css) { 21318 const runtime = getRuntime15(); 21319 runtime.styles.set(hash, css); 21320 for (const targetDocument of runtime.documents.keys()) { 21321 injectStyle15(targetDocument, hash, css); 21322 } 21323 } 21324 if (typeof process === "undefined" || true) { 21325 registerStyle15("fa606a57ae", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.f37b9e2e191ebd66__visually-hidden{word-wrap:normal;border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-break:normal}}}"); 21326 } 21327 var style_default14 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" }; 21328 var VisuallyHidden = (0, import_element39.forwardRef)( 21329 function VisuallyHidden2({ render: render5, ...restProps }, ref) { 21330 const element = useRender({ 21331 render: render5, 21332 ref, 21333 props: mergeProps( 21334 { className: style_default14["visually-hidden"] }, 21335 restProps, 21336 { 21337 // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it. 21338 "data-visually-hidden": "" 21339 } 21340 ) 21341 }); 21342 return element; 21343 } 21344 ); 21345 21346 // packages/ui/build-module/link/link.mjs 21347 var import_element40 = __toESM(require_element(), 1); 21348 var import_i18n12 = __toESM(require_i18n(), 1); 21349 var import_jsx_runtime131 = __toESM(require_jsx_runtime(), 1); 21350 var STYLE_HASH_ATTRIBUTE16 = "data-wp-hash"; 21351 function getRuntime16() { 21352 const globalScope = globalThis; 21353 if (globalScope.__wpStyleRuntime) { 21354 return globalScope.__wpStyleRuntime; 21355 } 21356 globalScope.__wpStyleRuntime = { 21357 documents: /* @__PURE__ */ new Map(), 21358 styles: /* @__PURE__ */ new Map(), 21359 injectedStyles: /* @__PURE__ */ new WeakMap() 21360 }; 21361 if (typeof document !== "undefined") { 21362 registerDocument16(document); 21363 } 21364 return globalScope.__wpStyleRuntime; 21365 } 21366 function documentContainsStyleHash16(targetDocument, hash) { 21367 if (!targetDocument.head) { 21368 return false; 21369 } 21370 for (const style of targetDocument.head.querySelectorAll( 21371 `style[$STYLE_HASH_ATTRIBUTE16}]` 21372 )) { 21373 if (style.getAttribute(STYLE_HASH_ATTRIBUTE16) === hash) { 21374 return true; 21375 } 21376 } 21377 return false; 21378 } 21379 function injectStyle16(targetDocument, hash, css) { 21380 if (!targetDocument.head) { 21381 return; 21382 } 21383 const runtime = getRuntime16(); 21384 let injectedStyles = runtime.injectedStyles.get(targetDocument); 21385 if (!injectedStyles) { 21386 injectedStyles = /* @__PURE__ */ new Set(); 21387 runtime.injectedStyles.set(targetDocument, injectedStyles); 21388 } 21389 if (injectedStyles.has(hash)) { 21390 return; 21391 } 21392 if (documentContainsStyleHash16(targetDocument, hash)) { 21393 injectedStyles.add(hash); 21394 return; 21395 } 21396 const style = targetDocument.createElement("style"); 21397 style.setAttribute(STYLE_HASH_ATTRIBUTE16, hash); 21398 style.appendChild(targetDocument.createTextNode(css)); 21399 targetDocument.head.appendChild(style); 21400 injectedStyles.add(hash); 21401 } 21402 function registerDocument16(targetDocument) { 21403 const runtime = getRuntime16(); 21404 runtime.documents.set( 21405 targetDocument, 21406 (runtime.documents.get(targetDocument) ?? 0) + 1 21407 ); 21408 for (const [hash, css] of runtime.styles) { 21409 injectStyle16(targetDocument, hash, css); 21410 } 21411 return () => { 21412 const count = runtime.documents.get(targetDocument); 21413 if (count === void 0) { 21414 return; 21415 } 21416 if (count <= 1) { 21417 runtime.documents.delete(targetDocument); 21418 return; 21419 } 21420 runtime.documents.set(targetDocument, count - 1); 21421 }; 21422 } 21423 function registerStyle16(hash, css) { 21424 const runtime = getRuntime16(); 21425 runtime.styles.set(hash, css); 21426 for (const targetDocument of runtime.documents.keys()) { 21427 injectStyle16(targetDocument, hash, css); 21428 } 21429 } 21430 if (typeof process === "undefined" || true) { 21431 registerStyle16("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 21432 } 21433 var resets_default4 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 21434 if (typeof process === "undefined" || true) { 21435 registerStyle16("da99a163ac", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._08e8a2e44959f892__outset-ring--focus:focus,.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._970d04df7376df67__outset-ring--focus-within-except-active:focus-within,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus{outline:none}._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active){@include mixins.focus-ring()}}}"); 21436 } 21437 var focus_default3 = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active" }; 21438 if (typeof process === "undefined" || true) { 21439 registerStyle16("e8e6a9be37", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d4250949359b05ce__link{text-decoration-thickness:from-font;text-underline-offset:.2em}.c6055659b8e2cd2c__is-brand,.c6055659b8e2cd2c__is-brand:visited{--_gcd-a-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9))}.c6055659b8e2cd2c__is-brand:active,.c6055659b8e2cd2c__is-brand:hover{--_gcd-a-color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000))}._92e0dfcaeee15b88__is-neutral,._92e0dfcaeee15b88__is-neutral:visited{--_gcd-a-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);text-decoration-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d)}._92e0dfcaeee15b88__is-neutral:active,._92e0dfcaeee15b88__is-neutral:hover{--_gcd-a-color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}.cf122a9bf1035d42__is-unstyled{--_gcd-a-color:inherit;color:inherit;text-decoration:none}._0cb411afac4c86c7__link-icon{display:inline-block;font-weight:var(--wpds-typography-font-weight-default,400);line-height:1;margin-inline-start:var(--wpds-dimension-padding-xs,4px);text-decoration:none}._0cb411afac4c86c7__link-icon:after{content:"\\2197"}._0cb411afac4c86c7__link-icon:dir(rtl):after{content:"\\2196"}}}'); 21440 } 21441 var style_default15 = { "link": "d4250949359b05ce__link", "is-brand": "c6055659b8e2cd2c__is-brand", "is-neutral": "_92e0dfcaeee15b88__is-neutral", "is-unstyled": "cf122a9bf1035d42__is-unstyled", "link-icon": "_0cb411afac4c86c7__link-icon" }; 21442 if (typeof process === "undefined" || true) { 21443 registerStyle16("af6d9984a6", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-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))}&::placeholder{color:var(--_gcd-input-placeholder-color,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)}"); 21444 } 21445 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" }; 21446 var Link = (0, import_element40.forwardRef)(function Link2({ 21447 children, 21448 variant = "default", 21449 tone = "brand", 21450 openInNewTab = false, 21451 render: render5, 21452 className, 21453 ...props 21454 }, ref) { 21455 const element = useRender({ 21456 render: render5, 21457 defaultTagName: "a", 21458 ref, 21459 props: mergeProps(props, { 21460 className: clsx_default( 21461 global_css_defense_default4.a, 21462 resets_default4["box-sizing"], 21463 focus_default3["outset-ring--focus-except-active"], 21464 variant !== "unstyled" && style_default15.link, 21465 variant !== "unstyled" && style_default15[`is-$tone}`], 21466 variant === "unstyled" && style_default15["is-unstyled"], 21467 className 21468 ), 21469 target: openInNewTab ? "_blank" : void 0, 21470 children: /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_jsx_runtime131.Fragment, { children: [ 21471 children, 21472 openInNewTab && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)( 21473 "span", 21474 { 21475 className: style_default15["link-icon"], 21476 role: "img", 21477 "aria-label": ( 21478 /* translators: accessibility text appended to link text */ 21479 (0, import_i18n12.__)("(opens in a new tab)") 21480 ) 21481 } 21482 ) 21483 ] }) 21484 }) 21485 }); 21486 return element; 21487 }); 21488 21489 // packages/ui/build-module/skeleton/skeleton.mjs 21490 var import_element41 = __toESM(require_element(), 1); 21491 var STYLE_HASH_ATTRIBUTE17 = "data-wp-hash"; 21492 function getRuntime17() { 21493 const globalScope = globalThis; 21494 if (globalScope.__wpStyleRuntime) { 21495 return globalScope.__wpStyleRuntime; 21496 } 21497 globalScope.__wpStyleRuntime = { 21498 documents: /* @__PURE__ */ new Map(), 21499 styles: /* @__PURE__ */ new Map(), 21500 injectedStyles: /* @__PURE__ */ new WeakMap() 21501 }; 21502 if (typeof document !== "undefined") { 21503 registerDocument17(document); 21504 } 21505 return globalScope.__wpStyleRuntime; 21506 } 21507 function documentContainsStyleHash17(targetDocument, hash) { 21508 if (!targetDocument.head) { 21509 return false; 21510 } 21511 for (const style of targetDocument.head.querySelectorAll( 21512 `style[$STYLE_HASH_ATTRIBUTE17}]` 21513 )) { 21514 if (style.getAttribute(STYLE_HASH_ATTRIBUTE17) === hash) { 21515 return true; 21516 } 21517 } 21518 return false; 21519 } 21520 function injectStyle17(targetDocument, hash, css) { 21521 if (!targetDocument.head) { 21522 return; 21523 } 21524 const runtime = getRuntime17(); 21525 let injectedStyles = runtime.injectedStyles.get(targetDocument); 21526 if (!injectedStyles) { 21527 injectedStyles = /* @__PURE__ */ new Set(); 21528 runtime.injectedStyles.set(targetDocument, injectedStyles); 21529 } 21530 if (injectedStyles.has(hash)) { 21531 return; 21532 } 21533 if (documentContainsStyleHash17(targetDocument, hash)) { 21534 injectedStyles.add(hash); 21535 return; 21536 } 21537 const style = targetDocument.createElement("style"); 21538 style.setAttribute(STYLE_HASH_ATTRIBUTE17, hash); 21539 style.appendChild(targetDocument.createTextNode(css)); 21540 targetDocument.head.appendChild(style); 21541 injectedStyles.add(hash); 21542 } 21543 function registerDocument17(targetDocument) { 21544 const runtime = getRuntime17(); 21545 runtime.documents.set( 21546 targetDocument, 21547 (runtime.documents.get(targetDocument) ?? 0) + 1 21548 ); 21549 for (const [hash, css] of runtime.styles) { 21550 injectStyle17(targetDocument, hash, css); 21551 } 21552 return () => { 21553 const count = runtime.documents.get(targetDocument); 21554 if (count === void 0) { 21555 return; 21556 } 21557 if (count <= 1) { 21558 runtime.documents.delete(targetDocument); 21559 return; 21560 } 21561 runtime.documents.set(targetDocument, count - 1); 21562 }; 21563 } 21564 function registerStyle17(hash, css) { 21565 const runtime = getRuntime17(); 21566 runtime.styles.set(hash, css); 21567 for (const targetDocument of runtime.documents.keys()) { 21568 injectStyle17(targetDocument, hash, css); 21569 } 21570 } 21571 if (typeof process === "undefined" || true) { 21572 registerStyle17("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 21573 } 21574 var resets_default5 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 21575 if (typeof process === "undefined" || true) { 21576 registerStyle17("ed2c39ec90", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.b20cc1690085c2f0__skeleton{background-color:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);display:block;@media (forced-colors:active){border:var(--wpds-border-width-xs,1px) solid CanvasText}}._9b143194fdb45f93__pulse{@media not (prefers-reduced-motion){animation:e2b9fe0690281bc8__skeleton-pulse 1.5s ease-in-out infinite}}@keyframes e2b9fe0690281bc8__skeleton-pulse{0%,to{opacity:1}50%{opacity:.4}}}}"); 21577 } 21578 var style_default16 = { "skeleton": "b20cc1690085c2f0__skeleton", "pulse": "_9b143194fdb45f93__pulse", "skeleton-pulse": "e2b9fe0690281bc8__skeleton-pulse" }; 21579 var Skeleton = (0, import_element41.forwardRef)( 21580 function Skeleton2({ render: render5, ...props }, ref) { 21581 return useRender({ 21582 render: render5, 21583 ref, 21584 props: mergeProps( 21585 { 21586 className: clsx_default( 21587 style_default16.skeleton, 21588 style_default16.pulse, 21589 resets_default5["box-sizing"] 21590 ), 21591 // Decorative by default; consumers mark the loading 21592 // region with aria-busy / role="status". 21593 "aria-hidden": true 21594 }, 21595 props 21596 ) 21597 }); 21598 } 21599 ); 21600 21601 // packages/ui/build-module/tabs/index.mjs 21602 var tabs_exports = {}; 21603 __export(tabs_exports, { 21604 List: () => List, 21605 Panel: () => Panel2, 21606 Root: () => Root5, 21607 Tab: () => Tab 21608 }); 21609 21610 // packages/ui/build-module/tabs/list.mjs 21611 var import_element42 = __toESM(require_element(), 1); 21612 var import_compose2 = __toESM(require_compose(), 1); 21613 var import_jsx_runtime132 = __toESM(require_jsx_runtime(), 1); 21614 var STYLE_HASH_ATTRIBUTE18 = "data-wp-hash"; 21615 function getRuntime18() { 21616 const globalScope = globalThis; 21617 if (globalScope.__wpStyleRuntime) { 21618 return globalScope.__wpStyleRuntime; 21619 } 21620 globalScope.__wpStyleRuntime = { 21621 documents: /* @__PURE__ */ new Map(), 21622 styles: /* @__PURE__ */ new Map(), 21623 injectedStyles: /* @__PURE__ */ new WeakMap() 21624 }; 21625 if (typeof document !== "undefined") { 21626 registerDocument18(document); 21627 } 21628 return globalScope.__wpStyleRuntime; 21629 } 21630 function documentContainsStyleHash18(targetDocument, hash) { 21631 if (!targetDocument.head) { 21632 return false; 21633 } 21634 for (const style of targetDocument.head.querySelectorAll( 21635 `style[$STYLE_HASH_ATTRIBUTE18}]` 21636 )) { 21637 if (style.getAttribute(STYLE_HASH_ATTRIBUTE18) === hash) { 21638 return true; 21639 } 21640 } 21641 return false; 21642 } 21643 function injectStyle18(targetDocument, hash, css) { 21644 if (!targetDocument.head) { 21645 return; 21646 } 21647 const runtime = getRuntime18(); 21648 let injectedStyles = runtime.injectedStyles.get(targetDocument); 21649 if (!injectedStyles) { 21650 injectedStyles = /* @__PURE__ */ new Set(); 21651 runtime.injectedStyles.set(targetDocument, injectedStyles); 21652 } 21653 if (injectedStyles.has(hash)) { 21654 return; 21655 } 21656 if (documentContainsStyleHash18(targetDocument, hash)) { 21657 injectedStyles.add(hash); 21658 return; 21659 } 21660 const style = targetDocument.createElement("style"); 21661 style.setAttribute(STYLE_HASH_ATTRIBUTE18, hash); 21662 style.appendChild(targetDocument.createTextNode(css)); 21663 targetDocument.head.appendChild(style); 21664 injectedStyles.add(hash); 21665 } 21666 function registerDocument18(targetDocument) { 21667 const runtime = getRuntime18(); 21668 runtime.documents.set( 21669 targetDocument, 21670 (runtime.documents.get(targetDocument) ?? 0) + 1 21671 ); 21672 for (const [hash, css] of runtime.styles) { 21673 injectStyle18(targetDocument, hash, css); 21674 } 21675 return () => { 21676 const count = runtime.documents.get(targetDocument); 21677 if (count === void 0) { 21678 return; 21679 } 21680 if (count <= 1) { 21681 runtime.documents.delete(targetDocument); 21682 return; 21683 } 21684 runtime.documents.set(targetDocument, count - 1); 21685 }; 21686 } 21687 function registerStyle18(hash, css) { 21688 const runtime = getRuntime18(); 21689 runtime.styles.set(hash, css); 21690 for (const targetDocument of runtime.documents.keys()) { 21691 injectStyle18(targetDocument, hash, css); 21692 } 21693 } 21694 if (typeof process === "undefined" || true) { 21695 registerStyle18("bb8cbb8f31", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._7313adbc8a112e90__tablist{--direction-factor:1;--direction-start:left;--direction-end:right;align-items:stretch;display:flex;overflow-inline:auto;overscroll-behavior-inline:none;position:relative;&:dir(rtl){--direction-factor:-1;--direction-start:right;--direction-end:left}&[data-orientation=horizontal]{--fade-width:4rem;--fade-gradient-base:transparent 0%,#000 var(--fade-width);--fade-gradient-composed:var(--fade-gradient-base),#000 60%,transparent 50%;width:fit-content;&._9f2ac729c68a735a__is-overflowing-first{mask-image:linear-gradient(to var(--direction-end),var(--fade-gradient-base))}&._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to var(--direction-start),var(--fade-gradient-base))}&._9f2ac729c68a735a__is-overflowing-first._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to right,var(--fade-gradient-composed)),linear-gradient(to left,var(--fade-gradient-composed))}&._59228b5227f38a99__is-minimal-variant{gap:1rem}}&[data-orientation=vertical]{flex-direction:column}}._1c37dcfaa1ad8cda__indicator{@media not (prefers-reduced-motion){transition-duration:.2s;transition-property:translate,width,height,border-radius,border-block;transition-timing-function:ease-out}outline:2px solid transparent;outline-offset:-1px;pointer-events:none;position:absolute;&[data-orientation=horizontal]{background-color:var(--wpds-color-stroke-interactive-neutral-strong,#6e6e6e);bottom:0;height:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px));left:0;translate:var(--active-tab-left) 0;width:var(--active-tab-width);z-index:1}&[data-orientation=vertical]{background-color:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);border-radius:var(--wpds-border-radius-sm,2px);height:var(--active-tab-height);left:50%;top:0;translate:-50% var(--active-tab-top);width:100%;z-index:0}._7313adbc8a112e90__tablist[data-select-on-move=true]:has(:focus-visible)\n &[data-orientation=vertical]{border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));box-sizing:border-box}}.a5fd8814f195aa5e__tab{align-items:center;background:transparent;border:none;border-radius:0;box-shadow:none;color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);cursor:var(--wpds-cursor-control,pointer);display:flex;flex:1 0 auto;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:400;line-height:1.2;outline:none;padding:0;position:relative;white-space:nowrap;z-index:1;&[data-disabled]{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);cursor:default;@media (forced-colors:active){color:GrayText}}&:not([data-disabled]):is(:hover,:focus-visible){color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}&:after{border-radius:var(--wpds-border-radius-sm,2px);opacity:0;outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));pointer-events:none;position:absolute;z-index:-1;@media not (prefers-reduced-motion){transition:opacity .1s linear}}&:focus-visible:after{opacity:1}[data-orientation=horizontal] &{height:48px;padding-inline:var(--wpds-dimension-padding-lg,16px);scroll-margin:24px;&:after{content:"";inset:var(--wpds-dimension-padding-md,12px)}}._59228b5227f38a99__is-minimal-variant[data-orientation=horizontal] &{padding-inline:0;&:after{inset-inline:round(up,var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)),1px)}}[data-orientation=vertical] &{min-height:var(--wpds-dimension-size-lg,40px);padding:var(--wpds-dimension-padding-sm,8px) var(--wpds-dimension-padding-md,12px)}[data-orientation=vertical][data-select-on-move=false] &:after{content:"";inset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}._5dfc77e6edd345d4__tab-children{align-items:center;display:flex;flex-grow:1;[data-orientation=horizontal] &{justify-content:center}[data-orientation=vertical] &{justify-content:start}}._4a20e969d15e5ac1__tab-chevron{flex-shrink:0;margin-inline-end:calc(var(--wpds-dimension-gap-xs, 4px)*-1);opacity:0;[data-orientation=horizontal] &{display:none}[role=tab]:is([aria-selected=true],:focus-visible,:hover) &{opacity:1}@media not (prefers-reduced-motion){[data-select-on-move=true]\n [role=tab]:is([aria-selected=true])\n &{transition:opacity .15s linear .15s}}&:dir(rtl){rotate:180deg}}}}'); 21696 } 21697 var style_default17 = { "tablist": "_7313adbc8a112e90__tablist", "is-overflowing-first": "_9f2ac729c68a735a__is-overflowing-first", "is-overflowing-last": "_81c799c1f3cdd261__is-overflowing-last", "is-minimal-variant": "_59228b5227f38a99__is-minimal-variant", "indicator": "_1c37dcfaa1ad8cda__indicator", "tab": "a5fd8814f195aa5e__tab", "tab-children": "_5dfc77e6edd345d4__tab-children", "tab-chevron": "_4a20e969d15e5ac1__tab-chevron" }; 21698 var SCROLL_EPSILON = 1; 21699 var List = (0, import_element42.forwardRef)( 21700 function TabList({ 21701 children, 21702 variant = "default", 21703 className, 21704 activateOnFocus, 21705 ...otherProps 21706 }, forwardedRef) { 21707 const [listEl, setListEl] = (0, import_element42.useState)(null); 21708 const [overflow, setOverflow] = (0, import_element42.useState)({ 21709 first: false, 21710 last: false, 21711 isScrolling: false 21712 }); 21713 (0, import_element42.useEffect)(() => { 21714 if (!listEl) { 21715 return; 21716 } 21717 const measureOverflow = () => { 21718 const { scrollWidth, clientWidth, scrollLeft } = listEl; 21719 const maxScroll = Math.max(scrollWidth - clientWidth, 0); 21720 const direction = listEl.dir || (typeof window !== "undefined" ? window.getComputedStyle(listEl).direction : "ltr"); 21721 const scrollFromStart = direction === "rtl" && scrollLeft < 0 ? ( 21722 // In RTL layouts, scrollLeft is typically 0 at the visual "start" 21723 // (right edge) and becomes negative toward the "end" (left edge). 21724 // Normalize value for correct first/last detection logic. 21725 -scrollLeft 21726 ) : scrollLeft; 21727 const next = { 21728 first: scrollFromStart > SCROLL_EPSILON, 21729 last: scrollFromStart < maxScroll - SCROLL_EPSILON, 21730 isScrolling: scrollWidth > clientWidth 21731 }; 21732 setOverflow( 21733 (prev) => prev.first === next.first && prev.last === next.last && prev.isScrolling === next.isScrolling ? prev : next 21734 ); 21735 }; 21736 const resizeObserver = new ResizeObserver(measureOverflow); 21737 const observeTabs = () => { 21738 resizeObserver.disconnect(); 21739 resizeObserver.observe(listEl); 21740 listEl.querySelectorAll('[role="tab"]').forEach((tab) => resizeObserver.observe(tab)); 21741 }; 21742 const mutationObserver = new MutationObserver(observeTabs); 21743 mutationObserver.observe(listEl, { 21744 childList: true, 21745 subtree: true 21746 }); 21747 let scrollTick = false; 21748 const throttleMeasureOverflowOnScroll = () => { 21749 if (!scrollTick) { 21750 requestAnimationFrame(() => { 21751 measureOverflow(); 21752 scrollTick = false; 21753 }); 21754 scrollTick = true; 21755 } 21756 }; 21757 listEl.addEventListener( 21758 "scroll", 21759 throttleMeasureOverflowOnScroll, 21760 { passive: true } 21761 ); 21762 observeTabs(); 21763 measureOverflow(); 21764 return () => { 21765 listEl.removeEventListener( 21766 "scroll", 21767 throttleMeasureOverflowOnScroll 21768 ); 21769 resizeObserver.disconnect(); 21770 mutationObserver.disconnect(); 21771 }; 21772 }, [listEl]); 21773 const mergedListRef = (0, import_compose2.useMergeRefs)([ 21774 forwardedRef, 21775 (el) => setListEl(el) 21776 ]); 21777 return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)( 21778 index_parts_exports2.List, 21779 { 21780 ref: mergedListRef, 21781 activateOnFocus, 21782 "data-select-on-move": activateOnFocus ? "true" : "false", 21783 className: clsx_default( 21784 style_default17.tablist, 21785 overflow.first && style_default17["is-overflowing-first"], 21786 overflow.last && style_default17["is-overflowing-last"], 21787 style_default17[`is-$variant}-variant`], 21788 className 21789 ), 21790 ...otherProps, 21791 tabIndex: otherProps.tabIndex ?? (overflow.isScrolling ? -1 : void 0), 21792 children: [ 21793 children, 21794 /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(index_parts_exports2.Indicator, { className: style_default17.indicator }) 21795 ] 21796 } 21797 ); 21798 } 21799 ); 21800 21801 // packages/ui/build-module/tabs/panel.mjs 21802 var import_element44 = __toESM(require_element(), 1); 21803 21804 // packages/ui/build-module/tabs/context.mjs 21805 var import_element43 = __toESM(require_element(), 1); 21806 var import_jsx_runtime133 = __toESM(require_jsx_runtime(), 1); 21807 var VALIDATION_ENABLED = true; 21808 var TabsValidationContext = VALIDATION_ENABLED ? (0, import_element43.createContext)(null) : null; 21809 function useRegisterTabDev() { 21810 const context = (0, import_element43.useContext)(TabsValidationContext); 21811 (0, import_element43.useEffect)(() => { 21812 if (context) { 21813 return context.registerTab(); 21814 } 21815 return void 0; 21816 }, [context]); 21817 } 21818 function useRegisterTabProd() { 21819 } 21820 var useRegisterTab = VALIDATION_ENABLED ? useRegisterTabDev : useRegisterTabProd; 21821 function useRegisterPanelDev() { 21822 const context = (0, import_element43.useContext)(TabsValidationContext); 21823 (0, import_element43.useEffect)(() => { 21824 if (context) { 21825 return context.registerPanel(); 21826 } 21827 return void 0; 21828 }, [context]); 21829 } 21830 function useRegisterPanelProd() { 21831 } 21832 var useRegisterPanel = VALIDATION_ENABLED ? useRegisterPanelDev : useRegisterPanelProd; 21833 function TabsValidationProviderDev({ 21834 children 21835 }) { 21836 const tabCountRef = (0, import_element43.useRef)(0); 21837 const panelCountRef = (0, import_element43.useRef)(0); 21838 const scheduleValidation = useScheduleValidation(() => { 21839 const tabCount = tabCountRef.current; 21840 const panelCount = panelCountRef.current; 21841 if (tabCount !== panelCount) { 21842 throw new Error( 21843 `Tabs: Tab/Panel count mismatch ($tabCount} Tabs, $panelCount} Panels). Each Tab must be associated with exactly one Panel. Mismatched or missing associations can break screen reader navigation and violate WAI-ARIA Tabs pattern requirements.` 21844 ); 21845 } 21846 }); 21847 const registerTab = (0, import_element43.useCallback)(() => { 21848 tabCountRef.current += 1; 21849 scheduleValidation(); 21850 return () => { 21851 tabCountRef.current -= 1; 21852 scheduleValidation(); 21853 }; 21854 }, [scheduleValidation]); 21855 const registerPanel = (0, import_element43.useCallback)(() => { 21856 panelCountRef.current += 1; 21857 scheduleValidation(); 21858 return () => { 21859 panelCountRef.current -= 1; 21860 scheduleValidation(); 21861 }; 21862 }, [scheduleValidation]); 21863 const contextValue = (0, import_element43.useMemo)( 21864 () => ({ 21865 registerTab, 21866 registerPanel 21867 }), 21868 [registerTab, registerPanel] 21869 ); 21870 return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(TabsValidationContext.Provider, { value: contextValue, children }); 21871 } 21872 function TabsValidationProviderProd({ 21873 children 21874 }) { 21875 return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_jsx_runtime133.Fragment, { children }); 21876 } 21877 var TabsValidationProvider = VALIDATION_ENABLED ? TabsValidationProviderDev : TabsValidationProviderProd; 21878 21879 // packages/ui/build-module/tabs/panel.mjs 21880 var import_jsx_runtime134 = __toESM(require_jsx_runtime(), 1); 21881 var STYLE_HASH_ATTRIBUTE19 = "data-wp-hash"; 21882 function getRuntime19() { 21883 const globalScope = globalThis; 21884 if (globalScope.__wpStyleRuntime) { 21885 return globalScope.__wpStyleRuntime; 21886 } 21887 globalScope.__wpStyleRuntime = { 21888 documents: /* @__PURE__ */ new Map(), 21889 styles: /* @__PURE__ */ new Map(), 21890 injectedStyles: /* @__PURE__ */ new WeakMap() 21891 }; 21892 if (typeof document !== "undefined") { 21893 registerDocument19(document); 21894 } 21895 return globalScope.__wpStyleRuntime; 21896 } 21897 function documentContainsStyleHash19(targetDocument, hash) { 21898 if (!targetDocument.head) { 21899 return false; 21900 } 21901 for (const style of targetDocument.head.querySelectorAll( 21902 `style[$STYLE_HASH_ATTRIBUTE19}]` 21903 )) { 21904 if (style.getAttribute(STYLE_HASH_ATTRIBUTE19) === hash) { 21905 return true; 21906 } 21907 } 21908 return false; 21909 } 21910 function injectStyle19(targetDocument, hash, css) { 21911 if (!targetDocument.head) { 21912 return; 21913 } 21914 const runtime = getRuntime19(); 21915 let injectedStyles = runtime.injectedStyles.get(targetDocument); 21916 if (!injectedStyles) { 21917 injectedStyles = /* @__PURE__ */ new Set(); 21918 runtime.injectedStyles.set(targetDocument, injectedStyles); 21919 } 21920 if (injectedStyles.has(hash)) { 21921 return; 21922 } 21923 if (documentContainsStyleHash19(targetDocument, hash)) { 21924 injectedStyles.add(hash); 21925 return; 21926 } 21927 const style = targetDocument.createElement("style"); 21928 style.setAttribute(STYLE_HASH_ATTRIBUTE19, hash); 21929 style.appendChild(targetDocument.createTextNode(css)); 21930 targetDocument.head.appendChild(style); 21931 injectedStyles.add(hash); 21932 } 21933 function registerDocument19(targetDocument) { 21934 const runtime = getRuntime19(); 21935 runtime.documents.set( 21936 targetDocument, 21937 (runtime.documents.get(targetDocument) ?? 0) + 1 21938 ); 21939 for (const [hash, css] of runtime.styles) { 21940 injectStyle19(targetDocument, hash, css); 21941 } 21942 return () => { 21943 const count = runtime.documents.get(targetDocument); 21944 if (count === void 0) { 21945 return; 21946 } 21947 if (count <= 1) { 21948 runtime.documents.delete(targetDocument); 21949 return; 21950 } 21951 runtime.documents.set(targetDocument, count - 1); 21952 }; 21953 } 21954 function registerStyle19(hash, css) { 21955 const runtime = getRuntime19(); 21956 runtime.styles.set(hash, css); 21957 for (const targetDocument of runtime.documents.keys()) { 21958 injectStyle19(targetDocument, hash, css); 21959 } 21960 } 21961 if (typeof process === "undefined" || true) { 21962 registerStyle19("af6d9984a6", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-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))}&::placeholder{color:var(--_gcd-input-placeholder-color,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)}"); 21963 } 21964 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" }; 21965 if (typeof process === "undefined" || true) { 21966 registerStyle19("da99a163ac", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._08e8a2e44959f892__outset-ring--focus:focus,.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._970d04df7376df67__outset-ring--focus-within-except-active:focus-within,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus{outline:none}._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active){@include mixins.focus-ring()}}}"); 21967 } 21968 var focus_default4 = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active" }; 21969 var Panel2 = (0, import_element44.forwardRef)( 21970 function TabPanel({ className, ...otherProps }, forwardedRef) { 21971 useRegisterPanel(); 21972 return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)( 21973 index_parts_exports2.Panel, 21974 { 21975 ref: forwardedRef, 21976 className: clsx_default( 21977 global_css_defense_default5.div, 21978 focus_default4["outset-ring--focus-visible"], 21979 className 21980 ), 21981 ...otherProps 21982 } 21983 ); 21984 } 21985 ); 21986 21987 // packages/ui/build-module/tabs/root.mjs 21988 var import_element45 = __toESM(require_element(), 1); 21989 var import_jsx_runtime135 = __toESM(require_jsx_runtime(), 1); 21990 var Root5 = (0, import_element45.forwardRef)( 21991 function TabsRoot3({ ...otherProps }, forwardedRef) { 21992 return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(TabsValidationProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(index_parts_exports2.Root, { ref: forwardedRef, ...otherProps }) }); 21993 } 21994 ); 21995 21996 // packages/ui/build-module/tabs/tab.mjs 21997 var import_element46 = __toESM(require_element(), 1); 21998 var import_jsx_runtime136 = __toESM(require_jsx_runtime(), 1); 21999 var STYLE_HASH_ATTRIBUTE20 = "data-wp-hash"; 22000 function getRuntime20() { 22001 const globalScope = globalThis; 22002 if (globalScope.__wpStyleRuntime) { 22003 return globalScope.__wpStyleRuntime; 22004 } 22005 globalScope.__wpStyleRuntime = { 22006 documents: /* @__PURE__ */ new Map(), 22007 styles: /* @__PURE__ */ new Map(), 22008 injectedStyles: /* @__PURE__ */ new WeakMap() 22009 }; 22010 if (typeof document !== "undefined") { 22011 registerDocument20(document); 22012 } 22013 return globalScope.__wpStyleRuntime; 22014 } 22015 function documentContainsStyleHash20(targetDocument, hash) { 22016 if (!targetDocument.head) { 22017 return false; 22018 } 22019 for (const style of targetDocument.head.querySelectorAll( 22020 `style[$STYLE_HASH_ATTRIBUTE20}]` 22021 )) { 22022 if (style.getAttribute(STYLE_HASH_ATTRIBUTE20) === hash) { 22023 return true; 22024 } 22025 } 22026 return false; 22027 } 22028 function injectStyle20(targetDocument, hash, css) { 22029 if (!targetDocument.head) { 22030 return; 22031 } 22032 const runtime = getRuntime20(); 22033 let injectedStyles = runtime.injectedStyles.get(targetDocument); 22034 if (!injectedStyles) { 22035 injectedStyles = /* @__PURE__ */ new Set(); 22036 runtime.injectedStyles.set(targetDocument, injectedStyles); 22037 } 22038 if (injectedStyles.has(hash)) { 22039 return; 22040 } 22041 if (documentContainsStyleHash20(targetDocument, hash)) { 22042 injectedStyles.add(hash); 22043 return; 22044 } 22045 const style = targetDocument.createElement("style"); 22046 style.setAttribute(STYLE_HASH_ATTRIBUTE20, hash); 22047 style.appendChild(targetDocument.createTextNode(css)); 22048 targetDocument.head.appendChild(style); 22049 injectedStyles.add(hash); 22050 } 22051 function registerDocument20(targetDocument) { 22052 const runtime = getRuntime20(); 22053 runtime.documents.set( 22054 targetDocument, 22055 (runtime.documents.get(targetDocument) ?? 0) + 1 22056 ); 22057 for (const [hash, css] of runtime.styles) { 22058 injectStyle20(targetDocument, hash, css); 22059 } 22060 return () => { 22061 const count = runtime.documents.get(targetDocument); 22062 if (count === void 0) { 22063 return; 22064 } 22065 if (count <= 1) { 22066 runtime.documents.delete(targetDocument); 22067 return; 22068 } 22069 runtime.documents.set(targetDocument, count - 1); 22070 }; 22071 } 22072 function registerStyle20(hash, css) { 22073 const runtime = getRuntime20(); 22074 runtime.styles.set(hash, css); 22075 for (const targetDocument of runtime.documents.keys()) { 22076 injectStyle20(targetDocument, hash, css); 22077 } 22078 } 22079 if (typeof process === "undefined" || true) { 22080 registerStyle20("bb8cbb8f31", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._7313adbc8a112e90__tablist{--direction-factor:1;--direction-start:left;--direction-end:right;align-items:stretch;display:flex;overflow-inline:auto;overscroll-behavior-inline:none;position:relative;&:dir(rtl){--direction-factor:-1;--direction-start:right;--direction-end:left}&[data-orientation=horizontal]{--fade-width:4rem;--fade-gradient-base:transparent 0%,#000 var(--fade-width);--fade-gradient-composed:var(--fade-gradient-base),#000 60%,transparent 50%;width:fit-content;&._9f2ac729c68a735a__is-overflowing-first{mask-image:linear-gradient(to var(--direction-end),var(--fade-gradient-base))}&._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to var(--direction-start),var(--fade-gradient-base))}&._9f2ac729c68a735a__is-overflowing-first._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to right,var(--fade-gradient-composed)),linear-gradient(to left,var(--fade-gradient-composed))}&._59228b5227f38a99__is-minimal-variant{gap:1rem}}&[data-orientation=vertical]{flex-direction:column}}._1c37dcfaa1ad8cda__indicator{@media not (prefers-reduced-motion){transition-duration:.2s;transition-property:translate,width,height,border-radius,border-block;transition-timing-function:ease-out}outline:2px solid transparent;outline-offset:-1px;pointer-events:none;position:absolute;&[data-orientation=horizontal]{background-color:var(--wpds-color-stroke-interactive-neutral-strong,#6e6e6e);bottom:0;height:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px));left:0;translate:var(--active-tab-left) 0;width:var(--active-tab-width);z-index:1}&[data-orientation=vertical]{background-color:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);border-radius:var(--wpds-border-radius-sm,2px);height:var(--active-tab-height);left:50%;top:0;translate:-50% var(--active-tab-top);width:100%;z-index:0}._7313adbc8a112e90__tablist[data-select-on-move=true]:has(:focus-visible)\n &[data-orientation=vertical]{border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));box-sizing:border-box}}.a5fd8814f195aa5e__tab{align-items:center;background:transparent;border:none;border-radius:0;box-shadow:none;color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);cursor:var(--wpds-cursor-control,pointer);display:flex;flex:1 0 auto;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:400;line-height:1.2;outline:none;padding:0;position:relative;white-space:nowrap;z-index:1;&[data-disabled]{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);cursor:default;@media (forced-colors:active){color:GrayText}}&:not([data-disabled]):is(:hover,:focus-visible){color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}&:after{border-radius:var(--wpds-border-radius-sm,2px);opacity:0;outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));pointer-events:none;position:absolute;z-index:-1;@media not (prefers-reduced-motion){transition:opacity .1s linear}}&:focus-visible:after{opacity:1}[data-orientation=horizontal] &{height:48px;padding-inline:var(--wpds-dimension-padding-lg,16px);scroll-margin:24px;&:after{content:"";inset:var(--wpds-dimension-padding-md,12px)}}._59228b5227f38a99__is-minimal-variant[data-orientation=horizontal] &{padding-inline:0;&:after{inset-inline:round(up,var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)),1px)}}[data-orientation=vertical] &{min-height:var(--wpds-dimension-size-lg,40px);padding:var(--wpds-dimension-padding-sm,8px) var(--wpds-dimension-padding-md,12px)}[data-orientation=vertical][data-select-on-move=false] &:after{content:"";inset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}._5dfc77e6edd345d4__tab-children{align-items:center;display:flex;flex-grow:1;[data-orientation=horizontal] &{justify-content:center}[data-orientation=vertical] &{justify-content:start}}._4a20e969d15e5ac1__tab-chevron{flex-shrink:0;margin-inline-end:calc(var(--wpds-dimension-gap-xs, 4px)*-1);opacity:0;[data-orientation=horizontal] &{display:none}[role=tab]:is([aria-selected=true],:focus-visible,:hover) &{opacity:1}@media not (prefers-reduced-motion){[data-select-on-move=true]\n [role=tab]:is([aria-selected=true])\n &{transition:opacity .15s linear .15s}}&:dir(rtl){rotate:180deg}}}}'); 22081 } 22082 var style_default18 = { "tablist": "_7313adbc8a112e90__tablist", "is-overflowing-first": "_9f2ac729c68a735a__is-overflowing-first", "is-overflowing-last": "_81c799c1f3cdd261__is-overflowing-last", "is-minimal-variant": "_59228b5227f38a99__is-minimal-variant", "indicator": "_1c37dcfaa1ad8cda__indicator", "tab": "a5fd8814f195aa5e__tab", "tab-children": "_5dfc77e6edd345d4__tab-children", "tab-chevron": "_4a20e969d15e5ac1__tab-chevron" }; 22083 var Tab = (0, import_element46.forwardRef)(function Tab2({ className, children, ...otherProps }, forwardedRef) { 22084 useRegisterTab(); 22085 return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)( 22086 index_parts_exports2.Tab, 22087 { 22088 ref: forwardedRef, 22089 className: clsx_default(style_default18.tab, className), 22090 ...otherProps, 22091 children: [ 22092 /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("span", { className: style_default18["tab-children"], children }), 22093 /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(Icon, { icon: chevron_right_default, className: style_default18["tab-chevron"] }) 22094 ] 22095 } 22096 ); 22097 }); 22098 22099 // packages/fields/build-module/fields/pattern-title/view.mjs 22100 var import_jsx_runtime137 = __toESM(require_jsx_runtime(), 1); 22101 var { PATTERN_TYPES } = unlock3(import_patterns.privateApis); 22102 function PatternTitleView({ item }) { 22103 const lockMessage = (0, import_i18n13.__)("This pattern cannot be edited."); 22104 return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(BaseTitleView, { item, className: "fields-field__pattern-title", children: item.type === PATTERN_TYPES.theme && /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(import_jsx_runtime137.Fragment, { children: [ 22105 /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(VisuallyHidden, { children: lockMessage }), 22106 /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(tooltip_exports.Root, { children: [ 22107 /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 22108 tooltip_exports.Trigger, 22109 { 22110 render: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(icon_default, { icon: lock_small_default, size: 24 }) 22111 } 22112 ), 22113 /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(tooltip_exports.Popup, { children: lockMessage }) 22114 ] }) 22115 ] }) }); 22116 } 22117 22118 // packages/fields/build-module/fields/pattern-title/index.mjs 22119 var patternTitleField = { 22120 type: "text", 22121 id: "title", 22122 label: (0, import_i18n14.__)("Title"), 22123 placeholder: (0, import_i18n14.__)("No title"), 22124 getValue: ({ item }) => getItemTitle(item), 22125 render: PatternTitleView, 22126 enableHiding: false, 22127 enableGlobalSearch: true, 22128 filterBy: false 22129 }; 22130 var pattern_title_default = patternTitleField; 22131 22132 // packages/fields/build-module/fields/pattern-description/index.mjs 22133 var import_html_entities2 = __toESM(require_html_entities(), 1); 22134 var import_i18n15 = __toESM(require_i18n(), 1); 22135 var import_jsx_runtime138 = __toESM(require_jsx_runtime(), 1); 22136 function getPatternDescription(item) { 22137 if (typeof item.excerpt === "string") { 22138 return (0, import_html_entities2.decodeEntities)(item.excerpt); 22139 } 22140 return (0, import_html_entities2.decodeEntities)(item.excerpt?.raw || ""); 22141 } 22142 var patternDescriptionField = { 22143 id: "excerpt", 22144 type: "text", 22145 label: (0, import_i18n15.__)("Description"), 22146 placeholder: (0, import_i18n15.__)("Add a description"), 22147 getValue: ({ item }) => getPatternDescription(item), 22148 render: ({ item }) => { 22149 const description = getPatternDescription(item); 22150 return description ? /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(Text, { children: description }) : null; 22151 }, 22152 Edit: { 22153 control: "textarea", 22154 rows: 4 22155 }, 22156 enableSorting: false, 22157 enableHiding: false, 22158 filterBy: false, 22159 enableGlobalSearch: true 22160 }; 22161 var pattern_description_default = patternDescriptionField; 22162 22163 // packages/fields/build-module/fields/pattern-sync-status/index.mjs 22164 var import_i18n16 = __toESM(require_i18n(), 1); 22165 var import_patterns2 = __toESM(require_patterns(), 1); 22166 var import_jsx_runtime139 = __toESM(require_jsx_runtime(), 1); 22167 var { PATTERN_SYNC_TYPES, PATTERN_TYPES: PATTERN_TYPES2 } = unlock3(import_patterns2.privateApis); 22168 var SYNC_STATUS_FILTERS = [ 22169 { 22170 value: PATTERN_SYNC_TYPES.full, 22171 label: (0, import_i18n16._x)("Synced", "pattern (singular)"), 22172 description: (0, import_i18n16.__)("Patterns that are kept in sync across the site.") 22173 }, 22174 { 22175 value: PATTERN_SYNC_TYPES.unsynced, 22176 label: (0, import_i18n16._x)("Not synced", "pattern (singular)"), 22177 description: (0, import_i18n16.__)( 22178 "Patterns that can be changed freely without affecting the site." 22179 ) 22180 } 22181 ]; 22182 function getPatternSyncStatus(item) { 22183 if (item.type && item.type !== PATTERN_TYPES2.user) { 22184 return PATTERN_SYNC_TYPES.unsynced; 22185 } 22186 if (item.meta?.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced) { 22187 return PATTERN_SYNC_TYPES.unsynced; 22188 } 22189 return item.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full; 22190 } 22191 var patternSyncStatusField = { 22192 id: "sync-status", 22193 type: "text", 22194 label: (0, import_i18n16.__)("Sync status"), 22195 readOnly: true, 22196 enableSorting: false, 22197 enableHiding: true, 22198 elements: SYNC_STATUS_FILTERS, 22199 filterBy: { 22200 operators: ["is"], 22201 isPrimary: true 22202 }, 22203 render: ({ item }) => { 22204 const syncStatus = getPatternSyncStatus(item); 22205 return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)( 22206 "span", 22207 { 22208 className: `fields-field__pattern-sync-status fields-field__pattern-sync-status-$syncStatus}`, 22209 children: SYNC_STATUS_FILTERS.find( 22210 ({ value }) => value === syncStatus 22211 )?.label 22212 } 22213 ); 22214 } 22215 }; 22216 var pattern_sync_status_default = patternSyncStatusField; 22217 22218 // packages/fields/build-module/fields/featured-image/index.mjs 22219 var import_i18n18 = __toESM(require_i18n(), 1); 22220 22221 // packages/fields/build-module/components/media-edit/index.mjs 22222 var import_components4 = __toESM(require_components(), 1); 22223 var import_blob = __toESM(require_blob(), 1); 22224 var import_core_data5 = __toESM(require_core_data(), 1); 22225 var import_data9 = __toESM(require_data(), 1); 22226 var import_element48 = __toESM(require_element(), 1); 22227 var import_i18n17 = __toESM(require_i18n(), 1); 22228 var import_a11y2 = __toESM(require_a11y(), 1); 22229 var import_media_utils2 = __toESM(require_media_utils(), 1); 22230 var import_notices2 = __toESM(require_notices(), 1); 22231 22232 // node_modules/@react-spring/rafz/dist/react-spring-rafz.esm.js 22233 var updateQueue = makeQueue(); 22234 var raf = (fn) => schedule(fn, updateQueue); 22235 var writeQueue = makeQueue(); 22236 raf.write = (fn) => schedule(fn, writeQueue); 22237 var onStartQueue = makeQueue(); 22238 raf.onStart = (fn) => schedule(fn, onStartQueue); 22239 var onFrameQueue = makeQueue(); 22240 raf.onFrame = (fn) => schedule(fn, onFrameQueue); 22241 var onFinishQueue = makeQueue(); 22242 raf.onFinish = (fn) => schedule(fn, onFinishQueue); 22243 var timeouts = []; 22244 raf.setTimeout = (handler, ms) => { 22245 let time = raf.now() + ms; 22246 let cancel = () => { 22247 let i3 = timeouts.findIndex((t4) => t4.cancel == cancel); 22248 if (~i3) timeouts.splice(i3, 1); 22249 pendingCount -= ~i3 ? 1 : 0; 22250 }; 22251 let timeout = { 22252 time, 22253 handler, 22254 cancel 22255 }; 22256 timeouts.splice(findTimeout(time), 0, timeout); 22257 pendingCount += 1; 22258 start(); 22259 return timeout; 22260 }; 22261 var findTimeout = (time) => ~(~timeouts.findIndex((t4) => t4.time > time) || ~timeouts.length); 22262 raf.cancel = (fn) => { 22263 onStartQueue.delete(fn); 22264 onFrameQueue.delete(fn); 22265 onFinishQueue.delete(fn); 22266 updateQueue.delete(fn); 22267 writeQueue.delete(fn); 22268 }; 22269 raf.sync = (fn) => { 22270 sync = true; 22271 raf.batchedUpdates(fn); 22272 sync = false; 22273 }; 22274 raf.throttle = (fn) => { 22275 let lastArgs; 22276 function queuedFn() { 22277 try { 22278 fn(...lastArgs); 22279 } finally { 22280 lastArgs = null; 22281 } 22282 } 22283 function throttled(...args) { 22284 lastArgs = args; 22285 raf.onStart(queuedFn); 22286 } 22287 throttled.handler = fn; 22288 throttled.cancel = () => { 22289 onStartQueue.delete(queuedFn); 22290 lastArgs = null; 22291 }; 22292 return throttled; 22293 }; 22294 var nativeRaf = typeof window != "undefined" ? window.requestAnimationFrame : () => { 22295 }; 22296 raf.use = (impl) => nativeRaf = impl; 22297 raf.now = typeof performance != "undefined" ? () => performance.now() : Date.now; 22298 raf.batchedUpdates = (fn) => fn(); 22299 raf.catch = console.error; 22300 raf.frameLoop = "always"; 22301 raf.advance = () => { 22302 if (raf.frameLoop !== "demand") { 22303 console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"); 22304 } else { 22305 update2(); 22306 } 22307 }; 22308 var ts = -1; 22309 var pendingCount = 0; 22310 var sync = false; 22311 function schedule(fn, queue) { 22312 if (sync) { 22313 queue.delete(fn); 22314 fn(0); 22315 } else { 22316 queue.add(fn); 22317 start(); 22318 } 22319 } 22320 function start() { 22321 if (ts < 0) { 22322 ts = 0; 22323 if (raf.frameLoop !== "demand") { 22324 nativeRaf(loop); 22325 } 22326 } 22327 } 22328 function stop() { 22329 ts = -1; 22330 } 22331 function loop() { 22332 if (~ts) { 22333 nativeRaf(loop); 22334 raf.batchedUpdates(update2); 22335 } 22336 } 22337 function update2() { 22338 let prevTs = ts; 22339 ts = raf.now(); 22340 let count = findTimeout(ts); 22341 if (count) { 22342 eachSafely(timeouts.splice(0, count), (t4) => t4.handler()); 22343 pendingCount -= count; 22344 } 22345 if (!pendingCount) { 22346 stop(); 22347 return; 22348 } 22349 onStartQueue.flush(); 22350 updateQueue.flush(prevTs ? Math.min(64, ts - prevTs) : 16.667); 22351 onFrameQueue.flush(); 22352 writeQueue.flush(); 22353 onFinishQueue.flush(); 22354 } 22355 function makeQueue() { 22356 let next = /* @__PURE__ */ new Set(); 22357 let current = next; 22358 return { 22359 add(fn) { 22360 pendingCount += current == next && !next.has(fn) ? 1 : 0; 22361 next.add(fn); 22362 }, 22363 delete(fn) { 22364 pendingCount -= current == next && next.has(fn) ? 1 : 0; 22365 return next.delete(fn); 22366 }, 22367 flush(arg) { 22368 if (current.size) { 22369 next = /* @__PURE__ */ new Set(); 22370 pendingCount -= current.size; 22371 eachSafely(current, (fn) => fn(arg) && next.add(fn)); 22372 pendingCount += next.size; 22373 current = next; 22374 } 22375 } 22376 }; 22377 } 22378 function eachSafely(values, each2) { 22379 values.forEach((value) => { 22380 try { 22381 each2(value); 22382 } catch (e3) { 22383 raf.catch(e3); 22384 } 22385 }); 22386 } 22387 22388 // node_modules/@react-spring/shared/dist/react-spring-shared.esm.js 22389 var import_react13 = __toESM(require_react()); 22390 function noop5() { 22391 } 22392 var defineHidden = (obj, key, value) => Object.defineProperty(obj, key, { 22393 value, 22394 writable: true, 22395 configurable: true 22396 }); 22397 var is = { 22398 arr: Array.isArray, 22399 obj: (a3) => !!a3 && a3.constructor.name === "Object", 22400 fun: (a3) => typeof a3 === "function", 22401 str: (a3) => typeof a3 === "string", 22402 num: (a3) => typeof a3 === "number", 22403 und: (a3) => a3 === void 0 22404 }; 22405 function isEqual(a3, b3) { 22406 if (is.arr(a3)) { 22407 if (!is.arr(b3) || a3.length !== b3.length) return false; 22408 for (let i3 = 0; i3 < a3.length; i3++) { 22409 if (a3[i3] !== b3[i3]) return false; 22410 } 22411 return true; 22412 } 22413 return a3 === b3; 22414 } 22415 var each = (obj, fn) => obj.forEach(fn); 22416 function eachProp(obj, fn, ctx9) { 22417 if (is.arr(obj)) { 22418 for (let i3 = 0; i3 < obj.length; i3++) { 22419 fn.call(ctx9, obj[i3], `$i3}`); 22420 } 22421 return; 22422 } 22423 for (const key in obj) { 22424 if (obj.hasOwnProperty(key)) { 22425 fn.call(ctx9, obj[key], key); 22426 } 22427 } 22428 } 22429 var toArray = (a3) => is.und(a3) ? [] : is.arr(a3) ? a3 : [a3]; 22430 function flush(queue, iterator) { 22431 if (queue.size) { 22432 const items = Array.from(queue); 22433 queue.clear(); 22434 each(items, iterator); 22435 } 22436 } 22437 var flushCalls = (queue, ...args) => flush(queue, (fn) => fn(...args)); 22438 var isSSR = () => typeof window === "undefined" || !window.navigator || /ServerSideRendering|^Deno\//.test(window.navigator.userAgent); 22439 var createStringInterpolator$1; 22440 var to; 22441 var colors$1 = null; 22442 var skipAnimation = false; 22443 var willAdvance = noop5; 22444 var assign = (globals2) => { 22445 if (globals2.to) to = globals2.to; 22446 if (globals2.now) raf.now = globals2.now; 22447 if (globals2.colors !== void 0) colors$1 = globals2.colors; 22448 if (globals2.skipAnimation != null) skipAnimation = globals2.skipAnimation; 22449 if (globals2.createStringInterpolator) createStringInterpolator$1 = globals2.createStringInterpolator; 22450 if (globals2.requestAnimationFrame) raf.use(globals2.requestAnimationFrame); 22451 if (globals2.batchedUpdates) raf.batchedUpdates = globals2.batchedUpdates; 22452 if (globals2.willAdvance) willAdvance = globals2.willAdvance; 22453 if (globals2.frameLoop) raf.frameLoop = globals2.frameLoop; 22454 }; 22455 var globals = /* @__PURE__ */ Object.freeze({ 22456 __proto__: null, 22457 get createStringInterpolator() { 22458 return createStringInterpolator$1; 22459 }, 22460 get to() { 22461 return to; 22462 }, 22463 get colors() { 22464 return colors$1; 22465 }, 22466 get skipAnimation() { 22467 return skipAnimation; 22468 }, 22469 get willAdvance() { 22470 return willAdvance; 22471 }, 22472 assign 22473 }); 22474 var startQueue = /* @__PURE__ */ new Set(); 22475 var currentFrame = []; 22476 var prevFrame = []; 22477 var priority = 0; 22478 var frameLoop = { 22479 get idle() { 22480 return !startQueue.size && !currentFrame.length; 22481 }, 22482 start(animation) { 22483 if (priority > animation.priority) { 22484 startQueue.add(animation); 22485 raf.onStart(flushStartQueue); 22486 } else { 22487 startSafely(animation); 22488 raf(advance2); 22489 } 22490 }, 22491 advance: advance2, 22492 sort(animation) { 22493 if (priority) { 22494 raf.onFrame(() => frameLoop.sort(animation)); 22495 } else { 22496 const prevIndex = currentFrame.indexOf(animation); 22497 if (~prevIndex) { 22498 currentFrame.splice(prevIndex, 1); 22499 startUnsafely(animation); 22500 } 22501 } 22502 }, 22503 clear() { 22504 currentFrame = []; 22505 startQueue.clear(); 22506 } 22507 }; 22508 function flushStartQueue() { 22509 startQueue.forEach(startSafely); 22510 startQueue.clear(); 22511 raf(advance2); 22512 } 22513 function startSafely(animation) { 22514 if (!currentFrame.includes(animation)) startUnsafely(animation); 22515 } 22516 function startUnsafely(animation) { 22517 currentFrame.splice(findIndex(currentFrame, (other) => other.priority > animation.priority), 0, animation); 22518 } 22519 function advance2(dt) { 22520 const nextFrame = prevFrame; 22521 for (let i3 = 0; i3 < currentFrame.length; i3++) { 22522 const animation = currentFrame[i3]; 22523 priority = animation.priority; 22524 if (!animation.idle) { 22525 willAdvance(animation); 22526 animation.advance(dt); 22527 if (!animation.idle) { 22528 nextFrame.push(animation); 22529 } 22530 } 22531 } 22532 priority = 0; 22533 prevFrame = currentFrame; 22534 prevFrame.length = 0; 22535 currentFrame = nextFrame; 22536 return currentFrame.length > 0; 22537 } 22538 function findIndex(arr, test) { 22539 const index2 = arr.findIndex(test); 22540 return index2 < 0 ? arr.length : index2; 22541 } 22542 var colors = { 22543 transparent: 0, 22544 aliceblue: 4042850303, 22545 antiquewhite: 4209760255, 22546 aqua: 16777215, 22547 aquamarine: 2147472639, 22548 azure: 4043309055, 22549 beige: 4126530815, 22550 bisque: 4293182719, 22551 black: 255, 22552 blanchedalmond: 4293643775, 22553 blue: 65535, 22554 blueviolet: 2318131967, 22555 brown: 2771004159, 22556 burlywood: 3736635391, 22557 burntsienna: 3934150143, 22558 cadetblue: 1604231423, 22559 chartreuse: 2147418367, 22560 chocolate: 3530104575, 22561 coral: 4286533887, 22562 cornflowerblue: 1687547391, 22563 cornsilk: 4294499583, 22564 crimson: 3692313855, 22565 cyan: 16777215, 22566 darkblue: 35839, 22567 darkcyan: 9145343, 22568 darkgoldenrod: 3095792639, 22569 darkgray: 2846468607, 22570 darkgreen: 6553855, 22571 darkgrey: 2846468607, 22572 darkkhaki: 3182914559, 22573 darkmagenta: 2332068863, 22574 darkolivegreen: 1433087999, 22575 darkorange: 4287365375, 22576 darkorchid: 2570243327, 22577 darkred: 2332033279, 22578 darksalmon: 3918953215, 22579 darkseagreen: 2411499519, 22580 darkslateblue: 1211993087, 22581 darkslategray: 793726975, 22582 darkslategrey: 793726975, 22583 darkturquoise: 13554175, 22584 darkviolet: 2483082239, 22585 deeppink: 4279538687, 22586 deepskyblue: 12582911, 22587 dimgray: 1768516095, 22588 dimgrey: 1768516095, 22589 dodgerblue: 512819199, 22590 firebrick: 2988581631, 22591 floralwhite: 4294635775, 22592 forestgreen: 579543807, 22593 fuchsia: 4278255615, 22594 gainsboro: 3705462015, 22595 ghostwhite: 4177068031, 22596 gold: 4292280575, 22597 goldenrod: 3668254975, 22598 gray: 2155905279, 22599 green: 8388863, 22600 greenyellow: 2919182335, 22601 grey: 2155905279, 22602 honeydew: 4043305215, 22603 hotpink: 4285117695, 22604 indianred: 3445382399, 22605 indigo: 1258324735, 22606 ivory: 4294963455, 22607 khaki: 4041641215, 22608 lavender: 3873897215, 22609 lavenderblush: 4293981695, 22610 lawngreen: 2096890111, 22611 lemonchiffon: 4294626815, 22612 lightblue: 2916673279, 22613 lightcoral: 4034953471, 22614 lightcyan: 3774873599, 22615 lightgoldenrodyellow: 4210742015, 22616 lightgray: 3553874943, 22617 lightgreen: 2431553791, 22618 lightgrey: 3553874943, 22619 lightpink: 4290167295, 22620 lightsalmon: 4288707327, 22621 lightseagreen: 548580095, 22622 lightskyblue: 2278488831, 22623 lightslategray: 2005441023, 22624 lightslategrey: 2005441023, 22625 lightsteelblue: 2965692159, 22626 lightyellow: 4294959359, 22627 lime: 16711935, 22628 limegreen: 852308735, 22629 linen: 4210091775, 22630 magenta: 4278255615, 22631 maroon: 2147483903, 22632 mediumaquamarine: 1724754687, 22633 mediumblue: 52735, 22634 mediumorchid: 3126187007, 22635 mediumpurple: 2473647103, 22636 mediumseagreen: 1018393087, 22637 mediumslateblue: 2070474495, 22638 mediumspringgreen: 16423679, 22639 mediumturquoise: 1221709055, 22640 mediumvioletred: 3340076543, 22641 midnightblue: 421097727, 22642 mintcream: 4127193855, 22643 mistyrose: 4293190143, 22644 moccasin: 4293178879, 22645 navajowhite: 4292783615, 22646 navy: 33023, 22647 oldlace: 4260751103, 22648 olive: 2155872511, 22649 olivedrab: 1804477439, 22650 orange: 4289003775, 22651 orangered: 4282712319, 22652 orchid: 3664828159, 22653 palegoldenrod: 4008225535, 22654 palegreen: 2566625535, 22655 paleturquoise: 2951671551, 22656 palevioletred: 3681588223, 22657 papayawhip: 4293907967, 22658 peachpuff: 4292524543, 22659 peru: 3448061951, 22660 pink: 4290825215, 22661 plum: 3718307327, 22662 powderblue: 2967529215, 22663 purple: 2147516671, 22664 rebeccapurple: 1714657791, 22665 red: 4278190335, 22666 rosybrown: 3163525119, 22667 royalblue: 1097458175, 22668 saddlebrown: 2336560127, 22669 salmon: 4202722047, 22670 sandybrown: 4104413439, 22671 seagreen: 780883967, 22672 seashell: 4294307583, 22673 sienna: 2689740287, 22674 silver: 3233857791, 22675 skyblue: 2278484991, 22676 slateblue: 1784335871, 22677 slategray: 1887473919, 22678 slategrey: 1887473919, 22679 snow: 4294638335, 22680 springgreen: 16744447, 22681 steelblue: 1182971135, 22682 tan: 3535047935, 22683 teal: 8421631, 22684 thistle: 3636451583, 22685 tomato: 4284696575, 22686 turquoise: 1088475391, 22687 violet: 4001558271, 22688 wheat: 4125012991, 22689 white: 4294967295, 22690 whitesmoke: 4126537215, 22691 yellow: 4294902015, 22692 yellowgreen: 2597139199 22693 }; 22694 var NUMBER = "[-+]?\\d*\\.?\\d+"; 22695 var PERCENTAGE = NUMBER + "%"; 22696 function call(...parts) { 22697 return "\\(\\s*(" + parts.join(")\\s*,\\s*(") + ")\\s*\\)"; 22698 } 22699 var rgb = new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER)); 22700 var rgba = new RegExp("rgba" + call(NUMBER, NUMBER, NUMBER, NUMBER)); 22701 var hsl = new RegExp("hsl" + call(NUMBER, PERCENTAGE, PERCENTAGE)); 22702 var hsla = new RegExp("hsla" + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER)); 22703 var hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/; 22704 var hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/; 22705 var hex6 = /^#([0-9a-fA-F]{6})$/; 22706 var hex8 = /^#([0-9a-fA-F]{8})$/; 22707 function normalizeColor(color) { 22708 let match3; 22709 if (typeof color === "number") { 22710 return color >>> 0 === color && color >= 0 && color <= 4294967295 ? color : null; 22711 } 22712 if (match3 = hex6.exec(color)) return parseInt(match3[1] + "ff", 16) >>> 0; 22713 if (colors$1 && colors$1[color] !== void 0) { 22714 return colors$1[color]; 22715 } 22716 if (match3 = rgb.exec(color)) { 22717 return (parse255(match3[1]) << 24 | parse255(match3[2]) << 16 | parse255(match3[3]) << 8 | 255) >>> 0; 22718 } 22719 if (match3 = rgba.exec(color)) { 22720 return (parse255(match3[1]) << 24 | parse255(match3[2]) << 16 | parse255(match3[3]) << 8 | parse1(match3[4])) >>> 0; 22721 } 22722 if (match3 = hex3.exec(color)) { 22723 return parseInt(match3[1] + match3[1] + match3[2] + match3[2] + match3[3] + match3[3] + "ff", 16) >>> 0; 22724 } 22725 if (match3 = hex8.exec(color)) return parseInt(match3[1], 16) >>> 0; 22726 if (match3 = hex4.exec(color)) { 22727 return parseInt(match3[1] + match3[1] + match3[2] + match3[2] + match3[3] + match3[3] + match3[4] + match3[4], 16) >>> 0; 22728 } 22729 if (match3 = hsl.exec(color)) { 22730 return (hslToRgb(parse360(match3[1]), parsePercentage(match3[2]), parsePercentage(match3[3])) | 255) >>> 0; 22731 } 22732 if (match3 = hsla.exec(color)) { 22733 return (hslToRgb(parse360(match3[1]), parsePercentage(match3[2]), parsePercentage(match3[3])) | parse1(match3[4])) >>> 0; 22734 } 22735 return null; 22736 } 22737 function hue2rgb(p4, q, t4) { 22738 if (t4 < 0) t4 += 1; 22739 if (t4 > 1) t4 -= 1; 22740 if (t4 < 1 / 6) return p4 + (q - p4) * 6 * t4; 22741 if (t4 < 1 / 2) return q; 22742 if (t4 < 2 / 3) return p4 + (q - p4) * (2 / 3 - t4) * 6; 22743 return p4; 22744 } 22745 function hslToRgb(h3, s3, l3) { 22746 const q = l3 < 0.5 ? l3 * (1 + s3) : l3 + s3 - l3 * s3; 22747 const p4 = 2 * l3 - q; 22748 const r4 = hue2rgb(p4, q, h3 + 1 / 3); 22749 const g3 = hue2rgb(p4, q, h3); 22750 const b3 = hue2rgb(p4, q, h3 - 1 / 3); 22751 return Math.round(r4 * 255) << 24 | Math.round(g3 * 255) << 16 | Math.round(b3 * 255) << 8; 22752 } 22753 function parse255(str3) { 22754 const int = parseInt(str3, 10); 22755 if (int < 0) return 0; 22756 if (int > 255) return 255; 22757 return int; 22758 } 22759 function parse360(str3) { 22760 const int = parseFloat(str3); 22761 return (int % 360 + 360) % 360 / 360; 22762 } 22763 function parse1(str3) { 22764 const num = parseFloat(str3); 22765 if (num < 0) return 0; 22766 if (num > 1) return 255; 22767 return Math.round(num * 255); 22768 } 22769 function parsePercentage(str3) { 22770 const int = parseFloat(str3); 22771 if (int < 0) return 0; 22772 if (int > 100) return 1; 22773 return int / 100; 22774 } 22775 function colorToRgba(input) { 22776 let int32Color = normalizeColor(input); 22777 if (int32Color === null) return input; 22778 int32Color = int32Color || 0; 22779 let r4 = (int32Color & 4278190080) >>> 24; 22780 let g3 = (int32Color & 16711680) >>> 16; 22781 let b3 = (int32Color & 65280) >>> 8; 22782 let a3 = (int32Color & 255) / 255; 22783 return `rgba($r4}, $g3}, $b3}, $a3})`; 22784 } 22785 var createInterpolator = (range, output, extrapolate) => { 22786 if (is.fun(range)) { 22787 return range; 22788 } 22789 if (is.arr(range)) { 22790 return createInterpolator({ 22791 range, 22792 output, 22793 extrapolate 22794 }); 22795 } 22796 if (is.str(range.output[0])) { 22797 return createStringInterpolator$1(range); 22798 } 22799 const config2 = range; 22800 const outputRange = config2.output; 22801 const inputRange = config2.range || [0, 1]; 22802 const extrapolateLeft = config2.extrapolateLeft || config2.extrapolate || "extend"; 22803 const extrapolateRight = config2.extrapolateRight || config2.extrapolate || "extend"; 22804 const easing = config2.easing || ((t4) => t4); 22805 return (input) => { 22806 const range2 = findRange(input, inputRange); 22807 return interpolate(input, inputRange[range2], inputRange[range2 + 1], outputRange[range2], outputRange[range2 + 1], easing, extrapolateLeft, extrapolateRight, config2.map); 22808 }; 22809 }; 22810 function interpolate(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight, map) { 22811 let result = map ? map(input) : input; 22812 if (result < inputMin) { 22813 if (extrapolateLeft === "identity") return result; 22814 else if (extrapolateLeft === "clamp") result = inputMin; 22815 } 22816 if (result > inputMax) { 22817 if (extrapolateRight === "identity") return result; 22818 else if (extrapolateRight === "clamp") result = inputMax; 22819 } 22820 if (outputMin === outputMax) return outputMin; 22821 if (inputMin === inputMax) return input <= inputMin ? outputMin : outputMax; 22822 if (inputMin === -Infinity) result = -result; 22823 else if (inputMax === Infinity) result = result - inputMin; 22824 else result = (result - inputMin) / (inputMax - inputMin); 22825 result = easing(result); 22826 if (outputMin === -Infinity) result = -result; 22827 else if (outputMax === Infinity) result = result + outputMin; 22828 else result = result * (outputMax - outputMin) + outputMin; 22829 return result; 22830 } 22831 function findRange(input, inputRange) { 22832 for (var i3 = 1; i3 < inputRange.length - 1; ++i3) if (inputRange[i3] >= input) break; 22833 return i3 - 1; 22834 } 22835 function _extends() { 22836 _extends = Object.assign ? Object.assign.bind() : function(target) { 22837 for (var i3 = 1; i3 < arguments.length; i3++) { 22838 var source = arguments[i3]; 22839 for (var key in source) { 22840 if (Object.prototype.hasOwnProperty.call(source, key)) { 22841 target[key] = source[key]; 22842 } 22843 } 22844 } 22845 return target; 22846 }; 22847 return _extends.apply(this, arguments); 22848 } 22849 var $get = /* @__PURE__ */ Symbol.for("FluidValue.get"); 22850 var $observers = /* @__PURE__ */ Symbol.for("FluidValue.observers"); 22851 var hasFluidValue = (arg) => Boolean(arg && arg[$get]); 22852 var getFluidValue = (arg) => arg && arg[$get] ? arg[$get]() : arg; 22853 var getFluidObservers = (target) => target[$observers] || null; 22854 function callFluidObserver(observer, event) { 22855 if (observer.eventObserved) { 22856 observer.eventObserved(event); 22857 } else { 22858 observer(event); 22859 } 22860 } 22861 function callFluidObservers(target, event) { 22862 let observers = target[$observers]; 22863 if (observers) { 22864 observers.forEach((observer) => { 22865 callFluidObserver(observer, event); 22866 }); 22867 } 22868 } 22869 var FluidValue = class { 22870 constructor(get) { 22871 this[$get] = void 0; 22872 this[$observers] = void 0; 22873 if (!get && !(get = this.get)) { 22874 throw Error("Unknown getter"); 22875 } 22876 setFluidGetter(this, get); 22877 } 22878 }; 22879 var setFluidGetter = (target, get) => setHidden(target, $get, get); 22880 function addFluidObserver(target, observer) { 22881 if (target[$get]) { 22882 let observers = target[$observers]; 22883 if (!observers) { 22884 setHidden(target, $observers, observers = /* @__PURE__ */ new Set()); 22885 } 22886 if (!observers.has(observer)) { 22887 observers.add(observer); 22888 if (target.observerAdded) { 22889 target.observerAdded(observers.size, observer); 22890 } 22891 } 22892 } 22893 return observer; 22894 } 22895 function removeFluidObserver(target, observer) { 22896 let observers = target[$observers]; 22897 if (observers && observers.has(observer)) { 22898 const count = observers.size - 1; 22899 if (count) { 22900 observers.delete(observer); 22901 } else { 22902 target[$observers] = null; 22903 } 22904 if (target.observerRemoved) { 22905 target.observerRemoved(count, observer); 22906 } 22907 } 22908 } 22909 var setHidden = (target, key, value) => Object.defineProperty(target, key, { 22910 value, 22911 writable: true, 22912 configurable: true 22913 }); 22914 var numberRegex = /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g; 22915 var colorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi; 22916 var unitRegex = new RegExp(`($numberRegex.source})(%|[a-z]+)`, "i"); 22917 var rgbaRegex = /rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi; 22918 var cssVariableRegex = /var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/; 22919 var variableToRgba = (input) => { 22920 const [token, fallback] = parseCSSVariable(input); 22921 if (!token || isSSR()) { 22922 return input; 22923 } 22924 const value = window.getComputedStyle(document.documentElement).getPropertyValue(token); 22925 if (value) { 22926 return value.trim(); 22927 } else if (fallback && fallback.startsWith("--")) { 22928 const _value = window.getComputedStyle(document.documentElement).getPropertyValue(fallback); 22929 if (_value) { 22930 return _value; 22931 } else { 22932 return input; 22933 } 22934 } else if (fallback && cssVariableRegex.test(fallback)) { 22935 return variableToRgba(fallback); 22936 } else if (fallback) { 22937 return fallback; 22938 } 22939 return input; 22940 }; 22941 var parseCSSVariable = (current) => { 22942 const match3 = cssVariableRegex.exec(current); 22943 if (!match3) return [,]; 22944 const [, token, fallback] = match3; 22945 return [token, fallback]; 22946 }; 22947 var namedColorRegex; 22948 var rgbaRound = (_, p1, p22, p32, p4) => `rgba($Math.round(p1)}, $Math.round(p22)}, $Math.round(p32)}, $p4})`; 22949 var createStringInterpolator = (config2) => { 22950 if (!namedColorRegex) namedColorRegex = colors$1 ? new RegExp(`($Object.keys(colors$1).join("|")})(?!\\w)`, "g") : /^\b$/; 22951 const output = config2.output.map((value) => { 22952 return getFluidValue(value).replace(cssVariableRegex, variableToRgba).replace(colorRegex, colorToRgba).replace(namedColorRegex, colorToRgba); 22953 }); 22954 const keyframes = output.map((value) => value.match(numberRegex).map(Number)); 22955 const outputRanges = keyframes[0].map((_, i3) => keyframes.map((values) => { 22956 if (!(i3 in values)) { 22957 throw Error('The arity of each "output" value must be equal'); 22958 } 22959 return values[i3]; 22960 })); 22961 const interpolators = outputRanges.map((output2) => createInterpolator(_extends({}, config2, { 22962 output: output2 22963 }))); 22964 return (input) => { 22965 var _output$find; 22966 const missingUnit = !unitRegex.test(output[0]) && ((_output$find = output.find((value) => unitRegex.test(value))) == null ? void 0 : _output$find.replace(numberRegex, "")); 22967 let i3 = 0; 22968 return output[0].replace(numberRegex, () => `$interpolators[i3++](input)}$missingUnit || ""}`).replace(rgbaRegex, rgbaRound); 22969 }; 22970 }; 22971 var prefix = "react-spring: "; 22972 var once = (fn) => { 22973 const func = fn; 22974 let called = false; 22975 if (typeof func != "function") { 22976 throw new TypeError(`$prefix}once requires a function parameter`); 22977 } 22978 return (...args) => { 22979 if (!called) { 22980 func(...args); 22981 called = true; 22982 } 22983 }; 22984 }; 22985 var warnInterpolate = once(console.warn); 22986 function deprecateInterpolate() { 22987 warnInterpolate(`$prefix}The "interpolate" function is deprecated in v9 (use "to" instead)`); 22988 } 22989 var warnDirectCall = once(console.warn); 22990 function isAnimatedString(value) { 22991 return is.str(value) && (value[0] == "#" || /\d/.test(value) || !isSSR() && cssVariableRegex.test(value) || value in (colors$1 || {})); 22992 } 22993 var useIsomorphicLayoutEffect = isSSR() ? import_react13.useEffect : import_react13.useLayoutEffect; 22994 var useIsMounted = () => { 22995 const isMounted = (0, import_react13.useRef)(false); 22996 useIsomorphicLayoutEffect(() => { 22997 isMounted.current = true; 22998 return () => { 22999 isMounted.current = false; 23000 }; 23001 }, []); 23002 return isMounted; 23003 }; 23004 function useForceUpdate() { 23005 const update4 = (0, import_react13.useState)()[1]; 23006 const isMounted = useIsMounted(); 23007 return () => { 23008 if (isMounted.current) { 23009 update4(Math.random()); 23010 } 23011 }; 23012 } 23013 function useMemoOne(getResult, inputs) { 23014 const [initial2] = (0, import_react13.useState)(() => ({ 23015 inputs, 23016 result: getResult() 23017 })); 23018 const committed = (0, import_react13.useRef)(); 23019 const prevCache = committed.current; 23020 let cache = prevCache; 23021 if (cache) { 23022 const useCache = Boolean(inputs && cache.inputs && areInputsEqual(inputs, cache.inputs)); 23023 if (!useCache) { 23024 cache = { 23025 inputs, 23026 result: getResult() 23027 }; 23028 } 23029 } else { 23030 cache = initial2; 23031 } 23032 (0, import_react13.useEffect)(() => { 23033 committed.current = cache; 23034 if (prevCache == initial2) { 23035 initial2.inputs = initial2.result = void 0; 23036 } 23037 }, [cache]); 23038 return cache.result; 23039 } 23040 function areInputsEqual(next, prev) { 23041 if (next.length !== prev.length) { 23042 return false; 23043 } 23044 for (let i3 = 0; i3 < next.length; i3++) { 23045 if (next[i3] !== prev[i3]) { 23046 return false; 23047 } 23048 } 23049 return true; 23050 } 23051 var useOnce = (effect) => (0, import_react13.useEffect)(effect, emptyDeps); 23052 var emptyDeps = []; 23053 23054 // node_modules/@react-spring/core/dist/react-spring-core.esm.js 23055 var React74 = __toESM(require_react()); 23056 var import_react15 = __toESM(require_react()); 23057 23058 // node_modules/@react-spring/animated/dist/react-spring-animated.esm.js 23059 var React73 = __toESM(require_react()); 23060 var import_react14 = __toESM(require_react()); 23061 var $node = /* @__PURE__ */ Symbol.for("Animated:node"); 23062 var isAnimated = (value) => !!value && value[$node] === value; 23063 var getAnimated = (owner) => owner && owner[$node]; 23064 var setAnimated = (owner, node) => defineHidden(owner, $node, node); 23065 var getPayload = (owner) => owner && owner[$node] && owner[$node].getPayload(); 23066 var Animated = class { 23067 constructor() { 23068 this.payload = void 0; 23069 setAnimated(this, this); 23070 } 23071 getPayload() { 23072 return this.payload || []; 23073 } 23074 }; 23075 var AnimatedValue = class _AnimatedValue extends Animated { 23076 constructor(_value) { 23077 super(); 23078 this.done = true; 23079 this.elapsedTime = void 0; 23080 this.lastPosition = void 0; 23081 this.lastVelocity = void 0; 23082 this.v0 = void 0; 23083 this.durationProgress = 0; 23084 this._value = _value; 23085 if (is.num(this._value)) { 23086 this.lastPosition = this._value; 23087 } 23088 } 23089 static create(value) { 23090 return new _AnimatedValue(value); 23091 } 23092 getPayload() { 23093 return [this]; 23094 } 23095 getValue() { 23096 return this._value; 23097 } 23098 setValue(value, step) { 23099 if (is.num(value)) { 23100 this.lastPosition = value; 23101 if (step) { 23102 value = Math.round(value / step) * step; 23103 if (this.done) { 23104 this.lastPosition = value; 23105 } 23106 } 23107 } 23108 if (this._value === value) { 23109 return false; 23110 } 23111 this._value = value; 23112 return true; 23113 } 23114 reset() { 23115 const { 23116 done 23117 } = this; 23118 this.done = false; 23119 if (is.num(this._value)) { 23120 this.elapsedTime = 0; 23121 this.durationProgress = 0; 23122 this.lastPosition = this._value; 23123 if (done) this.lastVelocity = null; 23124 this.v0 = null; 23125 } 23126 } 23127 }; 23128 var AnimatedString = class _AnimatedString extends AnimatedValue { 23129 constructor(value) { 23130 super(0); 23131 this._string = null; 23132 this._toString = void 0; 23133 this._toString = createInterpolator({ 23134 output: [value, value] 23135 }); 23136 } 23137 static create(value) { 23138 return new _AnimatedString(value); 23139 } 23140 getValue() { 23141 let value = this._string; 23142 return value == null ? this._string = this._toString(this._value) : value; 23143 } 23144 setValue(value) { 23145 if (is.str(value)) { 23146 if (value == this._string) { 23147 return false; 23148 } 23149 this._string = value; 23150 this._value = 1; 23151 } else if (super.setValue(value)) { 23152 this._string = null; 23153 } else { 23154 return false; 23155 } 23156 return true; 23157 } 23158 reset(goal) { 23159 if (goal) { 23160 this._toString = createInterpolator({ 23161 output: [this.getValue(), goal] 23162 }); 23163 } 23164 this._value = 0; 23165 super.reset(); 23166 } 23167 }; 23168 var TreeContext = { 23169 dependencies: null 23170 }; 23171 var AnimatedObject = class extends Animated { 23172 constructor(source) { 23173 super(); 23174 this.source = source; 23175 this.setValue(source); 23176 } 23177 getValue(animated2) { 23178 const values = {}; 23179 eachProp(this.source, (source, key) => { 23180 if (isAnimated(source)) { 23181 values[key] = source.getValue(animated2); 23182 } else if (hasFluidValue(source)) { 23183 values[key] = getFluidValue(source); 23184 } else if (!animated2) { 23185 values[key] = source; 23186 } 23187 }); 23188 return values; 23189 } 23190 setValue(source) { 23191 this.source = source; 23192 this.payload = this._makePayload(source); 23193 } 23194 reset() { 23195 if (this.payload) { 23196 each(this.payload, (node) => node.reset()); 23197 } 23198 } 23199 _makePayload(source) { 23200 if (source) { 23201 const payload = /* @__PURE__ */ new Set(); 23202 eachProp(source, this._addToPayload, payload); 23203 return Array.from(payload); 23204 } 23205 } 23206 _addToPayload(source) { 23207 if (TreeContext.dependencies && hasFluidValue(source)) { 23208 TreeContext.dependencies.add(source); 23209 } 23210 const payload = getPayload(source); 23211 if (payload) { 23212 each(payload, (node) => this.add(node)); 23213 } 23214 } 23215 }; 23216 var AnimatedArray = class _AnimatedArray extends AnimatedObject { 23217 constructor(source) { 23218 super(source); 23219 } 23220 static create(source) { 23221 return new _AnimatedArray(source); 23222 } 23223 getValue() { 23224 return this.source.map((node) => node.getValue()); 23225 } 23226 setValue(source) { 23227 const payload = this.getPayload(); 23228 if (source.length == payload.length) { 23229 return payload.map((node, i3) => node.setValue(source[i3])).some(Boolean); 23230 } 23231 super.setValue(source.map(makeAnimated)); 23232 return true; 23233 } 23234 }; 23235 function makeAnimated(value) { 23236 const nodeType = isAnimatedString(value) ? AnimatedString : AnimatedValue; 23237 return nodeType.create(value); 23238 } 23239 function getAnimatedType(value) { 23240 const parentNode = getAnimated(value); 23241 return parentNode ? parentNode.constructor : is.arr(value) ? AnimatedArray : isAnimatedString(value) ? AnimatedString : AnimatedValue; 23242 } 23243 function _extends2() { 23244 _extends2 = Object.assign ? Object.assign.bind() : function(target) { 23245 for (var i3 = 1; i3 < arguments.length; i3++) { 23246 var source = arguments[i3]; 23247 for (var key in source) { 23248 if (Object.prototype.hasOwnProperty.call(source, key)) { 23249 target[key] = source[key]; 23250 } 23251 } 23252 } 23253 return target; 23254 }; 23255 return _extends2.apply(this, arguments); 23256 } 23257 var withAnimated = (Component3, host2) => { 23258 const hasInstance = !is.fun(Component3) || Component3.prototype && Component3.prototype.isReactComponent; 23259 return (0, import_react14.forwardRef)((givenProps, givenRef) => { 23260 const instanceRef = (0, import_react14.useRef)(null); 23261 const ref = hasInstance && (0, import_react14.useCallback)((value) => { 23262 instanceRef.current = updateRef(givenRef, value); 23263 }, [givenRef]); 23264 const [props, deps] = getAnimatedState(givenProps, host2); 23265 const forceUpdate = useForceUpdate(); 23266 const callback = () => { 23267 const instance = instanceRef.current; 23268 if (hasInstance && !instance) { 23269 return; 23270 } 23271 const didUpdate = instance ? host2.applyAnimatedValues(instance, props.getValue(true)) : false; 23272 if (didUpdate === false) { 23273 forceUpdate(); 23274 } 23275 }; 23276 const observer = new PropsObserver(callback, deps); 23277 const observerRef = (0, import_react14.useRef)(); 23278 useIsomorphicLayoutEffect(() => { 23279 observerRef.current = observer; 23280 each(deps, (dep) => addFluidObserver(dep, observer)); 23281 return () => { 23282 if (observerRef.current) { 23283 each(observerRef.current.deps, (dep) => removeFluidObserver(dep, observerRef.current)); 23284 raf.cancel(observerRef.current.update); 23285 } 23286 }; 23287 }); 23288 (0, import_react14.useEffect)(callback, []); 23289 useOnce(() => () => { 23290 const observer2 = observerRef.current; 23291 each(observer2.deps, (dep) => removeFluidObserver(dep, observer2)); 23292 }); 23293 const usedProps = host2.getComponentProps(props.getValue()); 23294 return React73.createElement(Component3, _extends2({}, usedProps, { 23295 ref 23296 })); 23297 }); 23298 }; 23299 var PropsObserver = class { 23300 constructor(update4, deps) { 23301 this.update = update4; 23302 this.deps = deps; 23303 } 23304 eventObserved(event) { 23305 if (event.type == "change") { 23306 raf.write(this.update); 23307 } 23308 } 23309 }; 23310 function getAnimatedState(props, host2) { 23311 const dependencies = /* @__PURE__ */ new Set(); 23312 TreeContext.dependencies = dependencies; 23313 if (props.style) props = _extends2({}, props, { 23314 style: host2.createAnimatedStyle(props.style) 23315 }); 23316 props = new AnimatedObject(props); 23317 TreeContext.dependencies = null; 23318 return [props, dependencies]; 23319 } 23320 function updateRef(ref, value) { 23321 if (ref) { 23322 if (is.fun(ref)) ref(value); 23323 else ref.current = value; 23324 } 23325 return value; 23326 } 23327 var cacheKey = /* @__PURE__ */ Symbol.for("AnimatedComponent"); 23328 var createHost = (components, { 23329 applyAnimatedValues: _applyAnimatedValues = () => false, 23330 createAnimatedStyle: _createAnimatedStyle = (style) => new AnimatedObject(style), 23331 getComponentProps: _getComponentProps = (props) => props 23332 } = {}) => { 23333 const hostConfig = { 23334 applyAnimatedValues: _applyAnimatedValues, 23335 createAnimatedStyle: _createAnimatedStyle, 23336 getComponentProps: _getComponentProps 23337 }; 23338 const animated2 = (Component3) => { 23339 const displayName = getDisplayName(Component3) || "Anonymous"; 23340 if (is.str(Component3)) { 23341 Component3 = animated2[Component3] || (animated2[Component3] = withAnimated(Component3, hostConfig)); 23342 } else { 23343 Component3 = Component3[cacheKey] || (Component3[cacheKey] = withAnimated(Component3, hostConfig)); 23344 } 23345 Component3.displayName = `Animated($displayName})`; 23346 return Component3; 23347 }; 23348 eachProp(components, (Component3, key) => { 23349 if (is.arr(components)) { 23350 key = getDisplayName(Component3); 23351 } 23352 animated2[key] = animated2(Component3); 23353 }); 23354 return { 23355 animated: animated2 23356 }; 23357 }; 23358 var getDisplayName = (arg) => is.str(arg) ? arg : arg && is.str(arg.displayName) ? arg.displayName : is.fun(arg) && arg.name || null; 23359 23360 // node_modules/@react-spring/core/dist/react-spring-core.esm.js 23361 function _extends3() { 23362 _extends3 = Object.assign ? Object.assign.bind() : function(target) { 23363 for (var i3 = 1; i3 < arguments.length; i3++) { 23364 var source = arguments[i3]; 23365 for (var key in source) { 23366 if (Object.prototype.hasOwnProperty.call(source, key)) { 23367 target[key] = source[key]; 23368 } 23369 } 23370 } 23371 return target; 23372 }; 23373 return _extends3.apply(this, arguments); 23374 } 23375 function callProp(value, ...args) { 23376 return is.fun(value) ? value(...args) : value; 23377 } 23378 var matchProp = (value, key) => value === true || !!(key && value && (is.fun(value) ? value(key) : toArray(value).includes(key))); 23379 var resolveProp = (prop, key) => is.obj(prop) ? key && prop[key] : prop; 23380 var getDefaultProp = (props, key) => props.default === true ? props[key] : props.default ? props.default[key] : void 0; 23381 var noopTransform = (value) => value; 23382 var getDefaultProps = (props, transform = noopTransform) => { 23383 let keys = DEFAULT_PROPS; 23384 if (props.default && props.default !== true) { 23385 props = props.default; 23386 keys = Object.keys(props); 23387 } 23388 const defaults2 = {}; 23389 for (const key of keys) { 23390 const value = transform(props[key], key); 23391 if (!is.und(value)) { 23392 defaults2[key] = value; 23393 } 23394 } 23395 return defaults2; 23396 }; 23397 var DEFAULT_PROPS = ["config", "onProps", "onStart", "onChange", "onPause", "onResume", "onRest"]; 23398 var RESERVED_PROPS = { 23399 config: 1, 23400 from: 1, 23401 to: 1, 23402 ref: 1, 23403 loop: 1, 23404 reset: 1, 23405 pause: 1, 23406 cancel: 1, 23407 reverse: 1, 23408 immediate: 1, 23409 default: 1, 23410 delay: 1, 23411 onProps: 1, 23412 onStart: 1, 23413 onChange: 1, 23414 onPause: 1, 23415 onResume: 1, 23416 onRest: 1, 23417 onResolve: 1, 23418 items: 1, 23419 trail: 1, 23420 sort: 1, 23421 expires: 1, 23422 initial: 1, 23423 enter: 1, 23424 update: 1, 23425 leave: 1, 23426 children: 1, 23427 onDestroyed: 1, 23428 keys: 1, 23429 callId: 1, 23430 parentId: 1 23431 }; 23432 function getForwardProps(props) { 23433 const forward = {}; 23434 let count = 0; 23435 eachProp(props, (value, prop) => { 23436 if (!RESERVED_PROPS[prop]) { 23437 forward[prop] = value; 23438 count++; 23439 } 23440 }); 23441 if (count) { 23442 return forward; 23443 } 23444 } 23445 function inferTo(props) { 23446 const to2 = getForwardProps(props); 23447 if (to2) { 23448 const out = { 23449 to: to2 23450 }; 23451 eachProp(props, (val, key) => key in to2 || (out[key] = val)); 23452 return out; 23453 } 23454 return _extends3({}, props); 23455 } 23456 function computeGoal(value) { 23457 value = getFluidValue(value); 23458 return is.arr(value) ? value.map(computeGoal) : isAnimatedString(value) ? globals.createStringInterpolator({ 23459 range: [0, 1], 23460 output: [value, value] 23461 })(1) : value; 23462 } 23463 function isAsyncTo(to2) { 23464 return is.fun(to2) || is.arr(to2) && is.obj(to2[0]); 23465 } 23466 var config = { 23467 default: { 23468 tension: 170, 23469 friction: 26 23470 }, 23471 gentle: { 23472 tension: 120, 23473 friction: 14 23474 }, 23475 wobbly: { 23476 tension: 180, 23477 friction: 12 23478 }, 23479 stiff: { 23480 tension: 210, 23481 friction: 20 23482 }, 23483 slow: { 23484 tension: 280, 23485 friction: 60 23486 }, 23487 molasses: { 23488 tension: 280, 23489 friction: 120 23490 } 23491 }; 23492 var c1 = 1.70158; 23493 var c2 = c1 * 1.525; 23494 var c3 = c1 + 1; 23495 var c4 = 2 * Math.PI / 3; 23496 var c5 = 2 * Math.PI / 4.5; 23497 var bounceOut = (x2) => { 23498 const n1 = 7.5625; 23499 const d1 = 2.75; 23500 if (x2 < 1 / d1) { 23501 return n1 * x2 * x2; 23502 } else if (x2 < 2 / d1) { 23503 return n1 * (x2 -= 1.5 / d1) * x2 + 0.75; 23504 } else if (x2 < 2.5 / d1) { 23505 return n1 * (x2 -= 2.25 / d1) * x2 + 0.9375; 23506 } else { 23507 return n1 * (x2 -= 2.625 / d1) * x2 + 0.984375; 23508 } 23509 }; 23510 var easings = { 23511 linear: (x2) => x2, 23512 easeInQuad: (x2) => x2 * x2, 23513 easeOutQuad: (x2) => 1 - (1 - x2) * (1 - x2), 23514 easeInOutQuad: (x2) => x2 < 0.5 ? 2 * x2 * x2 : 1 - Math.pow(-2 * x2 + 2, 2) / 2, 23515 easeInCubic: (x2) => x2 * x2 * x2, 23516 easeOutCubic: (x2) => 1 - Math.pow(1 - x2, 3), 23517 easeInOutCubic: (x2) => x2 < 0.5 ? 4 * x2 * x2 * x2 : 1 - Math.pow(-2 * x2 + 2, 3) / 2, 23518 easeInQuart: (x2) => x2 * x2 * x2 * x2, 23519 easeOutQuart: (x2) => 1 - Math.pow(1 - x2, 4), 23520 easeInOutQuart: (x2) => x2 < 0.5 ? 8 * x2 * x2 * x2 * x2 : 1 - Math.pow(-2 * x2 + 2, 4) / 2, 23521 easeInQuint: (x2) => x2 * x2 * x2 * x2 * x2, 23522 easeOutQuint: (x2) => 1 - Math.pow(1 - x2, 5), 23523 easeInOutQuint: (x2) => x2 < 0.5 ? 16 * x2 * x2 * x2 * x2 * x2 : 1 - Math.pow(-2 * x2 + 2, 5) / 2, 23524 easeInSine: (x2) => 1 - Math.cos(x2 * Math.PI / 2), 23525 easeOutSine: (x2) => Math.sin(x2 * Math.PI / 2), 23526 easeInOutSine: (x2) => -(Math.cos(Math.PI * x2) - 1) / 2, 23527 easeInExpo: (x2) => x2 === 0 ? 0 : Math.pow(2, 10 * x2 - 10), 23528 easeOutExpo: (x2) => x2 === 1 ? 1 : 1 - Math.pow(2, -10 * x2), 23529 easeInOutExpo: (x2) => x2 === 0 ? 0 : x2 === 1 ? 1 : x2 < 0.5 ? Math.pow(2, 20 * x2 - 10) / 2 : (2 - Math.pow(2, -20 * x2 + 10)) / 2, 23530 easeInCirc: (x2) => 1 - Math.sqrt(1 - Math.pow(x2, 2)), 23531 easeOutCirc: (x2) => Math.sqrt(1 - Math.pow(x2 - 1, 2)), 23532 easeInOutCirc: (x2) => x2 < 0.5 ? (1 - Math.sqrt(1 - Math.pow(2 * x2, 2))) / 2 : (Math.sqrt(1 - Math.pow(-2 * x2 + 2, 2)) + 1) / 2, 23533 easeInBack: (x2) => c3 * x2 * x2 * x2 - c1 * x2 * x2, 23534 easeOutBack: (x2) => 1 + c3 * Math.pow(x2 - 1, 3) + c1 * Math.pow(x2 - 1, 2), 23535 easeInOutBack: (x2) => x2 < 0.5 ? Math.pow(2 * x2, 2) * ((c2 + 1) * 2 * x2 - c2) / 2 : (Math.pow(2 * x2 - 2, 2) * ((c2 + 1) * (x2 * 2 - 2) + c2) + 2) / 2, 23536 easeInElastic: (x2) => x2 === 0 ? 0 : x2 === 1 ? 1 : -Math.pow(2, 10 * x2 - 10) * Math.sin((x2 * 10 - 10.75) * c4), 23537 easeOutElastic: (x2) => x2 === 0 ? 0 : x2 === 1 ? 1 : Math.pow(2, -10 * x2) * Math.sin((x2 * 10 - 0.75) * c4) + 1, 23538 easeInOutElastic: (x2) => x2 === 0 ? 0 : x2 === 1 ? 1 : x2 < 0.5 ? -(Math.pow(2, 20 * x2 - 10) * Math.sin((20 * x2 - 11.125) * c5)) / 2 : Math.pow(2, -20 * x2 + 10) * Math.sin((20 * x2 - 11.125) * c5) / 2 + 1, 23539 easeInBounce: (x2) => 1 - bounceOut(1 - x2), 23540 easeOutBounce: bounceOut, 23541 easeInOutBounce: (x2) => x2 < 0.5 ? (1 - bounceOut(1 - 2 * x2)) / 2 : (1 + bounceOut(2 * x2 - 1)) / 2 23542 }; 23543 var defaults = _extends3({}, config.default, { 23544 mass: 1, 23545 damping: 1, 23546 easing: easings.linear, 23547 clamp: false 23548 }); 23549 var AnimationConfig = class { 23550 constructor() { 23551 this.tension = void 0; 23552 this.friction = void 0; 23553 this.frequency = void 0; 23554 this.damping = void 0; 23555 this.mass = void 0; 23556 this.velocity = 0; 23557 this.restVelocity = void 0; 23558 this.precision = void 0; 23559 this.progress = void 0; 23560 this.duration = void 0; 23561 this.easing = void 0; 23562 this.clamp = void 0; 23563 this.bounce = void 0; 23564 this.decay = void 0; 23565 this.round = void 0; 23566 Object.assign(this, defaults); 23567 } 23568 }; 23569 function mergeConfig(config2, newConfig, defaultConfig) { 23570 if (defaultConfig) { 23571 defaultConfig = _extends3({}, defaultConfig); 23572 sanitizeConfig(defaultConfig, newConfig); 23573 newConfig = _extends3({}, defaultConfig, newConfig); 23574 } 23575 sanitizeConfig(config2, newConfig); 23576 Object.assign(config2, newConfig); 23577 for (const key in defaults) { 23578 if (config2[key] == null) { 23579 config2[key] = defaults[key]; 23580 } 23581 } 23582 let { 23583 mass, 23584 frequency, 23585 damping 23586 } = config2; 23587 if (!is.und(frequency)) { 23588 if (frequency < 0.01) frequency = 0.01; 23589 if (damping < 0) damping = 0; 23590 config2.tension = Math.pow(2 * Math.PI / frequency, 2) * mass; 23591 config2.friction = 4 * Math.PI * damping * mass / frequency; 23592 } 23593 return config2; 23594 } 23595 function sanitizeConfig(config2, props) { 23596 if (!is.und(props.decay)) { 23597 config2.duration = void 0; 23598 } else { 23599 const isTensionConfig = !is.und(props.tension) || !is.und(props.friction); 23600 if (isTensionConfig || !is.und(props.frequency) || !is.und(props.damping) || !is.und(props.mass)) { 23601 config2.duration = void 0; 23602 config2.decay = void 0; 23603 } 23604 if (isTensionConfig) { 23605 config2.frequency = void 0; 23606 } 23607 } 23608 } 23609 var emptyArray = []; 23610 var Animation = class { 23611 constructor() { 23612 this.changed = false; 23613 this.values = emptyArray; 23614 this.toValues = null; 23615 this.fromValues = emptyArray; 23616 this.to = void 0; 23617 this.from = void 0; 23618 this.config = new AnimationConfig(); 23619 this.immediate = false; 23620 } 23621 }; 23622 function scheduleProps(callId, { 23623 key, 23624 props, 23625 defaultProps, 23626 state: state2, 23627 actions: actions2 23628 }) { 23629 return new Promise((resolve, reject) => { 23630 var _props$cancel; 23631 let delay; 23632 let timeout; 23633 let cancel = matchProp((_props$cancel = props.cancel) != null ? _props$cancel : defaultProps == null ? void 0 : defaultProps.cancel, key); 23634 if (cancel) { 23635 onStart(); 23636 } else { 23637 if (!is.und(props.pause)) { 23638 state2.paused = matchProp(props.pause, key); 23639 } 23640 let pause = defaultProps == null ? void 0 : defaultProps.pause; 23641 if (pause !== true) { 23642 pause = state2.paused || matchProp(pause, key); 23643 } 23644 delay = callProp(props.delay || 0, key); 23645 if (pause) { 23646 state2.resumeQueue.add(onResume); 23647 actions2.pause(); 23648 } else { 23649 actions2.resume(); 23650 onResume(); 23651 } 23652 } 23653 function onPause() { 23654 state2.resumeQueue.add(onResume); 23655 state2.timeouts.delete(timeout); 23656 timeout.cancel(); 23657 delay = timeout.time - raf.now(); 23658 } 23659 function onResume() { 23660 if (delay > 0 && !globals.skipAnimation) { 23661 state2.delayed = true; 23662 timeout = raf.setTimeout(onStart, delay); 23663 state2.pauseQueue.add(onPause); 23664 state2.timeouts.add(timeout); 23665 } else { 23666 onStart(); 23667 } 23668 } 23669 function onStart() { 23670 if (state2.delayed) { 23671 state2.delayed = false; 23672 } 23673 state2.pauseQueue.delete(onPause); 23674 state2.timeouts.delete(timeout); 23675 if (callId <= (state2.cancelId || 0)) { 23676 cancel = true; 23677 } 23678 try { 23679 actions2.start(_extends3({}, props, { 23680 callId, 23681 cancel 23682 }), resolve); 23683 } catch (err) { 23684 reject(err); 23685 } 23686 } 23687 }); 23688 } 23689 var getCombinedResult = (target, results) => results.length == 1 ? results[0] : results.some((result) => result.cancelled) ? getCancelledResult(target.get()) : results.every((result) => result.noop) ? getNoopResult(target.get()) : getFinishedResult(target.get(), results.every((result) => result.finished)); 23690 var getNoopResult = (value) => ({ 23691 value, 23692 noop: true, 23693 finished: true, 23694 cancelled: false 23695 }); 23696 var getFinishedResult = (value, finished, cancelled = false) => ({ 23697 value, 23698 finished, 23699 cancelled 23700 }); 23701 var getCancelledResult = (value) => ({ 23702 value, 23703 cancelled: true, 23704 finished: false 23705 }); 23706 function runAsync(to2, props, state2, target) { 23707 const { 23708 callId, 23709 parentId, 23710 onRest 23711 } = props; 23712 const { 23713 asyncTo: prevTo, 23714 promise: prevPromise 23715 } = state2; 23716 if (!parentId && to2 === prevTo && !props.reset) { 23717 return prevPromise; 23718 } 23719 return state2.promise = (async () => { 23720 state2.asyncId = callId; 23721 state2.asyncTo = to2; 23722 const defaultProps = getDefaultProps(props, (value, key) => key === "onRest" ? void 0 : value); 23723 let preventBail; 23724 let bail; 23725 const bailPromise = new Promise((resolve, reject) => (preventBail = resolve, bail = reject)); 23726 const bailIfEnded = (bailSignal) => { 23727 const bailResult = callId <= (state2.cancelId || 0) && getCancelledResult(target) || callId !== state2.asyncId && getFinishedResult(target, false); 23728 if (bailResult) { 23729 bailSignal.result = bailResult; 23730 bail(bailSignal); 23731 throw bailSignal; 23732 } 23733 }; 23734 const animate = (arg1, arg2) => { 23735 const bailSignal = new BailSignal(); 23736 const skipAnimationSignal = new SkipAniamtionSignal(); 23737 return (async () => { 23738 if (globals.skipAnimation) { 23739 stopAsync(state2); 23740 skipAnimationSignal.result = getFinishedResult(target, false); 23741 bail(skipAnimationSignal); 23742 throw skipAnimationSignal; 23743 } 23744 bailIfEnded(bailSignal); 23745 const props2 = is.obj(arg1) ? _extends3({}, arg1) : _extends3({}, arg2, { 23746 to: arg1 23747 }); 23748 props2.parentId = callId; 23749 eachProp(defaultProps, (value, key) => { 23750 if (is.und(props2[key])) { 23751 props2[key] = value; 23752 } 23753 }); 23754 const result2 = await target.start(props2); 23755 bailIfEnded(bailSignal); 23756 if (state2.paused) { 23757 await new Promise((resume) => { 23758 state2.resumeQueue.add(resume); 23759 }); 23760 } 23761 return result2; 23762 })(); 23763 }; 23764 let result; 23765 if (globals.skipAnimation) { 23766 stopAsync(state2); 23767 return getFinishedResult(target, false); 23768 } 23769 try { 23770 let animating; 23771 if (is.arr(to2)) { 23772 animating = (async (queue) => { 23773 for (const props2 of queue) { 23774 await animate(props2); 23775 } 23776 })(to2); 23777 } else { 23778 animating = Promise.resolve(to2(animate, target.stop.bind(target))); 23779 } 23780 await Promise.all([animating.then(preventBail), bailPromise]); 23781 result = getFinishedResult(target.get(), true, false); 23782 } catch (err) { 23783 if (err instanceof BailSignal) { 23784 result = err.result; 23785 } else if (err instanceof SkipAniamtionSignal) { 23786 result = err.result; 23787 } else { 23788 throw err; 23789 } 23790 } finally { 23791 if (callId == state2.asyncId) { 23792 state2.asyncId = parentId; 23793 state2.asyncTo = parentId ? prevTo : void 0; 23794 state2.promise = parentId ? prevPromise : void 0; 23795 } 23796 } 23797 if (is.fun(onRest)) { 23798 raf.batchedUpdates(() => { 23799 onRest(result, target, target.item); 23800 }); 23801 } 23802 return result; 23803 })(); 23804 } 23805 function stopAsync(state2, cancelId) { 23806 flush(state2.timeouts, (t4) => t4.cancel()); 23807 state2.pauseQueue.clear(); 23808 state2.resumeQueue.clear(); 23809 state2.asyncId = state2.asyncTo = state2.promise = void 0; 23810 if (cancelId) state2.cancelId = cancelId; 23811 } 23812 var BailSignal = class extends Error { 23813 constructor() { 23814 super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise."); 23815 this.result = void 0; 23816 } 23817 }; 23818 var SkipAniamtionSignal = class extends Error { 23819 constructor() { 23820 super("SkipAnimationSignal"); 23821 this.result = void 0; 23822 } 23823 }; 23824 var isFrameValue = (value) => value instanceof FrameValue; 23825 var nextId$1 = 1; 23826 var FrameValue = class extends FluidValue { 23827 constructor(...args) { 23828 super(...args); 23829 this.id = nextId$1++; 23830 this.key = void 0; 23831 this._priority = 0; 23832 } 23833 get priority() { 23834 return this._priority; 23835 } 23836 set priority(priority2) { 23837 if (this._priority != priority2) { 23838 this._priority = priority2; 23839 this._onPriorityChange(priority2); 23840 } 23841 } 23842 get() { 23843 const node = getAnimated(this); 23844 return node && node.getValue(); 23845 } 23846 to(...args) { 23847 return globals.to(this, args); 23848 } 23849 interpolate(...args) { 23850 deprecateInterpolate(); 23851 return globals.to(this, args); 23852 } 23853 toJSON() { 23854 return this.get(); 23855 } 23856 observerAdded(count) { 23857 if (count == 1) this._attach(); 23858 } 23859 observerRemoved(count) { 23860 if (count == 0) this._detach(); 23861 } 23862 _attach() { 23863 } 23864 _detach() { 23865 } 23866 _onChange(value, idle = false) { 23867 callFluidObservers(this, { 23868 type: "change", 23869 parent: this, 23870 value, 23871 idle 23872 }); 23873 } 23874 _onPriorityChange(priority2) { 23875 if (!this.idle) { 23876 frameLoop.sort(this); 23877 } 23878 callFluidObservers(this, { 23879 type: "priority", 23880 parent: this, 23881 priority: priority2 23882 }); 23883 } 23884 }; 23885 var $P = /* @__PURE__ */ Symbol.for("SpringPhase"); 23886 var HAS_ANIMATED = 1; 23887 var IS_ANIMATING = 2; 23888 var IS_PAUSED = 4; 23889 var hasAnimated = (target) => (target[$P] & HAS_ANIMATED) > 0; 23890 var isAnimating = (target) => (target[$P] & IS_ANIMATING) > 0; 23891 var isPaused = (target) => (target[$P] & IS_PAUSED) > 0; 23892 var setActiveBit = (target, active) => active ? target[$P] |= IS_ANIMATING | HAS_ANIMATED : target[$P] &= ~IS_ANIMATING; 23893 var setPausedBit = (target, paused) => paused ? target[$P] |= IS_PAUSED : target[$P] &= ~IS_PAUSED; 23894 var SpringValue = class extends FrameValue { 23895 constructor(arg1, arg2) { 23896 super(); 23897 this.key = void 0; 23898 this.animation = new Animation(); 23899 this.queue = void 0; 23900 this.defaultProps = {}; 23901 this._state = { 23902 paused: false, 23903 delayed: false, 23904 pauseQueue: /* @__PURE__ */ new Set(), 23905 resumeQueue: /* @__PURE__ */ new Set(), 23906 timeouts: /* @__PURE__ */ new Set() 23907 }; 23908 this._pendingCalls = /* @__PURE__ */ new Set(); 23909 this._lastCallId = 0; 23910 this._lastToId = 0; 23911 this._memoizedDuration = 0; 23912 if (!is.und(arg1) || !is.und(arg2)) { 23913 const props = is.obj(arg1) ? _extends3({}, arg1) : _extends3({}, arg2, { 23914 from: arg1 23915 }); 23916 if (is.und(props.default)) { 23917 props.default = true; 23918 } 23919 this.start(props); 23920 } 23921 } 23922 get idle() { 23923 return !(isAnimating(this) || this._state.asyncTo) || isPaused(this); 23924 } 23925 get goal() { 23926 return getFluidValue(this.animation.to); 23927 } 23928 get velocity() { 23929 const node = getAnimated(this); 23930 return node instanceof AnimatedValue ? node.lastVelocity || 0 : node.getPayload().map((node2) => node2.lastVelocity || 0); 23931 } 23932 get hasAnimated() { 23933 return hasAnimated(this); 23934 } 23935 get isAnimating() { 23936 return isAnimating(this); 23937 } 23938 get isPaused() { 23939 return isPaused(this); 23940 } 23941 get isDelayed() { 23942 return this._state.delayed; 23943 } 23944 advance(dt) { 23945 let idle = true; 23946 let changed = false; 23947 const anim = this.animation; 23948 let { 23949 config: config2, 23950 toValues 23951 } = anim; 23952 const payload = getPayload(anim.to); 23953 if (!payload && hasFluidValue(anim.to)) { 23954 toValues = toArray(getFluidValue(anim.to)); 23955 } 23956 anim.values.forEach((node2, i3) => { 23957 if (node2.done) return; 23958 const to2 = node2.constructor == AnimatedString ? 1 : payload ? payload[i3].lastPosition : toValues[i3]; 23959 let finished = anim.immediate; 23960 let position = to2; 23961 if (!finished) { 23962 position = node2.lastPosition; 23963 if (config2.tension <= 0) { 23964 node2.done = true; 23965 return; 23966 } 23967 let elapsed = node2.elapsedTime += dt; 23968 const from = anim.fromValues[i3]; 23969 const v0 = node2.v0 != null ? node2.v0 : node2.v0 = is.arr(config2.velocity) ? config2.velocity[i3] : config2.velocity; 23970 let velocity; 23971 const precision = config2.precision || (from == to2 ? 5e-3 : Math.min(1, Math.abs(to2 - from) * 1e-3)); 23972 if (!is.und(config2.duration)) { 23973 let p4 = 1; 23974 if (config2.duration > 0) { 23975 if (this._memoizedDuration !== config2.duration) { 23976 this._memoizedDuration = config2.duration; 23977 if (node2.durationProgress > 0) { 23978 node2.elapsedTime = config2.duration * node2.durationProgress; 23979 elapsed = node2.elapsedTime += dt; 23980 } 23981 } 23982 p4 = (config2.progress || 0) + elapsed / this._memoizedDuration; 23983 p4 = p4 > 1 ? 1 : p4 < 0 ? 0 : p4; 23984 node2.durationProgress = p4; 23985 } 23986 position = from + config2.easing(p4) * (to2 - from); 23987 velocity = (position - node2.lastPosition) / dt; 23988 finished = p4 == 1; 23989 } else if (config2.decay) { 23990 const decay = config2.decay === true ? 0.998 : config2.decay; 23991 const e3 = Math.exp(-(1 - decay) * elapsed); 23992 position = from + v0 / (1 - decay) * (1 - e3); 23993 finished = Math.abs(node2.lastPosition - position) <= precision; 23994 velocity = v0 * e3; 23995 } else { 23996 velocity = node2.lastVelocity == null ? v0 : node2.lastVelocity; 23997 const restVelocity = config2.restVelocity || precision / 10; 23998 const bounceFactor = config2.clamp ? 0 : config2.bounce; 23999 const canBounce = !is.und(bounceFactor); 24000 const isGrowing = from == to2 ? node2.v0 > 0 : from < to2; 24001 let isMoving; 24002 let isBouncing = false; 24003 const step = 1; 24004 const numSteps = Math.ceil(dt / step); 24005 for (let n3 = 0; n3 < numSteps; ++n3) { 24006 isMoving = Math.abs(velocity) > restVelocity; 24007 if (!isMoving) { 24008 finished = Math.abs(to2 - position) <= precision; 24009 if (finished) { 24010 break; 24011 } 24012 } 24013 if (canBounce) { 24014 isBouncing = position == to2 || position > to2 == isGrowing; 24015 if (isBouncing) { 24016 velocity = -velocity * bounceFactor; 24017 position = to2; 24018 } 24019 } 24020 const springForce = -config2.tension * 1e-6 * (position - to2); 24021 const dampingForce = -config2.friction * 1e-3 * velocity; 24022 const acceleration = (springForce + dampingForce) / config2.mass; 24023 velocity = velocity + acceleration * step; 24024 position = position + velocity * step; 24025 } 24026 } 24027 node2.lastVelocity = velocity; 24028 if (Number.isNaN(position)) { 24029 console.warn(`Got NaN while animating:`, this); 24030 finished = true; 24031 } 24032 } 24033 if (payload && !payload[i3].done) { 24034 finished = false; 24035 } 24036 if (finished) { 24037 node2.done = true; 24038 } else { 24039 idle = false; 24040 } 24041 if (node2.setValue(position, config2.round)) { 24042 changed = true; 24043 } 24044 }); 24045 const node = getAnimated(this); 24046 const currVal = node.getValue(); 24047 if (idle) { 24048 const finalVal = getFluidValue(anim.to); 24049 if ((currVal !== finalVal || changed) && !config2.decay) { 24050 node.setValue(finalVal); 24051 this._onChange(finalVal); 24052 } else if (changed && config2.decay) { 24053 this._onChange(currVal); 24054 } 24055 this._stop(); 24056 } else if (changed) { 24057 this._onChange(currVal); 24058 } 24059 } 24060 set(value) { 24061 raf.batchedUpdates(() => { 24062 this._stop(); 24063 this._focus(value); 24064 this._set(value); 24065 }); 24066 return this; 24067 } 24068 pause() { 24069 this._update({ 24070 pause: true 24071 }); 24072 } 24073 resume() { 24074 this._update({ 24075 pause: false 24076 }); 24077 } 24078 finish() { 24079 if (isAnimating(this)) { 24080 const { 24081 to: to2, 24082 config: config2 24083 } = this.animation; 24084 raf.batchedUpdates(() => { 24085 this._onStart(); 24086 if (!config2.decay) { 24087 this._set(to2, false); 24088 } 24089 this._stop(); 24090 }); 24091 } 24092 return this; 24093 } 24094 update(props) { 24095 const queue = this.queue || (this.queue = []); 24096 queue.push(props); 24097 return this; 24098 } 24099 start(to2, arg2) { 24100 let queue; 24101 if (!is.und(to2)) { 24102 queue = [is.obj(to2) ? to2 : _extends3({}, arg2, { 24103 to: to2 24104 })]; 24105 } else { 24106 queue = this.queue || []; 24107 this.queue = []; 24108 } 24109 return Promise.all(queue.map((props) => { 24110 const up = this._update(props); 24111 return up; 24112 })).then((results) => getCombinedResult(this, results)); 24113 } 24114 stop(cancel) { 24115 const { 24116 to: to2 24117 } = this.animation; 24118 this._focus(this.get()); 24119 stopAsync(this._state, cancel && this._lastCallId); 24120 raf.batchedUpdates(() => this._stop(to2, cancel)); 24121 return this; 24122 } 24123 reset() { 24124 this._update({ 24125 reset: true 24126 }); 24127 } 24128 eventObserved(event) { 24129 if (event.type == "change") { 24130 this._start(); 24131 } else if (event.type == "priority") { 24132 this.priority = event.priority + 1; 24133 } 24134 } 24135 _prepareNode(props) { 24136 const key = this.key || ""; 24137 let { 24138 to: to2, 24139 from 24140 } = props; 24141 to2 = is.obj(to2) ? to2[key] : to2; 24142 if (to2 == null || isAsyncTo(to2)) { 24143 to2 = void 0; 24144 } 24145 from = is.obj(from) ? from[key] : from; 24146 if (from == null) { 24147 from = void 0; 24148 } 24149 const range = { 24150 to: to2, 24151 from 24152 }; 24153 if (!hasAnimated(this)) { 24154 if (props.reverse) [to2, from] = [from, to2]; 24155 from = getFluidValue(from); 24156 if (!is.und(from)) { 24157 this._set(from); 24158 } else if (!getAnimated(this)) { 24159 this._set(to2); 24160 } 24161 } 24162 return range; 24163 } 24164 _update(_ref, isLoop) { 24165 let props = _extends3({}, _ref); 24166 const { 24167 key, 24168 defaultProps 24169 } = this; 24170 if (props.default) Object.assign(defaultProps, getDefaultProps(props, (value, prop) => /^on/.test(prop) ? resolveProp(value, key) : value)); 24171 mergeActiveFn(this, props, "onProps"); 24172 sendEvent(this, "onProps", props, this); 24173 const range = this._prepareNode(props); 24174 if (Object.isFrozen(this)) { 24175 throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?"); 24176 } 24177 const state2 = this._state; 24178 return scheduleProps(++this._lastCallId, { 24179 key, 24180 props, 24181 defaultProps, 24182 state: state2, 24183 actions: { 24184 pause: () => { 24185 if (!isPaused(this)) { 24186 setPausedBit(this, true); 24187 flushCalls(state2.pauseQueue); 24188 sendEvent(this, "onPause", getFinishedResult(this, checkFinished(this, this.animation.to)), this); 24189 } 24190 }, 24191 resume: () => { 24192 if (isPaused(this)) { 24193 setPausedBit(this, false); 24194 if (isAnimating(this)) { 24195 this._resume(); 24196 } 24197 flushCalls(state2.resumeQueue); 24198 sendEvent(this, "onResume", getFinishedResult(this, checkFinished(this, this.animation.to)), this); 24199 } 24200 }, 24201 start: this._merge.bind(this, range) 24202 } 24203 }).then((result) => { 24204 if (props.loop && result.finished && !(isLoop && result.noop)) { 24205 const nextProps = createLoopUpdate(props); 24206 if (nextProps) { 24207 return this._update(nextProps, true); 24208 } 24209 } 24210 return result; 24211 }); 24212 } 24213 _merge(range, props, resolve) { 24214 if (props.cancel) { 24215 this.stop(true); 24216 return resolve(getCancelledResult(this)); 24217 } 24218 const hasToProp = !is.und(range.to); 24219 const hasFromProp = !is.und(range.from); 24220 if (hasToProp || hasFromProp) { 24221 if (props.callId > this._lastToId) { 24222 this._lastToId = props.callId; 24223 } else { 24224 return resolve(getCancelledResult(this)); 24225 } 24226 } 24227 const { 24228 key, 24229 defaultProps, 24230 animation: anim 24231 } = this; 24232 const { 24233 to: prevTo, 24234 from: prevFrom 24235 } = anim; 24236 let { 24237 to: to2 = prevTo, 24238 from = prevFrom 24239 } = range; 24240 if (hasFromProp && !hasToProp && (!props.default || is.und(to2))) { 24241 to2 = from; 24242 } 24243 if (props.reverse) [to2, from] = [from, to2]; 24244 const hasFromChanged = !isEqual(from, prevFrom); 24245 if (hasFromChanged) { 24246 anim.from = from; 24247 } 24248 from = getFluidValue(from); 24249 const hasToChanged = !isEqual(to2, prevTo); 24250 if (hasToChanged) { 24251 this._focus(to2); 24252 } 24253 const hasAsyncTo = isAsyncTo(props.to); 24254 const { 24255 config: config2 24256 } = anim; 24257 const { 24258 decay, 24259 velocity 24260 } = config2; 24261 if (hasToProp || hasFromProp) { 24262 config2.velocity = 0; 24263 } 24264 if (props.config && !hasAsyncTo) { 24265 mergeConfig(config2, callProp(props.config, key), props.config !== defaultProps.config ? callProp(defaultProps.config, key) : void 0); 24266 } 24267 let node = getAnimated(this); 24268 if (!node || is.und(to2)) { 24269 return resolve(getFinishedResult(this, true)); 24270 } 24271 const reset = is.und(props.reset) ? hasFromProp && !props.default : !is.und(from) && matchProp(props.reset, key); 24272 const value = reset ? from : this.get(); 24273 const goal = computeGoal(to2); 24274 const isAnimatable = is.num(goal) || is.arr(goal) || isAnimatedString(goal); 24275 const immediate = !hasAsyncTo && (!isAnimatable || matchProp(defaultProps.immediate || props.immediate, key)); 24276 if (hasToChanged) { 24277 const nodeType = getAnimatedType(to2); 24278 if (nodeType !== node.constructor) { 24279 if (immediate) { 24280 node = this._set(goal); 24281 } else throw Error(`Cannot animate between $node.constructor.name} and $nodeType.name}, as the "to" prop suggests`); 24282 } 24283 } 24284 const goalType = node.constructor; 24285 let started = hasFluidValue(to2); 24286 let finished = false; 24287 if (!started) { 24288 const hasValueChanged = reset || !hasAnimated(this) && hasFromChanged; 24289 if (hasToChanged || hasValueChanged) { 24290 finished = isEqual(computeGoal(value), goal); 24291 started = !finished; 24292 } 24293 if (!isEqual(anim.immediate, immediate) && !immediate || !isEqual(config2.decay, decay) || !isEqual(config2.velocity, velocity)) { 24294 started = true; 24295 } 24296 } 24297 if (finished && isAnimating(this)) { 24298 if (anim.changed && !reset) { 24299 started = true; 24300 } else if (!started) { 24301 this._stop(prevTo); 24302 } 24303 } 24304 if (!hasAsyncTo) { 24305 if (started || hasFluidValue(prevTo)) { 24306 anim.values = node.getPayload(); 24307 anim.toValues = hasFluidValue(to2) ? null : goalType == AnimatedString ? [1] : toArray(goal); 24308 } 24309 if (anim.immediate != immediate) { 24310 anim.immediate = immediate; 24311 if (!immediate && !reset) { 24312 this._set(prevTo); 24313 } 24314 } 24315 if (started) { 24316 const { 24317 onRest 24318 } = anim; 24319 each(ACTIVE_EVENTS, (type) => mergeActiveFn(this, props, type)); 24320 const result = getFinishedResult(this, checkFinished(this, prevTo)); 24321 flushCalls(this._pendingCalls, result); 24322 this._pendingCalls.add(resolve); 24323 if (anim.changed) raf.batchedUpdates(() => { 24324 anim.changed = !reset; 24325 onRest == null ? void 0 : onRest(result, this); 24326 if (reset) { 24327 callProp(defaultProps.onRest, result); 24328 } else { 24329 anim.onStart == null ? void 0 : anim.onStart(result, this); 24330 } 24331 }); 24332 } 24333 } 24334 if (reset) { 24335 this._set(value); 24336 } 24337 if (hasAsyncTo) { 24338 resolve(runAsync(props.to, props, this._state, this)); 24339 } else if (started) { 24340 this._start(); 24341 } else if (isAnimating(this) && !hasToChanged) { 24342 this._pendingCalls.add(resolve); 24343 } else { 24344 resolve(getNoopResult(value)); 24345 } 24346 } 24347 _focus(value) { 24348 const anim = this.animation; 24349 if (value !== anim.to) { 24350 if (getFluidObservers(this)) { 24351 this._detach(); 24352 } 24353 anim.to = value; 24354 if (getFluidObservers(this)) { 24355 this._attach(); 24356 } 24357 } 24358 } 24359 _attach() { 24360 let priority2 = 0; 24361 const { 24362 to: to2 24363 } = this.animation; 24364 if (hasFluidValue(to2)) { 24365 addFluidObserver(to2, this); 24366 if (isFrameValue(to2)) { 24367 priority2 = to2.priority + 1; 24368 } 24369 } 24370 this.priority = priority2; 24371 } 24372 _detach() { 24373 const { 24374 to: to2 24375 } = this.animation; 24376 if (hasFluidValue(to2)) { 24377 removeFluidObserver(to2, this); 24378 } 24379 } 24380 _set(arg, idle = true) { 24381 const value = getFluidValue(arg); 24382 if (!is.und(value)) { 24383 const oldNode = getAnimated(this); 24384 if (!oldNode || !isEqual(value, oldNode.getValue())) { 24385 const nodeType = getAnimatedType(value); 24386 if (!oldNode || oldNode.constructor != nodeType) { 24387 setAnimated(this, nodeType.create(value)); 24388 } else { 24389 oldNode.setValue(value); 24390 } 24391 if (oldNode) { 24392 raf.batchedUpdates(() => { 24393 this._onChange(value, idle); 24394 }); 24395 } 24396 } 24397 } 24398 return getAnimated(this); 24399 } 24400 _onStart() { 24401 const anim = this.animation; 24402 if (!anim.changed) { 24403 anim.changed = true; 24404 sendEvent(this, "onStart", getFinishedResult(this, checkFinished(this, anim.to)), this); 24405 } 24406 } 24407 _onChange(value, idle) { 24408 if (!idle) { 24409 this._onStart(); 24410 callProp(this.animation.onChange, value, this); 24411 } 24412 callProp(this.defaultProps.onChange, value, this); 24413 super._onChange(value, idle); 24414 } 24415 _start() { 24416 const anim = this.animation; 24417 getAnimated(this).reset(getFluidValue(anim.to)); 24418 if (!anim.immediate) { 24419 anim.fromValues = anim.values.map((node) => node.lastPosition); 24420 } 24421 if (!isAnimating(this)) { 24422 setActiveBit(this, true); 24423 if (!isPaused(this)) { 24424 this._resume(); 24425 } 24426 } 24427 } 24428 _resume() { 24429 if (globals.skipAnimation) { 24430 this.finish(); 24431 } else { 24432 frameLoop.start(this); 24433 } 24434 } 24435 _stop(goal, cancel) { 24436 if (isAnimating(this)) { 24437 setActiveBit(this, false); 24438 const anim = this.animation; 24439 each(anim.values, (node) => { 24440 node.done = true; 24441 }); 24442 if (anim.toValues) { 24443 anim.onChange = anim.onPause = anim.onResume = void 0; 24444 } 24445 callFluidObservers(this, { 24446 type: "idle", 24447 parent: this 24448 }); 24449 const result = cancel ? getCancelledResult(this.get()) : getFinishedResult(this.get(), checkFinished(this, goal != null ? goal : anim.to)); 24450 flushCalls(this._pendingCalls, result); 24451 if (anim.changed) { 24452 anim.changed = false; 24453 sendEvent(this, "onRest", result, this); 24454 } 24455 } 24456 } 24457 }; 24458 function checkFinished(target, to2) { 24459 const goal = computeGoal(to2); 24460 const value = computeGoal(target.get()); 24461 return isEqual(value, goal); 24462 } 24463 function createLoopUpdate(props, loop2 = props.loop, to2 = props.to) { 24464 let loopRet = callProp(loop2); 24465 if (loopRet) { 24466 const overrides = loopRet !== true && inferTo(loopRet); 24467 const reverse = (overrides || props).reverse; 24468 const reset = !overrides || overrides.reset; 24469 return createUpdate(_extends3({}, props, { 24470 loop: loop2, 24471 default: false, 24472 pause: void 0, 24473 to: !reverse || isAsyncTo(to2) ? to2 : void 0, 24474 from: reset ? props.from : void 0, 24475 reset 24476 }, overrides)); 24477 } 24478 } 24479 function createUpdate(props) { 24480 const { 24481 to: to2, 24482 from 24483 } = props = inferTo(props); 24484 const keys = /* @__PURE__ */ new Set(); 24485 if (is.obj(to2)) findDefined(to2, keys); 24486 if (is.obj(from)) findDefined(from, keys); 24487 props.keys = keys.size ? Array.from(keys) : null; 24488 return props; 24489 } 24490 function findDefined(values, keys) { 24491 eachProp(values, (value, key) => value != null && keys.add(key)); 24492 } 24493 var ACTIVE_EVENTS = ["onStart", "onRest", "onChange", "onPause", "onResume"]; 24494 function mergeActiveFn(target, props, type) { 24495 target.animation[type] = props[type] !== getDefaultProp(props, type) ? resolveProp(props[type], target.key) : void 0; 24496 } 24497 function sendEvent(target, type, ...args) { 24498 var _target$animation$typ, _target$animation, _target$defaultProps$, _target$defaultProps; 24499 (_target$animation$typ = (_target$animation = target.animation)[type]) == null ? void 0 : _target$animation$typ.call(_target$animation, ...args); 24500 (_target$defaultProps$ = (_target$defaultProps = target.defaultProps)[type]) == null ? void 0 : _target$defaultProps$.call(_target$defaultProps, ...args); 24501 } 24502 var BATCHED_EVENTS = ["onStart", "onChange", "onRest"]; 24503 var nextId = 1; 24504 var Controller = class { 24505 constructor(props, flush2) { 24506 this.id = nextId++; 24507 this.springs = {}; 24508 this.queue = []; 24509 this.ref = void 0; 24510 this._flush = void 0; 24511 this._initialProps = void 0; 24512 this._lastAsyncId = 0; 24513 this._active = /* @__PURE__ */ new Set(); 24514 this._changed = /* @__PURE__ */ new Set(); 24515 this._started = false; 24516 this._item = void 0; 24517 this._state = { 24518 paused: false, 24519 pauseQueue: /* @__PURE__ */ new Set(), 24520 resumeQueue: /* @__PURE__ */ new Set(), 24521 timeouts: /* @__PURE__ */ new Set() 24522 }; 24523 this._events = { 24524 onStart: /* @__PURE__ */ new Map(), 24525 onChange: /* @__PURE__ */ new Map(), 24526 onRest: /* @__PURE__ */ new Map() 24527 }; 24528 this._onFrame = this._onFrame.bind(this); 24529 if (flush2) { 24530 this._flush = flush2; 24531 } 24532 if (props) { 24533 this.start(_extends3({ 24534 default: true 24535 }, props)); 24536 } 24537 } 24538 get idle() { 24539 return !this._state.asyncTo && Object.values(this.springs).every((spring) => { 24540 return spring.idle && !spring.isDelayed && !spring.isPaused; 24541 }); 24542 } 24543 get item() { 24544 return this._item; 24545 } 24546 set item(item) { 24547 this._item = item; 24548 } 24549 get() { 24550 const values = {}; 24551 this.each((spring, key) => values[key] = spring.get()); 24552 return values; 24553 } 24554 set(values) { 24555 for (const key in values) { 24556 const value = values[key]; 24557 if (!is.und(value)) { 24558 this.springs[key].set(value); 24559 } 24560 } 24561 } 24562 update(props) { 24563 if (props) { 24564 this.queue.push(createUpdate(props)); 24565 } 24566 return this; 24567 } 24568 start(props) { 24569 let { 24570 queue 24571 } = this; 24572 if (props) { 24573 queue = toArray(props).map(createUpdate); 24574 } else { 24575 this.queue = []; 24576 } 24577 if (this._flush) { 24578 return this._flush(this, queue); 24579 } 24580 prepareKeys(this, queue); 24581 return flushUpdateQueue(this, queue); 24582 } 24583 stop(arg, keys) { 24584 if (arg !== !!arg) { 24585 keys = arg; 24586 } 24587 if (keys) { 24588 const springs = this.springs; 24589 each(toArray(keys), (key) => springs[key].stop(!!arg)); 24590 } else { 24591 stopAsync(this._state, this._lastAsyncId); 24592 this.each((spring) => spring.stop(!!arg)); 24593 } 24594 return this; 24595 } 24596 pause(keys) { 24597 if (is.und(keys)) { 24598 this.start({ 24599 pause: true 24600 }); 24601 } else { 24602 const springs = this.springs; 24603 each(toArray(keys), (key) => springs[key].pause()); 24604 } 24605 return this; 24606 } 24607 resume(keys) { 24608 if (is.und(keys)) { 24609 this.start({ 24610 pause: false 24611 }); 24612 } else { 24613 const springs = this.springs; 24614 each(toArray(keys), (key) => springs[key].resume()); 24615 } 24616 return this; 24617 } 24618 each(iterator) { 24619 eachProp(this.springs, iterator); 24620 } 24621 _onFrame() { 24622 const { 24623 onStart, 24624 onChange, 24625 onRest 24626 } = this._events; 24627 const active = this._active.size > 0; 24628 const changed = this._changed.size > 0; 24629 if (active && !this._started || changed && !this._started) { 24630 this._started = true; 24631 flush(onStart, ([onStart2, result]) => { 24632 result.value = this.get(); 24633 onStart2(result, this, this._item); 24634 }); 24635 } 24636 const idle = !active && this._started; 24637 const values = changed || idle && onRest.size ? this.get() : null; 24638 if (changed && onChange.size) { 24639 flush(onChange, ([onChange2, result]) => { 24640 result.value = values; 24641 onChange2(result, this, this._item); 24642 }); 24643 } 24644 if (idle) { 24645 this._started = false; 24646 flush(onRest, ([onRest2, result]) => { 24647 result.value = values; 24648 onRest2(result, this, this._item); 24649 }); 24650 } 24651 } 24652 eventObserved(event) { 24653 if (event.type == "change") { 24654 this._changed.add(event.parent); 24655 if (!event.idle) { 24656 this._active.add(event.parent); 24657 } 24658 } else if (event.type == "idle") { 24659 this._active.delete(event.parent); 24660 } else return; 24661 raf.onFrame(this._onFrame); 24662 } 24663 }; 24664 function flushUpdateQueue(ctrl, queue) { 24665 return Promise.all(queue.map((props) => flushUpdate(ctrl, props))).then((results) => getCombinedResult(ctrl, results)); 24666 } 24667 async function flushUpdate(ctrl, props, isLoop) { 24668 const { 24669 keys, 24670 to: to2, 24671 from, 24672 loop: loop2, 24673 onRest, 24674 onResolve 24675 } = props; 24676 const defaults2 = is.obj(props.default) && props.default; 24677 if (loop2) { 24678 props.loop = false; 24679 } 24680 if (to2 === false) props.to = null; 24681 if (from === false) props.from = null; 24682 const asyncTo = is.arr(to2) || is.fun(to2) ? to2 : void 0; 24683 if (asyncTo) { 24684 props.to = void 0; 24685 props.onRest = void 0; 24686 if (defaults2) { 24687 defaults2.onRest = void 0; 24688 } 24689 } else { 24690 each(BATCHED_EVENTS, (key) => { 24691 const handler = props[key]; 24692 if (is.fun(handler)) { 24693 const queue = ctrl["_events"][key]; 24694 props[key] = ({ 24695 finished, 24696 cancelled 24697 }) => { 24698 const result2 = queue.get(handler); 24699 if (result2) { 24700 if (!finished) result2.finished = false; 24701 if (cancelled) result2.cancelled = true; 24702 } else { 24703 queue.set(handler, { 24704 value: null, 24705 finished: finished || false, 24706 cancelled: cancelled || false 24707 }); 24708 } 24709 }; 24710 if (defaults2) { 24711 defaults2[key] = props[key]; 24712 } 24713 } 24714 }); 24715 } 24716 const state2 = ctrl["_state"]; 24717 if (props.pause === !state2.paused) { 24718 state2.paused = props.pause; 24719 flushCalls(props.pause ? state2.pauseQueue : state2.resumeQueue); 24720 } else if (state2.paused) { 24721 props.pause = true; 24722 } 24723 const promises = (keys || Object.keys(ctrl.springs)).map((key) => ctrl.springs[key].start(props)); 24724 const cancel = props.cancel === true || getDefaultProp(props, "cancel") === true; 24725 if (asyncTo || cancel && state2.asyncId) { 24726 promises.push(scheduleProps(++ctrl["_lastAsyncId"], { 24727 props, 24728 state: state2, 24729 actions: { 24730 pause: noop5, 24731 resume: noop5, 24732 start(props2, resolve) { 24733 if (cancel) { 24734 stopAsync(state2, ctrl["_lastAsyncId"]); 24735 resolve(getCancelledResult(ctrl)); 24736 } else { 24737 props2.onRest = onRest; 24738 resolve(runAsync(asyncTo, props2, state2, ctrl)); 24739 } 24740 } 24741 } 24742 })); 24743 } 24744 if (state2.paused) { 24745 await new Promise((resume) => { 24746 state2.resumeQueue.add(resume); 24747 }); 24748 } 24749 const result = getCombinedResult(ctrl, await Promise.all(promises)); 24750 if (loop2 && result.finished && !(isLoop && result.noop)) { 24751 const nextProps = createLoopUpdate(props, loop2, to2); 24752 if (nextProps) { 24753 prepareKeys(ctrl, [nextProps]); 24754 return flushUpdate(ctrl, nextProps, true); 24755 } 24756 } 24757 if (onResolve) { 24758 raf.batchedUpdates(() => onResolve(result, ctrl, ctrl.item)); 24759 } 24760 return result; 24761 } 24762 function createSpring(key, observer) { 24763 const spring = new SpringValue(); 24764 spring.key = key; 24765 if (observer) { 24766 addFluidObserver(spring, observer); 24767 } 24768 return spring; 24769 } 24770 function prepareSprings(springs, props, create8) { 24771 if (props.keys) { 24772 each(props.keys, (key) => { 24773 const spring = springs[key] || (springs[key] = create8(key)); 24774 spring["_prepareNode"](props); 24775 }); 24776 } 24777 } 24778 function prepareKeys(ctrl, queue) { 24779 each(queue, (props) => { 24780 prepareSprings(ctrl.springs, props, (key) => { 24781 return createSpring(key, ctrl); 24782 }); 24783 }); 24784 } 24785 function _objectWithoutPropertiesLoose(source, excluded) { 24786 if (source == null) return {}; 24787 var target = {}; 24788 var sourceKeys = Object.keys(source); 24789 var key, i3; 24790 for (i3 = 0; i3 < sourceKeys.length; i3++) { 24791 key = sourceKeys[i3]; 24792 if (excluded.indexOf(key) >= 0) continue; 24793 target[key] = source[key]; 24794 } 24795 return target; 24796 } 24797 var _excluded$3 = ["children"]; 24798 var SpringContext = (_ref) => { 24799 let { 24800 children 24801 } = _ref, props = _objectWithoutPropertiesLoose(_ref, _excluded$3); 24802 const inherited = (0, import_react15.useContext)(ctx); 24803 const pause = props.pause || !!inherited.pause, immediate = props.immediate || !!inherited.immediate; 24804 props = useMemoOne(() => ({ 24805 pause, 24806 immediate 24807 }), [pause, immediate]); 24808 const { 24809 Provider: Provider2 24810 } = ctx; 24811 return React74.createElement(Provider2, { 24812 value: props 24813 }, children); 24814 }; 24815 var ctx = makeContext(SpringContext, {}); 24816 SpringContext.Provider = ctx.Provider; 24817 SpringContext.Consumer = ctx.Consumer; 24818 function makeContext(target, init2) { 24819 Object.assign(target, React74.createContext(init2)); 24820 target.Provider._context = target; 24821 target.Consumer._context = target; 24822 return target; 24823 } 24824 var TransitionPhase; 24825 (function(TransitionPhase2) { 24826 TransitionPhase2["MOUNT"] = "mount"; 24827 TransitionPhase2["ENTER"] = "enter"; 24828 TransitionPhase2["UPDATE"] = "update"; 24829 TransitionPhase2["LEAVE"] = "leave"; 24830 })(TransitionPhase || (TransitionPhase = {})); 24831 var Interpolation = class extends FrameValue { 24832 constructor(source, args) { 24833 super(); 24834 this.key = void 0; 24835 this.idle = true; 24836 this.calc = void 0; 24837 this._active = /* @__PURE__ */ new Set(); 24838 this.source = source; 24839 this.calc = createInterpolator(...args); 24840 const value = this._get(); 24841 const nodeType = getAnimatedType(value); 24842 setAnimated(this, nodeType.create(value)); 24843 } 24844 advance(_dt) { 24845 const value = this._get(); 24846 const oldValue = this.get(); 24847 if (!isEqual(value, oldValue)) { 24848 getAnimated(this).setValue(value); 24849 this._onChange(value, this.idle); 24850 } 24851 if (!this.idle && checkIdle(this._active)) { 24852 becomeIdle(this); 24853 } 24854 } 24855 _get() { 24856 const inputs = is.arr(this.source) ? this.source.map(getFluidValue) : toArray(getFluidValue(this.source)); 24857 return this.calc(...inputs); 24858 } 24859 _start() { 24860 if (this.idle && !checkIdle(this._active)) { 24861 this.idle = false; 24862 each(getPayload(this), (node) => { 24863 node.done = false; 24864 }); 24865 if (globals.skipAnimation) { 24866 raf.batchedUpdates(() => this.advance()); 24867 becomeIdle(this); 24868 } else { 24869 frameLoop.start(this); 24870 } 24871 } 24872 } 24873 _attach() { 24874 let priority2 = 1; 24875 each(toArray(this.source), (source) => { 24876 if (hasFluidValue(source)) { 24877 addFluidObserver(source, this); 24878 } 24879 if (isFrameValue(source)) { 24880 if (!source.idle) { 24881 this._active.add(source); 24882 } 24883 priority2 = Math.max(priority2, source.priority + 1); 24884 } 24885 }); 24886 this.priority = priority2; 24887 this._start(); 24888 } 24889 _detach() { 24890 each(toArray(this.source), (source) => { 24891 if (hasFluidValue(source)) { 24892 removeFluidObserver(source, this); 24893 } 24894 }); 24895 this._active.clear(); 24896 becomeIdle(this); 24897 } 24898 eventObserved(event) { 24899 if (event.type == "change") { 24900 if (event.idle) { 24901 this.advance(); 24902 } else { 24903 this._active.add(event.parent); 24904 this._start(); 24905 } 24906 } else if (event.type == "idle") { 24907 this._active.delete(event.parent); 24908 } else if (event.type == "priority") { 24909 this.priority = toArray(this.source).reduce((highest, parent) => Math.max(highest, (isFrameValue(parent) ? parent.priority : 0) + 1), 0); 24910 } 24911 } 24912 }; 24913 function isIdle(source) { 24914 return source.idle !== false; 24915 } 24916 function checkIdle(active) { 24917 return !active.size || Array.from(active).every(isIdle); 24918 } 24919 function becomeIdle(self2) { 24920 if (!self2.idle) { 24921 self2.idle = true; 24922 each(getPayload(self2), (node) => { 24923 node.done = true; 24924 }); 24925 callFluidObservers(self2, { 24926 type: "idle", 24927 parent: self2 24928 }); 24929 } 24930 } 24931 globals.assign({ 24932 createStringInterpolator, 24933 to: (source, args) => new Interpolation(source, args) 24934 }); 24935 var update3 = frameLoop.advance; 24936 24937 // node_modules/@react-spring/web/dist/react-spring-web.esm.js 24938 var import_react_dom4 = __toESM(require_react_dom()); 24939 function _objectWithoutPropertiesLoose2(source, excluded) { 24940 if (source == null) return {}; 24941 var target = {}; 24942 var sourceKeys = Object.keys(source); 24943 var key, i3; 24944 for (i3 = 0; i3 < sourceKeys.length; i3++) { 24945 key = sourceKeys[i3]; 24946 if (excluded.indexOf(key) >= 0) continue; 24947 target[key] = source[key]; 24948 } 24949 return target; 24950 } 24951 var _excluded$2 = ["style", "children", "scrollTop", "scrollLeft"]; 24952 var isCustomPropRE = /^--/; 24953 function dangerousStyleValue(name2, value) { 24954 if (value == null || typeof value === "boolean" || value === "") return ""; 24955 if (typeof value === "number" && value !== 0 && !isCustomPropRE.test(name2) && !(isUnitlessNumber.hasOwnProperty(name2) && isUnitlessNumber[name2])) return value + "px"; 24956 return ("" + value).trim(); 24957 } 24958 var attributeCache = {}; 24959 function applyAnimatedValues(instance, props) { 24960 if (!instance.nodeType || !instance.setAttribute) { 24961 return false; 24962 } 24963 const isFilterElement = instance.nodeName === "filter" || instance.parentNode && instance.parentNode.nodeName === "filter"; 24964 const _ref = props, { 24965 style, 24966 children, 24967 scrollTop, 24968 scrollLeft 24969 } = _ref, attributes = _objectWithoutPropertiesLoose2(_ref, _excluded$2); 24970 const values = Object.values(attributes); 24971 const names = Object.keys(attributes).map((name2) => isFilterElement || instance.hasAttribute(name2) ? name2 : attributeCache[name2] || (attributeCache[name2] = name2.replace(/([A-Z])/g, (n3) => "-" + n3.toLowerCase()))); 24972 if (children !== void 0) { 24973 instance.textContent = children; 24974 } 24975 for (let name2 in style) { 24976 if (style.hasOwnProperty(name2)) { 24977 const value = dangerousStyleValue(name2, style[name2]); 24978 if (isCustomPropRE.test(name2)) { 24979 instance.style.setProperty(name2, value); 24980 } else { 24981 instance.style[name2] = value; 24982 } 24983 } 24984 } 24985 names.forEach((name2, i3) => { 24986 instance.setAttribute(name2, values[i3]); 24987 }); 24988 if (scrollTop !== void 0) { 24989 instance.scrollTop = scrollTop; 24990 } 24991 if (scrollLeft !== void 0) { 24992 instance.scrollLeft = scrollLeft; 24993 } 24994 } 24995 var isUnitlessNumber = { 24996 animationIterationCount: true, 24997 borderImageOutset: true, 24998 borderImageSlice: true, 24999 borderImageWidth: true, 25000 boxFlex: true, 25001 boxFlexGroup: true, 25002 boxOrdinalGroup: true, 25003 columnCount: true, 25004 columns: true, 25005 flex: true, 25006 flexGrow: true, 25007 flexPositive: true, 25008 flexShrink: true, 25009 flexNegative: true, 25010 flexOrder: true, 25011 gridRow: true, 25012 gridRowEnd: true, 25013 gridRowSpan: true, 25014 gridRowStart: true, 25015 gridColumn: true, 25016 gridColumnEnd: true, 25017 gridColumnSpan: true, 25018 gridColumnStart: true, 25019 fontWeight: true, 25020 lineClamp: true, 25021 lineHeight: true, 25022 opacity: true, 25023 order: true, 25024 orphans: true, 25025 tabSize: true, 25026 widows: true, 25027 zIndex: true, 25028 zoom: true, 25029 fillOpacity: true, 25030 floodOpacity: true, 25031 stopOpacity: true, 25032 strokeDasharray: true, 25033 strokeDashoffset: true, 25034 strokeMiterlimit: true, 25035 strokeOpacity: true, 25036 strokeWidth: true 25037 }; 25038 var prefixKey = (prefix2, key) => prefix2 + key.charAt(0).toUpperCase() + key.substring(1); 25039 var prefixes = ["Webkit", "Ms", "Moz", "O"]; 25040 isUnitlessNumber = Object.keys(isUnitlessNumber).reduce((acc, prop) => { 25041 prefixes.forEach((prefix2) => acc[prefixKey(prefix2, prop)] = acc[prop]); 25042 return acc; 25043 }, isUnitlessNumber); 25044 var _excluded$1 = ["x", "y", "z"]; 25045 var domTransforms = /^(matrix|translate|scale|rotate|skew)/; 25046 var pxTransforms = /^(translate)/; 25047 var degTransforms = /^(rotate|skew)/; 25048 var addUnit = (value, unit) => is.num(value) && value !== 0 ? value + unit : value; 25049 var isValueIdentity = (value, id) => is.arr(value) ? value.every((v3) => isValueIdentity(v3, id)) : is.num(value) ? value === id : parseFloat(value) === id; 25050 var AnimatedStyle = class extends AnimatedObject { 25051 constructor(_ref) { 25052 let { 25053 x: x2, 25054 y: y3, 25055 z 25056 } = _ref, style = _objectWithoutPropertiesLoose2(_ref, _excluded$1); 25057 const inputs = []; 25058 const transforms = []; 25059 if (x2 || y3 || z) { 25060 inputs.push([x2 || 0, y3 || 0, z || 0]); 25061 transforms.push((xyz) => [`translate3d($xyz.map((v3) => addUnit(v3, "px")).join(",")})`, isValueIdentity(xyz, 0)]); 25062 } 25063 eachProp(style, (value, key) => { 25064 if (key === "transform") { 25065 inputs.push([value || ""]); 25066 transforms.push((transform) => [transform, transform === ""]); 25067 } else if (domTransforms.test(key)) { 25068 delete style[key]; 25069 if (is.und(value)) return; 25070 const unit = pxTransforms.test(key) ? "px" : degTransforms.test(key) ? "deg" : ""; 25071 inputs.push(toArray(value)); 25072 transforms.push(key === "rotate3d" ? ([x3, y4, z2, deg]) => [`rotate3d($x3},$y4},$z2},$addUnit(deg, unit)})`, isValueIdentity(deg, 0)] : (input) => [`$key}($input.map((v3) => addUnit(v3, unit)).join(",")})`, isValueIdentity(input, key.startsWith("scale") ? 1 : 0)]); 25073 } 25074 }); 25075 if (inputs.length) { 25076 style.transform = new FluidTransform(inputs, transforms); 25077 } 25078 super(style); 25079 } 25080 }; 25081 var FluidTransform = class extends FluidValue { 25082 constructor(inputs, transforms) { 25083 super(); 25084 this._value = null; 25085 this.inputs = inputs; 25086 this.transforms = transforms; 25087 } 25088 get() { 25089 return this._value || (this._value = this._get()); 25090 } 25091 _get() { 25092 let transform = ""; 25093 let identity4 = true; 25094 each(this.inputs, (input, i3) => { 25095 const arg1 = getFluidValue(input[0]); 25096 const [t4, id] = this.transforms[i3](is.arr(arg1) ? arg1 : input.map(getFluidValue)); 25097 transform += " " + t4; 25098 identity4 = identity4 && id; 25099 }); 25100 return identity4 ? "none" : transform; 25101 } 25102 observerAdded(count) { 25103 if (count == 1) each(this.inputs, (input) => each(input, (value) => hasFluidValue(value) && addFluidObserver(value, this))); 25104 } 25105 observerRemoved(count) { 25106 if (count == 0) each(this.inputs, (input) => each(input, (value) => hasFluidValue(value) && removeFluidObserver(value, this))); 25107 } 25108 eventObserved(event) { 25109 if (event.type == "change") { 25110 this._value = null; 25111 } 25112 callFluidObservers(this, event); 25113 } 25114 }; 25115 var primitives = ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr", "circle", "clipPath", "defs", "ellipse", "foreignObject", "g", "image", "line", "linearGradient", "mask", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "stop", "svg", "text", "tspan"]; 25116 var _excluded = ["scrollTop", "scrollLeft"]; 25117 globals.assign({ 25118 batchedUpdates: import_react_dom4.unstable_batchedUpdates, 25119 createStringInterpolator, 25120 colors 25121 }); 25122 var host = createHost(primitives, { 25123 applyAnimatedValues, 25124 createAnimatedStyle: (style) => new AnimatedStyle(style), 25125 getComponentProps: (_ref) => { 25126 let props = _objectWithoutPropertiesLoose2(_ref, _excluded); 25127 return props; 25128 } 25129 }); 25130 var animated = host.animated; 25131 25132 // packages/fields/build-module/components/media-edit/use-moving-animation.mjs 25133 var import_element47 = __toESM(require_element(), 1); 25134 function getAbsolutePosition(element) { 25135 return { 25136 top: element.offsetTop, 25137 left: element.offsetLeft 25138 }; 25139 } 25140 function useMovingAnimation(triggerAnimationOnChange) { 25141 const ref = (0, import_element47.useRef)(null); 25142 const previousRef = (0, import_element47.useRef)(void 0); 25143 if (ref.current) { 25144 previousRef.current = getAbsolutePosition(ref.current); 25145 } 25146 (0, import_element47.useLayoutEffect)(() => { 25147 const previous = previousRef.current; 25148 if (!previous || !ref.current) { 25149 return; 25150 } 25151 if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) { 25152 return; 25153 } 25154 const controller = new Controller({ 25155 x: 0, 25156 y: 0, 25157 config: { mass: 5, tension: 2e3, friction: 200 }, 25158 onChange({ value }) { 25159 if (!ref.current) { 25160 return; 25161 } 25162 let { x: x22, y: y22 } = value; 25163 x22 = Math.round(x22); 25164 y22 = Math.round(y22); 25165 const finishedMoving = x22 === 0 && y22 === 0; 25166 ref.current.style.transform = finishedMoving ? "" : `translate3d($x22}px,$y22}px,0)`; 25167 } 25168 }); 25169 ref.current.style.transform = ""; 25170 const destination = getAbsolutePosition(ref.current); 25171 const x2 = Math.round(previous.left - destination.left); 25172 const y3 = Math.round(previous.top - destination.top); 25173 controller.start({ x: 0, y: 0, from: { x: x2, y: y3 } }); 25174 return () => { 25175 controller.stop(); 25176 controller.set({ x: 0, y: 0 }); 25177 }; 25178 }, [triggerAnimationOnChange]); 25179 return ref; 25180 } 25181 25182 // packages/fields/build-module/components/media-edit/index.mjs 25183 var import_jsx_runtime140 = __toESM(require_jsx_runtime(), 1); 25184 var { MediaUploadModal } = unlock3(import_media_utils2.privateApis); 25185 function AnimatedMediaItem({ 25186 children, 25187 index: index2, 25188 className 25189 }) { 25190 const ref = useMovingAnimation(index2); 25191 return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { ref, className, children }); 25192 } 25193 function normalizeValue(value) { 25194 if (Array.isArray(value)) { 25195 return value; 25196 } 25197 return value ? [value] : []; 25198 } 25199 function ConditionalMediaUpload({ render: render5, multiple, ...props }) { 25200 const [isModalOpen, setIsModalOpen] = (0, import_element48.useState)(false); 25201 if (window.__experimentalDataViewsMediaModal) { 25202 return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(import_jsx_runtime140.Fragment, { children: [ 25203 render5 && render5({ open: () => setIsModalOpen(true) }), 25204 isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25205 MediaUploadModal, 25206 { 25207 ...props, 25208 multiple, 25209 isOpen: isModalOpen, 25210 onClose: () => { 25211 setIsModalOpen(false); 25212 props.onClose?.(); 25213 }, 25214 onSelect: (media) => { 25215 setIsModalOpen(false); 25216 props.onSelect?.(media); 25217 } 25218 } 25219 ) 25220 ] }); 25221 } 25222 return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25223 import_media_utils2.MediaUpload, 25224 { 25225 ...props, 25226 render: render5, 25227 multiple: multiple ? "add" : void 0 25228 } 25229 ); 25230 } 25231 function MediaPickerButton({ 25232 open, 25233 children, 25234 label, 25235 showTooltip = false, 25236 onFilesDrop, 25237 attachment, 25238 isUploading = false 25239 }) { 25240 const isBlob = attachment && (0, import_blob.isBlobURL)(attachment.source_url); 25241 const mediaPickerButton = /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)( 25242 "div", 25243 { 25244 className: clsx_default("fields__media-edit-picker-button", { 25245 "has-attachment": attachment 25246 }), 25247 role: "button", 25248 tabIndex: 0, 25249 onClick: () => { 25250 if (!isUploading) { 25251 open(); 25252 } 25253 }, 25254 onKeyDown: (event) => { 25255 if (isUploading) { 25256 return; 25257 } 25258 if (event.key === "Enter" || event.key === " ") { 25259 event.preventDefault(); 25260 open(); 25261 } 25262 }, 25263 "aria-label": label, 25264 "aria-disabled": isUploading, 25265 children: [ 25266 children, 25267 isBlob && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("span", { className: "fields__media-edit-picker-button-spinner", children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_components4.Spinner, {}) }), 25268 !isUploading && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25269 import_components4.DropZone, 25270 { 25271 onFilesDrop: (files) => onFilesDrop(files, attachment?.id) 25272 } 25273 ) 25274 ] 25275 } 25276 ); 25277 if (!showTooltip) { 25278 return mediaPickerButton; 25279 } 25280 return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(tooltip_exports.Root, { children: [ 25281 /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(tooltip_exports.Trigger, { render: mediaPickerButton }), 25282 /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(tooltip_exports.Popup, { children: label }) 25283 ] }); 25284 } 25285 var archiveMimeTypes = [ 25286 "application/zip", 25287 "application/x-zip-compressed", 25288 "application/x-rar-compressed", 25289 "application/x-7z-compressed", 25290 "application/x-tar", 25291 "application/x-gzip" 25292 ]; 25293 function MediaTitle({ attachment }) { 25294 return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_components4.__experimentalTruncate, { className: "fields__media-edit-filename", children: attachment.title.rendered }); 25295 } 25296 function MediaEditPlaceholder(props) { 25297 return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(MediaPickerButton, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("span", { className: "fields__media-edit-placeholder", children: props.label }) }); 25298 } 25299 function MoveButtons({ 25300 itemId, 25301 index: index2, 25302 totalItems, 25303 isUploading, 25304 moveItem, 25305 orientation = "vertical" 25306 }) { 25307 const isHorizontal = orientation === "horizontal"; 25308 return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(import_jsx_runtime140.Fragment, { children: [ 25309 /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25310 import_components4.Button, 25311 { 25312 __next40pxDefaultSize: true, 25313 icon: isHorizontal ? chevron_left_default : chevron_up_default, 25314 label: isHorizontal ? (0, import_i18n17.__)("Move left") : (0, import_i18n17.__)("Move up"), 25315 size: "small", 25316 disabled: isUploading || index2 === 0, 25317 accessibleWhenDisabled: true, 25318 tooltipPosition: "top", 25319 onClick: (event) => { 25320 event.stopPropagation(); 25321 moveItem(itemId, "up"); 25322 } 25323 } 25324 ), 25325 /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25326 import_components4.Button, 25327 { 25328 __next40pxDefaultSize: true, 25329 icon: isHorizontal ? chevron_right_default : chevron_down_default, 25330 label: isHorizontal ? (0, import_i18n17.__)("Move right") : (0, import_i18n17.__)("Move down"), 25331 size: "small", 25332 disabled: isUploading || index2 === totalItems - 1, 25333 accessibleWhenDisabled: true, 25334 tooltipPosition: "top", 25335 onClick: (event) => { 25336 event.stopPropagation(); 25337 moveItem(itemId, "down"); 25338 } 25339 } 25340 ) 25341 ] }); 25342 } 25343 function MediaPreview({ attachment }) { 25344 const url = attachment.source_url; 25345 const mimeType = attachment.mime_type || ""; 25346 if (mimeType.startsWith("image")) { 25347 return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25348 "img", 25349 { 25350 className: "fields__media-edit-thumbnail", 25351 alt: attachment.alt_text || "", 25352 src: url 25353 } 25354 ); 25355 } else if (mimeType.startsWith("audio")) { 25356 return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_components4.Icon, { icon: audio_default }); 25357 } else if (mimeType.startsWith("video")) { 25358 return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_components4.Icon, { icon: video_default }); 25359 } else if (archiveMimeTypes.includes(mimeType)) { 25360 return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_components4.Icon, { icon: archive_default }); 25361 } 25362 return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_components4.Icon, { icon: file_default }); 25363 } 25364 function ExpandedMediaEditAttachments({ 25365 allItems, 25366 addButtonLabel, 25367 multiple, 25368 removeItem, 25369 moveItem, 25370 open, 25371 onFilesDrop, 25372 isUploading, 25373 setTargetItemId 25374 }) { 25375 return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)( 25376 "div", 25377 { 25378 className: clsx_default("fields__media-edit-expanded", { 25379 "is-multiple": multiple, 25380 "is-single": !multiple, 25381 "is-empty": !allItems?.length 25382 }), 25383 children: [ 25384 allItems?.map((attachment, index2) => { 25385 const hasPreviewImage = attachment.mime_type?.startsWith("image"); 25386 const isBlob = (0, import_blob.isBlobURL)(attachment.source_url); 25387 const attachmentNumericId = attachment.id; 25388 return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)( 25389 AnimatedMediaItem, 25390 { 25391 index: index2, 25392 className: clsx_default("fields__media-edit-expanded-item", { 25393 "has-preview-image": hasPreviewImage 25394 }), 25395 children: [ 25396 /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25397 MediaPickerButton, 25398 { 25399 open: () => { 25400 setTargetItemId(attachmentNumericId); 25401 open(); 25402 }, 25403 label: !isBlob ? (0, import_i18n17.sprintf)( 25404 /* translators: %s: The title of the media item. */ 25405 (0, import_i18n17.__)("Replace %s"), 25406 attachment.title.rendered 25407 ) : (0, import_i18n17.__)("Replace"), 25408 showTooltip: true, 25409 onFilesDrop, 25410 attachment, 25411 isUploading, 25412 children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { className: "fields__media-edit-expanded-preview", children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25413 import_components4.__experimentalVStack, 25414 { 25415 spacing: 0, 25416 alignment: "center", 25417 justify: "center", 25418 className: "fields__media-edit-expanded-preview-stack", 25419 children: (!isBlob || hasPreviewImage) && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25420 MediaPreview, 25421 { 25422 attachment 25423 } 25424 ) 25425 } 25426 ) }) 25427 } 25428 ), 25429 !isBlob && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { className: "fields__media-edit-expanded-overlay", children: /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)( 25430 import_components4.__experimentalHStack, 25431 { 25432 className: "fields__media-edit-expanded-actions", 25433 spacing: 0, 25434 alignment: "flex-end", 25435 expanded: false, 25436 children: [ 25437 multiple && allItems.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25438 MoveButtons, 25439 { 25440 itemId: attachmentNumericId, 25441 index: index2, 25442 totalItems: allItems.length, 25443 isUploading, 25444 moveItem, 25445 orientation: "horizontal" 25446 } 25447 ), 25448 /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25449 import_components4.Button, 25450 { 25451 __next40pxDefaultSize: true, 25452 icon: close_small_default, 25453 label: (0, import_i18n17.__)("Remove"), 25454 size: "small", 25455 disabled: isUploading, 25456 accessibleWhenDisabled: true, 25457 tooltipPosition: "top", 25458 onClick: (event) => { 25459 event.stopPropagation(); 25460 removeItem(attachmentNumericId); 25461 } 25462 } 25463 ) 25464 ] 25465 } 25466 ) }) 25467 ] 25468 }, 25469 attachment.id 25470 ); 25471 }), 25472 (multiple || !allItems?.length) && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25473 MediaEditPlaceholder, 25474 { 25475 open: () => { 25476 setTargetItemId(void 0); 25477 open(); 25478 }, 25479 label: addButtonLabel, 25480 onFilesDrop, 25481 isUploading 25482 } 25483 ) 25484 ] 25485 } 25486 ); 25487 } 25488 function CompactMediaEditAttachments({ 25489 allItems, 25490 addButtonLabel, 25491 multiple, 25492 removeItem, 25493 moveItem, 25494 open, 25495 onFilesDrop, 25496 isUploading, 25497 setTargetItemId 25498 }) { 25499 return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(import_jsx_runtime140.Fragment, { children: [ 25500 !!allItems?.length && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25501 "div", 25502 { 25503 className: clsx_default("fields__media-edit-compact-group", { 25504 "is-single": allItems.length === 1 25505 }), 25506 children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_components4.__experimentalVStack, { spacing: 0, children: allItems.map((attachment, index2) => { 25507 const isBlob = (0, import_blob.isBlobURL)(attachment.source_url); 25508 const showMoveButtons = multiple && allItems.length > 1; 25509 const attachmentNumericId = attachment.id; 25510 return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)( 25511 AnimatedMediaItem, 25512 { 25513 index: index2, 25514 className: "fields__media-edit-compact", 25515 children: [ 25516 /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25517 MediaPickerButton, 25518 { 25519 open: () => { 25520 setTargetItemId( 25521 attachmentNumericId 25522 ); 25523 open(); 25524 }, 25525 label: (0, import_i18n17.__)("Replace"), 25526 showTooltip: true, 25527 onFilesDrop, 25528 attachment, 25529 isUploading, 25530 children: /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(import_jsx_runtime140.Fragment, { children: [ 25531 /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25532 MediaPreview, 25533 { 25534 attachment 25535 } 25536 ), 25537 !isBlob && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25538 MediaTitle, 25539 { 25540 attachment 25541 } 25542 ) 25543 ] }) 25544 } 25545 ), 25546 !isBlob && /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)( 25547 import_components4.__experimentalHStack, 25548 { 25549 className: "fields__media-edit-compact-movers", 25550 spacing: 0, 25551 alignment: "flex-end", 25552 expanded: false, 25553 children: [ 25554 showMoveButtons && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25555 MoveButtons, 25556 { 25557 itemId: attachmentNumericId, 25558 index: index2, 25559 totalItems: allItems.length, 25560 isUploading, 25561 moveItem, 25562 orientation: "vertical" 25563 } 25564 ), 25565 /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25566 import_components4.Button, 25567 { 25568 __next40pxDefaultSize: true, 25569 icon: close_small_default, 25570 label: (0, import_i18n17.__)("Remove"), 25571 size: "small", 25572 disabled: isUploading, 25573 accessibleWhenDisabled: true, 25574 tooltipPosition: "top", 25575 onClick: (event) => { 25576 event.stopPropagation(); 25577 removeItem( 25578 attachmentNumericId 25579 ); 25580 } 25581 } 25582 ) 25583 ] 25584 } 25585 ) 25586 ] 25587 }, 25588 attachment.id 25589 ); 25590 }) }) 25591 } 25592 ), 25593 (multiple || !allItems?.length) && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25594 MediaEditPlaceholder, 25595 { 25596 open: () => { 25597 setTargetItemId(void 0); 25598 open(); 25599 }, 25600 label: addButtonLabel, 25601 onFilesDrop, 25602 isUploading 25603 } 25604 ) 25605 ] }); 25606 } 25607 function MediaEdit({ 25608 data, 25609 field, 25610 onChange, 25611 hideLabelFromVision, 25612 allowedTypes = ["image"], 25613 multiple, 25614 isExpanded, 25615 validity 25616 }) { 25617 const value = field.getValue({ item: data }); 25618 const [isTouched, setIsTouched] = (0, import_element48.useState)(false); 25619 const validityTargetRef = (0, import_element48.useRef)(null); 25620 const [customValidity, setCustomValidity] = (0, import_element48.useState)(void 0); 25621 (0, import_element48.useEffect)(() => { 25622 const validityTarget = validityTargetRef.current; 25623 const handler = () => { 25624 setIsTouched(true); 25625 }; 25626 validityTarget?.addEventListener("invalid", handler); 25627 return () => validityTarget?.removeEventListener("invalid", handler); 25628 }, []); 25629 const attachments = (0, import_data9.useSelect)( 25630 (select9) => { 25631 if (!value) { 25632 return null; 25633 } 25634 const normalizedValue = normalizeValue(value); 25635 const sortedIds = normalizedValue.toSorted((a3, b3) => a3 - b3); 25636 const { getEntityRecords } = select9(import_core_data5.store); 25637 return getEntityRecords("postType", "attachment", { 25638 include: sortedIds 25639 }); 25640 }, 25641 [value] 25642 ); 25643 const stableAttachmentsRef = (0, import_element48.useRef)( 25644 null 25645 ); 25646 if (attachments !== null) { 25647 stableAttachmentsRef.current = attachments; 25648 } 25649 let stableAttachments = attachments; 25650 if (attachments === null && stableAttachmentsRef.current && value) { 25651 const stableIds = new Set( 25652 stableAttachmentsRef.current.map((a3) => a3.id) 25653 ); 25654 if (normalizeValue(value).every((id) => stableIds.has(id))) { 25655 stableAttachments = stableAttachmentsRef.current; 25656 } 25657 } 25658 const orderedAttachments = (0, import_element48.useMemo)(() => { 25659 if (!stableAttachments) { 25660 return null; 25661 } 25662 const normalizedValue = normalizeValue(value); 25663 const attachmentMap = new Map( 25664 stableAttachments.map((a3) => [a3.id, a3]) 25665 ); 25666 return normalizedValue.map((id) => attachmentMap.get(id)).filter((a3) => a3 !== void 0); 25667 }, [stableAttachments, value]); 25668 const { createErrorNotice } = (0, import_data9.useDispatch)(import_notices2.store); 25669 const { receiveEntityRecords } = (0, import_data9.useDispatch)(import_core_data5.store); 25670 const [targetItemId, setTargetItemId] = (0, import_element48.useState)(); 25671 const openModalRef = (0, import_element48.useRef)(void 0); 25672 const [pendingOpen, setPendingOpen] = (0, import_element48.useState)(false); 25673 const [blobs, setBlobs] = (0, import_element48.useState)([]); 25674 (0, import_element48.useEffect)(() => { 25675 if (pendingOpen) { 25676 setPendingOpen(false); 25677 openModalRef.current?.(); 25678 } 25679 }, [pendingOpen]); 25680 const onChangeControl = (0, import_element48.useCallback)( 25681 (newValue) => onChange(field.setValue({ item: data, value: newValue })), 25682 [data, field, onChange] 25683 ); 25684 const removeItem = (0, import_element48.useCallback)( 25685 (itemId) => { 25686 const currentIds = normalizeValue(value); 25687 const newIds = currentIds.filter((id) => id !== itemId); 25688 setIsTouched(true); 25689 onChangeControl(newIds.length ? newIds : void 0); 25690 }, 25691 [value, onChangeControl] 25692 ); 25693 const moveItem = (0, import_element48.useCallback)( 25694 (itemId, direction) => { 25695 if (!orderedAttachments) { 25696 return; 25697 } 25698 const currentIds = orderedAttachments.map((a3) => a3.id); 25699 const index2 = currentIds.indexOf(itemId); 25700 const newIndex = direction === "up" ? index2 - 1 : index2 + 1; 25701 [currentIds[index2], currentIds[newIndex]] = [ 25702 currentIds[newIndex], 25703 currentIds[index2] 25704 ]; 25705 onChangeControl(currentIds); 25706 }, 25707 [orderedAttachments, onChangeControl] 25708 ); 25709 const onFilesDrop = (0, import_element48.useCallback)( 25710 (files, _targetItemId) => { 25711 setTargetItemId(_targetItemId); 25712 (0, import_media_utils2.uploadMedia)({ 25713 allowedTypes: allowedTypes?.length ? allowedTypes : void 0, 25714 filesList: files, 25715 onFileChange(uploadedMedia) { 25716 const blobUrls = uploadedMedia.filter((item) => (0, import_blob.isBlobURL)(item.url)).map((item) => item.url); 25717 setBlobs(blobUrls); 25718 if (!!blobUrls.length) { 25719 return; 25720 } 25721 receiveEntityRecords( 25722 "postType", 25723 "attachment", 25724 [], 25725 void 0, 25726 true 25727 ); 25728 const uploadedIds = uploadedMedia.map( 25729 (item) => item.id 25730 ); 25731 if (!multiple) { 25732 onChangeControl(uploadedIds[0]); 25733 setTargetItemId(void 0); 25734 return; 25735 } 25736 const currentValue = normalizeValue(value); 25737 if (_targetItemId === void 0) { 25738 onChangeControl([...currentValue, ...uploadedIds]); 25739 } else { 25740 const newValue = [...currentValue]; 25741 newValue.splice( 25742 currentValue.indexOf(_targetItemId), 25743 1, 25744 ...uploadedIds 25745 ); 25746 onChangeControl(newValue); 25747 } 25748 setTargetItemId(void 0); 25749 }, 25750 onError(error2) { 25751 setTargetItemId(void 0); 25752 setBlobs([]); 25753 createErrorNotice(error2.message, { type: "snackbar" }); 25754 }, 25755 multiple: !!multiple 25756 }); 25757 }, 25758 [ 25759 allowedTypes, 25760 value, 25761 multiple, 25762 createErrorNotice, 25763 onChangeControl, 25764 receiveEntityRecords 25765 ] 25766 ); 25767 const addButtonLabel = field.placeholder || (multiple ? (0, import_i18n17.__)("Choose files") : (0, import_i18n17.__)("Choose file")); 25768 const allItems = (0, import_element48.useMemo)(() => { 25769 if (!blobs.length) { 25770 return orderedAttachments; 25771 } 25772 const items = [ 25773 ...orderedAttachments || [] 25774 ]; 25775 const blobItems = blobs.map((url) => ({ 25776 id: url, 25777 source_url: url, 25778 mime_type: (0, import_blob.getBlobTypeByURL)(url) 25779 })); 25780 if (targetItemId !== void 0) { 25781 const targetIndex = items.findIndex( 25782 (a3) => a3.id === targetItemId 25783 ); 25784 items.splice(targetIndex, 1, ...blobItems); 25785 } else { 25786 items.push(...blobItems); 25787 } 25788 return items; 25789 }, [orderedAttachments, targetItemId, blobs]); 25790 (0, import_element48.useEffect)(() => { 25791 if (!isTouched) { 25792 return; 25793 } 25794 const input = validityTargetRef.current; 25795 if (!input) { 25796 return; 25797 } 25798 if (validity) { 25799 const customValidityResult = validity?.custom; 25800 setCustomValidity(customValidityResult); 25801 if (customValidityResult?.type === "invalid") { 25802 input.setCustomValidity( 25803 customValidityResult.message || (0, import_i18n17.__)("Invalid") 25804 ); 25805 } else { 25806 input.setCustomValidity(""); 25807 } 25808 } else { 25809 input.setCustomValidity(""); 25810 setCustomValidity(void 0); 25811 } 25812 }, [isTouched, field.isValid, validity]); 25813 (0, import_element48.useEffect)(() => { 25814 if (isTouched && customValidity?.message) { 25815 (0, import_a11y2.speak)(customValidity.message); 25816 } 25817 }, [isTouched, customValidity?.message]); 25818 const onBlur = (0, import_element48.useCallback)( 25819 (event) => { 25820 if (isTouched) { 25821 return; 25822 } 25823 if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) { 25824 setIsTouched(true); 25825 } 25826 }, 25827 [isTouched] 25828 ); 25829 return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { onBlur, children: [ 25830 /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("fieldset", { className: "fields__media-edit", "data-field-id": field.id, children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25831 ConditionalMediaUpload, 25832 { 25833 onSelect: (selectedMedia) => { 25834 if (!multiple) { 25835 onChangeControl(selectedMedia.id); 25836 setTargetItemId(void 0); 25837 return; 25838 } 25839 const newIds = Array.isArray(selectedMedia) ? selectedMedia.map((m2) => m2.id) : [selectedMedia.id]; 25840 const currentValue = normalizeValue(value); 25841 if (!currentValue.length) { 25842 onChangeControl(newIds); 25843 } else if (targetItemId === void 0) { 25844 const existingItems = currentValue.filter( 25845 (id) => newIds.includes(id) 25846 ); 25847 const newItems = newIds.filter( 25848 (id) => !currentValue.includes(id) 25849 ); 25850 onChangeControl([ 25851 ...existingItems, 25852 ...newItems 25853 ]); 25854 } else if (selectedMedia.id !== targetItemId) { 25855 const filtered = currentValue.filter( 25856 (id) => id !== selectedMedia.id 25857 ); 25858 onChangeControl( 25859 filtered.map( 25860 (id) => id === targetItemId ? selectedMedia.id : id 25861 ) 25862 ); 25863 } 25864 setTargetItemId(void 0); 25865 }, 25866 onClose: () => setTargetItemId(void 0), 25867 allowedTypes, 25868 value: targetItemId !== void 0 ? targetItemId : value, 25869 multiple: multiple && targetItemId === void 0, 25870 title: field.label, 25871 render: ({ open }) => { 25872 openModalRef.current = open; 25873 const AttachmentsComponent = isExpanded ? ExpandedMediaEditAttachments : CompactMediaEditAttachments; 25874 return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(import_components4.__experimentalVStack, { spacing: 2, children: [ 25875 field.label && (hideLabelFromVision ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("legend", {}), children: field.label }) : /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25876 import_components4.BaseControl.VisualLabel, 25877 { 25878 as: "legend", 25879 style: { marginBottom: 0 }, 25880 children: field.label 25881 } 25882 )), 25883 /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25884 AttachmentsComponent, 25885 { 25886 allItems, 25887 addButtonLabel, 25888 multiple, 25889 removeItem, 25890 moveItem, 25891 open: () => setPendingOpen(true), 25892 onFilesDrop, 25893 isUploading: !!blobs.length, 25894 setTargetItemId 25895 } 25896 ), 25897 field.description && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25898 import_components4.__experimentalText, 25899 { 25900 variant: "muted", 25901 className: "fields__media-edit-description", 25902 children: field.description 25903 } 25904 ) 25905 ] }); 25906 } 25907 } 25908 ) }), 25909 /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(VisuallyHidden, { children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25910 "input", 25911 { 25912 type: "text", 25913 ref: validityTargetRef, 25914 value: value ?? "", 25915 tabIndex: -1, 25916 "aria-hidden": "true", 25917 onChange: () => { 25918 } 25919 } 25920 ) }), 25921 customValidity && /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)( 25922 "p", 25923 { 25924 className: clsx_default( 25925 "components-validated-control__indicator", 25926 { 25927 "is-invalid": customValidity.type === "invalid", 25928 "is-valid": customValidity.type === "valid" 25929 } 25930 ), 25931 children: [ 25932 /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 25933 import_components4.Icon, 25934 { 25935 className: "components-validated-control__indicator-icon", 25936 icon: error_default, 25937 size: 16, 25938 fill: "currentColor" 25939 } 25940 ), 25941 customValidity.message 25942 ] 25943 } 25944 ) 25945 ] }); 25946 } 25947 25948 // packages/fields/build-module/fields/featured-image/featured-image-view.mjs 25949 var import_jsx_runtime141 = __toESM(require_jsx_runtime(), 1); 25950 var FeaturedImageView = ({ 25951 item, 25952 config: config2 25953 }) => { 25954 const media = item?._embedded?.["wp:featuredmedia"]?.[0]; 25955 const url = media?.source_url; 25956 if (url) { 25957 return /* @__PURE__ */ (0, import_jsx_runtime141.jsx)( 25958 "img", 25959 { 25960 className: "fields-controls__featured-image-image", 25961 src: url, 25962 alt: "", 25963 srcSet: media?.media_details?.sizes ? Object.values(media.media_details.sizes).map( 25964 (size4) => `$size4.source_url} $size4.width}w` 25965 ).join(", ") : void 0, 25966 sizes: config2?.sizes || "100vw" 25967 } 25968 ); 25969 } 25970 return /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("span", { className: "fields-controls__featured-image-placeholder" }); 25971 }; 25972 25973 // packages/fields/build-module/fields/featured-image/index.mjs 25974 var import_jsx_runtime142 = __toESM(require_jsx_runtime(), 1); 25975 var featuredImageField = { 25976 id: "featured_media", 25977 type: "media", 25978 label: (0, import_i18n18.__)("Featured Image"), 25979 placeholder: (0, import_i18n18.__)("Set featured image"), 25980 Edit: (props) => /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(MediaEdit, { ...props, isExpanded: true }), 25981 render: FeaturedImageView, 25982 setValue: ({ value }) => ({ 25983 featured_media: value ?? 0 25984 }), 25985 enableSorting: false, 25986 filterBy: false 25987 }; 25988 var featured_image_default = featuredImageField; 25989 25990 // packages/fields/build-module/fields/template/index.mjs 25991 var import_i18n21 = __toESM(require_i18n(), 1); 25992 25993 // packages/fields/build-module/fields/template/template-edit.mjs 25994 var import_element49 = __toESM(require_element(), 1); 25995 var import_core_data7 = __toESM(require_core_data(), 1); 25996 var import_components5 = __toESM(require_components(), 1); 25997 var import_data11 = __toESM(require_data(), 1); 25998 var import_i18n19 = __toESM(require_i18n(), 1); 25999 26000 // packages/fields/build-module/fields/template/hooks.mjs 26001 var import_data10 = __toESM(require_data(), 1); 26002 var import_core_data6 = __toESM(require_core_data(), 1); 26003 function useTemplateFieldMode(record) { 26004 const postType2 = record.type; 26005 const availableTemplates = record?.available_templates ?? {}; 26006 const hasAvailableTemplates = Object.keys(availableTemplates).length > 0; 26007 return (0, import_data10.useSelect)( 26008 (select9) => { 26009 const isBlockTheme = !!select9(import_core_data6.store).getCurrentTheme()?.is_block_theme; 26010 const postTypeObj = select9(import_core_data6.store).getPostType(postType2); 26011 if (!postTypeObj?.viewable) { 26012 return null; 26013 } 26014 const canCreateTemplates = isBlockTheme && (select9(import_core_data6.store).canUser("create", { 26015 kind: "postType", 26016 name: "wp_template" 26017 }) ?? false); 26018 const isVisible2 = hasAvailableTemplates || canCreateTemplates; 26019 const canViewTemplates = isVisible2 ? !!select9(import_core_data6.store).canUser("read", { 26020 kind: "postType", 26021 name: "wp_template" 26022 }) : false; 26023 if ((!isBlockTheme || !canViewTemplates) && isVisible2) { 26024 return "classic"; 26025 } 26026 if (isBlockTheme && canViewTemplates) { 26027 return "block-theme"; 26028 } 26029 return null; 26030 }, 26031 [postType2, hasAvailableTemplates] 26032 ); 26033 } 26034 function getTemplateSlugToCheck(postType2, slug) { 26035 if (slug) { 26036 return postType2 === "page" ? `$postType2}-$slug}` : `single-$postType2}-$slug}`; 26037 } 26038 return postType2 === "page" ? "page" : `single-$postType2}`; 26039 } 26040 var NAME_NOT_FOUND = ""; 26041 function useDefaultTemplateLabel(postType2, postId2, slug) { 26042 return (0, import_data10.useSelect)( 26043 (select9) => { 26044 if (!postType2 || !postId2) { 26045 return NAME_NOT_FOUND; 26046 } 26047 const postIdStr = String(postId2); 26048 const homePage = unlock3(select9(import_core_data6.store)).getHomePage(); 26049 if (postType2 === "page" && homePage?.postType === "page" && homePage?.postId === postIdStr) { 26050 const templates = select9( 26051 import_core_data6.store 26052 ).getEntityRecords("postType", "wp_template", { 26053 per_page: -1 26054 }); 26055 const frontPage = templates?.find( 26056 (t4) => t4.slug === "front-page" 26057 ); 26058 if (frontPage) { 26059 return getItemTitle(frontPage); 26060 } 26061 } 26062 const postsPageId = unlock3(select9(import_core_data6.store)).getPostsPageId(); 26063 if (postType2 === "page" && postsPageId === postIdStr) { 26064 const templateId22 = select9(import_core_data6.store).getDefaultTemplateId({ 26065 slug: "home" 26066 }); 26067 if (!templateId22) { 26068 return NAME_NOT_FOUND; 26069 } 26070 const template22 = select9( 26071 import_core_data6.store 26072 ).getEntityRecord( 26073 "postType", 26074 "wp_template", 26075 templateId22 26076 ); 26077 return template22 ? getItemTitle(template22) : NAME_NOT_FOUND; 26078 } 26079 const slugToCheck = getTemplateSlugToCheck(postType2, slug); 26080 const templateId2 = select9(import_core_data6.store).getDefaultTemplateId({ 26081 slug: slugToCheck 26082 }); 26083 if (!templateId2) { 26084 return NAME_NOT_FOUND; 26085 } 26086 const template2 = select9(import_core_data6.store).getEntityRecord( 26087 "postType", 26088 "wp_template", 26089 templateId2 26090 ); 26091 return template2 ? getItemTitle(template2) : NAME_NOT_FOUND; 26092 }, 26093 [postType2, postId2, slug] 26094 ); 26095 } 26096 26097 // packages/fields/build-module/fields/template/template-edit.mjs 26098 var import_jsx_runtime143 = __toESM(require_jsx_runtime(), 1); 26099 var EMPTY_ARRAY5 = []; 26100 function ClassicTemplateEdit({ 26101 data, 26102 field, 26103 onChange 26104 }) { 26105 const postId2 = typeof data.id === "number" ? data.id : parseInt(data.id, 10); 26106 const value = field.getValue({ item: data }); 26107 const options = (0, import_element49.useMemo)( 26108 () => Object.entries( 26109 data?.available_templates ?? {} 26110 ).map(([templateSlug, title]) => ({ 26111 label: title, 26112 value: templateSlug 26113 })), 26114 [data] 26115 ); 26116 const canSwitchTemplate = (0, import_data11.useSelect)( 26117 (select9) => { 26118 const { getHomePage, getPostsPageId } = unlock3( 26119 select9(import_core_data7.store) 26120 ); 26121 const singlePostId = String(postId2); 26122 const isPostsPage = getPostsPageId() === singlePostId; 26123 const isFrontPage = data.type === "page" && getHomePage()?.postId === singlePostId; 26124 return !isPostsPage && !isFrontPage; 26125 }, 26126 [postId2, data.type] 26127 ); 26128 return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)( 26129 import_components5.SelectControl, 26130 { 26131 label: (0, import_i18n19.__)("Template"), 26132 hideLabelFromVision: true, 26133 value, 26134 options, 26135 onChange, 26136 disabled: !canSwitchTemplate 26137 } 26138 ); 26139 } 26140 function BlockThemeTemplateEdit({ 26141 data, 26142 field, 26143 onChange 26144 }) { 26145 const postType2 = data.type; 26146 const postId2 = typeof data.id === "number" ? data.id : parseInt(data.id, 10); 26147 const slug = data.slug; 26148 const { templates, canSwitchTemplate } = (0, import_data11.useSelect)( 26149 (select9) => { 26150 const allTemplates = select9(import_core_data7.store).getEntityRecords( 26151 "postType", 26152 "wp_template", 26153 { 26154 per_page: -1, 26155 post_type: postType2 26156 } 26157 ) ?? EMPTY_ARRAY5; 26158 const { getHomePage, getPostsPageId } = unlock3( 26159 select9(import_core_data7.store) 26160 ); 26161 const singlePostId = String(postId2); 26162 const isPostsPage = getPostsPageId() === singlePostId; 26163 const isFrontPage = postType2 === "page" && getHomePage()?.postId === singlePostId; 26164 return { 26165 templates: allTemplates, 26166 canSwitchTemplate: !isPostsPage && !isFrontPage 26167 }; 26168 }, 26169 [postId2, postType2] 26170 ); 26171 const defaultTemplateLabel = useDefaultTemplateLabel( 26172 postType2, 26173 postId2, 26174 slug 26175 ); 26176 const value = field.getValue({ item: data }); 26177 const options = (0, import_element49.useMemo)(() => { 26178 const templateOptions = templates.map((template2) => ({ 26179 label: getItemTitle(template2), 26180 value: template2.slug 26181 })); 26182 return [ 26183 { label: defaultTemplateLabel, value: "" }, 26184 ...templateOptions 26185 ]; 26186 }, [templates, defaultTemplateLabel]); 26187 return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)( 26188 import_components5.SelectControl, 26189 { 26190 label: (0, import_i18n19.__)("Template"), 26191 hideLabelFromVision: true, 26192 value, 26193 options, 26194 onChange, 26195 disabled: !canSwitchTemplate 26196 } 26197 ); 26198 } 26199 var TemplateEdit = ({ 26200 data, 26201 field, 26202 onChange 26203 }) => { 26204 const onChangeControl = (0, import_element49.useCallback)( 26205 (newValue) => onChange({ 26206 [field.id]: newValue 26207 }), 26208 [field.id, onChange] 26209 ); 26210 const mode = useTemplateFieldMode(data); 26211 if (!mode || !["block-theme", "classic"].includes(mode)) { 26212 return null; 26213 } 26214 const Edit2 = mode === "classic" ? ClassicTemplateEdit : BlockThemeTemplateEdit; 26215 return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(Edit2, { data, field, onChange: onChangeControl }); 26216 }; 26217 26218 // packages/fields/build-module/fields/template/template-view.mjs 26219 var import_data12 = __toESM(require_data(), 1); 26220 var import_core_data8 = __toESM(require_core_data(), 1); 26221 var import_i18n20 = __toESM(require_i18n(), 1); 26222 var import_jsx_runtime144 = __toESM(require_jsx_runtime(), 1); 26223 function ClassicTemplateView({ 26224 item, 26225 field 26226 }) { 26227 const templateSlug = field.getValue({ item }); 26228 const availableTemplates = item?.available_templates ?? {}; 26229 const classicLabel = templateSlug && availableTemplates[templateSlug] ? availableTemplates[templateSlug] : (0, import_i18n20.__)("Default template"); 26230 return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(import_jsx_runtime144.Fragment, { children: classicLabel }); 26231 } 26232 function BlockThemeTemplateView({ 26233 item, 26234 field 26235 }) { 26236 const postType2 = item.type; 26237 const slug = item.slug; 26238 const postId2 = item.id; 26239 const templateSlug = field.getValue({ item }); 26240 const defaultTemplateLabel = useDefaultTemplateLabel( 26241 postType2, 26242 postId2, 26243 slug 26244 ); 26245 const templateLabel = (0, import_data12.useSelect)( 26246 (select9) => { 26247 if (!templateSlug) { 26248 return; 26249 } 26250 const allTemplates = select9( 26251 import_core_data8.store 26252 ).getEntityRecords("postType", "wp_template", { 26253 per_page: -1, 26254 post_type: postType2 26255 }); 26256 const match3 = allTemplates?.find( 26257 (t4) => t4.slug === templateSlug 26258 ); 26259 return match3 ? getItemTitle(match3) : void 0; 26260 }, 26261 [postType2, templateSlug] 26262 ); 26263 return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(import_jsx_runtime144.Fragment, { children: templateLabel ?? defaultTemplateLabel }); 26264 } 26265 var TemplateView = ({ 26266 item, 26267 field 26268 }) => { 26269 const mode = useTemplateFieldMode(item); 26270 if (!mode || !["block-theme", "classic"].includes(mode)) { 26271 return null; 26272 } 26273 const View4 = mode === "classic" ? ClassicTemplateView : BlockThemeTemplateView; 26274 return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(View4, { item, field }); 26275 }; 26276 26277 // packages/fields/build-module/fields/template/index.mjs 26278 var templateField = { 26279 id: "template", 26280 type: "text", 26281 label: (0, import_i18n21.__)("Template"), 26282 Edit: TemplateEdit, 26283 render: TemplateView, 26284 enableSorting: false, 26285 filterBy: false 26286 }; 26287 var template_default = templateField; 26288 26289 // packages/fields/build-module/fields/parent/index.mjs 26290 var import_i18n25 = __toESM(require_i18n(), 1); 26291 26292 // packages/fields/build-module/fields/parent/parent-edit.mjs 26293 var import_remove_accents = __toESM(require_remove_accents(), 1); 26294 var import_components6 = __toESM(require_components(), 1); 26295 var import_data13 = __toESM(require_data(), 1); 26296 var import_element50 = __toESM(require_element(), 1); 26297 var import_core_data9 = __toESM(require_core_data(), 1); 26298 var import_compose3 = __toESM(require_compose(), 1); 26299 var import_html_entities4 = __toESM(require_html_entities(), 1); 26300 var import_i18n23 = __toESM(require_i18n(), 1); 26301 var import_url6 = __toESM(require_url(), 1); 26302 26303 // packages/fields/build-module/fields/parent/utils.mjs 26304 var import_html_entities3 = __toESM(require_html_entities(), 1); 26305 var import_i18n22 = __toESM(require_i18n(), 1); 26306 function getTitleWithFallbackName(post2) { 26307 return typeof post2.title === "object" && "rendered" in post2.title && post2.title.rendered ? (0, import_html_entities3.decodeEntities)(post2.title.rendered) : `#$post2?.id} (${(0, import_i18n22.__)("no title")})`; 26308 } 26309 26310 // packages/fields/build-module/fields/parent/parent-edit.mjs 26311 var import_jsx_runtime145 = __toESM(require_jsx_runtime(), 1); 26312 function buildTermsTree(flatTerms) { 26313 const flatTermsWithParentAndChildren = flatTerms.map((term) => { 26314 return { 26315 children: [], 26316 ...term 26317 }; 26318 }); 26319 if (flatTermsWithParentAndChildren.some( 26320 ({ parent }) => parent === null || parent === void 0 26321 )) { 26322 return flatTermsWithParentAndChildren; 26323 } 26324 const termsByParent = flatTermsWithParentAndChildren.reduce( 26325 (acc, term) => { 26326 const { parent } = term; 26327 if (!acc[parent]) { 26328 acc[parent] = []; 26329 } 26330 acc[parent].push(term); 26331 return acc; 26332 }, 26333 {} 26334 ); 26335 const fillWithChildren = (terms) => { 26336 return terms.map((term) => { 26337 const children = termsByParent[term.id]; 26338 return { 26339 ...term, 26340 children: children && children.length ? fillWithChildren(children) : [] 26341 }; 26342 }); 26343 }; 26344 return fillWithChildren(termsByParent["0"] || []); 26345 } 26346 var getItemPriority = (name2, searchValue) => { 26347 const normalizedName = (0, import_remove_accents.default)(name2 || "").toLowerCase(); 26348 const normalizedSearch = (0, import_remove_accents.default)(searchValue || "").toLowerCase(); 26349 if (normalizedName === normalizedSearch) { 26350 return 0; 26351 } 26352 if (normalizedName.startsWith(normalizedSearch)) { 26353 return normalizedName.length; 26354 } 26355 return Infinity; 26356 }; 26357 function PageAttributesParent({ 26358 data, 26359 onChangeControl 26360 }) { 26361 const [fieldValue, setFieldValue] = (0, import_element50.useState)(""); 26362 const pageId = data.parent; 26363 const postId2 = data.id; 26364 const postTypeSlug = data.type; 26365 const { parentPostTitle, pageItems, isHierarchical } = (0, import_data13.useSelect)( 26366 (select9) => { 26367 const { getEntityRecord, getEntityRecords, getPostType } = select9(import_core_data9.store); 26368 const postTypeInfo = getPostType(postTypeSlug); 26369 const postIsHierarchical = postTypeInfo?.hierarchical && postTypeInfo.viewable; 26370 const parentPost = pageId ? getEntityRecord( 26371 "postType", 26372 postTypeSlug, 26373 pageId 26374 ) : null; 26375 const query = { 26376 per_page: 100, 26377 exclude: postId2, 26378 parent_exclude: postId2, 26379 orderby: "menu_order", 26380 order: "asc", 26381 _fields: "id,title,parent", 26382 ...!!fieldValue && { 26383 // Perform a search by relevance when the field is changed. 26384 search: fieldValue, 26385 orderby: "relevance", 26386 search_columns: ["post_title"] 26387 } 26388 }; 26389 return { 26390 isHierarchical: postIsHierarchical, 26391 parentPostTitle: parentPost ? getTitleWithFallbackName(parentPost) : "", 26392 pageItems: postIsHierarchical ? getEntityRecords( 26393 "postType", 26394 postTypeSlug, 26395 query 26396 ) : null 26397 }; 26398 }, 26399 [fieldValue, pageId, postId2, postTypeSlug] 26400 ); 26401 const parentOptions = (0, import_element50.useMemo)(() => { 26402 const getOptionsFromTree = (tree2, level = 0) => { 26403 const mappedNodes = tree2.map((treeNode) => [ 26404 { 26405 value: treeNode.id, 26406 label: "\u2014 ".repeat(level) + (0, import_html_entities4.decodeEntities)(treeNode.name), 26407 rawName: treeNode.name 26408 }, 26409 ...getOptionsFromTree(treeNode.children || [], level + 1) 26410 ]); 26411 const sortedNodes = mappedNodes.sort(([a3], [b3]) => { 26412 const priorityA = getItemPriority(a3.rawName, fieldValue); 26413 const priorityB = getItemPriority(b3.rawName, fieldValue); 26414 return priorityA >= priorityB ? 1 : -1; 26415 }); 26416 return sortedNodes.flat(); 26417 }; 26418 if (!pageItems) { 26419 return []; 26420 } 26421 let tree = pageItems.map((item) => ({ 26422 id: item.id, 26423 parent: item.parent ?? null, 26424 name: getTitleWithFallbackName(item) 26425 })); 26426 if (!fieldValue) { 26427 tree = buildTermsTree(tree); 26428 } 26429 const opts = getOptionsFromTree(tree); 26430 const optsHasParent = opts.find((item) => item.value === pageId); 26431 if (pageId && parentPostTitle && !optsHasParent) { 26432 opts.unshift({ 26433 value: pageId, 26434 label: parentPostTitle, 26435 rawName: "" 26436 }); 26437 } 26438 return opts.map((option) => ({ 26439 ...option, 26440 value: option.value.toString() 26441 })); 26442 }, [pageItems, fieldValue, parentPostTitle, pageId]); 26443 if (!isHierarchical) { 26444 return null; 26445 } 26446 const handleKeydown = (inputValue) => { 26447 setFieldValue(inputValue); 26448 }; 26449 const handleChange = (selectedPostId) => { 26450 if (selectedPostId) { 26451 return onChangeControl(parseInt(selectedPostId, 10) ?? 0); 26452 } 26453 onChangeControl(0); 26454 }; 26455 return /* @__PURE__ */ (0, import_jsx_runtime145.jsx)( 26456 import_components6.ComboboxControl, 26457 { 26458 label: (0, import_i18n23.__)("Parent"), 26459 help: (0, import_i18n23.__)("Choose a parent page."), 26460 value: pageId?.toString(), 26461 options: parentOptions, 26462 onFilterValueChange: (0, import_compose3.debounce)( 26463 (value) => handleKeydown(value), 26464 300 26465 ), 26466 onChange: handleChange, 26467 hideLabelFromVision: true 26468 } 26469 ); 26470 } 26471 var ParentEdit = ({ 26472 data, 26473 field, 26474 onChange 26475 }) => { 26476 const { id } = field; 26477 const homeUrl = (0, import_data13.useSelect)((select9) => { 26478 return select9(import_core_data9.store).getEntityRecord("root", "__unstableBase")?.home; 26479 }, []); 26480 const onChangeControl = (0, import_element50.useCallback)( 26481 (newValue) => onChange({ 26482 [id]: newValue 26483 }), 26484 [id, onChange] 26485 ); 26486 return /* @__PURE__ */ (0, import_jsx_runtime145.jsx)("fieldset", { className: "fields-controls__parent", children: /* @__PURE__ */ (0, import_jsx_runtime145.jsxs)("div", { children: [ 26487 (0, import_element50.createInterpolateElement)( 26488 (0, import_i18n23.sprintf)( 26489 /* translators: %1$s The home URL of the WordPress installation without the scheme. */ 26490 (0, import_i18n23.__)( 26491 'Child pages inherit characteristics from their parent, such as URL structure. For instance, if "Pricing" is a child of "Services", its URL would be %1$s<wbr />/services<wbr />/pricing.' 26492 ), 26493 (0, import_url6.filterURLForDisplay)(homeUrl).replace( 26494 /([/.])/g, 26495 "<wbr />$1" 26496 ) 26497 ), 26498 { 26499 wbr: /* @__PURE__ */ (0, import_jsx_runtime145.jsx)("wbr", {}) 26500 } 26501 ), 26502 /* @__PURE__ */ (0, import_jsx_runtime145.jsx)("p", { children: (0, import_element50.createInterpolateElement)( 26503 (0, import_i18n23.__)( 26504 "They also show up as sub-items in the default navigation menu. <a>Learn more.</a>" 26505 ), 26506 { 26507 a: /* @__PURE__ */ (0, import_jsx_runtime145.jsx)( 26508 import_components6.ExternalLink, 26509 { 26510 href: (0, import_i18n23.__)( 26511 "https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes" 26512 ), 26513 children: void 0 26514 } 26515 ) 26516 } 26517 ) }), 26518 /* @__PURE__ */ (0, import_jsx_runtime145.jsx)( 26519 PageAttributesParent, 26520 { 26521 data, 26522 onChangeControl 26523 } 26524 ) 26525 ] }) }); 26526 }; 26527 26528 // packages/fields/build-module/fields/parent/parent-view.mjs 26529 var import_data14 = __toESM(require_data(), 1); 26530 var import_core_data10 = __toESM(require_core_data(), 1); 26531 var import_i18n24 = __toESM(require_i18n(), 1); 26532 var import_jsx_runtime146 = __toESM(require_jsx_runtime(), 1); 26533 var ParentView = ({ 26534 item 26535 }) => { 26536 const parent = (0, import_data14.useSelect)( 26537 (select9) => { 26538 const { getEntityRecord } = select9(import_core_data10.store); 26539 return item?.parent ? getEntityRecord("postType", item.type, item.parent) : null; 26540 }, 26541 [item.parent, item.type] 26542 ); 26543 if (parent) { 26544 return /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(import_jsx_runtime146.Fragment, { children: getTitleWithFallbackName(parent) }); 26545 } 26546 return /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(import_jsx_runtime146.Fragment, { children: (0, import_i18n24.__)("None") }); 26547 }; 26548 26549 // packages/fields/build-module/fields/parent/index.mjs 26550 var parentField = { 26551 id: "parent", 26552 type: "text", 26553 label: (0, import_i18n25.__)("Parent"), 26554 Edit: ParentEdit, 26555 render: ParentView, 26556 enableSorting: true, 26557 filterBy: false 26558 }; 26559 var parent_default = parentField; 26560 26561 // packages/fields/build-module/fields/password/index.mjs 26562 var import_i18n27 = __toESM(require_i18n(), 1); 26563 26564 // packages/fields/build-module/fields/password/edit.mjs 26565 var import_components7 = __toESM(require_components(), 1); 26566 var import_element51 = __toESM(require_element(), 1); 26567 var import_i18n26 = __toESM(require_i18n(), 1); 26568 var import_jsx_runtime147 = __toESM(require_jsx_runtime(), 1); 26569 function PasswordEdit({ 26570 data, 26571 onChange, 26572 field 26573 }) { 26574 const [showPassword, setShowPassword] = (0, import_element51.useState)( 26575 !!field.getValue({ item: data }) 26576 ); 26577 const handleTogglePassword = (value) => { 26578 setShowPassword(value); 26579 if (!value) { 26580 onChange({ password: "" }); 26581 } 26582 }; 26583 return /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)( 26584 import_components7.__experimentalVStack, 26585 { 26586 as: "fieldset", 26587 spacing: 4, 26588 className: "fields-controls__password", 26589 children: [ 26590 /* @__PURE__ */ (0, import_jsx_runtime147.jsx)( 26591 import_components7.CheckboxControl, 26592 { 26593 label: (0, import_i18n26.__)("Password protected"), 26594 help: (0, import_i18n26.__)("Only visible to those who know the password"), 26595 checked: showPassword, 26596 onChange: handleTogglePassword 26597 } 26598 ), 26599 showPassword && /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "fields-controls__password-input", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)( 26600 import_components7.TextControl, 26601 { 26602 label: (0, import_i18n26.__)("Password"), 26603 onChange: (value) => onChange({ 26604 password: value 26605 }), 26606 value: field.getValue({ item: data }) || "", 26607 placeholder: (0, import_i18n26.__)("Use a secure password"), 26608 type: "text", 26609 maxLength: 255 26610 } 26611 ) }) 26612 ] 26613 } 26614 ); 26615 } 26616 var edit_default = PasswordEdit; 26617 26618 // packages/fields/build-module/fields/password/index.mjs 26619 var passwordField = { 26620 id: "password", 26621 type: "text", 26622 label: (0, import_i18n27.__)("Password"), 26623 Edit: edit_default, 26624 enableSorting: false, 26625 enableHiding: false, 26626 isVisible: (item) => item.status !== "private", 26627 filterBy: false 26628 }; 26629 var password_default = passwordField; 26630 26631 // packages/fields/build-module/fields/status/index.mjs 26632 var import_i18n29 = __toESM(require_i18n(), 1); 26633 26634 // packages/fields/build-module/fields/status/status-view.mjs 26635 var import_components8 = __toESM(require_components(), 1); 26636 26637 // packages/fields/build-module/fields/status/status-elements.mjs 26638 var import_i18n28 = __toESM(require_i18n(), 1); 26639 var STATUSES = [ 26640 { 26641 value: "draft", 26642 label: (0, import_i18n28.__)("Draft"), 26643 icon: drafts_default, 26644 description: (0, import_i18n28.__)("Not ready to publish.") 26645 }, 26646 { 26647 value: "future", 26648 label: (0, import_i18n28.__)("Scheduled"), 26649 icon: scheduled_default, 26650 description: (0, import_i18n28.__)("Publish automatically on a chosen date.") 26651 }, 26652 { 26653 value: "pending", 26654 label: (0, import_i18n28.__)("Pending Review"), 26655 icon: pending_default, 26656 description: (0, import_i18n28.__)("Waiting for review before publishing.") 26657 }, 26658 { 26659 value: "private", 26660 label: (0, import_i18n28.__)("Private"), 26661 icon: not_allowed_default, 26662 description: (0, import_i18n28.__)("Only visible to site admins and editors.") 26663 }, 26664 { 26665 value: "publish", 26666 label: (0, import_i18n28.__)("Published"), 26667 icon: published_default, 26668 description: (0, import_i18n28.__)("Visible to everyone.") 26669 }, 26670 { value: "trash", label: (0, import_i18n28.__)("Trash"), icon: trash_default } 26671 ]; 26672 var status_elements_default = STATUSES; 26673 26674 // packages/fields/build-module/fields/status/status-view.mjs 26675 var import_jsx_runtime148 = __toESM(require_jsx_runtime(), 1); 26676 function StatusView({ item, field }) { 26677 const currentStatus = field.getValue({ item }); 26678 const status = status_elements_default.find(({ value }) => value === currentStatus); 26679 const label = status?.label || currentStatus; 26680 const icon = status?.icon; 26681 return /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(import_components8.__experimentalHStack, { alignment: "left", spacing: 0, children: [ 26682 icon && /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "fields-controls__status-icon", children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(import_components8.Icon, { icon }) }), 26683 /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("span", { children: label }) 26684 ] }); 26685 } 26686 var status_view_default = StatusView; 26687 26688 // packages/fields/build-module/fields/status/index.mjs 26689 var OPERATOR_IS_ANY = "isAny"; 26690 var statusField = { 26691 label: (0, import_i18n29.__)("Status"), 26692 id: "status", 26693 type: "text", 26694 elements: status_elements_default, 26695 // An auto-draft is a draft that hasn't been saved yet, so treat it as 26696 // one for display, selection, and filtering. 26697 getValue: ({ item }) => item.status === "auto-draft" ? "draft" : item.status, 26698 render: status_view_default, 26699 Edit: "radio", 26700 enableSorting: false, 26701 filterBy: { 26702 operators: [OPERATOR_IS_ANY] 26703 } 26704 }; 26705 var status_default = statusField; 26706 26707 // packages/fields/build-module/fields/comment-status/index.mjs 26708 var import_i18n30 = __toESM(require_i18n(), 1); 26709 var commentStatusField = { 26710 id: "comment_status", 26711 label: (0, import_i18n30.__)("Comments"), 26712 type: "text", 26713 Edit: "radio", 26714 enableSorting: false, 26715 enableHiding: false, 26716 filterBy: false, 26717 elements: [ 26718 { 26719 value: "open", 26720 label: (0, import_i18n30.__)("Open"), 26721 description: (0, import_i18n30.__)("Visitors can add new comments and replies.") 26722 }, 26723 { 26724 value: "closed", 26725 label: (0, import_i18n30.__)("Closed"), 26726 description: (0, import_i18n30.__)( 26727 "Visitors cannot add new comments or replies. Existing comments remain visible." 26728 ) 26729 } 26730 ] 26731 }; 26732 var comment_status_default = commentStatusField; 26733 26734 // packages/fields/build-module/fields/ping-status/index.mjs 26735 var import_i18n31 = __toESM(require_i18n(), 1); 26736 var import_components9 = __toESM(require_components(), 1); 26737 var import_jsx_runtime149 = __toESM(require_jsx_runtime(), 1); 26738 function PingStatusEdit({ 26739 data, 26740 onChange 26741 }) { 26742 const pingStatus = data?.ping_status ?? "open"; 26743 const onTogglePingback = (checked) => { 26744 onChange({ 26745 ...data, 26746 ping_status: checked ? "open" : "closed" 26747 }); 26748 }; 26749 return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)( 26750 import_components9.CheckboxControl, 26751 { 26752 label: (0, import_i18n31.__)("Enable pingbacks & trackbacks"), 26753 checked: pingStatus === "open", 26754 onChange: onTogglePingback, 26755 help: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)( 26756 import_components9.ExternalLink, 26757 { 26758 href: (0, import_i18n31.__)( 26759 "https://wordpress.org/documentation/article/trackbacks-and-pingbacks/" 26760 ), 26761 children: (0, import_i18n31.__)("Learn more about pingbacks & trackbacks") 26762 } 26763 ) 26764 } 26765 ); 26766 } 26767 var pingStatusField = { 26768 id: "ping_status", 26769 label: (0, import_i18n31.__)("Trackbacks & Pingbacks"), 26770 type: "text", 26771 Edit: PingStatusEdit, 26772 enableSorting: false, 26773 enableHiding: false, 26774 filterBy: false, 26775 elements: [ 26776 { 26777 value: "open", 26778 label: (0, import_i18n31.__)("Allow"), 26779 description: (0, import_i18n31.__)( 26780 "Allow link notifications from other blogs (pingbacks and trackbacks) on new articles." 26781 ) 26782 }, 26783 { 26784 value: "closed", 26785 label: (0, import_i18n31.__)("Don't allow"), 26786 description: (0, import_i18n31.__)( 26787 "Don't allow link notifications from other blogs (pingbacks and trackbacks) on new articles." 26788 ) 26789 } 26790 ] 26791 }; 26792 var ping_status_default = pingStatusField; 26793 26794 // packages/fields/build-module/fields/discussion/index.mjs 26795 var import_i18n32 = __toESM(require_i18n(), 1); 26796 var discussionField = { 26797 id: "discussion", 26798 label: (0, import_i18n32.__)("Discussion"), 26799 type: "text", 26800 render: ({ item }) => { 26801 const commentsOpen = item.comment_status === "open"; 26802 const pingsOpen = item.ping_status === "open"; 26803 if (commentsOpen && pingsOpen) { 26804 return (0, import_i18n32.__)("Open"); 26805 } 26806 if (commentsOpen && !pingsOpen) { 26807 return (0, import_i18n32.__)("Comments only"); 26808 } 26809 if (!commentsOpen && pingsOpen) { 26810 return (0, import_i18n32.__)("Pings only"); 26811 } 26812 return (0, import_i18n32.__)("Closed"); 26813 }, 26814 filterBy: false 26815 }; 26816 var discussion_default = discussionField; 26817 26818 // packages/fields/build-module/fields/date/index.mjs 26819 var import_i18n34 = __toESM(require_i18n(), 1); 26820 26821 // packages/fields/build-module/fields/date/date-view.mjs 26822 var import_i18n33 = __toESM(require_i18n(), 1); 26823 var import_element52 = __toESM(require_element(), 1); 26824 var import_date2 = __toESM(require_date(), 1); 26825 var import_jsx_runtime150 = __toESM(require_jsx_runtime(), 1); 26826 var getFormattedDate = (dateToDisplay) => (0, import_date2.dateI18n)( 26827 (0, import_date2.getSettings)().formats.datetimeAbbreviated, 26828 (0, import_date2.getDate)(dateToDisplay) 26829 ); 26830 var DateView = ({ item }) => { 26831 const isDraftOrPrivate = ["draft", "private"].includes( 26832 item.status ?? "" 26833 ); 26834 if (isDraftOrPrivate) { 26835 return (0, import_element52.createInterpolateElement)( 26836 (0, import_i18n33.sprintf)( 26837 /* translators: %s: page creation or modification date. */ 26838 (0, import_i18n33.__)("<span>Modified: <time>%s</time></span>"), 26839 getFormattedDate(item.date ?? null) 26840 ), 26841 { 26842 span: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("span", {}), 26843 time: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("time", {}) 26844 } 26845 ); 26846 } 26847 const isScheduled = item.status === "future"; 26848 if (isScheduled) { 26849 return (0, import_element52.createInterpolateElement)( 26850 (0, import_i18n33.sprintf)( 26851 /* translators: %s: page creation date */ 26852 (0, import_i18n33.__)("<span>Scheduled: <time>%s</time></span>"), 26853 getFormattedDate(item.date ?? null) 26854 ), 26855 { 26856 span: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("span", {}), 26857 time: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("time", {}) 26858 } 26859 ); 26860 } 26861 const isPublished = item.status === "publish"; 26862 if (isPublished) { 26863 return (0, import_element52.createInterpolateElement)( 26864 (0, import_i18n33.sprintf)( 26865 /* translators: %s: page creation time */ 26866 (0, import_i18n33.__)("<span>Published: <time>%s</time></span>"), 26867 getFormattedDate(item.date ?? null) 26868 ), 26869 { 26870 span: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("span", {}), 26871 time: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("time", {}) 26872 } 26873 ); 26874 } 26875 const dateToDisplay = (0, import_date2.getDate)(item.modified ?? null) > (0, import_date2.getDate)(item.date ?? null) ? item.modified : item.date; 26876 const isPending = item.status === "pending"; 26877 if (isPending) { 26878 return (0, import_element52.createInterpolateElement)( 26879 (0, import_i18n33.sprintf)( 26880 /* translators: %s: page creation or modification date. */ 26881 (0, import_i18n33.__)("<span>Modified: <time>%s</time></span>"), 26882 getFormattedDate(dateToDisplay ?? null) 26883 ), 26884 { 26885 span: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("span", {}), 26886 time: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("time", {}) 26887 } 26888 ); 26889 } 26890 return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("time", { children: getFormattedDate(item.date ?? null) }); 26891 }; 26892 var date_view_default = DateView; 26893 26894 // packages/fields/build-module/fields/date/index.mjs 26895 var dateField = { 26896 id: "date", 26897 type: "datetime", 26898 label: (0, import_i18n34.__)("Date"), 26899 render: date_view_default, 26900 filterBy: { 26901 operators: ["before", "after"] 26902 } 26903 }; 26904 var date_default = dateField; 26905 26906 // packages/fields/build-module/fields/scheduled-date/index.mjs 26907 var import_i18n35 = __toESM(require_i18n(), 1); 26908 var scheduledDateField = { 26909 id: "scheduled_date", 26910 type: "datetime", 26911 label: (0, import_i18n35.__)("Scheduled Date"), 26912 getValue: ({ item }) => item.date, 26913 setValue: ({ value }) => ({ date: value }), 26914 isVisible: (item) => item.status === "future", 26915 Edit: { 26916 control: "datetime", 26917 compact: true 26918 }, 26919 enableHiding: false, 26920 enableSorting: false, 26921 filterBy: false 26922 }; 26923 var scheduled_date_default = scheduledDateField; 26924 26925 // packages/fields/build-module/fields/last-edited/index.mjs 26926 var import_i18n37 = __toESM(require_i18n(), 1); 26927 26928 // packages/fields/build-module/fields/last-edited/last-edited-date-view.mjs 26929 var import_i18n36 = __toESM(require_i18n(), 1); 26930 var import_date3 = __toESM(require_date(), 1); 26931 var import_jsx_runtime151 = __toESM(require_jsx_runtime(), 1); 26932 function LastEditedDateView({ item }) { 26933 if (!item.modified) { 26934 return null; 26935 } 26936 return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(Text, { children: (0, import_i18n36.sprintf)( 26937 // translators: %s: Human-readable time difference, e.g. "2 days ago". 26938 (0, import_i18n36.__)("Last edited %s."), 26939 (0, import_date3.humanTimeDiff)(item.modified) 26940 ) }); 26941 } 26942 26943 // packages/fields/build-module/fields/last-edited/index.mjs 26944 var lastEditedDateField = { 26945 id: "last_edited_date", 26946 type: "datetime", 26947 label: (0, import_i18n37.__)("Last edited"), 26948 render: LastEditedDateView, 26949 getValue: ({ item }) => item.modified, 26950 isVisible: (item) => !!item.modified, 26951 readOnly: true, 26952 enableHiding: false, 26953 enableSorting: false, 26954 filterBy: false 26955 }; 26956 var last_edited_default = lastEditedDateField; 26957 26958 // packages/fields/build-module/fields/author/index.mjs 26959 var import_i18n39 = __toESM(require_i18n(), 1); 26960 var import_data16 = __toESM(require_data(), 1); 26961 var import_core_data12 = __toESM(require_core_data(), 1); 26962 26963 // packages/fields/build-module/fields/author/author-view.mjs 26964 var import_i18n38 = __toESM(require_i18n(), 1); 26965 var import_element53 = __toESM(require_element(), 1); 26966 var import_components10 = __toESM(require_components(), 1); 26967 var import_data15 = __toESM(require_data(), 1); 26968 var import_core_data11 = __toESM(require_core_data(), 1); 26969 var import_jsx_runtime152 = __toESM(require_jsx_runtime(), 1); 26970 function AuthorView({ item }) { 26971 const authorId = item?.author; 26972 const embeddedAuthorId = item?._embedded?.author?.[0]?.id; 26973 const shouldFetch = Boolean( 26974 authorId && (!embeddedAuthorId || authorId !== embeddedAuthorId) 26975 ); 26976 const author = (0, import_data15.useSelect)( 26977 (select9) => { 26978 if (!shouldFetch) { 26979 return null; 26980 } 26981 const { getEntityRecord } = select9(import_core_data11.store); 26982 return authorId ? getEntityRecord("root", "user", authorId) : null; 26983 }, 26984 [authorId, shouldFetch] 26985 ); 26986 const text = author?.name || item?._embedded?.author?.[0]?.name; 26987 const imageUrl = author?.avatar_urls?.[48] || item?._embedded?.author?.[0]?.avatar_urls?.[48]; 26988 const [isImageLoaded, setIsImageLoaded] = (0, import_element53.useState)(false); 26989 return /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(import_components10.__experimentalHStack, { alignment: "left", spacing: 0, children: [ 26990 !!imageUrl && /* @__PURE__ */ (0, import_jsx_runtime152.jsx)( 26991 "div", 26992 { 26993 className: clsx_default("fields-controls__author-avatar", { 26994 "is-loaded": isImageLoaded 26995 }), 26996 children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)( 26997 "img", 26998 { 26999 onLoad: () => setIsImageLoaded(true), 27000 alt: (0, import_i18n38.__)("Author avatar"), 27001 src: imageUrl 27002 } 27003 ) 27004 } 27005 ), 27006 !imageUrl && /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "fields-controls__author-icon", children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(import_components10.Icon, { icon: comment_author_avatar_default }) }), 27007 /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "fields-controls__author-name", children: text }) 27008 ] }); 27009 } 27010 var author_view_default = AuthorView; 27011 27012 // packages/fields/build-module/fields/author/index.mjs 27013 var authorField = { 27014 label: (0, import_i18n39.__)("Author"), 27015 id: "author", 27016 type: "integer", 27017 getElements: async () => { 27018 const authors = await (0, import_data16.resolveSelect)(import_core_data12.store).getEntityRecords( 27019 "root", 27020 "user", 27021 { 27022 per_page: -1, 27023 who: "authors", 27024 _fields: "id,name", 27025 context: "view" 27026 } 27027 ) ?? []; 27028 return authors.map(({ id, name: name2 }) => ({ 27029 value: id, 27030 label: name2 27031 })); 27032 }, 27033 setValue: ({ value }) => ({ author: Number(value) }), 27034 render: author_view_default, 27035 sort: (a3, b3, direction) => { 27036 const nameA = a3._embedded?.author?.[0]?.name || ""; 27037 const nameB = b3._embedded?.author?.[0]?.name || ""; 27038 return direction === "asc" ? nameA.localeCompare(nameB) : nameB.localeCompare(nameA); 27039 }, 27040 filterBy: { 27041 operators: ["isAny", "isNone"] 27042 } 27043 }; 27044 var author_default = authorField; 27045 27046 // packages/fields/build-module/fields/template-author/index.mjs 27047 var import_i18n40 = __toESM(require_i18n(), 1); 27048 var import_data18 = __toESM(require_data(), 1); 27049 var import_core_data14 = __toESM(require_core_data(), 1); 27050 27051 // packages/fields/build-module/fields/template-author/view.mjs 27052 var import_element54 = __toESM(require_element(), 1); 27053 var import_data17 = __toESM(require_data(), 1); 27054 var import_core_data13 = __toESM(require_core_data(), 1); 27055 var import_jsx_runtime153 = __toESM(require_jsx_runtime(), 1); 27056 function getIconForSource(originalSource) { 27057 switch (originalSource) { 27058 case "theme": 27059 return layout_default; 27060 case "plugin": 27061 return plugins_default; 27062 case "site": 27063 return globe_default; 27064 default: 27065 return comment_author_avatar_default; 27066 } 27067 } 27068 function TemplateAuthorView({ 27069 item 27070 }) { 27071 const [isImageLoaded, setIsImageLoaded] = (0, import_element54.useState)(false); 27072 const originalSource = item.original_source; 27073 const icon = getIconForSource(originalSource); 27074 const text = item.author_text; 27075 const authorId = item.author; 27076 const imageUrl = (0, import_data17.useSelect)( 27077 (select9) => { 27078 if (originalSource === "site") { 27079 const siteData = select9(import_core_data13.store).getEntityRecord("root", "__unstableBase"); 27080 const logoId = siteData?.site_logo; 27081 if (!logoId) { 27082 return void 0; 27083 } 27084 return select9(import_core_data13.store).getEntityRecord("postType", "attachment", logoId)?.source_url; 27085 } 27086 if (originalSource !== "user" || !authorId) { 27087 return void 0; 27088 } 27089 return select9(import_core_data13.store).getUser(authorId)?.avatar_urls?.[48]; 27090 }, 27091 [originalSource, authorId] 27092 ); 27093 return /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(Stack, { direction: "row", align: "center", children: [ 27094 imageUrl && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)( 27095 "div", 27096 { 27097 className: clsx_default("fields-controls__author-avatar", { 27098 "is-loaded": isImageLoaded 27099 }), 27100 children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)( 27101 "img", 27102 { 27103 onLoad: () => setIsImageLoaded(true), 27104 alt: "", 27105 src: imageUrl 27106 } 27107 ) 27108 } 27109 ), 27110 !imageUrl && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { className: "fields-controls__author-icon", children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Icon, { icon }) }), 27111 /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { className: "fields-controls__author-name", children: text }) 27112 ] }); 27113 } 27114 27115 // packages/fields/build-module/fields/template-author/index.mjs 27116 async function getAuthorElements(postType2) { 27117 const records = await (0, import_data18.resolveSelect)(import_core_data14.store).getEntityRecords( 27118 "postType", 27119 postType2, 27120 { per_page: -1, _fields: "id,author_text" } 27121 ); 27122 const seen = /* @__PURE__ */ new Set(); 27123 const elements2 = []; 27124 for (const record of records ?? []) { 27125 const value = record.author_text; 27126 if (value && !seen.has(value)) { 27127 seen.add(value); 27128 elements2.push({ value, label: value }); 27129 } 27130 } 27131 return elements2; 27132 } 27133 var templateAuthorField = { 27134 label: (0, import_i18n40.__)("Author"), 27135 id: "author", 27136 getValue: ({ item }) => item.author_text, 27137 render: TemplateAuthorView, 27138 getElements: () => getAuthorElements("wp_template") 27139 }; 27140 var templatePartAuthorField = { 27141 label: (0, import_i18n40.__)("Author"), 27142 id: "author", 27143 getValue: ({ item }) => item.author_text, 27144 render: TemplateAuthorView, 27145 enableSorting: false, 27146 filterBy: { 27147 isPrimary: true 27148 }, 27149 getElements: () => getAuthorElements("wp_template_part") 27150 }; 27151 27152 // packages/fields/build-module/fields/notes/index.mjs 27153 var import_i18n41 = __toESM(require_i18n(), 1); 27154 var notesField = { 27155 id: "notesCount", 27156 label: (0, import_i18n41.__)("Notes"), 27157 type: "integer", 27158 enableSorting: false, 27159 filterBy: false 27160 }; 27161 var notes_default = notesField; 27162 27163 // packages/fields/build-module/fields/excerpt/index.mjs 27164 var import_html_entities5 = __toESM(require_html_entities(), 1); 27165 var import_i18n42 = __toESM(require_i18n(), 1); 27166 var import_components11 = __toESM(require_components(), 1); 27167 var import_jsx_runtime154 = __toESM(require_jsx_runtime(), 1); 27168 var excerptField = { 27169 id: "excerpt", 27170 type: "text", 27171 label: (0, import_i18n42.__)("Excerpt"), 27172 placeholder: (0, import_i18n42.__)("Add an excerpt"), 27173 description: /* @__PURE__ */ (0, import_jsx_runtime154.jsx)( 27174 import_components11.ExternalLink, 27175 { 27176 href: (0, import_i18n42.__)( 27177 "https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt" 27178 ), 27179 children: (0, import_i18n42.__)("Learn more about manual excerpts") 27180 } 27181 ), 27182 render: ({ item }) => { 27183 let excerpt; 27184 if (typeof item.excerpt === "string") { 27185 excerpt = !!item.excerpt ? (0, import_html_entities5.decodeEntities)(item.excerpt) : (0, import_i18n42.__)("Add an excerpt"); 27186 } else { 27187 excerpt = (0, import_html_entities5.decodeEntities)(item.excerpt?.raw || ""); 27188 } 27189 return /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(import_components11.__experimentalText, { align: "left", numberOfLines: 3, truncate: true, children: excerpt }); 27190 }, 27191 Edit: { 27192 control: "textarea", 27193 rows: 4 27194 }, 27195 enableSorting: false, 27196 filterBy: false 27197 }; 27198 var excerpt_default = excerptField; 27199 27200 // packages/fields/build-module/fields/description/index.mjs 27201 var import_html_entities6 = __toESM(require_html_entities(), 1); 27202 var import_i18n43 = __toESM(require_i18n(), 1); 27203 var import_jsx_runtime155 = __toESM(require_jsx_runtime(), 1); 27204 var isCustomTemplate = (item) => item.source === "custom" && !item.has_theme_file && item.is_custom; 27205 var getValue = ({ item }) => (0, import_html_entities6.decodeEntities)(item.description || ""); 27206 var render = ({ item }) => { 27207 const { description } = item; 27208 return description && /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(Text, { children: (0, import_html_entities6.decodeEntities)(description) }); 27209 }; 27210 var descriptionField = { 27211 id: "description", 27212 type: "text", 27213 label: (0, import_i18n43.__)("Description"), 27214 placeholder: (0, import_i18n43.__)("Add a description"), 27215 getValue, 27216 render, 27217 Edit: { 27218 control: "textarea", 27219 rows: 4 27220 }, 27221 isVisible: isCustomTemplate, 27222 enableSorting: false, 27223 filterBy: false, 27224 enableGlobalSearch: true 27225 }; 27226 var readOnlyDescriptionField = { 27227 id: "description_readonly", 27228 type: "text", 27229 label: (0, import_i18n43.__)("Description"), 27230 getValue, 27231 render, 27232 readOnly: true, 27233 isVisible: (item) => !isCustomTemplate(item) && !!item.description, 27234 enableSorting: false, 27235 enableHiding: false, 27236 filterBy: false 27237 }; 27238 var description_default = descriptionField; 27239 27240 // packages/fields/build-module/fields/format/index.mjs 27241 var import_i18n44 = __toESM(require_i18n(), 1); 27242 var import_data19 = __toESM(require_data(), 1); 27243 var import_core_data15 = __toESM(require_core_data(), 1); 27244 var POST_FORMATS = [ 27245 { id: "aside", caption: (0, import_i18n44.__)("Aside") }, 27246 { id: "audio", caption: (0, import_i18n44.__)("Audio") }, 27247 { id: "chat", caption: (0, import_i18n44.__)("Chat") }, 27248 { id: "gallery", caption: (0, import_i18n44.__)("Gallery") }, 27249 { id: "image", caption: (0, import_i18n44.__)("Image") }, 27250 { id: "link", caption: (0, import_i18n44.__)("Link") }, 27251 { id: "quote", caption: (0, import_i18n44.__)("Quote") }, 27252 { id: "standard", caption: (0, import_i18n44.__)("Standard") }, 27253 { id: "status", caption: (0, import_i18n44.__)("Status") }, 27254 { id: "video", caption: (0, import_i18n44.__)("Video") } 27255 ].sort((a3, b3) => { 27256 const normalizedA = a3.caption.toUpperCase(); 27257 const normalizedB = b3.caption.toUpperCase(); 27258 if (normalizedA < normalizedB) { 27259 return -1; 27260 } 27261 if (normalizedA > normalizedB) { 27262 return 1; 27263 } 27264 return 0; 27265 }); 27266 var formatField = { 27267 id: "format", 27268 label: (0, import_i18n44.__)("Format"), 27269 type: "text", 27270 Edit: "radio", 27271 enableSorting: false, 27272 enableHiding: false, 27273 filterBy: false, 27274 getElements: async () => { 27275 const themeSupports = await (0, import_data19.resolveSelect)(import_core_data15.store).getThemeSupports(); 27276 return POST_FORMATS.filter( 27277 (f3) => themeSupports?.formats?.includes( 27278 f3.id 27279 ) 27280 ).map((f3) => ({ value: f3.id, label: f3.caption })); 27281 } 27282 }; 27283 var format_default = formatField; 27284 27285 // packages/fields/build-module/fields/post-content-info/index.mjs 27286 var import_i18n46 = __toESM(require_i18n(), 1); 27287 27288 // packages/fields/build-module/fields/post-content-info/post-content-info-view.mjs 27289 var import_components12 = __toESM(require_components(), 1); 27290 var import_i18n45 = __toESM(require_i18n(), 1); 27291 var import_wordcount = __toESM(require_wordcount(), 1); 27292 var import_date4 = __toESM(require_date(), 1); 27293 var import_element55 = __toESM(require_element(), 1); 27294 var import_jsx_runtime156 = __toESM(require_jsx_runtime(), 1); 27295 var AVERAGE_READING_RATE = 189; 27296 function PostContentInfoView({ 27297 item 27298 }) { 27299 let content = ""; 27300 if (typeof item.content === "string") { 27301 content = item.content; 27302 } else if (typeof item.content === "function") { 27303 content = item.content(item); 27304 } 27305 const wordCountType = (0, import_i18n45._x)( 27306 "words", 27307 "Word count type. Do not translate!" 27308 ); 27309 const wordsCounted = (0, import_element55.useMemo)( 27310 () => content ? (0, import_wordcount.count)(content, wordCountType) : 0, 27311 [content, wordCountType] 27312 ); 27313 const modified = item.modified; 27314 if (!wordsCounted && !modified) { 27315 return null; 27316 } 27317 let contentInfoText; 27318 if (wordsCounted) { 27319 const readingTime = Math.round(wordsCounted / AVERAGE_READING_RATE); 27320 const wordsCountText = (0, import_i18n45.sprintf)( 27321 // translators: %s: the number of words in the post. 27322 (0, import_i18n45._n)("%s word", "%s words", wordsCounted), 27323 wordsCounted.toLocaleString() 27324 ); 27325 const minutesText = readingTime <= 1 ? (0, import_i18n45.__)("1 minute") : (0, import_i18n45.sprintf)( 27326 /* translators: %s: the number of minutes to read the post. */ 27327 (0, import_i18n45._n)("%s minute", "%s minutes", readingTime), 27328 readingTime.toLocaleString() 27329 ); 27330 contentInfoText = (0, import_i18n45.sprintf)( 27331 /* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */ 27332 (0, import_i18n45.__)("%1$s, %2$s read time."), 27333 wordsCountText, 27334 minutesText 27335 ); 27336 } 27337 return /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)(import_components12.__experimentalVStack, { spacing: 1, children: [ 27338 contentInfoText && /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(import_components12.__experimentalText, { variant: "muted", children: contentInfoText }), 27339 modified && /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(import_components12.__experimentalText, { variant: "muted", children: (0, import_i18n45.sprintf)( 27340 // translators: %s: Human-readable time difference, e.g. "2 days ago". 27341 (0, import_i18n45.__)("Last edited %s."), 27342 (0, import_date4.humanTimeDiff)(modified) 27343 ) }) 27344 ] }); 27345 } 27346 27347 // packages/fields/build-module/fields/post-content-info/index.mjs 27348 var postContentInfoField = { 27349 label: (0, import_i18n46.__)("Post content information"), 27350 id: "post-content-info", 27351 type: "text", 27352 readOnly: true, 27353 render: PostContentInfoView, 27354 enableSorting: false, 27355 enableHiding: false, 27356 filterBy: false 27357 }; 27358 var post_content_info_default = postContentInfoField; 27359 27360 // packages/fields/build-module/fields/sticky/index.mjs 27361 var import_i18n47 = __toESM(require_i18n(), 1); 27362 var stickyField = { 27363 id: "sticky", 27364 type: "boolean", 27365 label: (0, import_i18n47.__)("Sticky"), 27366 description: (0, import_i18n47.__)("Pin this post to the top of the blog."), 27367 enableSorting: false, 27368 enableHiding: false, 27369 isVisible: (item) => !!item._links?.["wp:action-sticky"], 27370 filterBy: false 27371 }; 27372 var sticky_default = stickyField; 27373 27374 // packages/fields/build-module/fields/posts-per-page/index.mjs 27375 var import_i18n48 = __toESM(require_i18n(), 1); 27376 var postsPerPageField = { 27377 id: "posts_per_page", 27378 type: "integer", 27379 label: (0, import_i18n48.__)("Posts per page"), 27380 description: (0, import_i18n48.__)( 27381 "Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting." 27382 ), 27383 getValue: ({ item }) => item.posts_per_page ?? 1, 27384 setValue: ({ value }) => ({ posts_per_page: value }), 27385 isValid: { min: 1 }, 27386 enableSorting: false, 27387 enableHiding: false, 27388 filterBy: false 27389 }; 27390 var posts_per_page_default = postsPerPageField; 27391 27392 // packages/fields/build-module/fields/site-discussion/index.mjs 27393 var import_i18n49 = __toESM(require_i18n(), 1); 27394 var siteDiscussionField = { 27395 id: "default_comment_status", 27396 type: "text", 27397 label: (0, import_i18n49.__)("Discussion"), 27398 Edit: "radio", 27399 getValue: ({ item }) => item.default_comment_status || "", 27400 setValue: ({ value }) => ({ 27401 default_comment_status: value || null 27402 }), 27403 render: ({ item }) => { 27404 return item.default_comment_status === "open" ? (0, import_i18n49.__)("Comments open") : (0, import_i18n49.__)("Comments closed"); 27405 }, 27406 elements: [ 27407 { 27408 value: "open", 27409 label: (0, import_i18n49.__)("Open"), 27410 description: (0, import_i18n49.__)("Visitors can add new comments and replies.") 27411 }, 27412 { 27413 value: "", 27414 label: (0, import_i18n49.__)("Closed"), 27415 description: (0, import_i18n49.__)( 27416 "Visitors cannot add new comments or replies. Existing comments remain visible." 27417 ) 27418 } 27419 ], 27420 enableSorting: false, 27421 enableHiding: false, 27422 filterBy: false 27423 }; 27424 var site_discussion_default = siteDiscussionField; 27425 27426 // packages/fields/build-module/fields/posts-page-title/index.mjs 27427 var import_i18n50 = __toESM(require_i18n(), 1); 27428 var postsPageTitleField = { 27429 id: "posts_page_title", 27430 type: "text", 27431 label: (0, import_i18n50.__)("Blog title"), 27432 description: (0, import_i18n50.__)( 27433 "Set the Posts Page title. Appears in search results, and when the page is shared on social media." 27434 ), 27435 getValue: ({ item }) => { 27436 const title = item.title; 27437 if (typeof title === "string") { 27438 return title; 27439 } 27440 return title?.raw ?? ""; 27441 }, 27442 setValue: ({ value }) => ({ title: value }), 27443 enableSorting: false, 27444 enableHiding: false, 27445 filterBy: false 27446 }; 27447 var posts_page_title_default = postsPageTitleField; 27448 27449 // packages/fields/build-module/actions/view-post.mjs 27450 var import_i18n51 = __toESM(require_i18n(), 1); 27451 var viewPost = { 27452 id: "view-post", 27453 label: (0, import_i18n51._x)("View", "verb"), 27454 isPrimary: true, 27455 icon: external_default, 27456 isEligible(post2) { 27457 return post2.status !== "trash"; 27458 }, 27459 callback(posts, { onActionPerformed }) { 27460 const post2 = posts[0]; 27461 window.open(post2?.link, "_blank"); 27462 if (onActionPerformed) { 27463 onActionPerformed(posts); 27464 } 27465 } 27466 }; 27467 var view_post_default = viewPost; 27468 27469 // packages/fields/build-module/actions/reorder-page.mjs 27470 var import_data20 = __toESM(require_data(), 1); 27471 var import_core_data16 = __toESM(require_core_data(), 1); 27472 var import_i18n52 = __toESM(require_i18n(), 1); 27473 var import_notices3 = __toESM(require_notices(), 1); 27474 var import_element56 = __toESM(require_element(), 1); 27475 var import_components13 = __toESM(require_components(), 1); 27476 var import_jsx_runtime157 = __toESM(require_jsx_runtime(), 1); 27477 function isItemValid(item) { 27478 return typeof item.menu_order === "number" && Number.isInteger(item.menu_order); 27479 } 27480 function ReorderModal({ 27481 items, 27482 closeModal: closeModal2, 27483 onActionPerformed 27484 }) { 27485 const [item, setItem] = (0, import_element56.useState)(items[0]); 27486 const { editEntityRecord, saveEditedEntityRecord } = (0, import_data20.useDispatch)(import_core_data16.store); 27487 const { createSuccessNotice, createErrorNotice } = (0, import_data20.useDispatch)(import_notices3.store); 27488 const isValid2 = isItemValid(item); 27489 async function onOrder(event) { 27490 event.preventDefault(); 27491 if (!isValid2) { 27492 return; 27493 } 27494 try { 27495 await editEntityRecord("postType", item.type, item.id, { 27496 menu_order: item.menu_order 27497 }); 27498 closeModal2?.(); 27499 await saveEditedEntityRecord("postType", item.type, item.id, { 27500 throwOnError: true 27501 }); 27502 createSuccessNotice((0, import_i18n52.__)("Order updated."), { 27503 type: "snackbar" 27504 }); 27505 onActionPerformed?.(items); 27506 } catch (error2) { 27507 const typedError = error2; 27508 const errorMessage = typedError.message && typedError.code !== "unknown_error" ? typedError.message : (0, import_i18n52.__)("An error occurred while updating the order"); 27509 createErrorNotice(errorMessage, { 27510 type: "snackbar" 27511 }); 27512 } 27513 } 27514 return /* @__PURE__ */ (0, import_jsx_runtime157.jsx)("form", { onSubmit: onOrder, children: /* @__PURE__ */ (0, import_jsx_runtime157.jsxs)(import_components13.__experimentalVStack, { spacing: "5", children: [ 27515 /* @__PURE__ */ (0, import_jsx_runtime157.jsx)("div", { children: (0, import_i18n52.__)( 27516 "Determines the order of pages. Pages with the same order value are sorted alphabetically. Negative order values are supported." 27517 ) }), 27518 /* @__PURE__ */ (0, import_jsx_runtime157.jsx)( 27519 import_components13.__experimentalInputControl, 27520 { 27521 label: (0, import_i18n52.__)("Order"), 27522 type: "number", 27523 value: typeof item.menu_order === "number" && Number.isInteger(item.menu_order) ? String(item.menu_order) : "", 27524 onChange: (value) => { 27525 const parsed = parseInt(value, 10); 27526 setItem({ 27527 ...item, 27528 menu_order: isNaN(parsed) ? void 0 : parsed 27529 }); 27530 } 27531 } 27532 ), 27533 /* @__PURE__ */ (0, import_jsx_runtime157.jsxs)(import_components13.__experimentalHStack, { justify: "right", children: [ 27534 /* @__PURE__ */ (0, import_jsx_runtime157.jsx)( 27535 import_components13.Button, 27536 { 27537 __next40pxDefaultSize: true, 27538 variant: "tertiary", 27539 onClick: () => { 27540 closeModal2?.(); 27541 }, 27542 children: (0, import_i18n52.__)("Cancel") 27543 } 27544 ), 27545 /* @__PURE__ */ (0, import_jsx_runtime157.jsx)( 27546 import_components13.Button, 27547 { 27548 __next40pxDefaultSize: true, 27549 variant: "primary", 27550 type: "submit", 27551 accessibleWhenDisabled: true, 27552 disabled: !isValid2, 27553 children: (0, import_i18n52.__)("Save") 27554 } 27555 ) 27556 ] }) 27557 ] }) }); 27558 } 27559 var reorderPage = { 27560 id: "order-pages", 27561 label: (0, import_i18n52.__)("Order"), 27562 isEligible({ status }) { 27563 return status !== "trash"; 27564 }, 27565 modalFocusOnMount: "firstContentElement", 27566 RenderModal: ReorderModal 27567 }; 27568 var reorder_page_default = reorderPage; 27569 27570 // packages/fields/build-module/actions/duplicate-post.mjs 27571 var import_data21 = __toESM(require_data(), 1); 27572 var import_core_data17 = __toESM(require_core_data(), 1); 27573 var import_i18n53 = __toESM(require_i18n(), 1); 27574 var import_notices4 = __toESM(require_notices(), 1); 27575 var import_element57 = __toESM(require_element(), 1); 27576 var import_components14 = __toESM(require_components(), 1); 27577 var import_jsx_runtime158 = __toESM(require_jsx_runtime(), 1); 27578 var duplicatePost = { 27579 id: "duplicate-post", 27580 label: (0, import_i18n53._x)("Duplicate", "action label"), 27581 isEligible({ status }) { 27582 return status !== "trash"; 27583 }, 27584 modalFocusOnMount: "firstContentElement", 27585 RenderModal: ({ items, closeModal: closeModal2, onActionPerformed }) => { 27586 const [item, setItem] = (0, import_element57.useState)({ 27587 ...items[0], 27588 title: (0, import_i18n53.sprintf)( 27589 /* translators: %s: Existing post title */ 27590 (0, import_i18n53._x)("%s (Copy)", "post"), 27591 getItemTitle(items[0]) 27592 ) 27593 }); 27594 const [isCreatingPage, setIsCreatingPage] = (0, import_element57.useState)(false); 27595 const { saveEntityRecord } = (0, import_data21.useDispatch)(import_core_data17.store); 27596 const { createSuccessNotice, createErrorNotice } = (0, import_data21.useDispatch)(import_notices4.store); 27597 async function createPage(event) { 27598 event.preventDefault(); 27599 if (isCreatingPage) { 27600 return; 27601 } 27602 const isTemplate2 = item.type === "wp_template"; 27603 const newItemObject = { 27604 status: isTemplate2 ? "publish" : "draft", 27605 title: item.title, 27606 slug: isTemplate2 ? item.slug : item.title || (0, import_i18n53.__)("No title"), 27607 comment_status: item.comment_status, 27608 content: typeof item.content === "string" ? item.content : item.content.raw, 27609 excerpt: typeof item.excerpt === "string" ? item.excerpt : item.excerpt?.raw, 27610 meta: item.meta, 27611 parent: item.parent, 27612 password: item.password, 27613 template: item.template, 27614 format: item.format, 27615 featured_media: item.featured_media, 27616 menu_order: item.menu_order, 27617 ping_status: item.ping_status 27618 }; 27619 const assignablePropertiesPrefix = "wp:action-assign-"; 27620 const assignableProperties = Object.keys(item?._links || {}).filter( 27621 (property) => property.startsWith(assignablePropertiesPrefix) 27622 ).map( 27623 (property) => property.slice(assignablePropertiesPrefix.length) 27624 ); 27625 assignableProperties.forEach((property) => { 27626 if (item.hasOwnProperty(property)) { 27627 newItemObject[property] = item[property]; 27628 } 27629 }); 27630 setIsCreatingPage(true); 27631 try { 27632 const newItem = await saveEntityRecord( 27633 "postType", 27634 item.type, 27635 newItemObject, 27636 { throwOnError: true } 27637 ); 27638 createSuccessNotice( 27639 (0, import_i18n53.sprintf)( 27640 // translators: %s: Title of the created post, e.g: "Hello world". 27641 (0, import_i18n53.__)('"%s" successfully created.'), 27642 getItemTitle(newItem) 27643 ), 27644 { 27645 id: "duplicate-post-action", 27646 type: "snackbar" 27647 } 27648 ); 27649 if (onActionPerformed) { 27650 onActionPerformed([newItem]); 27651 } 27652 } catch (error2) { 27653 const typedError = error2; 27654 const errorMessage = typedError.message && typedError.code !== "unknown_error" ? typedError.message : (0, import_i18n53.__)("An error occurred while duplicating the page."); 27655 createErrorNotice(errorMessage, { 27656 type: "snackbar" 27657 }); 27658 } finally { 27659 setIsCreatingPage(false); 27660 closeModal2?.(); 27661 } 27662 } 27663 return /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("form", { onSubmit: createPage, children: /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(import_components14.__experimentalVStack, { spacing: 3, children: [ 27664 typeof item.id === "string" && /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { children: (0, import_i18n53.__)( 27665 "You are about to duplicate a bundled template. Changes will not be live until you activate the new template." 27666 ) }), 27667 /* @__PURE__ */ (0, import_jsx_runtime158.jsx)( 27668 import_components14.__experimentalInputControl, 27669 { 27670 label: (0, import_i18n53.__)("Title"), 27671 placeholder: (0, import_i18n53.__)("No title"), 27672 value: getItemTitle(item), 27673 onChange: (value) => setItem((prev) => ({ 27674 ...prev, 27675 title: value || (0, import_i18n53.__)("No title") 27676 })) 27677 } 27678 ), 27679 /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(import_components14.__experimentalHStack, { spacing: 2, justify: "end", children: [ 27680 /* @__PURE__ */ (0, import_jsx_runtime158.jsx)( 27681 import_components14.Button, 27682 { 27683 variant: "tertiary", 27684 onClick: closeModal2, 27685 __next40pxDefaultSize: true, 27686 children: (0, import_i18n53.__)("Cancel") 27687 } 27688 ), 27689 /* @__PURE__ */ (0, import_jsx_runtime158.jsx)( 27690 import_components14.Button, 27691 { 27692 variant: "primary", 27693 type: "submit", 27694 isBusy: isCreatingPage, 27695 "aria-disabled": isCreatingPage, 27696 __next40pxDefaultSize: true, 27697 children: (0, import_i18n53._x)("Duplicate", "action label") 27698 } 27699 ) 27700 ] }) 27701 ] }) }); 27702 } 27703 }; 27704 var duplicate_post_default = duplicatePost; 27705 27706 // packages/fields/build-module/actions/rename-post.mjs 27707 var import_data22 = __toESM(require_data(), 1); 27708 var import_core_data18 = __toESM(require_core_data(), 1); 27709 var import_i18n54 = __toESM(require_i18n(), 1); 27710 var import_element58 = __toESM(require_element(), 1); 27711 var import_patterns3 = __toESM(require_patterns(), 1); 27712 var import_components15 = __toESM(require_components(), 1); 27713 var import_notices5 = __toESM(require_notices(), 1); 27714 var import_jsx_runtime159 = __toESM(require_jsx_runtime(), 1); 27715 var { PATTERN_TYPES: PATTERN_TYPES3 } = unlock3(import_patterns3.privateApis); 27716 var renamePost = { 27717 id: "rename-post", 27718 label: (0, import_i18n54.__)("Rename"), 27719 modalFocusOnMount: "firstContentElement", 27720 isEligible(post2) { 27721 if (post2.status === "trash") { 27722 return false; 27723 } 27724 if (post2.type === "wp_template" && typeof post2.id === "string" && window?.__experimentalTemplateActivate) { 27725 return false; 27726 } 27727 const specialChecks = ["wp_template", "wp_template_part"]; 27728 if (!window?.__experimentalTemplateActivate) { 27729 specialChecks.push("wp_template"); 27730 } 27731 if (!specialChecks.includes(post2.type)) { 27732 return post2.permissions?.update; 27733 } 27734 if (isTemplate(post2) && !window?.__experimentalTemplateActivate) { 27735 return isTemplateRemovable(post2) && post2.is_custom && post2.permissions?.update; 27736 } 27737 if (isTemplatePart(post2)) { 27738 return post2.source === "custom" && !post2?.has_theme_file && post2.permissions?.update; 27739 } 27740 return post2.type === PATTERN_TYPES3.user && post2.permissions?.update; 27741 }, 27742 RenderModal: ({ items, closeModal: closeModal2, onActionPerformed }) => { 27743 const [item] = items; 27744 const [title, setTitle] = (0, import_element58.useState)(() => getItemTitle(item, "")); 27745 const { editEntityRecord, saveEditedEntityRecord } = (0, import_data22.useDispatch)(import_core_data18.store); 27746 const { createSuccessNotice, createErrorNotice } = (0, import_data22.useDispatch)(import_notices5.store); 27747 async function onRename(event) { 27748 event.preventDefault(); 27749 try { 27750 await editEntityRecord("postType", item.type, item.id, { 27751 title 27752 }); 27753 setTitle(""); 27754 closeModal2?.(); 27755 await saveEditedEntityRecord("postType", item.type, item.id, { 27756 throwOnError: true 27757 }); 27758 createSuccessNotice((0, import_i18n54.__)("Name updated"), { 27759 type: "snackbar" 27760 }); 27761 onActionPerformed?.(items); 27762 } catch (error2) { 27763 const typedError = error2; 27764 const errorMessage = typedError.message && typedError.code !== "unknown_error" ? typedError.message : (0, import_i18n54.__)("An error occurred while updating the name"); 27765 createErrorNotice(errorMessage, { type: "snackbar" }); 27766 } 27767 } 27768 return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("form", { onSubmit: onRename, children: /* @__PURE__ */ (0, import_jsx_runtime159.jsxs)(import_components15.__experimentalVStack, { spacing: "5", children: [ 27769 /* @__PURE__ */ (0, import_jsx_runtime159.jsx)( 27770 import_components15.TextControl, 27771 { 27772 label: (0, import_i18n54.__)("Name"), 27773 value: title, 27774 onChange: setTitle, 27775 required: true 27776 } 27777 ), 27778 /* @__PURE__ */ (0, import_jsx_runtime159.jsxs)(import_components15.__experimentalHStack, { justify: "right", children: [ 27779 /* @__PURE__ */ (0, import_jsx_runtime159.jsx)( 27780 import_components15.Button, 27781 { 27782 __next40pxDefaultSize: true, 27783 variant: "tertiary", 27784 onClick: () => { 27785 closeModal2?.(); 27786 }, 27787 children: (0, import_i18n54.__)("Cancel") 27788 } 27789 ), 27790 /* @__PURE__ */ (0, import_jsx_runtime159.jsx)( 27791 import_components15.Button, 27792 { 27793 __next40pxDefaultSize: true, 27794 variant: "primary", 27795 type: "submit", 27796 children: (0, import_i18n54.__)("Save") 27797 } 27798 ) 27799 ] }) 27800 ] }) }); 27801 } 27802 }; 27803 var rename_post_default = renamePost; 27804 27805 // packages/fields/build-module/actions/reset-post.mjs 27806 var import_data23 = __toESM(require_data(), 1); 27807 var import_core_data19 = __toESM(require_core_data(), 1); 27808 var import_i18n55 = __toESM(require_i18n(), 1); 27809 var import_notices6 = __toESM(require_notices(), 1); 27810 var import_element59 = __toESM(require_element(), 1); 27811 var import_blocks4 = __toESM(require_blocks(), 1); 27812 var import_components16 = __toESM(require_components(), 1); 27813 var import_url7 = __toESM(require_url(), 1); 27814 var import_api_fetch = __toESM(require_api_fetch(), 1); 27815 var import_jsx_runtime160 = __toESM(require_jsx_runtime(), 1); 27816 var isTemplateRevertable2 = (templateOrTemplatePart) => { 27817 if (!templateOrTemplatePart) { 27818 return false; 27819 } 27820 return templateOrTemplatePart.source === "custom" && (Boolean(templateOrTemplatePart?.plugin) || templateOrTemplatePart?.has_theme_file); 27821 }; 27822 var revertTemplate = async (template2, { allowUndo = true } = {}) => { 27823 const noticeId = "edit-site-template-reverted"; 27824 (0, import_data23.dispatch)(import_notices6.store).removeNotice(noticeId); 27825 if (!isTemplateRevertable2(template2)) { 27826 (0, import_data23.dispatch)(import_notices6.store).createErrorNotice( 27827 (0, import_i18n55.__)("This template is not revertable."), 27828 { 27829 type: "snackbar" 27830 } 27831 ); 27832 return; 27833 } 27834 try { 27835 const templateEntityConfig = (0, import_data23.select)(import_core_data19.store).getEntityConfig( 27836 "postType", 27837 template2.type 27838 ); 27839 if (!templateEntityConfig) { 27840 (0, import_data23.dispatch)(import_notices6.store).createErrorNotice( 27841 (0, import_i18n55.__)( 27842 "The editor has encountered an unexpected error. Please reload." 27843 ), 27844 { type: "snackbar" } 27845 ); 27846 return; 27847 } 27848 const fileTemplatePath = (0, import_url7.addQueryArgs)( 27849 `$templateEntityConfig.baseURL}/$template2.id}`, 27850 { context: "edit", source: template2.origin } 27851 ); 27852 const fileTemplate = await (0, import_api_fetch.default)({ 27853 path: fileTemplatePath 27854 }); 27855 if (!fileTemplate) { 27856 (0, import_data23.dispatch)(import_notices6.store).createErrorNotice( 27857 (0, import_i18n55.__)( 27858 "The editor has encountered an unexpected error. Please reload." 27859 ), 27860 { type: "snackbar" } 27861 ); 27862 return; 27863 } 27864 const serializeBlocks = ({ blocks: blocksForSerialization = [] }) => (0, import_blocks4.__unstableSerializeAndClean)(blocksForSerialization); 27865 const edited = (0, import_data23.select)(import_core_data19.store).getEditedEntityRecord( 27866 "postType", 27867 template2.type, 27868 template2.id 27869 ); 27870 (0, import_data23.dispatch)(import_core_data19.store).editEntityRecord( 27871 "postType", 27872 template2.type, 27873 template2.id, 27874 { 27875 content: serializeBlocks, 27876 // Required to make the `undo` behave correctly. 27877 blocks: edited.blocks, 27878 // Required to revert the blocks in the editor. 27879 source: "custom" 27880 // required to avoid turning the editor into a dirty state 27881 }, 27882 { 27883 undoIgnore: true 27884 // Required to merge this edit with the last undo level. 27885 } 27886 ); 27887 const blocks = (0, import_blocks4.parse)(fileTemplate?.content?.raw); 27888 (0, import_data23.dispatch)(import_core_data19.store).editEntityRecord( 27889 "postType", 27890 template2.type, 27891 fileTemplate.id, 27892 { 27893 content: serializeBlocks, 27894 blocks, 27895 source: "theme" 27896 } 27897 ); 27898 if (allowUndo) { 27899 const undoRevert = () => { 27900 (0, import_data23.dispatch)(import_core_data19.store).editEntityRecord( 27901 "postType", 27902 template2.type, 27903 edited.id, 27904 { 27905 content: serializeBlocks, 27906 blocks: edited.blocks, 27907 source: "custom" 27908 } 27909 ); 27910 }; 27911 (0, import_data23.dispatch)(import_notices6.store).createSuccessNotice( 27912 (0, import_i18n55.__)("Template reset."), 27913 { 27914 type: "snackbar", 27915 id: noticeId, 27916 actions: [ 27917 { 27918 label: (0, import_i18n55.__)("Undo"), 27919 onClick: undoRevert 27920 } 27921 ] 27922 } 27923 ); 27924 } 27925 } catch (error2) { 27926 const errorMessage = error2.message && error2.code !== "unknown_error" ? error2.message : (0, import_i18n55.__)("Template revert failed. Please reload."); 27927 (0, import_data23.dispatch)(import_notices6.store).createErrorNotice(errorMessage, { 27928 type: "snackbar" 27929 }); 27930 } 27931 }; 27932 var resetPostAction = { 27933 id: "reset-post", 27934 label: (0, import_i18n55.__)("Reset"), 27935 isEligible: (item) => { 27936 if (window?.__experimentalTemplateActivate) { 27937 return item.type === "wp_template_part" && item?.source === "custom" && item?.has_theme_file; 27938 } 27939 return isTemplateOrTemplatePart(item) && item?.source === "custom" && (Boolean(item.type === "wp_template" && item?.plugin) || item?.has_theme_file); 27940 }, 27941 icon: backup_default, 27942 supportsBulk: true, 27943 hideModalHeader: true, 27944 modalFocusOnMount: "firstContentElement", 27945 RenderModal: ({ items, closeModal: closeModal2, onActionPerformed }) => { 27946 const [isBusy, setIsBusy] = (0, import_element59.useState)(false); 27947 const { saveEditedEntityRecord } = (0, import_data23.useDispatch)(import_core_data19.store); 27948 const { createSuccessNotice, createErrorNotice } = (0, import_data23.useDispatch)(import_notices6.store); 27949 const onConfirm = async () => { 27950 try { 27951 for (const template2 of items) { 27952 await revertTemplate(template2, { 27953 allowUndo: false 27954 }); 27955 await saveEditedEntityRecord( 27956 "postType", 27957 template2.type, 27958 template2.id 27959 ); 27960 } 27961 createSuccessNotice( 27962 items.length > 1 ? (0, import_i18n55.sprintf)( 27963 /* translators: %d: The number of items. */ 27964 (0, import_i18n55.__)("%d items reset."), 27965 items.length 27966 ) : (0, import_i18n55.sprintf)( 27967 /* translators: %s: The template/part's name. */ 27968 (0, import_i18n55.__)('"%s" reset.'), 27969 getItemTitle(items[0]) 27970 ), 27971 { 27972 type: "snackbar", 27973 id: "revert-template-action" 27974 } 27975 ); 27976 } catch (error2) { 27977 let fallbackErrorMessage; 27978 if (items[0].type === "wp_template") { 27979 fallbackErrorMessage = items.length === 1 ? (0, import_i18n55.__)( 27980 "An error occurred while reverting the template." 27981 ) : (0, import_i18n55.__)( 27982 "An error occurred while reverting the templates." 27983 ); 27984 } else { 27985 fallbackErrorMessage = items.length === 1 ? (0, import_i18n55.__)( 27986 "An error occurred while reverting the template part." 27987 ) : (0, import_i18n55.__)( 27988 "An error occurred while reverting the template parts." 27989 ); 27990 } 27991 const typedError = error2; 27992 const errorMessage = typedError.message && typedError.code !== "unknown_error" ? typedError.message : fallbackErrorMessage; 27993 createErrorNotice(errorMessage, { type: "snackbar" }); 27994 } 27995 }; 27996 return /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)(import_components16.__experimentalVStack, { spacing: "5", children: [ 27997 /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(import_components16.__experimentalText, { children: (0, import_i18n55.__)("Reset to default and clear all customizations?") }), 27998 /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)(import_components16.__experimentalHStack, { justify: "right", children: [ 27999 /* @__PURE__ */ (0, import_jsx_runtime160.jsx)( 28000 import_components16.Button, 28001 { 28002 __next40pxDefaultSize: true, 28003 variant: "tertiary", 28004 onClick: closeModal2, 28005 disabled: isBusy, 28006 accessibleWhenDisabled: true, 28007 children: (0, import_i18n55.__)("Cancel") 28008 } 28009 ), 28010 /* @__PURE__ */ (0, import_jsx_runtime160.jsx)( 28011 import_components16.Button, 28012 { 28013 __next40pxDefaultSize: true, 28014 variant: "primary", 28015 onClick: async () => { 28016 setIsBusy(true); 28017 await onConfirm(); 28018 onActionPerformed?.(items); 28019 setIsBusy(false); 28020 closeModal2?.(); 28021 }, 28022 isBusy, 28023 disabled: isBusy, 28024 accessibleWhenDisabled: true, 28025 children: (0, import_i18n55.__)("Reset") 28026 } 28027 ) 28028 ] }) 28029 ] }); 28030 } 28031 }; 28032 var reset_post_default = resetPostAction; 28033 28034 // packages/fields/build-module/actions/duplicate-pattern.mjs 28035 var import_i18n56 = __toESM(require_i18n(), 1); 28036 var import_patterns4 = __toESM(require_patterns(), 1); 28037 var import_jsx_runtime161 = __toESM(require_jsx_runtime(), 1); 28038 var { CreatePatternModalContents, useDuplicatePatternProps } = unlock3(import_patterns4.privateApis); 28039 var duplicatePattern = { 28040 id: "duplicate-pattern", 28041 label: (0, import_i18n56._x)("Duplicate", "action label"), 28042 isEligible: (item) => item.type !== "wp_template_part", 28043 modalHeader: (0, import_i18n56._x)("Duplicate pattern", "action label"), 28044 modalFocusOnMount: "firstContentElement", 28045 RenderModal: ({ items, closeModal: closeModal2 }) => { 28046 const [item] = items; 28047 const duplicatedProps = useDuplicatePatternProps({ 28048 pattern: item, 28049 onSuccess: () => closeModal2?.() 28050 }); 28051 return /* @__PURE__ */ (0, import_jsx_runtime161.jsx)( 28052 CreatePatternModalContents, 28053 { 28054 onClose: closeModal2, 28055 confirmLabel: (0, import_i18n56._x)("Duplicate", "action label"), 28056 ...duplicatedProps 28057 } 28058 ); 28059 } 28060 }; 28061 var duplicate_pattern_default = duplicatePattern; 28062 28063 // node_modules/tslib/tslib.es6.mjs 28064 var __assign = function() { 28065 __assign = Object.assign || function __assign2(t4) { 28066 for (var s3, i3 = 1, n3 = arguments.length; i3 < n3; i3++) { 28067 s3 = arguments[i3]; 28068 for (var p4 in s3) if (Object.prototype.hasOwnProperty.call(s3, p4)) t4[p4] = s3[p4]; 28069 } 28070 return t4; 28071 }; 28072 return __assign.apply(this, arguments); 28073 }; 28074 28075 // node_modules/lower-case/dist.es2015/index.js 28076 function lowerCase(str3) { 28077 return str3.toLowerCase(); 28078 } 28079 28080 // node_modules/no-case/dist.es2015/index.js 28081 var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; 28082 var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; 28083 function noCase(input, options) { 28084 if (options === void 0) { 28085 options = {}; 28086 } 28087 var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d; 28088 var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); 28089 var start2 = 0; 28090 var end = result.length; 28091 while (result.charAt(start2) === "\0") 28092 start2++; 28093 while (result.charAt(end - 1) === "\0") 28094 end--; 28095 return result.slice(start2, end).split("\0").map(transform).join(delimiter); 28096 } 28097 function replace(input, re, value) { 28098 if (re instanceof RegExp) 28099 return input.replace(re, value); 28100 return re.reduce(function(input2, re2) { 28101 return input2.replace(re2, value); 28102 }, input); 28103 } 28104 28105 // node_modules/upper-case-first/dist.es2015/index.js 28106 function upperCaseFirst(input) { 28107 return input.charAt(0).toUpperCase() + input.substr(1); 28108 } 28109 28110 // node_modules/capital-case/dist.es2015/index.js 28111 function capitalCaseTransform(input) { 28112 return upperCaseFirst(input.toLowerCase()); 28113 } 28114 function capitalCase(input, options) { 28115 if (options === void 0) { 28116 options = {}; 28117 } 28118 return noCase(input, __assign({ delimiter: " ", transform: capitalCaseTransform }, options)); 28119 } 28120 28121 // node_modules/dot-case/dist.es2015/index.js 28122 function dotCase(input, options) { 28123 if (options === void 0) { 28124 options = {}; 28125 } 28126 return noCase(input, __assign({ delimiter: "." }, options)); 28127 } 28128 28129 // node_modules/param-case/dist.es2015/index.js 28130 function paramCase(input, options) { 28131 if (options === void 0) { 28132 options = {}; 28133 } 28134 return dotCase(input, __assign({ delimiter: "-" }, options)); 28135 } 28136 28137 // node_modules/client-zip/index.js 28138 "stream" in Blob.prototype || Object.defineProperty(Blob.prototype, "stream", { value() { 28139 return new Response(this).body; 28140 } }), "setBigUint64" in DataView.prototype || Object.defineProperty(DataView.prototype, "setBigUint64", { value(e3, n3, t4) { 28141 const i3 = Number(0xffffffffn & n3), r4 = Number(n3 >> 32n); 28142 this.setUint32(e3 + (t4 ? 0 : 4), i3, t4), this.setUint32(e3 + (t4 ? 4 : 0), r4, t4); 28143 } }); 28144 var e2 = (e3) => new DataView(new ArrayBuffer(e3)); 28145 var n2 = (e3) => new Uint8Array(e3.buffer || e3); 28146 var t2 = (e3) => new TextEncoder().encode(String(e3)); 28147 var i2 = (e3) => Math.min(4294967295, Number(e3)); 28148 var r3 = (e3) => Math.min(65535, Number(e3)); 28149 function f2(e3, i3) { 28150 if (void 0 === i3 || i3 instanceof Date || (i3 = new Date(i3)), e3 instanceof File) return { isFile: 1, t: i3 || new Date(e3.lastModified), i: e3.stream() }; 28151 if (e3 instanceof Response) return { isFile: 1, t: i3 || new Date(e3.headers.get("Last-Modified") || Date.now()), i: e3.body }; 28152 if (void 0 === i3) i3 = /* @__PURE__ */ new Date(); 28153 else if (isNaN(i3)) throw new Error("Invalid modification date."); 28154 if (void 0 === e3) return { isFile: 0, t: i3 }; 28155 if ("string" == typeof e3) return { isFile: 1, t: i3, i: t2(e3) }; 28156 if (e3 instanceof Blob) return { isFile: 1, t: i3, i: e3.stream() }; 28157 if (e3 instanceof Uint8Array || e3 instanceof ReadableStream) return { isFile: 1, t: i3, i: e3 }; 28158 if (e3 instanceof ArrayBuffer || ArrayBuffer.isView(e3)) return { isFile: 1, t: i3, i: n2(e3) }; 28159 if (Symbol.asyncIterator in e3) return { isFile: 1, t: i3, i: o2(e3[Symbol.asyncIterator]()) }; 28160 throw new TypeError("Unsupported input format."); 28161 } 28162 function o2(e3, n3 = e3) { 28163 return new ReadableStream({ async pull(n4) { 28164 let t4 = 0; 28165 for (; n4.desiredSize > t4; ) { 28166 const i3 = await e3.next(); 28167 if (!i3.value) { 28168 n4.close(); 28169 break; 28170 } 28171 { 28172 const e4 = a2(i3.value); 28173 n4.enqueue(e4), t4 += e4.byteLength; 28174 } 28175 } 28176 }, cancel(e4) { 28177 n3.throw?.(e4); 28178 } }); 28179 } 28180 function a2(e3) { 28181 return "string" == typeof e3 ? t2(e3) : e3 instanceof Uint8Array ? e3 : n2(e3); 28182 } 28183 function s2(e3, i3, r4) { 28184 let [f3, o4] = (function(e4) { 28185 return e4 ? e4 instanceof Uint8Array ? [e4, 1] : ArrayBuffer.isView(e4) || e4 instanceof ArrayBuffer ? [n2(e4), 1] : [t2(e4), 0] : [void 0, 0]; 28186 })(i3); 28187 if (e3 instanceof File) return { o: d2(f3 || t2(e3.name)), u: BigInt(e3.size), l: o4 }; 28188 if (e3 instanceof Response) { 28189 const n3 = e3.headers.get("content-disposition"), i4 = n3 && n3.match(/;\s*filename\*?=["']?(.*?)["']?$/i), a3 = i4 && i4[1] || e3.url && new URL(e3.url).pathname.split("/").findLast(Boolean), s3 = a3 && decodeURIComponent(a3), u3 = r4 || +e3.headers.get("content-length"); 28190 return { o: d2(f3 || t2(s3)), u: BigInt(u3), l: o4 }; 28191 } 28192 return f3 = d2(f3, void 0 !== e3 || void 0 !== r4), "string" == typeof e3 ? { o: f3, u: BigInt(t2(e3).length), l: o4 } : e3 instanceof Blob ? { o: f3, u: BigInt(e3.size), l: o4 } : e3 instanceof ArrayBuffer || ArrayBuffer.isView(e3) ? { o: f3, u: BigInt(e3.byteLength), l: o4 } : { o: f3, u: u2(e3, r4), l: o4 }; 28193 } 28194 function u2(e3, n3) { 28195 return n3 > -1 ? BigInt(n3) : e3 ? void 0 : 0n; 28196 } 28197 function d2(e3, n3 = 1) { 28198 if (!e3 || e3.every(((c6) => 47 === c6))) throw new Error("The file must have a name."); 28199 if (n3) for (; 47 === e3[e3.length - 1]; ) e3 = e3.subarray(0, -1); 28200 else 47 !== e3[e3.length - 1] && (e3 = new Uint8Array([...e3, 47])); 28201 return e3; 28202 } 28203 var l2 = new Uint32Array(256); 28204 for (let e3 = 0; e3 < 256; ++e3) { 28205 let n3 = e3; 28206 for (let e4 = 0; e4 < 8; ++e4) n3 = n3 >>> 1 ^ (1 & n3 && 3988292384); 28207 l2[e3] = n3; 28208 } 28209 function y2(e3, n3 = 0) { 28210 n3 ^= -1; 28211 for (var t4 = 0, i3 = e3.length; t4 < i3; t4++) n3 = n3 >>> 8 ^ l2[255 & n3 ^ e3[t4]]; 28212 return (-1 ^ n3) >>> 0; 28213 } 28214 function w2(e3, n3, t4 = 0) { 28215 const i3 = e3.getSeconds() >> 1 | e3.getMinutes() << 5 | e3.getHours() << 11, r4 = e3.getDate() | e3.getMonth() + 1 << 5 | e3.getFullYear() - 1980 << 9; 28216 n3.setUint16(t4, i3, 1), n3.setUint16(t4 + 2, r4, 1); 28217 } 28218 function B({ o: e3, l: n3 }, t4) { 28219 return 8 * (!n3 || (t4 ?? (function(e4) { 28220 try { 28221 b2.decode(e4); 28222 } catch { 28223 return 0; 28224 } 28225 return 1; 28226 })(e3))); 28227 } 28228 var b2 = new TextDecoder("utf8", { fatal: 1 }); 28229 function p3(t4, i3 = 0) { 28230 const r4 = e2(30); 28231 return r4.setUint32(0, 1347093252), r4.setUint32(4, 754976768 | i3), w2(t4.t, r4, 10), r4.setUint16(26, t4.o.length, 1), n2(r4); 28232 } 28233 async function* g2(e3) { 28234 let { i: n3 } = e3; 28235 if ("then" in n3 && (n3 = await n3), n3 instanceof Uint8Array) yield n3, e3.m = y2(n3, 0), e3.u = BigInt(n3.length); 28236 else { 28237 e3.u = 0n; 28238 const t4 = n3.getReader(); 28239 for (; ; ) { 28240 const { value: n4, done: i3 } = await t4.read(); 28241 if (i3) break; 28242 e3.m = y2(n4, e3.m), e3.u += BigInt(n4.length), yield n4; 28243 } 28244 } 28245 } 28246 function I(t4, r4) { 28247 const f3 = e2(16 + (r4 ? 8 : 0)); 28248 return f3.setUint32(0, 1347094280), f3.setUint32(4, t4.isFile ? t4.m : 0, 1), r4 ? (f3.setBigUint64(8, t4.u, 1), f3.setBigUint64(16, t4.u, 1)) : (f3.setUint32(8, i2(t4.u), 1), f3.setUint32(12, i2(t4.u), 1)), n2(f3); 28249 } 28250 function v2(t4, r4, f3 = 0, o4 = 0) { 28251 const a3 = e2(46); 28252 return a3.setUint32(0, 1347092738), a3.setUint32(4, 755182848), a3.setUint16(8, 2048 | f3), w2(t4.t, a3, 12), a3.setUint32(16, t4.isFile ? t4.m : 0, 1), a3.setUint32(20, i2(t4.u), 1), a3.setUint32(24, i2(t4.u), 1), a3.setUint16(28, t4.o.length, 1), a3.setUint16(30, o4, 1), a3.setUint16(40, t4.isFile ? 33204 : 16893, 1), a3.setUint32(42, i2(r4), 1), n2(a3); 28253 } 28254 function h2(t4, i3, r4) { 28255 const f3 = e2(r4); 28256 return f3.setUint16(0, 1, 1), f3.setUint16(2, r4 - 4, 1), 16 & r4 && (f3.setBigUint64(4, t4.u, 1), f3.setBigUint64(12, t4.u, 1)), f3.setBigUint64(r4 - 8, i3, 1), n2(f3); 28257 } 28258 function D(e3) { 28259 return e3 instanceof File || e3 instanceof Response ? [[e3], [e3]] : [[e3.input, e3.name, e3.size], [e3.input, e3.lastModified]]; 28260 } 28261 var S2 = (e3) => (function(e4) { 28262 let n3 = BigInt(22), t4 = 0n, i3 = 0; 28263 for (const r4 of e4) { 28264 if (!r4.o) throw new Error("Every file must have a non-empty name."); 28265 if (void 0 === r4.u) throw new Error(`Missing size for file "$new TextDecoder().decode(r4.o)}".`); 28266 const e5 = r4.u >= 0xffffffffn, f3 = t4 >= 0xffffffffn; 28267 t4 += BigInt(46 + r4.o.length + (e5 && 8)) + r4.u, n3 += BigInt(r4.o.length + 46 + (12 * f3 | 28 * e5)), i3 || (i3 = e5); 28268 } 28269 return (i3 || t4 >= 0xffffffffn) && (n3 += BigInt(76)), n3 + t4; 28270 })((function* (e4) { 28271 for (const n3 of e4) yield s2(...D(n3)[0]); 28272 })(e3)); 28273 function A(e3, n3 = {}) { 28274 const t4 = { "Content-Type": "application/zip", "Content-Disposition": "attachment" }; 28275 return ("bigint" == typeof n3.length || Number.isInteger(n3.length)) && n3.length > 0 && (t4["Content-Length"] = String(n3.length)), n3.metadata && (t4["Content-Length"] = String(S2(n3.metadata))), new Response(N2(e3, n3), { headers: t4 }); 28276 } 28277 function N2(t4, a3 = {}) { 28278 const u3 = (function(e3) { 28279 const n3 = e3[Symbol.iterator in e3 ? Symbol.iterator : Symbol.asyncIterator](); 28280 return { async next() { 28281 const e4 = await n3.next(); 28282 if (e4.done) return e4; 28283 const [t5, i3] = D(e4.value); 28284 return { done: 0, value: Object.assign(f2(...i3), s2(...t5)) }; 28285 }, throw: n3.throw?.bind(n3), [Symbol.asyncIterator]() { 28286 return this; 28287 } }; 28288 })(t4); 28289 return o2((async function* (t5, f3) { 28290 const o4 = []; 28291 let a4 = 0n, s3 = 0n, u4 = 0; 28292 for await (const e3 of t5) { 28293 const n3 = B(e3, f3.buffersAreUTF8); 28294 yield p3(e3, n3), yield new Uint8Array(e3.o), e3.isFile && (yield* g2(e3)); 28295 const t6 = e3.u >= 0xffffffffn, i3 = 12 * (a4 >= 0xffffffffn) | 28 * t6; 28296 yield I(e3, t6), o4.push(v2(e3, a4, n3, i3)), o4.push(e3.o), i3 && o4.push(h2(e3, a4, i3)), t6 && (a4 += 8n), s3++, a4 += BigInt(46 + e3.o.length) + e3.u, u4 || (u4 = t6); 28297 } 28298 let d3 = 0n; 28299 for (const e3 of o4) yield e3, d3 += BigInt(e3.length); 28300 if (u4 || a4 >= 0xffffffffn) { 28301 const t6 = e2(76); 28302 t6.setUint32(0, 1347094022), t6.setBigUint64(4, BigInt(44), 1), t6.setUint32(12, 755182848), t6.setBigUint64(24, s3, 1), t6.setBigUint64(32, s3, 1), t6.setBigUint64(40, d3, 1), t6.setBigUint64(48, a4, 1), t6.setUint32(56, 1347094023), t6.setBigUint64(64, a4 + d3, 1), t6.setUint32(72, 1, 1), yield n2(t6); 28303 } 28304 const l3 = e2(22); 28305 l3.setUint32(0, 1347093766), l3.setUint16(8, r3(s3), 1), l3.setUint16(10, r3(s3), 1), l3.setUint32(12, i2(d3), 1), l3.setUint32(16, i2(a4), 1), yield n2(l3); 28306 })(u3, a3), u3); 28307 } 28308 28309 // packages/fields/build-module/actions/export-pattern.mjs 28310 var import_blob2 = __toESM(require_blob(), 1); 28311 var import_i18n57 = __toESM(require_i18n(), 1); 28312 function getJsonFromItem(item) { 28313 return JSON.stringify( 28314 { 28315 __file: item.type, 28316 title: getItemTitle(item), 28317 content: typeof item.content === "string" ? item.content : item.content?.raw, 28318 syncStatus: item.wp_pattern_sync_status 28319 }, 28320 null, 28321 2 28322 ); 28323 } 28324 var exportPattern = { 28325 id: "export-pattern", 28326 label: (0, import_i18n57.__)("Export as JSON"), 28327 icon: download_default, 28328 supportsBulk: true, 28329 isEligible: (item) => item.type === "wp_block", 28330 callback: async (items) => { 28331 if (items.length === 1) { 28332 return (0, import_blob2.downloadBlob)( 28333 `$paramCase( 28334 getItemTitle(items[0]) || items[0].slug 28335 )}.json`, 28336 getJsonFromItem(items[0]), 28337 "application/json" 28338 ); 28339 } 28340 const nameCount = {}; 28341 const filesToZip = items.map((item) => { 28342 const name2 = paramCase(getItemTitle(item) || item.slug); 28343 nameCount[name2] = (nameCount[name2] || 0) + 1; 28344 return { 28345 name: `$name2 + (nameCount[name2] > 1 ? "-" + (nameCount[name2] - 1) : "")}.json`, 28346 lastModified: /* @__PURE__ */ new Date(), 28347 input: getJsonFromItem(item) 28348 }; 28349 }); 28350 return (0, import_blob2.downloadBlob)( 28351 (0, import_i18n57.__)("patterns-export") + ".zip", 28352 await A(filesToZip).blob(), 28353 "application/zip" 28354 ); 28355 } 28356 }; 28357 var export_pattern_default = exportPattern; 28358 28359 // packages/fields/build-module/actions/view-post-revisions.mjs 28360 var import_url8 = __toESM(require_url(), 1); 28361 var import_i18n58 = __toESM(require_i18n(), 1); 28362 var viewPostRevisions = { 28363 id: "view-post-revisions", 28364 context: "list", 28365 label(items) { 28366 const revisionsCount = items[0]._links?.["version-history"]?.[0]?.count ?? 0; 28367 return (0, import_i18n58.sprintf)( 28368 /* translators: %d: number of revisions. */ 28369 (0, import_i18n58.__)("View revisions (%d)"), 28370 revisionsCount 28371 ); 28372 }, 28373 isEligible(post2) { 28374 if (post2.status === "trash") { 28375 return false; 28376 } 28377 const lastRevisionId = post2?._links?.["predecessor-version"]?.[0]?.id ?? null; 28378 const revisionsCount = post2?._links?.["version-history"]?.[0]?.count ?? 0; 28379 return !!lastRevisionId && revisionsCount > 1; 28380 }, 28381 callback(posts, { onActionPerformed }) { 28382 const post2 = posts[0]; 28383 const href = (0, import_url8.addQueryArgs)("revision.php", { 28384 revision: post2?._links?.["predecessor-version"]?.[0]?.id 28385 }); 28386 document.location.href = href; 28387 if (onActionPerformed) { 28388 onActionPerformed(posts); 28389 } 28390 } 28391 }; 28392 var view_post_revisions_default = viewPostRevisions; 28393 28394 // packages/fields/build-module/actions/permanently-delete-post.mjs 28395 var import_core_data20 = __toESM(require_core_data(), 1); 28396 var import_i18n59 = __toESM(require_i18n(), 1); 28397 var import_notices7 = __toESM(require_notices(), 1); 28398 var import_element60 = __toESM(require_element(), 1); 28399 var import_data24 = __toESM(require_data(), 1); 28400 var import_components17 = __toESM(require_components(), 1); 28401 var import_html_entities7 = __toESM(require_html_entities(), 1); 28402 var import_jsx_runtime162 = __toESM(require_jsx_runtime(), 1); 28403 var permanentlyDeletePost = { 28404 id: "permanently-delete", 28405 label: (0, import_i18n59.__)("Permanently delete"), 28406 supportsBulk: true, 28407 icon: trash_default, 28408 isEligible(item) { 28409 if (isTemplateOrTemplatePart(item) || item.type === "wp_block") { 28410 return false; 28411 } 28412 const { status, permissions } = item; 28413 return status === "trash" && permissions?.delete; 28414 }, 28415 hideModalHeader: true, 28416 modalFocusOnMount: "firstContentElement", 28417 RenderModal: ({ items, closeModal: closeModal2, onActionPerformed }) => { 28418 const [isBusy, setIsBusy] = (0, import_element60.useState)(false); 28419 const { createSuccessNotice, createErrorNotice } = (0, import_data24.useDispatch)(import_notices7.store); 28420 const { deleteEntityRecord } = (0, import_data24.useDispatch)(import_core_data20.store); 28421 return /* @__PURE__ */ (0, import_jsx_runtime162.jsxs)(import_components17.__experimentalVStack, { spacing: "5", children: [ 28422 /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(import_components17.__experimentalText, { children: items.length > 1 ? (0, import_i18n59.sprintf)( 28423 // translators: %d: number of items to delete. 28424 (0, import_i18n59._n)( 28425 "Are you sure you want to permanently delete %d item?", 28426 "Are you sure you want to permanently delete %d items?", 28427 items.length 28428 ), 28429 items.length 28430 ) : (0, import_i18n59.sprintf)( 28431 // translators: %s: The post's title 28432 (0, import_i18n59.__)( 28433 'Are you sure you want to permanently delete "%s"?' 28434 ), 28435 (0, import_html_entities7.decodeEntities)(getItemTitle(items[0])) 28436 ) }), 28437 /* @__PURE__ */ (0, import_jsx_runtime162.jsxs)(import_components17.__experimentalHStack, { justify: "right", children: [ 28438 /* @__PURE__ */ (0, import_jsx_runtime162.jsx)( 28439 import_components17.Button, 28440 { 28441 variant: "tertiary", 28442 onClick: closeModal2, 28443 disabled: isBusy, 28444 accessibleWhenDisabled: true, 28445 __next40pxDefaultSize: true, 28446 children: (0, import_i18n59.__)("Cancel") 28447 } 28448 ), 28449 /* @__PURE__ */ (0, import_jsx_runtime162.jsx)( 28450 import_components17.Button, 28451 { 28452 variant: "primary", 28453 onClick: async () => { 28454 setIsBusy(true); 28455 const promiseResult = await Promise.allSettled( 28456 items.map( 28457 (post2) => deleteEntityRecord( 28458 "postType", 28459 post2.type, 28460 post2.id, 28461 { force: true }, 28462 { throwOnError: true } 28463 ) 28464 ) 28465 ); 28466 if (promiseResult.every( 28467 ({ status }) => status === "fulfilled" 28468 )) { 28469 let successMessage; 28470 if (promiseResult.length === 1) { 28471 successMessage = (0, import_i18n59.sprintf)( 28472 /* translators: %s: The posts's title. */ 28473 (0, import_i18n59.__)('"%s" permanently deleted.'), 28474 getItemTitle(items[0]) 28475 ); 28476 } else { 28477 successMessage = (0, import_i18n59.__)( 28478 "The items were permanently deleted." 28479 ); 28480 } 28481 createSuccessNotice(successMessage, { 28482 type: "snackbar", 28483 id: "permanently-delete-post-action" 28484 }); 28485 onActionPerformed?.(items); 28486 } else { 28487 let errorMessage; 28488 if (promiseResult.length === 1) { 28489 const typedError = promiseResult[0]; 28490 if (typedError.reason?.message) { 28491 errorMessage = typedError.reason.message; 28492 } else { 28493 errorMessage = (0, import_i18n59.__)( 28494 "An error occurred while permanently deleting the item." 28495 ); 28496 } 28497 } else { 28498 const errorMessages = /* @__PURE__ */ new Set(); 28499 const failedPromises = promiseResult.filter( 28500 ({ status }) => status === "rejected" 28501 ); 28502 for (const failedPromise of failedPromises) { 28503 const typedError = failedPromise; 28504 if (typedError.reason?.message) { 28505 errorMessages.add( 28506 typedError.reason.message 28507 ); 28508 } 28509 } 28510 if (errorMessages.size === 0) { 28511 errorMessage = (0, import_i18n59.__)( 28512 "An error occurred while permanently deleting the items." 28513 ); 28514 } else if (errorMessages.size === 1) { 28515 errorMessage = (0, import_i18n59.sprintf)( 28516 /* translators: %s: an error message */ 28517 (0, import_i18n59.__)( 28518 "An error occurred while permanently deleting the items: %s" 28519 ), 28520 [...errorMessages][0] 28521 ); 28522 } else { 28523 errorMessage = (0, import_i18n59.sprintf)( 28524 /* translators: %s: a list of comma separated error messages */ 28525 (0, import_i18n59.__)( 28526 "Some errors occurred while permanently deleting the items: %s" 28527 ), 28528 [...errorMessages].join(",") 28529 ); 28530 } 28531 } 28532 createErrorNotice(errorMessage, { 28533 type: "snackbar" 28534 }); 28535 } 28536 setIsBusy(false); 28537 closeModal2?.(); 28538 }, 28539 isBusy, 28540 disabled: isBusy, 28541 accessibleWhenDisabled: true, 28542 __next40pxDefaultSize: true, 28543 children: (0, import_i18n59.__)("Delete permanently") 28544 } 28545 ) 28546 ] }) 28547 ] }); 28548 } 28549 }; 28550 var permanently_delete_post_default = permanentlyDeletePost; 28551 28552 // packages/fields/build-module/actions/restore-post.mjs 28553 var import_core_data21 = __toESM(require_core_data(), 1); 28554 var import_i18n60 = __toESM(require_i18n(), 1); 28555 var import_notices8 = __toESM(require_notices(), 1); 28556 var restorePost = { 28557 id: "restore", 28558 label: (0, import_i18n60.__)("Restore"), 28559 isPrimary: true, 28560 icon: backup_default, 28561 supportsBulk: true, 28562 isEligible(item) { 28563 return !isTemplateOrTemplatePart(item) && item.type !== "wp_block" && item.status === "trash" && item.permissions?.update; 28564 }, 28565 async callback(posts, { registry, onActionPerformed }) { 28566 const { createSuccessNotice, createErrorNotice } = registry.dispatch(import_notices8.store); 28567 const { editEntityRecord, saveEditedEntityRecord } = registry.dispatch(import_core_data21.store); 28568 await Promise.allSettled( 28569 posts.map((post2) => { 28570 return editEntityRecord("postType", post2.type, post2.id, { 28571 status: "draft" 28572 }); 28573 }) 28574 ); 28575 const promiseResult = await Promise.allSettled( 28576 posts.map((post2) => { 28577 return saveEditedEntityRecord("postType", post2.type, post2.id, { 28578 throwOnError: true 28579 }); 28580 }) 28581 ); 28582 if (promiseResult.every(({ status }) => status === "fulfilled")) { 28583 let successMessage; 28584 if (posts.length === 1) { 28585 successMessage = (0, import_i18n60.sprintf)( 28586 /* translators: %s: The number of posts. */ 28587 (0, import_i18n60.__)('"%s" has been restored.'), 28588 getItemTitle(posts[0]) 28589 ); 28590 } else if (posts[0].type === "page") { 28591 successMessage = (0, import_i18n60.sprintf)( 28592 /* translators: %d: The number of posts. */ 28593 (0, import_i18n60.__)("%d pages have been restored."), 28594 posts.length 28595 ); 28596 } else { 28597 successMessage = (0, import_i18n60.sprintf)( 28598 /* translators: %d: The number of posts. */ 28599 (0, import_i18n60.__)("%d posts have been restored."), 28600 posts.length 28601 ); 28602 } 28603 createSuccessNotice(successMessage, { 28604 type: "snackbar", 28605 id: "restore-post-action" 28606 }); 28607 if (onActionPerformed) { 28608 onActionPerformed(posts); 28609 } 28610 } else { 28611 let errorMessage; 28612 if (promiseResult.length === 1) { 28613 const typedError = promiseResult[0]; 28614 if (typedError.reason?.message) { 28615 errorMessage = typedError.reason.message; 28616 } else { 28617 errorMessage = (0, import_i18n60.__)( 28618 "An error occurred while restoring the post." 28619 ); 28620 } 28621 } else { 28622 const errorMessages = /* @__PURE__ */ new Set(); 28623 const failedPromises = promiseResult.filter( 28624 ({ status }) => status === "rejected" 28625 ); 28626 for (const failedPromise of failedPromises) { 28627 const typedError = failedPromise; 28628 if (typedError.reason?.message) { 28629 errorMessages.add(typedError.reason.message); 28630 } 28631 } 28632 if (errorMessages.size === 0) { 28633 errorMessage = (0, import_i18n60.__)( 28634 "An error occurred while restoring the posts." 28635 ); 28636 } else if (errorMessages.size === 1) { 28637 errorMessage = (0, import_i18n60.sprintf)( 28638 /* translators: %s: an error message */ 28639 (0, import_i18n60.__)("An error occurred while restoring the posts: %s"), 28640 [...errorMessages][0] 28641 ); 28642 } else { 28643 errorMessage = (0, import_i18n60.sprintf)( 28644 /* translators: %s: a list of comma separated error messages */ 28645 (0, import_i18n60.__)( 28646 "Some errors occurred while restoring the posts: %s" 28647 ), 28648 [...errorMessages].join(",") 28649 ); 28650 } 28651 } 28652 createErrorNotice(errorMessage, { 28653 type: "snackbar" 28654 }); 28655 } 28656 } 28657 }; 28658 var restore_post_default = restorePost; 28659 28660 // packages/fields/build-module/actions/trash-post.mjs 28661 var import_data25 = __toESM(require_data(), 1); 28662 var import_core_data22 = __toESM(require_core_data(), 1); 28663 var import_i18n61 = __toESM(require_i18n(), 1); 28664 var import_notices9 = __toESM(require_notices(), 1); 28665 var import_element61 = __toESM(require_element(), 1); 28666 var import_components18 = __toESM(require_components(), 1); 28667 var import_jsx_runtime163 = __toESM(require_jsx_runtime(), 1); 28668 var trashPost = { 28669 id: "move-to-trash", 28670 label: (0, import_i18n61._x)("Trash", "verb"), 28671 isPrimary: true, 28672 icon: trash_default, 28673 isEligible(item) { 28674 if (item.type === "wp_template_part" || item.type === "wp_block") { 28675 return false; 28676 } 28677 if (item.type === "wp_template" && typeof item.id === "string") { 28678 return false; 28679 } 28680 return !!item.status && !["auto-draft", "trash"].includes(item.status) && item.permissions?.delete; 28681 }, 28682 supportsBulk: true, 28683 hideModalHeader: true, 28684 modalFocusOnMount: "firstContentElement", 28685 RenderModal: ({ items, closeModal: closeModal2, onActionPerformed }) => { 28686 const [isBusy, setIsBusy] = (0, import_element61.useState)(false); 28687 const { createSuccessNotice, createErrorNotice } = (0, import_data25.useDispatch)(import_notices9.store); 28688 const { deleteEntityRecord } = (0, import_data25.useDispatch)(import_core_data22.store); 28689 return /* @__PURE__ */ (0, import_jsx_runtime163.jsxs)(import_components18.__experimentalVStack, { spacing: "5", children: [ 28690 /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(import_components18.__experimentalText, { children: items.length === 1 ? (0, import_i18n61.sprintf)( 28691 // translators: %s: The item's title. 28692 (0, import_i18n61.__)( 28693 'Are you sure you want to move "%s" to the trash?' 28694 ), 28695 getItemTitle(items[0]) 28696 ) : (0, import_i18n61.sprintf)( 28697 // translators: %d: The number of items (2 or more). 28698 (0, import_i18n61._n)( 28699 "Are you sure you want to move %d item to the trash ?", 28700 "Are you sure you want to move %d items to the trash ?", 28701 items.length 28702 ), 28703 items.length 28704 ) }), 28705 /* @__PURE__ */ (0, import_jsx_runtime163.jsxs)(import_components18.__experimentalHStack, { justify: "right", children: [ 28706 /* @__PURE__ */ (0, import_jsx_runtime163.jsx)( 28707 import_components18.Button, 28708 { 28709 __next40pxDefaultSize: true, 28710 variant: "tertiary", 28711 onClick: closeModal2, 28712 disabled: isBusy, 28713 accessibleWhenDisabled: true, 28714 children: (0, import_i18n61.__)("Cancel") 28715 } 28716 ), 28717 /* @__PURE__ */ (0, import_jsx_runtime163.jsx)( 28718 import_components18.Button, 28719 { 28720 __next40pxDefaultSize: true, 28721 variant: "primary", 28722 onClick: async () => { 28723 setIsBusy(true); 28724 const promiseResult = await Promise.allSettled( 28725 items.map( 28726 (item) => deleteEntityRecord( 28727 "postType", 28728 item.type, 28729 item.id.toString(), 28730 {}, 28731 { throwOnError: true } 28732 ) 28733 ) 28734 ); 28735 if (promiseResult.every( 28736 ({ status }) => status === "fulfilled" 28737 )) { 28738 let successMessage; 28739 if (promiseResult.length === 1) { 28740 successMessage = (0, import_i18n61.sprintf)( 28741 /* translators: %s: The item's title. */ 28742 (0, import_i18n61.__)('"%s" moved to the trash.'), 28743 getItemTitle(items[0]) 28744 ); 28745 } else { 28746 successMessage = (0, import_i18n61.sprintf)( 28747 /* translators: %d: The number of items. */ 28748 (0, import_i18n61._n)( 28749 "%d item moved to the trash.", 28750 "%d items moved to the trash.", 28751 items.length 28752 ), 28753 items.length 28754 ); 28755 } 28756 createSuccessNotice(successMessage, { 28757 type: "snackbar", 28758 id: "move-to-trash-action" 28759 }); 28760 } else { 28761 let errorMessage; 28762 if (promiseResult.length === 1) { 28763 const typedError = promiseResult[0]; 28764 if (typedError.reason?.message) { 28765 errorMessage = typedError.reason.message; 28766 } else { 28767 errorMessage = (0, import_i18n61.__)( 28768 "An error occurred while moving the item to the trash." 28769 ); 28770 } 28771 } else { 28772 const errorMessages = /* @__PURE__ */ new Set(); 28773 const failedPromises = promiseResult.filter( 28774 ({ status }) => status === "rejected" 28775 ); 28776 for (const failedPromise of failedPromises) { 28777 const typedError = failedPromise; 28778 if (typedError.reason?.message) { 28779 errorMessages.add( 28780 typedError.reason.message 28781 ); 28782 } 28783 } 28784 if (errorMessages.size === 0) { 28785 errorMessage = (0, import_i18n61.__)( 28786 "An error occurred while moving the items to the trash." 28787 ); 28788 } else if (errorMessages.size === 1) { 28789 errorMessage = (0, import_i18n61.sprintf)( 28790 /* translators: %s: an error message */ 28791 (0, import_i18n61.__)( 28792 "An error occurred while moving the item to the trash: %s" 28793 ), 28794 [...errorMessages][0] 28795 ); 28796 } else { 28797 errorMessage = (0, import_i18n61.sprintf)( 28798 /* translators: %s: a list of comma separated error messages */ 28799 (0, import_i18n61.__)( 28800 "Some errors occurred while moving the items to the trash: %s" 28801 ), 28802 [...errorMessages].join(",") 28803 ); 28804 } 28805 } 28806 createErrorNotice(errorMessage, { 28807 type: "snackbar" 28808 }); 28809 } 28810 if (onActionPerformed) { 28811 onActionPerformed(items); 28812 } 28813 setIsBusy(false); 28814 closeModal2?.(); 28815 }, 28816 isBusy, 28817 disabled: isBusy, 28818 accessibleWhenDisabled: true, 28819 children: (0, import_i18n61._x)("Trash", "verb") 28820 } 28821 ) 28822 ] }) 28823 ] }); 28824 } 28825 }; 28826 var trash_post_default = trashPost; 28827 28828 // packages/fields/build-module/actions/delete-post.mjs 28829 var import_i18n62 = __toESM(require_i18n(), 1); 28830 var import_element62 = __toESM(require_element(), 1); 28831 var import_components19 = __toESM(require_components(), 1); 28832 var import_patterns5 = __toESM(require_patterns(), 1); 28833 var import_html_entities8 = __toESM(require_html_entities(), 1); 28834 28835 // packages/fields/build-module/mutation/index.mjs 28836 var import_notices10 = __toESM(require_notices(), 1); 28837 var import_core_data23 = __toESM(require_core_data(), 1); 28838 var import_data26 = __toESM(require_data(), 1); 28839 function getErrorMessagesFromPromises(allSettledResults) { 28840 const errorMessages = /* @__PURE__ */ new Set(); 28841 if (allSettledResults.length === 1) { 28842 const typedError = allSettledResults[0]; 28843 if (typedError.reason?.message) { 28844 errorMessages.add(typedError.reason.message); 28845 } 28846 } else { 28847 const failedPromises = allSettledResults.filter( 28848 ({ status }) => status === "rejected" 28849 ); 28850 for (const failedPromise of failedPromises) { 28851 const typedError = failedPromise; 28852 if (typedError.reason?.message) { 28853 errorMessages.add(typedError.reason.message); 28854 } 28855 } 28856 } 28857 return errorMessages; 28858 } 28859 var deletePostWithNotices = async (posts, notice, callbacks) => { 28860 const { createSuccessNotice, createErrorNotice } = (0, import_data26.dispatch)(import_notices10.store); 28861 const { deleteEntityRecord } = (0, import_data26.dispatch)(import_core_data23.store); 28862 const allSettledResults = await Promise.allSettled( 28863 posts.map((post2) => { 28864 return deleteEntityRecord( 28865 "postType", 28866 post2.type, 28867 post2.id, 28868 { force: true }, 28869 { throwOnError: true } 28870 ); 28871 }) 28872 ); 28873 if (allSettledResults.every(({ status }) => status === "fulfilled")) { 28874 let successMessage; 28875 if (allSettledResults.length === 1) { 28876 successMessage = notice.success.messages.getMessage(posts[0]); 28877 } else { 28878 successMessage = notice.success.messages.getBatchMessage(posts); 28879 } 28880 createSuccessNotice(successMessage, { 28881 type: notice.success.type ?? "snackbar", 28882 id: notice.success.id 28883 }); 28884 callbacks.onActionPerformed?.(posts); 28885 } else { 28886 const errorMessages = getErrorMessagesFromPromises(allSettledResults); 28887 let errorMessage = ""; 28888 if (allSettledResults.length === 1) { 28889 errorMessage = notice.error.messages.getMessage(errorMessages); 28890 } else { 28891 errorMessage = notice.error.messages.getBatchMessage(errorMessages); 28892 } 28893 createErrorNotice(errorMessage, { 28894 type: notice.error.type ?? "snackbar", 28895 id: notice.error.id 28896 }); 28897 callbacks.onActionError?.(); 28898 } 28899 }; 28900 28901 // packages/fields/build-module/actions/delete-post.mjs 28902 var import_jsx_runtime164 = __toESM(require_jsx_runtime(), 1); 28903 var { PATTERN_TYPES: PATTERN_TYPES4 } = unlock3(import_patterns5.privateApis); 28904 var deletePostAction = { 28905 id: "delete-post", 28906 label: (0, import_i18n62.__)("Delete"), 28907 isPrimary: true, 28908 icon: trash_default, 28909 isEligible(post2) { 28910 if (isTemplateOrTemplatePart(post2)) { 28911 return isTemplateRemovable(post2); 28912 } 28913 return post2.type === PATTERN_TYPES4.user; 28914 }, 28915 supportsBulk: true, 28916 hideModalHeader: true, 28917 modalFocusOnMount: "firstContentElement", 28918 RenderModal: ({ items, closeModal: closeModal2, onActionPerformed }) => { 28919 const [isBusy, setIsBusy] = (0, import_element62.useState)(false); 28920 const isResetting = items.every( 28921 (item) => isTemplateOrTemplatePart(item) && item?.has_theme_file 28922 ); 28923 return /* @__PURE__ */ (0, import_jsx_runtime164.jsxs)(import_components19.__experimentalVStack, { spacing: "5", children: [ 28924 /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(import_components19.__experimentalText, { children: items.length > 1 ? (0, import_i18n62.sprintf)( 28925 // translators: %d: number of items to delete. 28926 (0, import_i18n62._n)( 28927 "Delete %d item?", 28928 "Delete %d items?", 28929 items.length 28930 ), 28931 items.length 28932 ) : (0, import_i18n62.sprintf)( 28933 // translators: %s: The template or template part's title 28934 (0, import_i18n62._x)('Delete "%s"?', "template part"), 28935 getItemTitle(items[0]) 28936 ) }), 28937 /* @__PURE__ */ (0, import_jsx_runtime164.jsxs)(import_components19.__experimentalHStack, { justify: "right", children: [ 28938 /* @__PURE__ */ (0, import_jsx_runtime164.jsx)( 28939 import_components19.Button, 28940 { 28941 variant: "tertiary", 28942 onClick: closeModal2, 28943 disabled: isBusy, 28944 accessibleWhenDisabled: true, 28945 __next40pxDefaultSize: true, 28946 children: (0, import_i18n62.__)("Cancel") 28947 } 28948 ), 28949 /* @__PURE__ */ (0, import_jsx_runtime164.jsx)( 28950 import_components19.Button, 28951 { 28952 variant: "primary", 28953 onClick: async () => { 28954 setIsBusy(true); 28955 const notice = { 28956 success: { 28957 messages: { 28958 getMessage: (item) => { 28959 return isResetting ? (0, import_i18n62.sprintf)( 28960 /* translators: %s: The template/part's name. */ 28961 (0, import_i18n62.__)('"%s" reset.'), 28962 (0, import_html_entities8.decodeEntities)( 28963 getItemTitle(item) 28964 ) 28965 ) : (0, import_i18n62.sprintf)( 28966 /* translators: %s: The template/part's name. */ 28967 (0, import_i18n62._x)( 28968 '"%s" deleted.', 28969 "template part" 28970 ), 28971 (0, import_html_entities8.decodeEntities)( 28972 getItemTitle(item) 28973 ) 28974 ); 28975 }, 28976 getBatchMessage: () => { 28977 return isResetting ? (0, import_i18n62.__)("Items reset.") : (0, import_i18n62.__)("Items deleted."); 28978 } 28979 } 28980 }, 28981 error: { 28982 messages: { 28983 getMessage: (error2) => { 28984 if (error2.size === 1) { 28985 return [...error2][0]; 28986 } 28987 return isResetting ? (0, import_i18n62.__)( 28988 "An error occurred while reverting the item." 28989 ) : (0, import_i18n62.__)( 28990 "An error occurred while deleting the item." 28991 ); 28992 }, 28993 getBatchMessage: (errors) => { 28994 if (errors.size === 0) { 28995 return isResetting ? (0, import_i18n62.__)( 28996 "An error occurred while reverting the items." 28997 ) : (0, import_i18n62.__)( 28998 "An error occurred while deleting the items." 28999 ); 29000 } 29001 if (errors.size === 1) { 29002 return isResetting ? (0, import_i18n62.sprintf)( 29003 /* translators: %s: an error message */ 29004 (0, import_i18n62.__)( 29005 "An error occurred while reverting the items: %s" 29006 ), 29007 [...errors][0] 29008 ) : (0, import_i18n62.sprintf)( 29009 /* translators: %s: an error message */ 29010 (0, import_i18n62.__)( 29011 "An error occurred while deleting the items: %s" 29012 ), 29013 [...errors][0] 29014 ); 29015 } 29016 return isResetting ? (0, import_i18n62.sprintf)( 29017 /* translators: %s: a list of comma separated error messages */ 29018 (0, import_i18n62.__)( 29019 "Some errors occurred while reverting the items: %s" 29020 ), 29021 [...errors].join( 29022 "," 29023 ) 29024 ) : (0, import_i18n62.sprintf)( 29025 /* translators: %s: a list of comma separated error messages */ 29026 (0, import_i18n62.__)( 29027 "Some errors occurred while deleting the items: %s" 29028 ), 29029 [...errors].join( 29030 "," 29031 ) 29032 ); 29033 } 29034 } 29035 } 29036 }; 29037 await deletePostWithNotices(items, notice, { 29038 onActionPerformed 29039 }); 29040 setIsBusy(false); 29041 closeModal2?.(); 29042 }, 29043 isBusy, 29044 disabled: isBusy, 29045 accessibleWhenDisabled: true, 29046 __next40pxDefaultSize: true, 29047 children: (0, import_i18n62.__)("Delete") 29048 } 29049 ) 29050 ] }) 29051 ] }); 29052 } 29053 }; 29054 var delete_post_default = deletePostAction; 29055 29056 // packages/fields/build-module/actions/duplicate-template-part.mjs 29057 var import_data29 = __toESM(require_data(), 1); 29058 var import_i18n64 = __toESM(require_i18n(), 1); 29059 var import_notices12 = __toESM(require_notices(), 1); 29060 var import_element64 = __toESM(require_element(), 1); 29061 var import_blocks6 = __toESM(require_blocks(), 1); 29062 29063 // packages/fields/build-module/components/create-template-part-modal/index.mjs 29064 var import_components20 = __toESM(require_components(), 1); 29065 var import_compose4 = __toESM(require_compose(), 1); 29066 var import_core_data25 = __toESM(require_core_data(), 1); 29067 var import_data28 = __toESM(require_data(), 1); 29068 var import_element63 = __toESM(require_element(), 1); 29069 var import_i18n63 = __toESM(require_i18n(), 1); 29070 var import_notices11 = __toESM(require_notices(), 1); 29071 var import_blocks5 = __toESM(require_blocks(), 1); 29072 29073 // packages/fields/build-module/components/create-template-part-modal/utils.mjs 29074 var import_data27 = __toESM(require_data(), 1); 29075 var import_core_data24 = __toESM(require_core_data(), 1); 29076 var useExistingTemplateParts = () => { 29077 return (0, import_data27.useSelect)( 29078 (select9) => select9(import_core_data24.store).getEntityRecords( 29079 "postType", 29080 "wp_template_part", 29081 { 29082 per_page: -1 29083 } 29084 ), 29085 [] 29086 ) ?? []; 29087 }; 29088 var getUniqueTemplatePartTitle = (title, templateParts) => { 29089 const lowercaseTitle = title.toLowerCase(); 29090 const existingTitles = templateParts.map( 29091 (templatePart) => templatePart.title.rendered.toLowerCase() 29092 ); 29093 if (!existingTitles.includes(lowercaseTitle)) { 29094 return title; 29095 } 29096 let suffix = 2; 29097 while (existingTitles.includes(`$lowercaseTitle} $suffix}`)) { 29098 suffix++; 29099 } 29100 return `$title} $suffix}`; 29101 }; 29102 var getCleanTemplatePartSlug = (title) => { 29103 return paramCase(title).replace(/[^\w-]+/g, "") || "wp-custom-part"; 29104 }; 29105 29106 // packages/fields/build-module/components/create-template-part-modal/index.mjs 29107 var import_jsx_runtime165 = __toESM(require_jsx_runtime(), 1); 29108 function getAreaRadioId(value, instanceId) { 29109 return `fields-create-template-part-modal__area-option-$value}-$instanceId}`; 29110 } 29111 function getAreaRadioDescriptionId(value, instanceId) { 29112 return `fields-create-template-part-modal__area-option-description-$value}-$instanceId}`; 29113 } 29114 function CreateTemplatePartModal({ 29115 modalTitle, 29116 ...restProps 29117 }) { 29118 const defaultModalTitle = (0, import_data28.useSelect)( 29119 (select9) => select9(import_core_data25.store).getPostType("wp_template_part")?.labels?.add_new_item, 29120 [] 29121 ); 29122 return /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 29123 import_components20.Modal, 29124 { 29125 title: modalTitle || defaultModalTitle, 29126 onRequestClose: restProps.closeModal, 29127 overlayClassName: "fields-create-template-part-modal", 29128 focusOnMount: "firstContentElement", 29129 size: "medium", 29130 children: /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(CreateTemplatePartModalContents, { ...restProps }) 29131 } 29132 ); 29133 } 29134 var getTemplatePartIcon2 = (areaOrIconName) => { 29135 if ("header" === areaOrIconName) { 29136 return header_default; 29137 } else if ("footer" === areaOrIconName) { 29138 return footer_default; 29139 } else if ("sidebar" === areaOrIconName) { 29140 return sidebar_default; 29141 } else if ("navigation-overlay" === areaOrIconName) { 29142 return navigation_overlay_default; 29143 } 29144 return symbol_filled_default; 29145 }; 29146 function CreateTemplatePartModalContents({ 29147 defaultArea = "uncategorized", 29148 blocks = [], 29149 confirmLabel = (0, import_i18n63.__)("Add"), 29150 closeModal: closeModal2, 29151 onCreate, 29152 onError, 29153 defaultTitle = "" 29154 }) { 29155 const { createErrorNotice } = (0, import_data28.useDispatch)(import_notices11.store); 29156 const { saveEntityRecord } = (0, import_data28.useDispatch)(import_core_data25.store); 29157 const existingTemplateParts = useExistingTemplateParts(); 29158 const [title, setTitle] = (0, import_element63.useState)(defaultTitle); 29159 const [area, setArea] = (0, import_element63.useState)(defaultArea); 29160 const [isSubmitting, setIsSubmitting] = (0, import_element63.useState)(false); 29161 const instanceId = (0, import_compose4.useInstanceId)(CreateTemplatePartModal); 29162 const defaultTemplatePartAreas = (0, import_data28.useSelect)( 29163 (select9) => select9(import_core_data25.store).getCurrentTheme()?.default_template_part_areas, 29164 [] 29165 ); 29166 async function createTemplatePart() { 29167 if (!title || isSubmitting) { 29168 return; 29169 } 29170 try { 29171 setIsSubmitting(true); 29172 const uniqueTitle = getUniqueTemplatePartTitle( 29173 title, 29174 existingTemplateParts 29175 ); 29176 const cleanSlug = getCleanTemplatePartSlug(uniqueTitle); 29177 const templatePart = await saveEntityRecord( 29178 "postType", 29179 "wp_template_part", 29180 { 29181 slug: cleanSlug, 29182 title: uniqueTitle, 29183 content: (0, import_blocks5.serialize)(blocks), 29184 area 29185 }, 29186 { throwOnError: true } 29187 ); 29188 await onCreate(templatePart); 29189 } catch (error2) { 29190 const errorMessage = error2 instanceof Error && "code" in error2 && error2.message && error2.code !== "unknown_error" ? error2.message : (0, import_i18n63.__)( 29191 "An error occurred while creating the template part." 29192 ); 29193 createErrorNotice(errorMessage, { type: "snackbar" }); 29194 onError?.(); 29195 } finally { 29196 setIsSubmitting(false); 29197 } 29198 } 29199 return /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 29200 "form", 29201 { 29202 onSubmit: async (event) => { 29203 event.preventDefault(); 29204 await createTemplatePart(); 29205 }, 29206 children: /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)(import_components20.__experimentalVStack, { spacing: "4", children: [ 29207 /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 29208 import_components20.TextControl, 29209 { 29210 label: (0, import_i18n63.__)("Name"), 29211 value: title, 29212 onChange: setTitle, 29213 required: true 29214 } 29215 ), 29216 /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)("fieldset", { className: "fields-create-template-part-modal__area-fieldset", children: [ 29217 /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(import_components20.BaseControl.VisualLabel, { as: "legend", children: (0, import_i18n63.__)("Area") }), 29218 /* @__PURE__ */ (0, import_jsx_runtime165.jsx)("div", { className: "fields-create-template-part-modal__area-radio-group", children: (defaultTemplatePartAreas ?? []).map( 29219 (item) => { 29220 const icon = getTemplatePartIcon2(item.icon); 29221 return /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)( 29222 "div", 29223 { 29224 className: "fields-create-template-part-modal__area-radio-wrapper", 29225 children: [ 29226 /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 29227 "input", 29228 { 29229 type: "radio", 29230 id: getAreaRadioId( 29231 item.area, 29232 instanceId 29233 ), 29234 name: `fields-create-template-part-modal__area-$instanceId}`, 29235 value: item.area, 29236 checked: area === item.area, 29237 onChange: () => { 29238 setArea(item.area); 29239 }, 29240 "aria-describedby": getAreaRadioDescriptionId( 29241 item.area, 29242 instanceId 29243 ) 29244 } 29245 ), 29246 /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 29247 import_components20.Icon, 29248 { 29249 icon, 29250 className: "fields-create-template-part-modal__area-radio-icon" 29251 } 29252 ), 29253 /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 29254 "label", 29255 { 29256 htmlFor: getAreaRadioId( 29257 item.area, 29258 instanceId 29259 ), 29260 className: "fields-create-template-part-modal__area-radio-label", 29261 children: item.label 29262 } 29263 ), 29264 /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 29265 import_components20.Icon, 29266 { 29267 icon: check_default, 29268 className: "fields-create-template-part-modal__area-radio-checkmark" 29269 } 29270 ), 29271 /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 29272 "p", 29273 { 29274 className: "fields-create-template-part-modal__area-radio-description", 29275 id: getAreaRadioDescriptionId( 29276 item.area, 29277 instanceId 29278 ), 29279 children: item.description 29280 } 29281 ) 29282 ] 29283 }, 29284 item.area 29285 ); 29286 } 29287 ) }) 29288 ] }), 29289 /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)(import_components20.__experimentalHStack, { justify: "right", children: [ 29290 /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 29291 import_components20.Button, 29292 { 29293 __next40pxDefaultSize: true, 29294 variant: "tertiary", 29295 onClick: () => { 29296 closeModal2(); 29297 }, 29298 children: (0, import_i18n63.__)("Cancel") 29299 } 29300 ), 29301 /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 29302 import_components20.Button, 29303 { 29304 __next40pxDefaultSize: true, 29305 variant: "primary", 29306 type: "submit", 29307 "aria-disabled": !title || isSubmitting, 29308 isBusy: isSubmitting, 29309 children: confirmLabel 29310 } 29311 ) 29312 ] }) 29313 ] }) 29314 } 29315 ); 29316 } 29317 29318 // packages/fields/build-module/actions/duplicate-template-part.mjs 29319 var import_jsx_runtime166 = __toESM(require_jsx_runtime(), 1); 29320 var duplicateTemplatePart = { 29321 id: "duplicate-template-part", 29322 label: (0, import_i18n64._x)("Duplicate", "action label"), 29323 isEligible: (item) => item.type === "wp_template_part", 29324 modalHeader: (0, import_i18n64._x)("Duplicate template part", "action label"), 29325 modalFocusOnMount: "firstContentElement", 29326 RenderModal: ({ items, closeModal: closeModal2 }) => { 29327 const [item] = items; 29328 const blocks = (0, import_element64.useMemo)(() => { 29329 return item.blocks ?? (0, import_blocks6.parse)( 29330 typeof item.content === "string" ? item.content : item.content.raw, 29331 { 29332 __unstableSkipMigrationLogs: true 29333 } 29334 ); 29335 }, [item.content, item.blocks]); 29336 const { createSuccessNotice } = (0, import_data29.useDispatch)(import_notices12.store); 29337 function onTemplatePartSuccess(templatePart) { 29338 createSuccessNotice( 29339 (0, import_i18n64.sprintf)( 29340 // translators: %s: The new template part's title e.g. 'Call to action (copy)'. 29341 (0, import_i18n64._x)('"%s" duplicated.', "template part"), 29342 getItemTitle(templatePart) 29343 ), 29344 { type: "snackbar", id: "edit-site-patterns-success" } 29345 ); 29346 closeModal2?.(); 29347 } 29348 return /* @__PURE__ */ (0, import_jsx_runtime166.jsx)( 29349 CreateTemplatePartModalContents, 29350 { 29351 blocks, 29352 defaultArea: item.area, 29353 defaultTitle: (0, import_i18n64.sprintf)( 29354 /* translators: %s: Existing template part title */ 29355 (0, import_i18n64._x)("%s (Copy)", "template part"), 29356 getItemTitle(item) 29357 ), 29358 onCreate: onTemplatePartSuccess, 29359 onError: closeModal2, 29360 confirmLabel: (0, import_i18n64._x)("Duplicate", "action label"), 29361 closeModal: closeModal2 ?? (() => { 29362 }) 29363 } 29364 ); 29365 } 29366 }; 29367 var duplicate_template_part_default = duplicateTemplatePart; 29368 29369 // packages/media-fields/build-module/alt_text/index.mjs 29370 var import_i18n65 = __toESM(require_i18n(), 1); 29371 var import_components21 = __toESM(require_components(), 1); 29372 var import_jsx_runtime167 = __toESM(require_jsx_runtime(), 1); 29373 var altTextField = { 29374 id: "alt_text", 29375 type: "text", 29376 label: (0, import_i18n65.__)("Alt text"), 29377 isVisible: (item) => item?.media_type === "image", 29378 render: ({ item }) => item?.alt_text || "-", 29379 Edit: ({ field, onChange, data }) => { 29380 return /* @__PURE__ */ (0, import_jsx_runtime167.jsx)( 29381 import_components21.TextareaControl, 29382 { 29383 label: field.label, 29384 value: data.alt_text || "", 29385 onChange: (value) => onChange({ alt_text: value }), 29386 help: /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)(import_jsx_runtime167.Fragment, { children: [ 29387 /* @__PURE__ */ (0, import_jsx_runtime167.jsx)( 29388 Link, 29389 { 29390 href: ( 29391 // translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations. 29392 (0, import_i18n65.__)( 29393 "https://www.w3.org/WAI/tutorials/images/decision-tree/" 29394 ) 29395 ), 29396 openInNewTab: true, 29397 children: (0, import_i18n65.__)("Describe the purpose of the image.") 29398 } 29399 ), 29400 /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("br", {}), 29401 (0, import_i18n65.__)("Leave empty if decorative.") 29402 ] }), 29403 rows: 2 29404 } 29405 ); 29406 }, 29407 enableSorting: false, 29408 filterBy: false 29409 }; 29410 var alt_text_default = altTextField; 29411 29412 // packages/media-fields/build-module/attached_to/index.mjs 29413 var import_i18n68 = __toESM(require_i18n(), 1); 29414 29415 // packages/media-fields/build-module/attached_to/view.mjs 29416 var import_element65 = __toESM(require_element(), 1); 29417 var import_i18n66 = __toESM(require_i18n(), 1); 29418 29419 // packages/media-fields/build-module/utils/get-rendered-content.mjs 29420 function getRenderedContent(content) { 29421 if (!content) { 29422 return ""; 29423 } 29424 if (typeof content === "string") { 29425 return content; 29426 } 29427 if (typeof content === "object") { 29428 return content.rendered || content.raw || ""; 29429 } 29430 return ""; 29431 } 29432 29433 // packages/media-fields/build-module/attached_to/view.mjs 29434 var import_jsx_runtime168 = __toESM(require_jsx_runtime(), 1); 29435 function MediaAttachedToView({ 29436 item 29437 }) { 29438 const [attachedPostTitle, setAttachedPostTitle] = (0, import_element65.useState)(null); 29439 const parentId = item.post; 29440 const embeddedPostId = item._embedded?.["wp:attached-to"]?.[0]?.id; 29441 const embeddedPostTitle = item._embedded?.["wp:attached-to"]?.[0]?.title; 29442 (0, import_element65.useEffect)(() => { 29443 if (!!parentId && parentId === embeddedPostId) { 29444 setAttachedPostTitle( 29445 getRenderedContent(embeddedPostTitle) || (0, import_i18n66.__)("(no title)") 29446 ); 29447 } 29448 if (!parentId) { 29449 setAttachedPostTitle((0, import_i18n66.__)("(Unattached)")); 29450 } 29451 }, [parentId, embeddedPostId, embeddedPostTitle]); 29452 return /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(import_jsx_runtime168.Fragment, { children: attachedPostTitle }); 29453 } 29454 29455 // packages/media-fields/build-module/attached_to/edit.mjs 29456 var import_core_data26 = __toESM(require_core_data(), 1); 29457 var import_components22 = __toESM(require_components(), 1); 29458 var import_i18n67 = __toESM(require_i18n(), 1); 29459 var import_element66 = __toESM(require_element(), 1); 29460 var import_compose5 = __toESM(require_compose(), 1); 29461 var import_data30 = __toESM(require_data(), 1); 29462 var import_jsx_runtime169 = __toESM(require_jsx_runtime(), 1); 29463 function MediaAttachedToEdit({ 29464 data, 29465 onChange 29466 }) { 29467 const defaultPost = !!data.post && !!data?._embedded?.["wp:attached-to"]?.[0] ? [ 29468 { 29469 label: getRenderedContent( 29470 data._embedded?.["wp:attached-to"]?.[0]?.title 29471 ), 29472 value: data.post.toString() 29473 } 29474 ] : []; 29475 const [options, setOptions] = (0, import_element66.useState)(defaultPost); 29476 const [searchResults, setSearchResults] = (0, import_element66.useState)( 29477 [] 29478 ); 29479 const [isLoading, setIsLoading] = (0, import_element66.useState)(false); 29480 const [value, setValue] = (0, import_element66.useState)( 29481 data?.post?.toString() ?? null 29482 ); 29483 const postTypes = (0, import_data30.useSelect)( 29484 (select9) => select9(import_core_data26.store).getPostTypes(), 29485 [] 29486 ); 29487 const handleDetach = () => { 29488 onChange({ 29489 post: 0, 29490 _embedded: { ...data?._embedded, "wp:attached-to": void 0 } 29491 }); 29492 setValue(null); 29493 }; 29494 const onValueChange = async (filterValue) => { 29495 setIsLoading(true); 29496 const results = await (0, import_core_data26.__experimentalFetchLinkSuggestions)( 29497 filterValue, 29498 /* 29499 * @TODO `fetchLinkSuggestions()` should accept `perPage` as an option argument. 29500 * `isInitialSuggestions` limits the result to 3, otherwise it's hardcoded to 20. 29501 */ 29502 { type: "post", isInitialSuggestions: true }, 29503 {} 29504 ); 29505 setSearchResults(results); 29506 const suggestions = results.map((result) => { 29507 return { 29508 label: result.title, 29509 value: result.id.toString() 29510 }; 29511 }); 29512 const includeCurrent = !filterValue && suggestions.findIndex((s3) => s3.value === value) === -1; 29513 setOptions(suggestions.concat(includeCurrent ? defaultPost : [])); 29514 setIsLoading(false); 29515 }; 29516 const debouncedValueChange = (0, import_compose5.useDebounce)((0, import_compose5.useEvent)(onValueChange), 300); 29517 const handleSelectOption = (selectedPostId) => { 29518 if (!selectedPostId) { 29519 handleDetach(); 29520 return; 29521 } 29522 setValue(selectedPostId); 29523 if (selectedPostId) { 29524 const selectedPost = searchResults.find( 29525 (result) => result.id === Number(selectedPostId) 29526 ); 29527 if (selectedPost && postTypes) { 29528 const postType2 = postTypes.find( 29529 (_postType) => _postType.slug === selectedPost?.type 29530 ); 29531 const attachedTo = { 29532 ...postType2 && { type: postType2.slug }, 29533 id: Number(selectedPostId), 29534 title: { 29535 raw: selectedPost.title, 29536 rendered: selectedPost.title 29537 } 29538 }; 29539 onChange({ 29540 post: Number(selectedPostId), 29541 _embedded: { 29542 ...data?._embedded, 29543 "wp:attached-to": [attachedTo] 29544 } 29545 }); 29546 } 29547 } 29548 }; 29549 return /* @__PURE__ */ (0, import_jsx_runtime169.jsx)( 29550 import_components22.ComboboxControl, 29551 { 29552 className: "dataviews-media-field__attached-to", 29553 isLoading, 29554 label: (0, import_i18n67.__)("Attached to"), 29555 help: (0, import_i18n67.__)("Attach this file to a single post or page."), 29556 value, 29557 options, 29558 onFilterValueChange: (filterValue) => debouncedValueChange(filterValue), 29559 onChange: handleSelectOption, 29560 hideLabelFromVision: true, 29561 expandOnFocus: false 29562 } 29563 ); 29564 } 29565 29566 // packages/media-fields/build-module/attached_to/index.mjs 29567 var attachedToField = { 29568 id: "attached_to", 29569 type: "text", 29570 label: (0, import_i18n68.__)("Attached to"), 29571 Edit: MediaAttachedToEdit, 29572 render: MediaAttachedToView, 29573 enableSorting: false, 29574 filterBy: false 29575 }; 29576 var attached_to_default = attachedToField; 29577 29578 // packages/media-fields/build-module/author/index.mjs 29579 var import_i18n70 = __toESM(require_i18n(), 1); 29580 var import_data31 = __toESM(require_data(), 1); 29581 var import_core_data27 = __toESM(require_core_data(), 1); 29582 29583 // packages/media-fields/build-module/author/view.mjs 29584 var import_i18n69 = __toESM(require_i18n(), 1); 29585 var import_element67 = __toESM(require_element(), 1); 29586 var import_components23 = __toESM(require_components(), 1); 29587 var import_jsx_runtime170 = __toESM(require_jsx_runtime(), 1); 29588 function AuthorView2({ 29589 item 29590 }) { 29591 const author = item?._embedded?.author?.[0]; 29592 const text = author?.name; 29593 const imageUrl = author?.avatar_urls?.[48]; 29594 const [loadingState, setLoadingState] = (0, import_element67.useState)("loading"); 29595 (0, import_element67.useEffect)(() => { 29596 setLoadingState("loading"); 29597 }, [imageUrl]); 29598 const imgRef = (0, import_element67.useCallback)((img) => { 29599 if (img?.complete) { 29600 setLoadingState("instant"); 29601 } 29602 }, []); 29603 const handleLoad = () => { 29604 if (loadingState === "loading") { 29605 setLoadingState("loaded"); 29606 } 29607 }; 29608 return /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)(import_components23.__experimentalHStack, { alignment: "left", spacing: 0, children: [ 29609 !!imageUrl && /* @__PURE__ */ (0, import_jsx_runtime170.jsx)( 29610 "div", 29611 { 29612 className: clsx_default("media-author-field__avatar", { 29613 "is-loading": loadingState === "loading", 29614 "is-loaded": loadingState === "loaded" 29615 }), 29616 children: /* @__PURE__ */ (0, import_jsx_runtime170.jsx)( 29617 "img", 29618 { 29619 ref: imgRef, 29620 onLoad: handleLoad, 29621 alt: (0, import_i18n69.__)("Author avatar"), 29622 src: imageUrl 29623 } 29624 ) 29625 } 29626 ), 29627 !imageUrl && /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("div", { className: "media-author-field__icon", children: /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(import_components23.Icon, { icon: comment_author_avatar_default }) }), 29628 /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("span", { className: "media-author-field__name", children: text }) 29629 ] }); 29630 } 29631 29632 // packages/media-fields/build-module/author/index.mjs 29633 var authorField2 = { 29634 label: (0, import_i18n70.__)("Author"), 29635 id: "author", 29636 type: "integer", 29637 getElements: async () => { 29638 const authors = await (0, import_data31.resolveSelect)(import_core_data27.store).getEntityRecords( 29639 "root", 29640 "user", 29641 { 29642 per_page: -1, 29643 who: "authors", 29644 _fields: "id,name", 29645 context: "view" 29646 } 29647 ) ?? []; 29648 return authors.map(({ id, name: name2 }) => ({ 29649 value: id, 29650 label: name2 29651 })); 29652 }, 29653 render: AuthorView2, 29654 sort: (a3, b3, direction) => { 29655 const nameA = a3._embedded?.author?.[0]?.name || ""; 29656 const nameB = b3._embedded?.author?.[0]?.name || ""; 29657 return direction === "asc" ? nameA.localeCompare(nameB) : nameB.localeCompare(nameA); 29658 }, 29659 filterBy: { 29660 operators: ["isAny", "isNone"] 29661 }, 29662 readOnly: true 29663 }; 29664 var author_default2 = authorField2; 29665 29666 // packages/media-fields/build-module/caption/index.mjs 29667 var import_i18n71 = __toESM(require_i18n(), 1); 29668 var import_components24 = __toESM(require_components(), 1); 29669 29670 // packages/media-fields/build-module/utils/get-raw-content.mjs 29671 function getRawContent(content) { 29672 if (!content) { 29673 return ""; 29674 } 29675 if (typeof content === "string") { 29676 return content; 29677 } 29678 if (typeof content === "object" && "raw" in content) { 29679 return content.raw || ""; 29680 } 29681 return ""; 29682 } 29683 29684 // packages/media-fields/build-module/caption/index.mjs 29685 var import_jsx_runtime171 = __toESM(require_jsx_runtime(), 1); 29686 var captionField = { 29687 id: "caption", 29688 type: "text", 29689 label: (0, import_i18n71.__)("Caption"), 29690 getValue: ({ item }) => getRawContent(item?.caption), 29691 render: ({ item }) => getRawContent(item?.caption) || "-", 29692 Edit: ({ field, onChange, data }) => { 29693 return /* @__PURE__ */ (0, import_jsx_runtime171.jsx)( 29694 import_components24.TextareaControl, 29695 { 29696 label: field.label, 29697 value: getRawContent(data.caption) || "", 29698 onChange: (value) => onChange({ caption: value }), 29699 rows: 2 29700 } 29701 ); 29702 }, 29703 enableSorting: false, 29704 filterBy: false 29705 }; 29706 var caption_default = captionField; 29707 29708 // packages/media-fields/build-module/date_added/index.mjs 29709 var import_i18n72 = __toESM(require_i18n(), 1); 29710 var dateAddedField = { 29711 id: "date", 29712 type: "datetime", 29713 label: (0, import_i18n72.__)("Date added"), 29714 filterBy: { 29715 operators: ["before", "after"] 29716 }, 29717 readOnly: true 29718 }; 29719 var date_added_default = dateAddedField; 29720 29721 // packages/media-fields/build-module/description/index.mjs 29722 var import_i18n73 = __toESM(require_i18n(), 1); 29723 var import_components25 = __toESM(require_components(), 1); 29724 var import_jsx_runtime172 = __toESM(require_jsx_runtime(), 1); 29725 var descriptionField2 = { 29726 id: "description", 29727 type: "text", 29728 label: (0, import_i18n73.__)("Description"), 29729 getValue: ({ item }) => getRawContent(item?.description), 29730 render: ({ item }) => /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { children: getRawContent(item?.description) || "-" }), 29731 Edit: ({ field, onChange, data }) => { 29732 return /* @__PURE__ */ (0, import_jsx_runtime172.jsx)( 29733 import_components25.TextareaControl, 29734 { 29735 label: field.label, 29736 value: getRawContent(data.description) || "", 29737 onChange: (value) => onChange({ description: value }), 29738 rows: 5 29739 } 29740 ); 29741 }, 29742 enableSorting: false, 29743 filterBy: false 29744 }; 29745 var description_default2 = descriptionField2; 29746 29747 // packages/media-fields/build-module/filename/index.mjs 29748 var import_i18n74 = __toESM(require_i18n(), 1); 29749 var import_url10 = __toESM(require_url(), 1); 29750 29751 // packages/media-fields/build-module/filename/view.mjs 29752 var import_element68 = __toESM(require_element(), 1); 29753 var import_url9 = __toESM(require_url(), 1); 29754 var import_jsx_runtime173 = __toESM(require_jsx_runtime(), 1); 29755 var TRUNCATE_LENGTH = 15; 29756 function FileNameView({ 29757 item 29758 }) { 29759 const fileName = (0, import_element68.useMemo)( 29760 () => item?.source_url ? (0, import_url9.getFilename)(item.source_url) : null, 29761 [item?.source_url] 29762 ); 29763 if (!fileName) { 29764 return ""; 29765 } 29766 if (fileName.length <= TRUNCATE_LENGTH) { 29767 return /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("span", { className: "dataviews-media-field__filename", children: fileName }); 29768 } 29769 return /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)(tooltip_exports.Root, { children: [ 29770 /* @__PURE__ */ (0, import_jsx_runtime173.jsx)( 29771 tooltip_exports.Trigger, 29772 { 29773 render: /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("span", { className: "dataviews-media-field__filename", children: fileName }) 29774 } 29775 ), 29776 /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(tooltip_exports.Popup, { children: fileName }) 29777 ] }); 29778 } 29779 29780 // packages/media-fields/build-module/filename/index.mjs 29781 var filenameField = { 29782 id: "filename", 29783 type: "text", 29784 label: (0, import_i18n74.__)("File name"), 29785 getValue: ({ item }) => (0, import_url10.getFilename)(item?.source_url || ""), 29786 render: FileNameView, 29787 enableSorting: false, 29788 filterBy: false, 29789 readOnly: true 29790 }; 29791 var filename_default = filenameField; 29792 29793 // packages/media-fields/build-module/filesize/index.mjs 29794 var import_i18n75 = __toESM(require_i18n(), 1); 29795 var KB_IN_BYTES = 1024; 29796 var MB_IN_BYTES = 1024 * KB_IN_BYTES; 29797 var GB_IN_BYTES = 1024 * MB_IN_BYTES; 29798 var TB_IN_BYTES = 1024 * GB_IN_BYTES; 29799 var PB_IN_BYTES = 1024 * TB_IN_BYTES; 29800 var EB_IN_BYTES = 1024 * PB_IN_BYTES; 29801 var ZB_IN_BYTES = 1024 * EB_IN_BYTES; 29802 var YB_IN_BYTES = 1024 * ZB_IN_BYTES; 29803 function getBytesString(bytes, unitSymbol, decimals = 2) { 29804 return (0, import_i18n75.sprintf)( 29805 // translators: 1: Actual bytes of a file. 2: The unit symbol (e.g. MB). 29806 (0, import_i18n75._x)("%1$s %2$s", "file size"), 29807 bytes.toLocaleString(void 0, { 29808 minimumFractionDigits: 0, 29809 maximumFractionDigits: decimals 29810 }), 29811 unitSymbol 29812 ); 29813 } 29814 function formatFileSize(bytes, decimals = 2) { 29815 if (bytes === 0) { 29816 return getBytesString(0, (0, import_i18n75._x)("B", "unit symbol"), decimals); 29817 } 29818 const quant = { 29819 /* translators: Unit symbol for yottabyte. */ 29820 [(0, import_i18n75._x)("YB", "unit symbol")]: YB_IN_BYTES, 29821 /* translators: Unit symbol for zettabyte. */ 29822 [(0, import_i18n75._x)("ZB", "unit symbol")]: ZB_IN_BYTES, 29823 /* translators: Unit symbol for exabyte. */ 29824 [(0, import_i18n75._x)("EB", "unit symbol")]: EB_IN_BYTES, 29825 /* translators: Unit symbol for petabyte. */ 29826 [(0, import_i18n75._x)("PB", "unit symbol")]: PB_IN_BYTES, 29827 /* translators: Unit symbol for terabyte. */ 29828 [(0, import_i18n75._x)("TB", "unit symbol")]: TB_IN_BYTES, 29829 /* translators: Unit symbol for gigabyte. */ 29830 [(0, import_i18n75._x)("GB", "unit symbol")]: GB_IN_BYTES, 29831 /* translators: Unit symbol for megabyte. */ 29832 [(0, import_i18n75._x)("MB", "unit symbol")]: MB_IN_BYTES, 29833 /* translators: Unit symbol for kilobyte. */ 29834 [(0, import_i18n75._x)("KB", "unit symbol")]: KB_IN_BYTES, 29835 /* translators: Unit symbol for byte. */ 29836 [(0, import_i18n75._x)("B", "unit symbol")]: 1 29837 }; 29838 for (const [unit, mag] of Object.entries(quant)) { 29839 if (bytes >= mag) { 29840 return getBytesString(bytes / mag, unit, decimals); 29841 } 29842 } 29843 return ""; 29844 } 29845 var filesizeField = { 29846 id: "filesize", 29847 type: "text", 29848 label: (0, import_i18n75.__)("File size"), 29849 getValue: ({ item }) => item?.media_details?.filesize ? formatFileSize(item?.media_details?.filesize) : "", 29850 isVisible: (item) => { 29851 return !!item?.media_details?.filesize; 29852 }, 29853 enableSorting: false, 29854 filterBy: false, 29855 readOnly: true 29856 }; 29857 var filesize_default = filesizeField; 29858 29859 // packages/media-fields/build-module/media_dimensions/index.mjs 29860 var import_i18n76 = __toESM(require_i18n(), 1); 29861 var mediaDimensionsField = { 29862 id: "media_dimensions", 29863 type: "text", 29864 label: (0, import_i18n76.__)("Dimensions"), 29865 getValue: ({ item }) => item?.media_details?.width && item?.media_details?.height ? (0, import_i18n76.sprintf)( 29866 // translators: 1: Width. 2: Height. 29867 (0, import_i18n76._x)("%1$s \xD7 %2$s", "image dimensions"), 29868 item?.media_details?.width?.toString(), 29869 item?.media_details?.height?.toString() 29870 ) : "", 29871 isVisible: (item) => { 29872 return !!(item?.media_details?.width && item?.media_details?.height); 29873 }, 29874 enableSorting: false, 29875 filterBy: false, 29876 readOnly: true 29877 }; 29878 var media_dimensions_default = mediaDimensionsField; 29879 29880 // packages/media-fields/build-module/mime_type/index.mjs 29881 var import_i18n77 = __toESM(require_i18n(), 1); 29882 var mimeTypeField = { 29883 id: "mime_type", 29884 type: "text", 29885 label: (0, import_i18n77.__)("File type"), 29886 getValue: ({ item }) => item?.mime_type || "", 29887 render: ({ item }) => item?.mime_type || "-", 29888 // Disable sorting until REST API support for ordering my `mime_type` is added. 29889 // See: https://core.trac.wordpress.org/ticket/64073 29890 enableSorting: false, 29891 filterBy: false, 29892 readOnly: true 29893 }; 29894 var mime_type_default = mimeTypeField; 29895 29896 // packages/editor/build-module/dataviews/fields/content-preview/index.mjs 29897 var import_i18n203 = __toESM(require_i18n(), 1); 29898 29899 // packages/editor/build-module/dataviews/fields/content-preview/content-preview-view.mjs 29900 var import_i18n202 = __toESM(require_i18n(), 1); 29901 var import_block_editor34 = __toESM(require_block_editor(), 1); 29902 var import_data86 = __toESM(require_data(), 1); 29903 var import_core_data54 = __toESM(require_core_data(), 1); 29904 29905 // packages/editor/build-module/components/provider/index.mjs 29906 var import_element217 = __toESM(require_element(), 1); 29907 var import_data85 = __toESM(require_data(), 1); 29908 var import_i18n201 = __toESM(require_i18n(), 1); 29909 var import_core_data53 = __toESM(require_core_data(), 1); 29910 var import_block_editor33 = __toESM(require_block_editor(), 1); 29911 var import_notices18 = __toESM(require_notices(), 1); 29912 var import_patterns8 = __toESM(require_patterns(), 1); 29913 var import_blocks18 = __toESM(require_blocks(), 1); 29914 var import_url13 = __toESM(require_url(), 1); 29915 29916 // packages/editor/build-module/components/provider/with-registry-provider.mjs 29917 var import_element69 = __toESM(require_element(), 1); 29918 var import_data32 = __toESM(require_data(), 1); 29919 var import_compose6 = __toESM(require_compose(), 1); 29920 var import_block_editor4 = __toESM(require_block_editor(), 1); 29921 var import_jsx_runtime174 = __toESM(require_jsx_runtime(), 1); 29922 function getSubRegistry(subRegistries, registry, useSubRegistry) { 29923 if (!useSubRegistry) { 29924 return registry; 29925 } 29926 let subRegistry = subRegistries.get(registry); 29927 if (!subRegistry) { 29928 subRegistry = (0, import_data32.createRegistry)( 29929 { 29930 "core/block-editor": import_block_editor4.storeConfig 29931 }, 29932 registry 29933 ); 29934 subRegistry.registerStore("core/editor", storeConfig); 29935 subRegistries.set(registry, subRegistry); 29936 } 29937 return subRegistry; 29938 } 29939 var withRegistryProvider = (0, import_compose6.createHigherOrderComponent)( 29940 (WrappedComponent) => ({ useSubRegistry = true, ...props }) => { 29941 const registry = (0, import_data32.useRegistry)(); 29942 const [subRegistries] = (0, import_element69.useState)(() => /* @__PURE__ */ new WeakMap()); 29943 const subRegistry = getSubRegistry( 29944 subRegistries, 29945 registry, 29946 useSubRegistry 29947 ); 29948 if (subRegistry === registry) { 29949 return /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(WrappedComponent, { registry, ...props }); 29950 } 29951 return /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(import_data32.RegistryProvider, { value: subRegistry, children: /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(WrappedComponent, { registry: subRegistry, ...props }) }); 29952 }, 29953 "withRegistryProvider" 29954 ); 29955 var with_registry_provider_default = withRegistryProvider; 29956 29957 // packages/editor/build-module/components/provider/use-block-editor-settings.mjs 29958 var import_element201 = __toESM(require_element(), 1); 29959 var import_data65 = __toESM(require_data(), 1); 29960 var import_core_data45 = __toESM(require_core_data(), 1); 29961 var import_i18n190 = __toESM(require_i18n(), 1); 29962 var import_preferences6 = __toESM(require_preferences(), 1); 29963 var import_compose34 = __toESM(require_compose(), 1); 29964 var import_blocks12 = __toESM(require_blocks(), 1); 29965 var import_block_editor21 = __toESM(require_block_editor(), 1); 29966 29967 // packages/media-editor/build-module/components/media-editor-provider/index.mjs 29968 var import_element70 = __toESM(require_element(), 1); 29969 var import_jsx_runtime175 = __toESM(require_jsx_runtime(), 1); 29970 var MediaEditorContext = (0, import_element70.createContext)( 29971 void 0 29972 ); 29973 function MediaEditorProvider({ 29974 value, 29975 onChange, 29976 settings = {}, 29977 children 29978 }) { 29979 const contextValue = { 29980 media: value, 29981 onChange, 29982 fields: settings.fields || [] 29983 }; 29984 return /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(MediaEditorContext.Provider, { value: contextValue, children }); 29985 } 29986 function useMediaEditorContext() { 29987 const context = (0, import_element70.useContext)(MediaEditorContext); 29988 if (!context) { 29989 throw new Error( 29990 "useMediaEditorContext must be used within MediaEditorProvider" 29991 ); 29992 } 29993 return context; 29994 } 29995 29996 // packages/media-editor/build-module/components/media-preview/index.mjs 29997 var import_components26 = __toESM(require_components(), 1); 29998 var import_element71 = __toESM(require_element(), 1); 29999 var import_i18n78 = __toESM(require_i18n(), 1); 30000 30001 // packages/media-editor/build-module/utils/get-media-type.mjs 30002 function getMediaTypeFromMimeType(mimeType) { 30003 if (!mimeType) { 30004 return { type: "application" }; 30005 } 30006 if (mimeType.startsWith("image/")) { 30007 return { type: "image" }; 30008 } 30009 if (mimeType.startsWith("video/")) { 30010 return { type: "video" }; 30011 } 30012 if (mimeType.startsWith("audio/")) { 30013 return { type: "audio" }; 30014 } 30015 return { type: "application" }; 30016 } 30017 30018 // packages/media-editor/build-module/components/media-preview/index.mjs 30019 var import_jsx_runtime176 = __toESM(require_jsx_runtime(), 1); 30020 function MediaPreviewContent({ 30021 mediaType, 30022 mediaUrl, 30023 altText, 30024 displayTitle, 30025 mimeType, 30026 onLoad, 30027 onError, 30028 loadingState 30029 }) { 30030 switch (mediaType.type) { 30031 case "image": 30032 return /* @__PURE__ */ (0, import_jsx_runtime176.jsx)( 30033 "img", 30034 { 30035 className: loadingState === "loaded" ? "loaded" : "", 30036 src: mediaUrl, 30037 alt: altText || "", 30038 onLoad, 30039 onError 30040 } 30041 ); 30042 case "video": 30043 return /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("video", { src: mediaUrl, controls: true, onError, children: displayTitle }); 30044 case "audio": 30045 return /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("audio", { src: mediaUrl, controls: true, onError, children: displayTitle }); 30046 default: 30047 return /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("div", { className: "media-editor-preview__file-info", children: [ 30048 /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("p", { className: "media-editor-preview__file-name", children: displayTitle }), 30049 /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("p", { className: "media-editor-preview__mime-type", children: mimeType }), 30050 /* @__PURE__ */ (0, import_jsx_runtime176.jsx)( 30051 "a", 30052 { 30053 href: mediaUrl, 30054 target: "_blank", 30055 rel: "noopener", 30056 className: "media-editor-preview__download-link", 30057 children: (0, import_i18n78.__)("View file") 30058 } 30059 ) 30060 ] }); 30061 } 30062 } 30063 function MediaPreview2(props) { 30064 const [loadingState, setLoadingState] = (0, import_element71.useState)("loading"); 30065 const { media } = useMediaEditorContext(); 30066 const { 30067 source_url: mediaUrl, 30068 mime_type: mimeType, 30069 alt_text: altText, 30070 title 30071 } = media || {}; 30072 const mediaType = getMediaTypeFromMimeType(mimeType); 30073 if (!mediaUrl) { 30074 return /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("div", { className: "media-editor-preview media-editor-preview--empty", children: /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("p", { children: (0, import_i18n78.__)("No media file available.") }) }); 30075 } 30076 if (loadingState === "error") { 30077 return /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("div", { className: "media-editor-preview media-editor-preview--error", children: [ 30078 /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("p", { children: (0, import_i18n78.__)("Failed to load media file.") }), 30079 /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("p", { className: "media-editor-preview__url", children: mediaUrl }) 30080 ] }); 30081 } 30082 const displayTitle = typeof title === "string" ? title : title?.rendered || title?.raw; 30083 return /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)( 30084 "div", 30085 { 30086 ...props, 30087 className: `media-editor-preview media-editor-preview--$mediaType.type}`, 30088 children: [ 30089 mediaType.type === "image" && loadingState === "loading" && /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("div", { className: "media-editor-preview__spinner", children: /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_components26.Spinner, {}) }), 30090 /* @__PURE__ */ (0, import_jsx_runtime176.jsx)( 30091 MediaPreviewContent, 30092 { 30093 mediaType, 30094 mediaUrl, 30095 altText, 30096 displayTitle, 30097 mimeType, 30098 onLoad: () => setLoadingState("loaded"), 30099 onError: () => setLoadingState("error"), 30100 loadingState 30101 } 30102 ) 30103 ] 30104 } 30105 ); 30106 } 30107 30108 // packages/dataviews/build-module/components/dataviews-context/index.mjs 30109 var import_element72 = __toESM(require_element(), 1); 30110 30111 // packages/dataviews/build-module/constants.mjs 30112 var import_i18n79 = __toESM(require_i18n(), 1); 30113 var OPERATOR_IS_ANY2 = "isAny"; 30114 var OPERATOR_IS_NONE = "isNone"; 30115 var OPERATOR_IS_ALL = "isAll"; 30116 var OPERATOR_IS_NOT_ALL = "isNotAll"; 30117 var OPERATOR_BETWEEN = "between"; 30118 var OPERATOR_IN_THE_PAST = "inThePast"; 30119 var OPERATOR_OVER = "over"; 30120 var OPERATOR_IS = "is"; 30121 var OPERATOR_IS_NOT = "isNot"; 30122 var OPERATOR_LESS_THAN = "lessThan"; 30123 var OPERATOR_GREATER_THAN = "greaterThan"; 30124 var OPERATOR_LESS_THAN_OR_EQUAL = "lessThanOrEqual"; 30125 var OPERATOR_GREATER_THAN_OR_EQUAL = "greaterThanOrEqual"; 30126 var OPERATOR_BEFORE = "before"; 30127 var OPERATOR_AFTER = "after"; 30128 var OPERATOR_BEFORE_INC = "beforeInc"; 30129 var OPERATOR_AFTER_INC = "afterInc"; 30130 var OPERATOR_CONTAINS = "contains"; 30131 var OPERATOR_NOT_CONTAINS = "notContains"; 30132 var OPERATOR_STARTS_WITH = "startsWith"; 30133 var OPERATOR_ON = "on"; 30134 var OPERATOR_NOT_ON = "notOn"; 30135 var SORTING_DIRECTIONS = ["asc", "desc"]; 30136 var sortArrows = { asc: "\u2191", desc: "\u2193" }; 30137 var sortValues = { asc: "ascending", desc: "descending" }; 30138 var sortLabels = { 30139 asc: (0, import_i18n79.__)("Sort ascending"), 30140 desc: (0, import_i18n79.__)("Sort descending") 30141 }; 30142 var sortIcons = { 30143 asc: arrow_up_default, 30144 desc: arrow_down_default 30145 }; 30146 var LAYOUT_TABLE = "table"; 30147 var LAYOUT_GRID = "grid"; 30148 var LAYOUT_LIST = "list"; 30149 var LAYOUT_ACTIVITY = "activity"; 30150 var LAYOUT_PICKER_GRID = "pickerGrid"; 30151 var LAYOUT_PICKER_TABLE = "pickerTable"; 30152 var LAYOUT_PICKER_ACTIVITY = "pickerActivity"; 30153 30154 // packages/dataviews/build-module/components/dataviews-context/index.mjs 30155 var DataViewsContext = (0, import_element72.createContext)({ 30156 view: { type: LAYOUT_TABLE }, 30157 onChangeView: () => { 30158 }, 30159 fields: [], 30160 data: [], 30161 paginationInfo: { 30162 totalItems: 0, 30163 totalPages: 0 30164 }, 30165 selection: [], 30166 onChangeSelection: () => { 30167 }, 30168 setOpenedFilter: () => { 30169 }, 30170 openedFilter: null, 30171 getItemId: (item) => item.id, 30172 isItemClickable: () => true, 30173 renderItemLink: void 0, 30174 containerWidth: 0, 30175 containerRef: (0, import_element72.createRef)(), 30176 resizeObserverRef: () => { 30177 }, 30178 defaultLayouts: { list: {}, grid: {}, table: {} }, 30179 filters: [], 30180 isShowingFilter: false, 30181 setIsShowingFilter: () => { 30182 }, 30183 hasInitiallyLoaded: false, 30184 config: { 30185 perPageSizes: [] 30186 }, 30187 intersectionObserver: null 30188 }); 30189 DataViewsContext.displayName = "DataViewsContext"; 30190 var dataviews_context_default = DataViewsContext; 30191 30192 // packages/dataviews/build-module/components/dataviews-layouts/index.mjs 30193 var import_i18n100 = __toESM(require_i18n(), 1); 30194 30195 // packages/dataviews/build-module/components/dataviews-layouts/table/index.mjs 30196 var import_i18n87 = __toESM(require_i18n(), 1); 30197 var import_components32 = __toESM(require_components(), 1); 30198 var import_element81 = __toESM(require_element(), 1); 30199 var import_keycodes2 = __toESM(require_keycodes(), 1); 30200 30201 // packages/dataviews/build-module/components/dataviews-selection-checkbox/index.mjs 30202 var import_components27 = __toESM(require_components(), 1); 30203 var import_i18n80 = __toESM(require_i18n(), 1); 30204 var import_jsx_runtime177 = __toESM(require_jsx_runtime(), 1); 30205 var SELECTION_CHECKBOX_CLASS = "dataviews-selection-checkbox"; 30206 function DataViewsSelectionCheckbox({ 30207 selection, 30208 onChangeSelection, 30209 item, 30210 getItemId: getItemId2, 30211 titleField: titleField2, 30212 disabled: disabled2, 30213 ...extraProps 30214 }) { 30215 const id = getItemId2(item); 30216 const isInSelectionArray = selection.includes(id); 30217 const checked = !disabled2 && isInSelectionArray; 30218 const selectionLabel = titleField2?.getValue?.({ item }) || (0, import_i18n80.__)("(no title)"); 30219 return /* @__PURE__ */ (0, import_jsx_runtime177.jsx)( 30220 import_components27.CheckboxControl, 30221 { 30222 className: SELECTION_CHECKBOX_CLASS, 30223 "aria-label": selectionLabel, 30224 "aria-disabled": disabled2, 30225 checked, 30226 onChange: () => { 30227 if (disabled2) { 30228 return; 30229 } 30230 onChangeSelection( 30231 isInSelectionArray ? selection.filter((itemId) => id !== itemId) : [...selection, id] 30232 ); 30233 }, 30234 ...extraProps 30235 } 30236 ); 30237 } 30238 30239 // packages/dataviews/build-module/components/dataviews-item-actions/index.mjs 30240 var import_components28 = __toESM(require_components(), 1); 30241 var import_i18n81 = __toESM(require_i18n(), 1); 30242 var import_element73 = __toESM(require_element(), 1); 30243 var import_data33 = __toESM(require_data(), 1); 30244 var import_compose7 = __toESM(require_compose(), 1); 30245 30246 // packages/dataviews/build-module/lock-unlock.mjs 30247 var import_private_apis6 = __toESM(require_private_apis(), 1); 30248 var { lock: lock5, unlock: unlock5 } = (0, import_private_apis6.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 30249 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 30250 "@wordpress/dataviews" 30251 ); 30252 30253 // packages/dataviews/build-module/components/dataviews-item-actions/index.mjs 30254 var import_jsx_runtime178 = __toESM(require_jsx_runtime(), 1); 30255 var { Menu, kebabCase: kebabCase2 } = unlock5(import_components28.privateApis); 30256 function ButtonTrigger({ 30257 action, 30258 onClick, 30259 items, 30260 variant 30261 }) { 30262 const label = typeof action.label === "string" ? action.label : action.label(items); 30263 return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)( 30264 import_components28.Button, 30265 { 30266 disabled: !!action.disabled, 30267 accessibleWhenDisabled: true, 30268 size: "compact", 30269 variant, 30270 onClick, 30271 children: label 30272 } 30273 ); 30274 } 30275 function MenuItemTrigger({ 30276 action, 30277 onClick, 30278 items 30279 }) { 30280 const label = typeof action.label === "string" ? action.label : action.label(items); 30281 return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(Menu.Item, { disabled: action.disabled, onClick, children: /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(Menu.ItemLabel, { children: label }) }); 30282 } 30283 function ActionModal({ 30284 action, 30285 items, 30286 closeModal: closeModal2 30287 }) { 30288 const label = typeof action.label === "string" ? action.label : action.label(items); 30289 const modalHeader = typeof action.modalHeader === "function" ? action.modalHeader(items) : action.modalHeader; 30290 return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)( 30291 import_components28.Modal, 30292 { 30293 title: modalHeader || label, 30294 __experimentalHideHeader: !!action.hideModalHeader, 30295 onRequestClose: closeModal2, 30296 focusOnMount: action.modalFocusOnMount ?? true, 30297 size: action.modalSize || "medium", 30298 overlayClassName: `dataviews-action-modal dataviews-action-modal__$kebabCase2( 30299 action.id 30300 )}`, 30301 children: /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(action.RenderModal, { items, closeModal: closeModal2 }) 30302 } 30303 ); 30304 } 30305 function ActionsMenuGroup({ 30306 actions: actions2, 30307 item, 30308 registry, 30309 setActiveModalAction 30310 }) { 30311 const { primaryActions, regularActions } = (0, import_element73.useMemo)(() => { 30312 return actions2.reduce( 30313 (acc, action) => { 30314 (action.isPrimary ? acc.primaryActions : acc.regularActions).push(action); 30315 return acc; 30316 }, 30317 { 30318 primaryActions: [], 30319 regularActions: [] 30320 } 30321 ); 30322 }, [actions2]); 30323 const renderActionGroup = (actionList) => actionList.map((action) => /* @__PURE__ */ (0, import_jsx_runtime178.jsx)( 30324 MenuItemTrigger, 30325 { 30326 action, 30327 onClick: () => { 30328 if ("RenderModal" in action) { 30329 setActiveModalAction(action); 30330 return; 30331 } 30332 action.callback([item], { registry }); 30333 }, 30334 items: [item] 30335 }, 30336 action.id 30337 )); 30338 return /* @__PURE__ */ (0, import_jsx_runtime178.jsxs)(Menu.Group, { children: [ 30339 renderActionGroup(primaryActions), 30340 renderActionGroup(regularActions) 30341 ] }); 30342 } 30343 function ItemActions({ 30344 item, 30345 actions: actions2, 30346 isCompact 30347 }) { 30348 const registry = (0, import_data33.useRegistry)(); 30349 const { primaryActions, eligibleActions } = (0, import_element73.useMemo)(() => { 30350 const _eligibleActions = actions2.filter( 30351 (action) => !action.isEligible || action.isEligible(item) 30352 ); 30353 const _primaryActions = _eligibleActions.filter( 30354 (action) => action.isPrimary 30355 ); 30356 return { 30357 primaryActions: _primaryActions, 30358 eligibleActions: _eligibleActions 30359 }; 30360 }, [actions2, item]); 30361 const isMobileViewport = (0, import_compose7.useViewportMatch)("medium", "<"); 30362 if (isCompact) { 30363 return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)( 30364 CompactItemActions, 30365 { 30366 item, 30367 actions: eligibleActions, 30368 isSmall: true, 30369 registry 30370 } 30371 ); 30372 } 30373 return /* @__PURE__ */ (0, import_jsx_runtime178.jsxs)( 30374 Stack, 30375 { 30376 direction: "row", 30377 justify: "flex-end", 30378 className: "dataviews-item-actions", 30379 style: { 30380 flexShrink: 0, 30381 width: "auto" 30382 }, 30383 children: [ 30384 /* @__PURE__ */ (0, import_jsx_runtime178.jsx)( 30385 PrimaryActions, 30386 { 30387 item, 30388 actions: primaryActions, 30389 registry 30390 } 30391 ), 30392 (primaryActions.length < eligibleActions.length || // Since we hide primary actions on mobile, we need to show the menu 30393 // there if there are any actions at all. 30394 isMobileViewport) && /* @__PURE__ */ (0, import_jsx_runtime178.jsx)( 30395 CompactItemActions, 30396 { 30397 item, 30398 actions: eligibleActions, 30399 registry 30400 } 30401 ) 30402 ] 30403 } 30404 ); 30405 } 30406 function CompactItemActions({ 30407 item, 30408 actions: actions2, 30409 isSmall, 30410 registry 30411 }) { 30412 const [activeModalAction, setActiveModalAction] = (0, import_element73.useState)( 30413 null 30414 ); 30415 return /* @__PURE__ */ (0, import_jsx_runtime178.jsxs)(import_jsx_runtime178.Fragment, { children: [ 30416 /* @__PURE__ */ (0, import_jsx_runtime178.jsxs)(Menu, { placement: "bottom-end", children: [ 30417 /* @__PURE__ */ (0, import_jsx_runtime178.jsx)( 30418 Menu.TriggerButton, 30419 { 30420 render: /* @__PURE__ */ (0, import_jsx_runtime178.jsx)( 30421 import_components28.Button, 30422 { 30423 size: isSmall ? "small" : "compact", 30424 icon: more_vertical_default, 30425 label: (0, import_i18n81.__)("Actions"), 30426 accessibleWhenDisabled: true, 30427 disabled: !actions2.length, 30428 className: "dataviews-all-actions-button" 30429 } 30430 ) 30431 } 30432 ), 30433 /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(Menu.Popover, { children: /* @__PURE__ */ (0, import_jsx_runtime178.jsx)( 30434 ActionsMenuGroup, 30435 { 30436 actions: actions2, 30437 item, 30438 registry, 30439 setActiveModalAction 30440 } 30441 ) }) 30442 ] }), 30443 !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime178.jsx)( 30444 ActionModal, 30445 { 30446 action: activeModalAction, 30447 items: [item], 30448 closeModal: () => setActiveModalAction(null) 30449 } 30450 ) 30451 ] }); 30452 } 30453 function PrimaryActions({ 30454 item, 30455 actions: actions2, 30456 registry, 30457 buttonVariant 30458 }) { 30459 const [activeModalAction, setActiveModalAction] = (0, import_element73.useState)(null); 30460 const isMobileViewport = (0, import_compose7.useViewportMatch)("medium", "<"); 30461 if (isMobileViewport) { 30462 return null; 30463 } 30464 if (!Array.isArray(actions2) || actions2.length === 0) { 30465 return null; 30466 } 30467 return /* @__PURE__ */ (0, import_jsx_runtime178.jsxs)(import_jsx_runtime178.Fragment, { children: [ 30468 actions2.map((action) => /* @__PURE__ */ (0, import_jsx_runtime178.jsx)( 30469 ButtonTrigger, 30470 { 30471 action, 30472 onClick: () => { 30473 if ("RenderModal" in action) { 30474 setActiveModalAction(action); 30475 return; 30476 } 30477 action.callback([item], { registry }); 30478 }, 30479 items: [item], 30480 variant: buttonVariant 30481 }, 30482 action.id 30483 )), 30484 !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime178.jsx)( 30485 ActionModal, 30486 { 30487 action: activeModalAction, 30488 items: [item], 30489 closeModal: () => setActiveModalAction(null) 30490 } 30491 ) 30492 ] }); 30493 } 30494 30495 // packages/dataviews/build-module/components/dataviews-bulk-actions/index.mjs 30496 var import_components29 = __toESM(require_components(), 1); 30497 var import_i18n83 = __toESM(require_i18n(), 1); 30498 var import_element74 = __toESM(require_element(), 1); 30499 var import_data34 = __toESM(require_data(), 1); 30500 var import_compose8 = __toESM(require_compose(), 1); 30501 30502 // packages/dataviews/build-module/utils/get-footer-message.mjs 30503 var import_i18n82 = __toESM(require_i18n(), 1); 30504 function getFooterMessage(selectionCount, itemsCount, totalItems, onlyTotalCount = false) { 30505 if (selectionCount > 0) { 30506 return (0, import_i18n82.sprintf)( 30507 /* translators: %d: number of items. */ 30508 (0, import_i18n82._n)("%d Item selected", "%d Items selected", selectionCount), 30509 selectionCount 30510 ); 30511 } 30512 if (onlyTotalCount || totalItems <= itemsCount) { 30513 return (0, import_i18n82.sprintf)( 30514 /* translators: %d: number of items. */ 30515 (0, import_i18n82._n)("%d Item", "%d Items", totalItems), 30516 totalItems 30517 ); 30518 } 30519 return (0, import_i18n82.sprintf)( 30520 /* translators: %1$d: number of items. %2$d: total number of items. */ 30521 (0, import_i18n82._n)("%1$d of %2$d Item", "%1$d of %2$d Items", totalItems), 30522 itemsCount, 30523 totalItems 30524 ); 30525 } 30526 30527 // packages/dataviews/build-module/components/dataviews-bulk-actions/index.mjs 30528 var import_jsx_runtime179 = __toESM(require_jsx_runtime(), 1); 30529 function hasAPossibleBulkAction(actions2, item) { 30530 return actions2.some( 30531 (action) => action.supportsBulk && (!action.isEligible || action.isEligible(item)) 30532 ); 30533 } 30534 function useHasAPossibleBulkAction(actions2, item) { 30535 return (0, import_element74.useMemo)( 30536 () => hasAPossibleBulkAction(actions2, item), 30537 [actions2, item] 30538 ); 30539 } 30540 function useSomeItemHasAPossibleBulkAction(actions2, data) { 30541 return (0, import_element74.useMemo)( 30542 () => data.some((item) => hasAPossibleBulkAction(actions2, item)), 30543 [actions2, data] 30544 ); 30545 } 30546 function BulkSelectionCheckbox({ 30547 selection, 30548 onChangeSelection, 30549 data, 30550 actions: actions2, 30551 getItemId: getItemId2, 30552 disableSelectAll = false 30553 }) { 30554 const selectableItems = (0, import_element74.useMemo)(() => { 30555 return data.filter((item) => { 30556 return actions2.some( 30557 (action) => action.supportsBulk && (!action.isEligible || action.isEligible(item)) 30558 ); 30559 }); 30560 }, [data, actions2]); 30561 const selectedItems = data.filter( 30562 (item) => selection.includes(getItemId2(item)) && selectableItems.includes(item) 30563 ); 30564 const hasSelection = selection.length > 0; 30565 const areAllSelected = selectedItems.length === selectableItems.length; 30566 if (disableSelectAll) { 30567 return /* @__PURE__ */ (0, import_jsx_runtime179.jsx)( 30568 import_components29.CheckboxControl, 30569 { 30570 className: "dataviews-view-table-selection-checkbox", 30571 checked: hasSelection, 30572 disabled: !hasSelection, 30573 onChange: () => { 30574 onChangeSelection([]); 30575 }, 30576 "aria-label": (0, import_i18n83.__)("Deselect all") 30577 } 30578 ); 30579 } 30580 return /* @__PURE__ */ (0, import_jsx_runtime179.jsx)( 30581 import_components29.CheckboxControl, 30582 { 30583 className: "dataviews-view-table-selection-checkbox", 30584 checked: areAllSelected, 30585 indeterminate: !areAllSelected && !!selectedItems.length, 30586 onChange: () => { 30587 if (areAllSelected) { 30588 onChangeSelection([]); 30589 } else { 30590 onChangeSelection( 30591 selectableItems.map((item) => getItemId2(item)) 30592 ); 30593 } 30594 }, 30595 "aria-label": areAllSelected ? (0, import_i18n83.__)("Deselect all") : (0, import_i18n83.__)("Select all") 30596 } 30597 ); 30598 } 30599 30600 // packages/dataviews/build-module/components/dataviews-layouts/table/column-header-menu.mjs 30601 var import_i18n84 = __toESM(require_i18n(), 1); 30602 var import_components30 = __toESM(require_components(), 1); 30603 var import_element75 = __toESM(require_element(), 1); 30604 30605 // packages/dataviews/build-module/utils/get-hideable-fields.mjs 30606 function getHideableFields(view, fields2) { 30607 const togglableFields = [ 30608 view?.titleField, 30609 view?.mediaField, 30610 view?.descriptionField 30611 ].filter(Boolean); 30612 return fields2.filter( 30613 (f3) => !togglableFields.includes(f3.id) && f3.type !== "media" && f3.enableHiding !== false 30614 ); 30615 } 30616 30617 // packages/dataviews/build-module/components/dataviews-layouts/table/column-header-menu.mjs 30618 var import_jsx_runtime180 = __toESM(require_jsx_runtime(), 1); 30619 var { Menu: Menu2 } = unlock5(import_components30.privateApis); 30620 function WithMenuSeparators({ children }) { 30621 return import_element75.Children.toArray(children).filter(Boolean).map((child, i3) => /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)(import_element75.Fragment, { children: [ 30622 i3 > 0 && /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(Menu2.Separator, {}), 30623 child 30624 ] }, i3)); 30625 } 30626 var _HeaderMenu = (0, import_element75.forwardRef)(function HeaderMenu({ 30627 fieldId, 30628 view, 30629 fields: fields2, 30630 onChangeView, 30631 onHide, 30632 setOpenedFilter, 30633 canMove = true, 30634 canInsertLeft = true, 30635 canInsertRight = true 30636 }, ref) { 30637 const visibleFieldIds = view.fields ?? []; 30638 const index2 = visibleFieldIds?.indexOf(fieldId); 30639 const isSorted = view.sort?.field === fieldId; 30640 let isHidable = false; 30641 let isSortable = false; 30642 let canAddFilter = false; 30643 let operators = []; 30644 const field = fields2.find((f3) => f3.id === fieldId); 30645 const { setIsShowingFilter } = (0, import_element75.useContext)(dataviews_context_default); 30646 if (!field) { 30647 return null; 30648 } 30649 isHidable = field.enableHiding !== false; 30650 isSortable = field.enableSorting !== false; 30651 const header = field.header; 30652 operators = !!field.filterBy && field.filterBy?.operators || []; 30653 canAddFilter = !view.filters?.some((_filter) => fieldId === _filter.field) && !!(field.hasElements || field.Edit) && field.filterBy !== false && !field.filterBy?.isPrimary; 30654 if (!isSortable && !canMove && !isHidable && !canAddFilter) { 30655 return header; 30656 } 30657 const hiddenFields = getHideableFields(view, fields2).filter( 30658 (f3) => !visibleFieldIds.includes(f3.id) 30659 ); 30660 const canInsert = (canInsertLeft || canInsertRight) && !!hiddenFields.length; 30661 const isRtl = (0, import_i18n84.isRTL)(); 30662 return /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)(Menu2, { children: [ 30663 /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)( 30664 Menu2.TriggerButton, 30665 { 30666 render: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)( 30667 import_components30.Button, 30668 { 30669 size: "compact", 30670 className: "dataviews-view-table-header-button", 30671 ref, 30672 variant: "tertiary" 30673 } 30674 ), 30675 children: [ 30676 header, 30677 view.sort && isSorted && /* @__PURE__ */ (0, import_jsx_runtime180.jsx)("span", { "aria-hidden": "true", children: sortArrows[view.sort.direction] }) 30678 ] 30679 } 30680 ), 30681 /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(Menu2.Popover, { style: { minWidth: "240px" }, children: /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)(WithMenuSeparators, { children: [ 30682 isSortable && /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(Menu2.Group, { children: SORTING_DIRECTIONS.map( 30683 (direction) => { 30684 const isChecked = view.sort && isSorted && view.sort.direction === direction; 30685 const value = `$fieldId}-$direction}`; 30686 return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)( 30687 Menu2.RadioItem, 30688 { 30689 name: "view-table-sorting", 30690 value, 30691 checked: isChecked, 30692 onChange: () => { 30693 onChangeView({ 30694 ...view, 30695 sort: { 30696 field: fieldId, 30697 direction 30698 }, 30699 showLevels: false 30700 }); 30701 }, 30702 children: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(Menu2.ItemLabel, { children: sortLabels[direction] }) 30703 }, 30704 value 30705 ); 30706 } 30707 ) }), 30708 canAddFilter && /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(Menu2.Group, { children: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)( 30709 Menu2.Item, 30710 { 30711 prefix: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_components30.Icon, { icon: funnel_default }), 30712 onClick: () => { 30713 setOpenedFilter(fieldId); 30714 setIsShowingFilter(true); 30715 onChangeView({ 30716 ...view, 30717 page: 1, 30718 filters: [ 30719 ...view.filters || [], 30720 { 30721 field: fieldId, 30722 value: void 0, 30723 operator: operators[0] 30724 } 30725 ] 30726 }); 30727 }, 30728 children: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(Menu2.ItemLabel, { children: (0, import_i18n84.__)("Add filter") }) 30729 } 30730 ) }), 30731 (canMove || isHidable || canInsert) && field && /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)(Menu2.Group, { children: [ 30732 canMove && /* @__PURE__ */ (0, import_jsx_runtime180.jsx)( 30733 Menu2.Item, 30734 { 30735 prefix: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_components30.Icon, { icon: arrow_left_default }), 30736 disabled: isRtl ? index2 >= visibleFieldIds.length - 1 : index2 < 1, 30737 onClick: () => { 30738 const targetIndex = isRtl ? index2 + 1 : index2 - 1; 30739 const newFields = [ 30740 ...visibleFieldIds 30741 ]; 30742 newFields.splice(index2, 1); 30743 newFields.splice( 30744 targetIndex, 30745 0, 30746 fieldId 30747 ); 30748 onChangeView({ 30749 ...view, 30750 fields: newFields 30751 }); 30752 }, 30753 children: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(Menu2.ItemLabel, { children: (0, import_i18n84.__)("Move left") }) 30754 } 30755 ), 30756 canMove && /* @__PURE__ */ (0, import_jsx_runtime180.jsx)( 30757 Menu2.Item, 30758 { 30759 prefix: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_components30.Icon, { icon: arrow_right_default }), 30760 disabled: isRtl ? index2 < 1 : index2 >= visibleFieldIds.length - 1, 30761 onClick: () => { 30762 const targetIndex = isRtl ? index2 - 1 : index2 + 1; 30763 const newFields = [ 30764 ...visibleFieldIds 30765 ]; 30766 newFields.splice(index2, 1); 30767 newFields.splice( 30768 targetIndex, 30769 0, 30770 fieldId 30771 ); 30772 onChangeView({ 30773 ...view, 30774 fields: newFields 30775 }); 30776 }, 30777 children: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(Menu2.ItemLabel, { children: (0, import_i18n84.__)("Move right") }) 30778 } 30779 ), 30780 canInsertLeft && !!hiddenFields.length && /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)(Menu2, { children: [ 30781 /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(Menu2.SubmenuTriggerItem, { children: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(Menu2.ItemLabel, { children: (0, import_i18n84.__)("Insert left") }) }), 30782 /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(Menu2.Popover, { children: hiddenFields.map((hiddenField) => { 30783 const insertIndex = isRtl ? index2 + 1 : index2; 30784 return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)( 30785 Menu2.Item, 30786 { 30787 onClick: () => { 30788 onChangeView({ 30789 ...view, 30790 fields: [ 30791 ...visibleFieldIds.slice( 30792 0, 30793 insertIndex 30794 ), 30795 hiddenField.id, 30796 ...visibleFieldIds.slice( 30797 insertIndex 30798 ) 30799 ] 30800 }); 30801 }, 30802 children: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(Menu2.ItemLabel, { children: hiddenField.label }) 30803 }, 30804 hiddenField.id 30805 ); 30806 }) }) 30807 ] }), 30808 canInsertRight && !!hiddenFields.length && /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)(Menu2, { children: [ 30809 /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(Menu2.SubmenuTriggerItem, { children: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(Menu2.ItemLabel, { children: (0, import_i18n84.__)("Insert right") }) }), 30810 /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(Menu2.Popover, { children: hiddenFields.map((hiddenField) => { 30811 const insertIndex = isRtl ? index2 : index2 + 1; 30812 return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)( 30813 Menu2.Item, 30814 { 30815 onClick: () => { 30816 onChangeView({ 30817 ...view, 30818 fields: [ 30819 ...visibleFieldIds.slice( 30820 0, 30821 insertIndex 30822 ), 30823 hiddenField.id, 30824 ...visibleFieldIds.slice( 30825 insertIndex 30826 ) 30827 ] 30828 }); 30829 }, 30830 children: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(Menu2.ItemLabel, { children: hiddenField.label }) 30831 }, 30832 hiddenField.id 30833 ); 30834 }) }) 30835 ] }), 30836 isHidable && field && /* @__PURE__ */ (0, import_jsx_runtime180.jsx)( 30837 Menu2.Item, 30838 { 30839 prefix: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_components30.Icon, { icon: unseen_default }), 30840 onClick: () => { 30841 onHide(field); 30842 onChangeView({ 30843 ...view, 30844 fields: visibleFieldIds.filter( 30845 (id) => id !== fieldId 30846 ) 30847 }); 30848 }, 30849 children: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(Menu2.ItemLabel, { children: (0, import_i18n84.__)("Hide column") }) 30850 } 30851 ) 30852 ] }) 30853 ] }) }) 30854 ] }); 30855 }); 30856 var ColumnHeaderMenu = _HeaderMenu; 30857 var column_header_menu_default = ColumnHeaderMenu; 30858 30859 // packages/dataviews/build-module/components/dataviews-layouts/utils/item-click-wrapper.mjs 30860 var import_element76 = __toESM(require_element(), 1); 30861 var import_jsx_runtime181 = __toESM(require_jsx_runtime(), 1); 30862 function getClickableItemProps({ 30863 item, 30864 isItemClickable: isItemClickable2, 30865 onClickItem, 30866 className 30867 }) { 30868 if (!isItemClickable2(item) || !onClickItem) { 30869 return { className }; 30870 } 30871 return { 30872 className: className ? `$className} $className}--clickable` : void 0, 30873 role: "button", 30874 tabIndex: 0, 30875 onClick: (event) => { 30876 event.stopPropagation(); 30877 onClickItem(item); 30878 }, 30879 onKeyDown: (event) => { 30880 if (event.key === "Enter" || event.key === "" || event.key === " ") { 30881 event.stopPropagation(); 30882 onClickItem(item); 30883 } 30884 } 30885 }; 30886 } 30887 function ItemClickWrapper({ 30888 item, 30889 isItemClickable: isItemClickable2, 30890 onClickItem, 30891 renderItemLink, 30892 className, 30893 children, 30894 ...extraProps 30895 }) { 30896 if (!isItemClickable2(item)) { 30897 return /* @__PURE__ */ (0, import_jsx_runtime181.jsx)("div", { className, ...extraProps, children }); 30898 } 30899 if (renderItemLink) { 30900 const renderedElement = renderItemLink({ 30901 item, 30902 className: `$className} $className}--clickable`, 30903 ...extraProps, 30904 children 30905 }); 30906 return (0, import_element76.cloneElement)(renderedElement, { 30907 onClick: (event) => { 30908 event.stopPropagation(); 30909 if (renderedElement.props.onClick) { 30910 renderedElement.props.onClick(event); 30911 } 30912 }, 30913 onKeyDown: (event) => { 30914 if (event.key === "Enter" || event.key === "" || event.key === " ") { 30915 event.stopPropagation(); 30916 if (renderedElement.props.onKeyDown) { 30917 renderedElement.props.onKeyDown(event); 30918 } 30919 } 30920 } 30921 }); 30922 } 30923 const clickProps = getClickableItemProps({ 30924 item, 30925 isItemClickable: isItemClickable2, 30926 onClickItem, 30927 className 30928 }); 30929 return /* @__PURE__ */ (0, import_jsx_runtime181.jsx)("div", { ...clickProps, ...extraProps, children }); 30930 } 30931 30932 // packages/dataviews/build-module/components/dataviews-layouts/table/column-primary.mjs 30933 var import_jsx_runtime182 = __toESM(require_jsx_runtime(), 1); 30934 function ColumnPrimary({ 30935 item, 30936 level, 30937 titleField: titleField2, 30938 mediaField, 30939 descriptionField: descriptionField3, 30940 onClickItem, 30941 renderItemLink, 30942 isItemClickable: isItemClickable2 30943 }) { 30944 return /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)(Stack, { direction: "row", gap: "md", align: "flex-start", justify: "flex-start", children: [ 30945 mediaField && /* @__PURE__ */ (0, import_jsx_runtime182.jsx)( 30946 ItemClickWrapper, 30947 { 30948 item, 30949 isItemClickable: isItemClickable2, 30950 onClickItem, 30951 renderItemLink, 30952 className: "dataviews-view-table__cell-content-wrapper dataviews-column-primary__media", 30953 "aria-label": isItemClickable2(item) && (!!onClickItem || !!renderItemLink) && !!titleField2 ? titleField2.getValue?.({ item }) : void 0, 30954 children: /* @__PURE__ */ (0, import_jsx_runtime182.jsx)( 30955 mediaField.render, 30956 { 30957 item, 30958 field: mediaField, 30959 config: { sizes: "32px" } 30960 } 30961 ) 30962 } 30963 ), 30964 /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)( 30965 Stack, 30966 { 30967 direction: "column", 30968 align: "flex-start", 30969 className: "dataviews-view-table__primary-column-content", 30970 children: [ 30971 titleField2 && /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)( 30972 ItemClickWrapper, 30973 { 30974 item, 30975 isItemClickable: isItemClickable2, 30976 onClickItem, 30977 renderItemLink, 30978 className: "dataviews-view-table__cell-content-wrapper dataviews-title-field", 30979 children: [ 30980 level !== void 0 && level > 0 && /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)("span", { className: "dataviews-view-table__level", children: [ 30981 Array(level).fill("\u2014").join(" "), 30982 "\xA0" 30983 ] }), 30984 /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(titleField2.render, { item, field: titleField2 }) 30985 ] 30986 } 30987 ), 30988 descriptionField3 && /* @__PURE__ */ (0, import_jsx_runtime182.jsx)( 30989 descriptionField3.render, 30990 { 30991 item, 30992 field: descriptionField3 30993 } 30994 ) 30995 ] 30996 } 30997 ) 30998 ] }); 30999 } 31000 var column_primary_default = ColumnPrimary; 31001 31002 // packages/dataviews/build-module/components/dataviews-layouts/table/use-scroll-state.mjs 31003 var import_element77 = __toESM(require_element(), 1); 31004 var import_i18n85 = __toESM(require_i18n(), 1); 31005 var isScrolledToEnd = (element) => { 31006 if ((0, import_i18n85.isRTL)()) { 31007 const scrollLeft = Math.abs(element.scrollLeft); 31008 return scrollLeft <= 1; 31009 } 31010 return element.scrollLeft + element.clientWidth >= element.scrollWidth - 1; 31011 }; 31012 function useScrollState({ 31013 scrollContainerRef, 31014 enabledHorizontal = false 31015 }) { 31016 const [isHorizontalScrollEnd, setIsHorizontalScrollEnd] = (0, import_element77.useState)(false); 31017 const [isVerticallyScrolled, setIsVerticallyScrolled] = (0, import_element77.useState)(false); 31018 const handleScroll = (0, import_element77.useCallback)(() => { 31019 const scrollContainer = scrollContainerRef.current; 31020 if (!scrollContainer) { 31021 return; 31022 } 31023 if (enabledHorizontal) { 31024 setIsHorizontalScrollEnd(isScrolledToEnd(scrollContainer)); 31025 } 31026 setIsVerticallyScrolled(scrollContainer.scrollTop > 0); 31027 }, [scrollContainerRef, enabledHorizontal]); 31028 (0, import_element77.useEffect)(() => { 31029 if (typeof window === "undefined" || !scrollContainerRef.current) { 31030 return () => { 31031 }; 31032 } 31033 const scrollContainer = scrollContainerRef.current; 31034 handleScroll(); 31035 scrollContainer.addEventListener("scroll", handleScroll); 31036 window.addEventListener("resize", handleScroll); 31037 return () => { 31038 scrollContainer.removeEventListener("scroll", handleScroll); 31039 window.removeEventListener("resize", handleScroll); 31040 }; 31041 }, [scrollContainerRef, enabledHorizontal, handleScroll]); 31042 return { isHorizontalScrollEnd, isVerticallyScrolled }; 31043 } 31044 31045 // packages/dataviews/build-module/components/dataviews-layouts/utils/get-data-by-group.mjs 31046 function getDataByGroup(data, groupByField) { 31047 return data.reduce((groups, item) => { 31048 const groupName = groupByField.getValue({ item }); 31049 if (!groups.has(groupName)) { 31050 groups.set(groupName, []); 31051 } 31052 groups.get(groupName)?.push(item); 31053 return groups; 31054 }, /* @__PURE__ */ new Map()); 31055 } 31056 31057 // packages/dataviews/build-module/components/dataviews-layouts/utils/use-selection-props.mjs 31058 var import_element78 = __toESM(require_element(), 1); 31059 var import_keycodes = __toESM(require_keycodes(), 1); 31060 function getRange(orderedIds, fromIndex, toIndex) { 31061 return orderedIds.slice( 31062 Math.min(fromIndex, toIndex), 31063 Math.max(fromIndex, toIndex) + 1 31064 ); 31065 } 31066 function getRangeSelection({ 31067 anchorId, 31068 targetId, 31069 lastTargetId, 31070 orderedIds, 31071 selection 31072 }) { 31073 const targetIndex = orderedIds.indexOf(targetId); 31074 if (targetIndex === -1) { 31075 return selection; 31076 } 31077 const anchorIndex = anchorId === null ? -1 : orderedIds.indexOf(anchorId); 31078 const hasAnchor = anchorIndex !== -1; 31079 const rangeStart = hasAnchor ? anchorIndex : targetIndex; 31080 const lastTargetIndex = hasAnchor && lastTargetId !== null ? orderedIds.indexOf(lastTargetId) : -1; 31081 const lastRange = lastTargetIndex === -1 ? [] : getRange(orderedIds, rangeStart, lastTargetIndex); 31082 const base = selection.filter((id) => !lastRange.includes(id)); 31083 return [ 31084 .../* @__PURE__ */ new Set([ 31085 ...base, 31086 ...getRange(orderedIds, rangeStart, targetIndex) 31087 ]) 31088 ]; 31089 } 31090 function getClosestSelectedId({ 31091 targetId, 31092 orderedIds, 31093 selection 31094 }) { 31095 const targetIndex = orderedIds.indexOf(targetId); 31096 if (targetIndex === -1) { 31097 return null; 31098 } 31099 const selectedIds = new Set(selection); 31100 let closestId = null; 31101 let closestDistance = Infinity; 31102 orderedIds.forEach((id, index2) => { 31103 if (!selectedIds.has(id)) { 31104 return; 31105 } 31106 const distance2 = Math.abs(index2 - targetIndex); 31107 if (distance2 < closestDistance) { 31108 closestDistance = distance2; 31109 closestId = id; 31110 } 31111 }); 31112 return closestId; 31113 } 31114 function useSelectionProps({ 31115 data, 31116 actions: actions2, 31117 getItemId: getItemId2, 31118 selection, 31119 onChangeSelection 31120 }) { 31121 const gestureRef = (0, import_element78.useRef)(null); 31122 const isTouchDeviceRef = (0, import_element78.useRef)(false); 31123 (0, import_element78.useEffect)(() => { 31124 const markTouchDevice = () => { 31125 isTouchDeviceRef.current = true; 31126 }; 31127 document.addEventListener("touchstart", markTouchDevice, { 31128 once: true 31129 }); 31130 return () => document.removeEventListener("touchstart", markTouchDevice); 31131 }, []); 31132 const selectableIds = data.filter((item) => hasAPossibleBulkAction(actions2, item)).map(getItemId2); 31133 const selectableIdSet = new Set(selectableIds); 31134 const hasSelectableItems = selectableIds.length > 0; 31135 const getSelectionProps = (id) => { 31136 const isSelectable = selectableIdSet.has(id); 31137 return { 31138 onMouseDown: (event) => { 31139 if (event.button === 0 && event.shiftKey && hasSelectableItems) { 31140 event.preventDefault(); 31141 } 31142 }, 31143 onClickCapture: (event) => { 31144 if (!hasSelectableItems) { 31145 return; 31146 } 31147 const isModifierKeyPressed = (0, import_keycodes.isAppleOS)() ? event.metaKey : event.ctrlKey; 31148 const isSelectionCheckboxClick = event.target instanceof Element && !!event.target.closest(`.$SELECTION_CHECKBOX_CLASS}`); 31149 if (!isModifierKeyPressed && !event.shiftKey) { 31150 if (isSelectable && isSelectionCheckboxClick) { 31151 gestureRef.current = { 31152 anchorId: id, 31153 lastTargetId: null 31154 }; 31155 } 31156 return; 31157 } 31158 if (isTouchDeviceRef.current || document.getSelection()?.type === "Range") { 31159 return; 31160 } 31161 event.stopPropagation(); 31162 if (!isSelectionCheckboxClick) { 31163 event.preventDefault(); 31164 } 31165 if (!isSelectable) { 31166 return; 31167 } 31168 if (event.shiftKey) { 31169 let gesture = gestureRef.current; 31170 if (!gesture || !selectableIdSet.has(gesture.anchorId)) { 31171 gesture = { 31172 anchorId: getClosestSelectedId({ 31173 targetId: id, 31174 orderedIds: selectableIds, 31175 selection 31176 }) ?? id, 31177 lastTargetId: null 31178 }; 31179 } 31180 onChangeSelection( 31181 getRangeSelection({ 31182 anchorId: gesture.anchorId, 31183 targetId: id, 31184 lastTargetId: gesture.lastTargetId, 31185 orderedIds: selectableIds, 31186 selection 31187 }) 31188 ); 31189 gestureRef.current = { 31190 anchorId: gesture.anchorId, 31191 lastTargetId: id 31192 }; 31193 } else { 31194 onChangeSelection( 31195 selection.includes(id) ? selection.filter((itemId) => id !== itemId) : [...selection, id] 31196 ); 31197 gestureRef.current = { anchorId: id, lastTargetId: null }; 31198 } 31199 } 31200 }; 31201 }; 31202 return { getSelectionProps }; 31203 } 31204 31205 // packages/dataviews/build-module/components/dataviews-view-config/properties-section.mjs 31206 var import_components31 = __toESM(require_components(), 1); 31207 var import_i18n86 = __toESM(require_i18n(), 1); 31208 var import_element79 = __toESM(require_element(), 1); 31209 var import_jsx_runtime183 = __toESM(require_jsx_runtime(), 1); 31210 function FieldItem({ 31211 field, 31212 isVisible: isVisible2, 31213 onToggleVisibility 31214 }) { 31215 return /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(import_components31.__experimentalItem, { onClick: field.enableHiding ? onToggleVisibility : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime183.jsxs)(Stack, { direction: "row", gap: "sm", justify: "flex-start", align: "center", children: [ 31216 /* @__PURE__ */ (0, import_jsx_runtime183.jsx)("div", { style: { height: 24, width: 24 }, children: isVisible2 && /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(import_components31.Icon, { icon: check_default }) }), 31217 /* @__PURE__ */ (0, import_jsx_runtime183.jsx)("span", { className: "dataviews-view-config__label", children: field.label }) 31218 ] }) }); 31219 } 31220 function isDefined(item) { 31221 return !!item; 31222 } 31223 function PropertiesSection({ 31224 showLabel = true 31225 }) { 31226 const { view, fields: fields2, onChangeView } = (0, import_element79.useContext)(dataviews_context_default); 31227 const regularFields = getHideableFields(view, fields2); 31228 if (!regularFields?.length) { 31229 return null; 31230 } 31231 const titleField2 = fields2.find((f3) => f3.id === view.titleField); 31232 const previewField = fields2.find((f3) => f3.id === view.mediaField); 31233 const descriptionField3 = fields2.find( 31234 (f3) => f3.id === view.descriptionField 31235 ); 31236 const lockedFields = [ 31237 { 31238 field: titleField2, 31239 isVisibleFlag: "showTitle" 31240 }, 31241 { 31242 field: previewField, 31243 isVisibleFlag: "showMedia" 31244 }, 31245 { 31246 field: descriptionField3, 31247 isVisibleFlag: "showDescription" 31248 } 31249 ].filter(({ field }) => isDefined(field)); 31250 const visibleFieldIds = view.fields ?? []; 31251 const visibleRegularFieldsCount = regularFields.filter( 31252 (f3) => visibleFieldIds.includes(f3.id) 31253 ).length; 31254 const visibleLockedFields = lockedFields.filter( 31255 ({ isVisibleFlag }) => ( 31256 // @ts-expect-error 31257 view[isVisibleFlag] ?? true 31258 ) 31259 ); 31260 const totalVisibleFields = visibleLockedFields.length + visibleRegularFieldsCount; 31261 const isSingleVisibleLockedField = totalVisibleFields === 1 && visibleLockedFields.length === 1; 31262 return /* @__PURE__ */ (0, import_jsx_runtime183.jsxs)(Stack, { direction: "column", className: "dataviews-field-control", children: [ 31263 showLabel && /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(import_components31.BaseControl.VisualLabel, { children: (0, import_i18n86.__)("Properties") }), 31264 /* @__PURE__ */ (0, import_jsx_runtime183.jsx)( 31265 Stack, 31266 { 31267 direction: "column", 31268 className: "dataviews-view-config__properties", 31269 children: /* @__PURE__ */ (0, import_jsx_runtime183.jsxs)(import_components31.__experimentalItemGroup, { isBordered: true, isSeparated: true, size: "medium", children: [ 31270 lockedFields.map(({ field, isVisibleFlag }) => { 31271 const isVisible2 = view[isVisibleFlag] ?? true; 31272 const fieldToRender = isSingleVisibleLockedField && isVisible2 ? { ...field, enableHiding: false } : field; 31273 return /* @__PURE__ */ (0, import_jsx_runtime183.jsx)( 31274 FieldItem, 31275 { 31276 field: fieldToRender, 31277 isVisible: isVisible2, 31278 onToggleVisibility: () => { 31279 onChangeView({ 31280 ...view, 31281 [isVisibleFlag]: !isVisible2 31282 }); 31283 } 31284 }, 31285 field.id 31286 ); 31287 }), 31288 regularFields.map((field) => { 31289 const isVisible2 = visibleFieldIds.includes(field.id); 31290 const fieldToRender = totalVisibleFields === 1 && isVisible2 ? { ...field, enableHiding: false } : field; 31291 return /* @__PURE__ */ (0, import_jsx_runtime183.jsx)( 31292 FieldItem, 31293 { 31294 field: fieldToRender, 31295 isVisible: isVisible2, 31296 onToggleVisibility: () => { 31297 onChangeView({ 31298 ...view, 31299 fields: isVisible2 ? visibleFieldIds.filter( 31300 (fieldId) => fieldId !== field.id 31301 ) : [...visibleFieldIds, field.id] 31302 }); 31303 } 31304 }, 31305 field.id 31306 ); 31307 }) 31308 ] }) 31309 } 31310 ) 31311 ] }); 31312 } 31313 31314 // packages/dataviews/build-module/hooks/use-delayed-loading.mjs 31315 var import_element80 = __toESM(require_element(), 1); 31316 function useDelayedLoading(isLoading, options = { delay: 400 }) { 31317 const [showLoader, setShowLoader] = (0, import_element80.useState)(false); 31318 (0, import_element80.useEffect)(() => { 31319 if (!isLoading) { 31320 return; 31321 } 31322 const timeout = setTimeout(() => { 31323 setShowLoader(true); 31324 }, options.delay); 31325 return () => { 31326 clearTimeout(timeout); 31327 setShowLoader(false); 31328 }; 31329 }, [isLoading, options.delay]); 31330 return showLoader; 31331 } 31332 31333 // packages/dataviews/build-module/components/dataviews-layouts/table/index.mjs 31334 var import_jsx_runtime184 = __toESM(require_jsx_runtime(), 1); 31335 function getEffectiveAlign(explicitAlign, fieldType) { 31336 if (explicitAlign) { 31337 return explicitAlign; 31338 } 31339 if (fieldType === "integer" || fieldType === "number") { 31340 return "end"; 31341 } 31342 return void 0; 31343 } 31344 function TableColumnField({ 31345 item, 31346 fields: fields2, 31347 column, 31348 align 31349 }) { 31350 const field = fields2.find((f3) => f3.id === column); 31351 if (!field) { 31352 return null; 31353 } 31354 const className = clsx_default("dataviews-view-table__cell-content-wrapper", { 31355 "dataviews-view-table__cell-align-end": align === "end", 31356 "dataviews-view-table__cell-align-center": align === "center" 31357 }); 31358 return /* @__PURE__ */ (0, import_jsx_runtime184.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(field.render, { item, field }) }); 31359 } 31360 function TableRow({ 31361 hasBulkActions, 31362 item, 31363 level, 31364 actions: actions2, 31365 fields: fields2, 31366 id, 31367 view, 31368 titleField: titleField2, 31369 mediaField, 31370 descriptionField: descriptionField3, 31371 selection, 31372 getItemId: getItemId2, 31373 isItemClickable: isItemClickable2, 31374 onClickItem, 31375 renderItemLink, 31376 onChangeSelection, 31377 onMouseDown, 31378 onClickCapture, 31379 isActionsColumnSticky, 31380 posinset 31381 }) { 31382 const { paginationInfo } = (0, import_element81.useContext)(dataviews_context_default); 31383 const hasPossibleBulkAction = useHasAPossibleBulkAction(actions2, item); 31384 const isSelected2 = hasPossibleBulkAction && selection.includes(id); 31385 const { 31386 showTitle = true, 31387 showMedia = true, 31388 showDescription = true, 31389 infiniteScrollEnabled 31390 } = view; 31391 const columns = view.fields ?? []; 31392 const hasPrimaryColumn = titleField2 && showTitle || mediaField && showMedia || descriptionField3 && showDescription; 31393 return /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)( 31394 "tr", 31395 { 31396 className: clsx_default("dataviews-view-table__row", { 31397 "is-selected": hasPossibleBulkAction && isSelected2, 31398 "has-bulk-actions": hasPossibleBulkAction 31399 }), 31400 "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0, 31401 "aria-posinset": posinset, 31402 role: infiniteScrollEnabled ? "article" : void 0, 31403 onClickCapture, 31404 onMouseDown: (event) => { 31405 const isMetaClick = (0, import_keycodes2.isAppleOS)() ? event.metaKey : event.ctrlKey; 31406 if (event.button === 0 && isMetaClick && window.navigator.userAgent.toLowerCase().includes("firefox")) { 31407 event.preventDefault(); 31408 } 31409 onMouseDown(event); 31410 }, 31411 children: [ 31412 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime184.jsx)("td", { className: "dataviews-view-table__checkbox-column", children: /* @__PURE__ */ (0, import_jsx_runtime184.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime184.jsx)( 31413 DataViewsSelectionCheckbox, 31414 { 31415 item, 31416 selection, 31417 onChangeSelection, 31418 getItemId: getItemId2, 31419 titleField: titleField2, 31420 disabled: !hasPossibleBulkAction 31421 } 31422 ) }) }), 31423 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime184.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime184.jsx)( 31424 column_primary_default, 31425 { 31426 item, 31427 level, 31428 titleField: showTitle ? titleField2 : void 0, 31429 mediaField: showMedia ? mediaField : void 0, 31430 descriptionField: showDescription ? descriptionField3 : void 0, 31431 isItemClickable: isItemClickable2, 31432 onClickItem, 31433 renderItemLink 31434 } 31435 ) }), 31436 columns.map((column) => { 31437 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {}; 31438 const field = fields2.find((f3) => f3.id === column); 31439 const effectiveAlign = getEffectiveAlign(align, field?.type); 31440 return /* @__PURE__ */ (0, import_jsx_runtime184.jsx)( 31441 "td", 31442 { 31443 style: { 31444 width, 31445 maxWidth, 31446 minWidth 31447 }, 31448 children: /* @__PURE__ */ (0, import_jsx_runtime184.jsx)( 31449 TableColumnField, 31450 { 31451 fields: fields2, 31452 item, 31453 column, 31454 align: effectiveAlign 31455 } 31456 ) 31457 }, 31458 column 31459 ); 31460 }), 31461 !!actions2?.length && // Disable reason: we are not making the element interactive, 31462 // but preventing any click events from bubbling up to the 31463 // table row. This allows us to add a click handler to the row 31464 // itself (to toggle row selection) without erroneously 31465 // intercepting click events from ItemActions. 31466 /* @__PURE__ */ (0, import_jsx_runtime184.jsx)( 31467 "td", 31468 { 31469 className: clsx_default("dataviews-view-table__actions-column", { 31470 "dataviews-view-table__actions-column--sticky": true, 31471 "dataviews-view-table__actions-column--stuck": isActionsColumnSticky 31472 }), 31473 onClick: (e3) => e3.stopPropagation(), 31474 children: /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(ItemActions, { item, actions: actions2 }) 31475 } 31476 ) 31477 ] 31478 } 31479 ); 31480 } 31481 function ViewTable({ 31482 actions: actions2, 31483 data, 31484 fields: fields2, 31485 getItemId: getItemId2, 31486 getItemLevel, 31487 isLoading = false, 31488 onChangeView, 31489 onChangeSelection, 31490 selection, 31491 setOpenedFilter, 31492 onClickItem, 31493 isItemClickable: isItemClickable2, 31494 renderItemLink, 31495 view, 31496 className, 31497 empty 31498 }) { 31499 const { containerRef } = (0, import_element81.useContext)(dataviews_context_default); 31500 const isDelayedLoading = useDelayedLoading(isLoading); 31501 const groupField = view.groupBy?.field ? fields2.find((f3) => f3.id === view.groupBy?.field) : null; 31502 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 31503 const orderedData = dataByGroup ? Array.from(dataByGroup.values()).flat() : data; 31504 const { getSelectionProps } = useSelectionProps({ 31505 data: orderedData, 31506 actions: actions2, 31507 getItemId: getItemId2, 31508 selection, 31509 onChangeSelection 31510 }); 31511 const headerMenuRefs = (0, import_element81.useRef)(/* @__PURE__ */ new Map()); 31512 const headerMenuToFocusRef = (0, import_element81.useRef)(void 0); 31513 const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0, import_element81.useState)(); 31514 const [contextMenuAnchor, setContextMenuAnchor] = (0, import_element81.useState)(null); 31515 (0, import_element81.useEffect)(() => { 31516 if (headerMenuToFocusRef.current) { 31517 headerMenuToFocusRef.current.focus(); 31518 headerMenuToFocusRef.current = void 0; 31519 } 31520 }); 31521 const tableNoticeId = (0, import_element81.useId)(); 31522 const { isHorizontalScrollEnd, isVerticallyScrolled } = useScrollState({ 31523 scrollContainerRef: containerRef, 31524 enabledHorizontal: !!actions2?.length 31525 }); 31526 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions2, data); 31527 if (nextHeaderMenuToFocus) { 31528 headerMenuToFocusRef.current = nextHeaderMenuToFocus; 31529 setNextHeaderMenuToFocus(void 0); 31530 return; 31531 } 31532 const onHide = (field) => { 31533 const hidden = headerMenuRefs.current.get(field.id); 31534 const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : void 0; 31535 setNextHeaderMenuToFocus(fallback?.node); 31536 }; 31537 const handleHeaderContextMenu = (event) => { 31538 event.preventDefault(); 31539 event.stopPropagation(); 31540 const virtualAnchor = { 31541 getBoundingClientRect: () => ({ 31542 x: event.clientX, 31543 y: event.clientY, 31544 top: event.clientY, 31545 left: event.clientX, 31546 right: event.clientX, 31547 bottom: event.clientY, 31548 width: 0, 31549 height: 0, 31550 toJSON: () => ({}) 31551 }) 31552 }; 31553 window.requestAnimationFrame(() => { 31554 setContextMenuAnchor(virtualAnchor); 31555 }); 31556 }; 31557 const hasData = !!data?.length; 31558 const titleField2 = fields2.find((field) => field.id === view.titleField); 31559 const mediaField = fields2.find((field) => field.id === view.mediaField); 31560 const descriptionField3 = fields2.find( 31561 (field) => field.id === view.descriptionField 31562 ); 31563 const { showTitle = true, showMedia = true, showDescription = true } = view; 31564 const hasPrimaryColumn = titleField2 && showTitle || mediaField && showMedia || descriptionField3 && showDescription; 31565 const columns = view.fields ?? []; 31566 const headerMenuRef = (column, index2) => (node) => { 31567 if (node) { 31568 headerMenuRefs.current.set(column, { 31569 node, 31570 fallback: columns[index2 > 0 ? index2 - 1 : 1] 31571 }); 31572 } else { 31573 headerMenuRefs.current.delete(column); 31574 } 31575 }; 31576 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 31577 const isRtl = (0, import_i18n87.isRTL)(); 31578 if (!hasData) { 31579 return /* @__PURE__ */ (0, import_jsx_runtime184.jsx)( 31580 "div", 31581 { 31582 className: clsx_default("dataviews-no-results", { 31583 "is-refreshing": isDelayedLoading 31584 }), 31585 id: tableNoticeId, 31586 children: empty 31587 } 31588 ); 31589 } 31590 return /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)(import_jsx_runtime184.Fragment, { children: [ 31591 /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)( 31592 "table", 31593 { 31594 className: clsx_default("dataviews-view-table", className, { 31595 [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes( 31596 view.layout.density 31597 ), 31598 "has-bulk-actions": hasBulkActions, 31599 "is-refreshing": !isInfiniteScroll && isDelayedLoading 31600 }), 31601 "aria-busy": isLoading, 31602 "aria-describedby": tableNoticeId, 31603 role: isInfiniteScroll ? "feed" : void 0, 31604 inert: !isInfiniteScroll && isLoading ? "true" : void 0, 31605 children: [ 31606 /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)("colgroup", { children: [ 31607 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime184.jsx)("col", { className: "dataviews-view-table__col-checkbox" }), 31608 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime184.jsx)("col", { className: "dataviews-view-table__col-first-data" }), 31609 columns.map((column, index2) => /* @__PURE__ */ (0, import_jsx_runtime184.jsx)( 31610 "col", 31611 { 31612 className: clsx_default( 31613 `dataviews-view-table__col-$column}`, 31614 { 31615 "dataviews-view-table__col-expand": !hasPrimaryColumn && index2 === columns.length - 1 31616 } 31617 ) 31618 }, 31619 `col-$column}` 31620 )), 31621 !!actions2?.length && /* @__PURE__ */ (0, import_jsx_runtime184.jsx)("col", { className: "dataviews-view-table__col-actions" }) 31622 ] }), 31623 contextMenuAnchor && /* @__PURE__ */ (0, import_jsx_runtime184.jsx)( 31624 import_components32.Popover, 31625 { 31626 anchor: contextMenuAnchor, 31627 onClose: () => setContextMenuAnchor(null), 31628 placement: "bottom-start", 31629 children: /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(PropertiesSection, { showLabel: false }) 31630 } 31631 ), 31632 /* @__PURE__ */ (0, import_jsx_runtime184.jsx)( 31633 "thead", 31634 { 31635 className: clsx_default({ 31636 "dataviews-view-table__thead--stuck": isVerticallyScrolled 31637 }), 31638 onContextMenu: handleHeaderContextMenu, 31639 children: /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)("tr", { className: "dataviews-view-table__row", children: [ 31640 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime184.jsx)( 31641 "th", 31642 { 31643 className: "dataviews-view-table__checkbox-column", 31644 scope: "col", 31645 onContextMenu: handleHeaderContextMenu, 31646 children: /* @__PURE__ */ (0, import_jsx_runtime184.jsx)( 31647 BulkSelectionCheckbox, 31648 { 31649 selection, 31650 onChangeSelection, 31651 data, 31652 actions: actions2, 31653 getItemId: getItemId2 31654 } 31655 ) 31656 } 31657 ), 31658 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime184.jsx)("th", { scope: "col", children: titleField2 && /* @__PURE__ */ (0, import_jsx_runtime184.jsx)( 31659 column_header_menu_default, 31660 { 31661 ref: headerMenuRef( 31662 titleField2.id, 31663 0 31664 ), 31665 fieldId: titleField2.id, 31666 view, 31667 fields: fields2, 31668 onChangeView, 31669 onHide, 31670 setOpenedFilter, 31671 canMove: false, 31672 canInsertLeft: isRtl ? view.layout?.enableMoving ?? true : false, 31673 canInsertRight: isRtl ? false : view.layout?.enableMoving ?? true 31674 } 31675 ) }), 31676 columns.map((column, index2) => { 31677 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {}; 31678 const field = fields2.find( 31679 (f3) => f3.id === column 31680 ); 31681 const effectiveAlign = getEffectiveAlign( 31682 align, 31683 field?.type 31684 ); 31685 const canInsertOrMove = view.layout?.enableMoving ?? true; 31686 return /* @__PURE__ */ (0, import_jsx_runtime184.jsx)( 31687 "th", 31688 { 31689 style: { 31690 width, 31691 maxWidth, 31692 minWidth, 31693 textAlign: effectiveAlign 31694 }, 31695 "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0, 31696 scope: "col", 31697 children: /* @__PURE__ */ (0, import_jsx_runtime184.jsx)( 31698 column_header_menu_default, 31699 { 31700 ref: headerMenuRef(column, index2), 31701 fieldId: column, 31702 view, 31703 fields: fields2, 31704 onChangeView, 31705 onHide, 31706 setOpenedFilter, 31707 canMove: canInsertOrMove, 31708 canInsertLeft: canInsertOrMove, 31709 canInsertRight: canInsertOrMove 31710 } 31711 ) 31712 }, 31713 column 31714 ); 31715 }), 31716 !!actions2?.length && /* @__PURE__ */ (0, import_jsx_runtime184.jsx)( 31717 "th", 31718 { 31719 className: clsx_default( 31720 "dataviews-view-table__actions-column", 31721 { 31722 "dataviews-view-table__actions-column--sticky": true, 31723 "dataviews-view-table__actions-column--stuck": !isHorizontalScrollEnd 31724 } 31725 ), 31726 children: /* @__PURE__ */ (0, import_jsx_runtime184.jsx)("span", { className: "dataviews-view-table-header", children: (0, import_i18n87.__)("Actions") }) 31727 } 31728 ) 31729 ] }) 31730 } 31731 ), 31732 hasData && groupField && dataByGroup ? Array.from(dataByGroup.entries()).map( 31733 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)("tbody", { children: [ 31734 /* @__PURE__ */ (0, import_jsx_runtime184.jsx)("tr", { className: "dataviews-view-table__group-header-row", children: /* @__PURE__ */ (0, import_jsx_runtime184.jsx)( 31735 "td", 31736 { 31737 colSpan: columns.length + (hasPrimaryColumn ? 1 : 0) + (hasBulkActions ? 1 : 0) + (actions2?.length ? 1 : 0), 31738 className: "dataviews-view-table__group-header-cell", 31739 children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n87.sprintf)( 31740 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 31741 (0, import_i18n87.__)("%1$s: %2$s"), 31742 groupField.label, 31743 groupName 31744 ) 31745 } 31746 ) }), 31747 groupItems.map((item, index2) => { 31748 const id = getItemId2(item) || index2.toString(); 31749 return /* @__PURE__ */ (0, import_jsx_runtime184.jsx)( 31750 TableRow, 31751 { 31752 item, 31753 level: view.showLevels && typeof getItemLevel === "function" ? getItemLevel(item) : void 0, 31754 hasBulkActions, 31755 actions: actions2, 31756 fields: fields2, 31757 id, 31758 view, 31759 titleField: titleField2, 31760 mediaField, 31761 descriptionField: descriptionField3, 31762 selection, 31763 getItemId: getItemId2, 31764 onChangeSelection, 31765 ...getSelectionProps(id), 31766 onClickItem, 31767 renderItemLink, 31768 isItemClickable: isItemClickable2, 31769 isActionsColumnSticky: !isHorizontalScrollEnd 31770 }, 31771 getItemId2(item) 31772 ); 31773 }) 31774 ] }, `group-$groupName}`) 31775 ) : /* @__PURE__ */ (0, import_jsx_runtime184.jsx)("tbody", { children: hasData && data.map((item, index2) => { 31776 const id = getItemId2(item) || index2.toString(); 31777 return /* @__PURE__ */ (0, import_jsx_runtime184.jsx)( 31778 TableRow, 31779 { 31780 item, 31781 level: view.showLevels && typeof getItemLevel === "function" ? getItemLevel(item) : void 0, 31782 hasBulkActions, 31783 actions: actions2, 31784 fields: fields2, 31785 id, 31786 view, 31787 titleField: titleField2, 31788 mediaField, 31789 descriptionField: descriptionField3, 31790 selection, 31791 getItemId: getItemId2, 31792 onChangeSelection, 31793 ...getSelectionProps(id), 31794 onClickItem, 31795 renderItemLink, 31796 isItemClickable: isItemClickable2, 31797 isActionsColumnSticky: !isHorizontalScrollEnd, 31798 posinset: isInfiniteScroll ? index2 + 1 : void 0 31799 }, 31800 getItemId2(item) 31801 ); 31802 }) }) 31803 ] 31804 } 31805 ), 31806 isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime184.jsx)("div", { className: "dataviews-loading", id: tableNoticeId, children: /* @__PURE__ */ (0, import_jsx_runtime184.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(import_components32.Spinner, {}) }) }) 31807 ] }); 31808 } 31809 var table_default = ViewTable; 31810 31811 // packages/dataviews/build-module/components/dataviews-layouts/grid/index.mjs 31812 var import_components35 = __toESM(require_components(), 1); 31813 var import_i18n90 = __toESM(require_i18n(), 1); 31814 31815 // packages/dataviews/build-module/components/dataviews-layouts/grid/composite-grid.mjs 31816 var import_components34 = __toESM(require_components(), 1); 31817 var import_i18n89 = __toESM(require_i18n(), 1); 31818 var import_compose9 = __toESM(require_compose(), 1); 31819 var import_element85 = __toESM(require_element(), 1); 31820 31821 // packages/dataviews/build-module/components/dataviews-layouts/grid/preview-size-picker.mjs 31822 var import_components33 = __toESM(require_components(), 1); 31823 var import_i18n88 = __toESM(require_i18n(), 1); 31824 var import_element82 = __toESM(require_element(), 1); 31825 var import_jsx_runtime185 = __toESM(require_jsx_runtime(), 1); 31826 var imageSizes = [ 31827 { 31828 value: 120, 31829 breakpoint: 1 31830 }, 31831 { 31832 value: 170, 31833 breakpoint: 1 31834 }, 31835 { 31836 value: 230, 31837 breakpoint: 1 31838 }, 31839 { 31840 value: 290, 31841 breakpoint: 1112 31842 // at minimum image width, 4 images display at this container size 31843 }, 31844 { 31845 value: 350, 31846 breakpoint: 1636 31847 // at minimum image width, 6 images display at this container size 31848 }, 31849 { 31850 value: 430, 31851 breakpoint: 588 31852 // at minimum image width, 2 images display at this container size 31853 } 31854 ]; 31855 var DEFAULT_PREVIEW_SIZE = imageSizes[2].value; 31856 function useGridColumns() { 31857 const context = (0, import_element82.useContext)(dataviews_context_default); 31858 const view = context.view; 31859 return (0, import_element82.useMemo)(() => { 31860 const containerWidth = context.containerWidth; 31861 const gap = 32; 31862 const previewSize = view.layout?.previewSize ?? DEFAULT_PREVIEW_SIZE; 31863 const columns = Math.floor( 31864 (containerWidth + gap) / (previewSize + gap) 31865 ); 31866 return Math.max(1, columns); 31867 }, [context.containerWidth, view.layout?.previewSize]); 31868 } 31869 31870 // packages/dataviews/build-module/components/dataviews-layouts/utils/grid-items.mjs 31871 var import_element83 = __toESM(require_element(), 1); 31872 var import_jsx_runtime186 = __toESM(require_jsx_runtime(), 1); 31873 var GridItems = (0, import_element83.forwardRef)(({ className, previewSize, ...props }, ref) => { 31874 return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)( 31875 "div", 31876 { 31877 ref, 31878 className: clsx_default("dataviews-view-grid-items", className), 31879 style: { 31880 gridTemplateColumns: previewSize && `repeat(auto-fill, minmax($previewSize}px, 1fr))` 31881 }, 31882 ...props 31883 } 31884 ); 31885 }); 31886 31887 // packages/dataviews/build-module/components/dataviews-layouts/utils/use-infinite-scroll.mjs 31888 var import_element84 = __toESM(require_element(), 1); 31889 function useIntersectionObserver(elementRef, posinset) { 31890 const { intersectionObserver } = (0, import_element84.useContext)(dataviews_context_default); 31891 (0, import_element84.useEffect)(() => { 31892 const element = elementRef.current; 31893 if (!element || posinset === void 0 || !intersectionObserver) { 31894 return; 31895 } 31896 intersectionObserver.observe(element); 31897 return () => { 31898 intersectionObserver.unobserve(element); 31899 }; 31900 }, [elementRef, intersectionObserver, posinset]); 31901 } 31902 function usePlaceholdersNeeded(data, isInfiniteScroll, gridColumns) { 31903 const hasData = !!data?.length; 31904 const firstItemPosition = hasData && isInfiniteScroll ? data[0].position : void 0; 31905 return firstItemPosition && gridColumns ? (firstItemPosition - 1) % gridColumns : 0; 31906 } 31907 31908 // packages/dataviews/build-module/components/dataviews-layouts/grid/composite-grid.mjs 31909 var import_jsx_runtime187 = __toESM(require_jsx_runtime(), 1); 31910 var { Badge: WCBadge2 } = unlock5(import_components34.privateApis); 31911 function chunk(array, size4) { 31912 const chunks = []; 31913 for (let i3 = 0, j2 = array.length; i3 < j2; i3 += size4) { 31914 chunks.push(array.slice(i3, i3 + size4)); 31915 } 31916 return chunks; 31917 } 31918 var GridItem = (0, import_element85.forwardRef)( 31919 function GridItem2({ 31920 view, 31921 selection, 31922 onChangeSelection, 31923 onClickItem, 31924 isItemClickable: isItemClickable2, 31925 renderItemLink, 31926 getItemId: getItemId2, 31927 item, 31928 actions: actions2, 31929 mediaField, 31930 titleField: titleField2, 31931 descriptionField: descriptionField3, 31932 regularFields, 31933 badgeFields, 31934 hasBulkActions, 31935 config: config2, 31936 posinset, 31937 setsize, 31938 ...props 31939 }, forwardedRef) { 31940 const { 31941 showTitle = true, 31942 showMedia = true, 31943 showDescription = true 31944 } = view; 31945 const hasBulkAction = useHasAPossibleBulkAction(actions2, item); 31946 const id = getItemId2(item); 31947 const elementRef = (0, import_element85.useRef)(null); 31948 const setRefs = (0, import_element85.useCallback)( 31949 (node) => { 31950 elementRef.current = node; 31951 if (typeof forwardedRef === "function") { 31952 forwardedRef(node); 31953 } else if (forwardedRef) { 31954 forwardedRef.current = node; 31955 } 31956 }, 31957 [forwardedRef] 31958 ); 31959 useIntersectionObserver(elementRef, posinset); 31960 const instanceId = (0, import_compose9.useInstanceId)(GridItem2); 31961 const isSelected2 = selection.includes(id); 31962 const mediaPlaceholder = /* @__PURE__ */ (0, import_jsx_runtime187.jsx)("span", { className: "dataviews-view-grid__media-placeholder" }); 31963 const rendersMediaField = showMedia && mediaField?.render; 31964 const renderedMediaField = rendersMediaField ? /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 31965 mediaField.render, 31966 { 31967 item, 31968 field: mediaField, 31969 config: config2 31970 } 31971 ) : mediaPlaceholder; 31972 const renderedTitleField = showTitle && titleField2?.render ? /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(titleField2.render, { item, field: titleField2 }) : null; 31973 let mediaA11yProps; 31974 let titleA11yProps; 31975 if (isItemClickable2(item) && onClickItem) { 31976 if (renderedTitleField) { 31977 mediaA11yProps = { 31978 "aria-labelledby": `dataviews-view-grid__title-field-$instanceId}` 31979 }; 31980 titleA11yProps = { 31981 id: `dataviews-view-grid__title-field-$instanceId}` 31982 }; 31983 } else { 31984 mediaA11yProps = { 31985 "aria-label": (0, import_i18n89.__)("Navigate to item") 31986 }; 31987 } 31988 } 31989 return /* @__PURE__ */ (0, import_jsx_runtime187.jsxs)( 31990 Stack, 31991 { 31992 direction: "column", 31993 ...props, 31994 ref: setRefs, 31995 "aria-setsize": setsize, 31996 "aria-posinset": posinset, 31997 className: clsx_default( 31998 props.className, 31999 "dataviews-view-grid__row__gridcell", 32000 "dataviews-view-grid__card", 32001 { 32002 "is-selected": hasBulkAction && isSelected2 32003 } 32004 ), 32005 children: [ 32006 /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32007 ItemClickWrapper, 32008 { 32009 item, 32010 isItemClickable: isItemClickable2, 32011 onClickItem, 32012 renderItemLink, 32013 className: clsx_default("dataviews-view-grid__media", { 32014 "dataviews-view-grid__media--placeholder": !rendersMediaField 32015 }), 32016 ...mediaA11yProps, 32017 children: renderedMediaField 32018 } 32019 ), 32020 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32021 DataViewsSelectionCheckbox, 32022 { 32023 item, 32024 selection, 32025 onChangeSelection, 32026 getItemId: getItemId2, 32027 titleField: titleField2, 32028 disabled: !hasBulkAction 32029 } 32030 ), 32031 !!actions2?.length && /* @__PURE__ */ (0, import_jsx_runtime187.jsx)("div", { className: "dataviews-view-grid__media-actions", children: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32032 ItemActions, 32033 { 32034 item, 32035 actions: actions2, 32036 isCompact: true 32037 } 32038 ) }), 32039 showTitle && /* @__PURE__ */ (0, import_jsx_runtime187.jsx)("div", { className: "dataviews-view-grid__title-actions", children: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32040 ItemClickWrapper, 32041 { 32042 item, 32043 isItemClickable: isItemClickable2, 32044 onClickItem, 32045 renderItemLink, 32046 className: "dataviews-view-grid__title-field dataviews-title-field", 32047 ...titleA11yProps, 32048 title: titleField2?.getValueFormatted({ 32049 item, 32050 field: titleField2 32051 }) || void 0, 32052 children: renderedTitleField 32053 } 32054 ) }), 32055 /* @__PURE__ */ (0, import_jsx_runtime187.jsxs)(Stack, { direction: "column", gap: "xs", children: [ 32056 showDescription && descriptionField3?.render && /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32057 descriptionField3.render, 32058 { 32059 item, 32060 field: descriptionField3 32061 } 32062 ), 32063 !!badgeFields?.length && /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32064 Stack, 32065 { 32066 direction: "row", 32067 className: "dataviews-view-grid__badge-fields", 32068 gap: "sm", 32069 wrap: "wrap", 32070 align: "top", 32071 justify: "flex-start", 32072 children: badgeFields.map((field) => { 32073 return /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32074 WCBadge2, 32075 { 32076 className: "dataviews-view-grid__field-value", 32077 children: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32078 field.render, 32079 { 32080 item, 32081 field 32082 } 32083 ) 32084 }, 32085 field.id 32086 ); 32087 }) 32088 } 32089 ), 32090 !!regularFields?.length && /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32091 Stack, 32092 { 32093 direction: "column", 32094 className: "dataviews-view-grid__fields", 32095 gap: "xs", 32096 children: regularFields.map((field) => { 32097 return /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32098 import_components34.Flex, 32099 { 32100 className: "dataviews-view-grid__field", 32101 gap: 1, 32102 justify: "flex-start", 32103 expanded: true, 32104 style: { height: "auto" }, 32105 direction: "row", 32106 children: /* @__PURE__ */ (0, import_jsx_runtime187.jsxs)(import_jsx_runtime187.Fragment, { children: [ 32107 /* @__PURE__ */ (0, import_jsx_runtime187.jsxs)(tooltip_exports.Root, { children: [ 32108 /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32109 tooltip_exports.Trigger, 32110 { 32111 render: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(import_components34.FlexItem, { className: "dataviews-view-grid__field-name", children: field.header }) 32112 } 32113 ), 32114 /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(tooltip_exports.Popup, { children: field.label }) 32115 ] }), 32116 /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32117 import_components34.FlexItem, 32118 { 32119 className: "dataviews-view-grid__field-value", 32120 style: { maxHeight: "none" }, 32121 children: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32122 field.render, 32123 { 32124 item, 32125 field 32126 } 32127 ) 32128 } 32129 ) 32130 ] }) 32131 }, 32132 field.id 32133 ); 32134 }) 32135 } 32136 ) 32137 ] }) 32138 ] 32139 } 32140 ); 32141 } 32142 ); 32143 function CompositeGrid({ 32144 data, 32145 isInfiniteScroll, 32146 className, 32147 inert, 32148 isLoading, 32149 view, 32150 fields: fields2, 32151 selection, 32152 onChangeSelection, 32153 onClickItem, 32154 isItemClickable: isItemClickable2, 32155 renderItemLink, 32156 getItemId: getItemId2, 32157 actions: actions2, 32158 getSelectionProps 32159 }) { 32160 const { paginationInfo, resizeObserverRef } = (0, import_element85.useContext)(dataviews_context_default); 32161 const gridColumns = useGridColumns(); 32162 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions2, data); 32163 const titleField2 = fields2.find( 32164 (field) => field.id === view?.titleField 32165 ); 32166 const mediaField = fields2.find( 32167 (field) => field.id === view?.mediaField 32168 ); 32169 const descriptionField3 = fields2.find( 32170 (field) => field.id === view?.descriptionField 32171 ); 32172 const otherFields = view.fields ?? []; 32173 const { regularFields, badgeFields } = otherFields.reduce( 32174 (accumulator, fieldId) => { 32175 const field = fields2.find((f3) => f3.id === fieldId); 32176 if (!field) { 32177 return accumulator; 32178 } 32179 const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields"; 32180 accumulator[key].push(field); 32181 return accumulator; 32182 }, 32183 { regularFields: [], badgeFields: [] } 32184 ); 32185 const size4 = "900px"; 32186 const totalRows = Math.ceil(data.length / gridColumns); 32187 const placeholdersNeeded = usePlaceholdersNeeded( 32188 data, 32189 isInfiniteScroll, 32190 gridColumns 32191 ); 32192 return /* @__PURE__ */ (0, import_jsx_runtime187.jsxs)(import_jsx_runtime187.Fragment, { 32193 // Render infinite scroll layout (no rows, feed semantics) 32194 children: [ 32195 isInfiniteScroll && /* @__PURE__ */ (0, import_jsx_runtime187.jsxs)( 32196 import_components34.Composite, 32197 { 32198 render: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32199 GridItems, 32200 { 32201 className: clsx_default( 32202 "dataviews-view-grid-infinite-scroll", 32203 className, 32204 { 32205 [`has-$view.layout?.density}-density`]: view.layout?.density && [ 32206 "compact", 32207 "comfortable" 32208 ].includes(view.layout.density) 32209 } 32210 ), 32211 previewSize: view.layout?.previewSize, 32212 "aria-busy": isLoading, 32213 ref: resizeObserverRef 32214 } 32215 ), 32216 role: "feed", 32217 focusWrap: true, 32218 inert, 32219 children: [ 32220 Array.from({ length: placeholdersNeeded }).map( 32221 (_, index2) => /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32222 import_components34.Composite.Item, 32223 { 32224 render: (props) => /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32225 Stack, 32226 { 32227 ...props, 32228 direction: "column", 32229 role: "article", 32230 className: "dataviews-view-grid__row__gridcell dataviews-view-grid__card dataviews-view-grid__placeholder" 32231 } 32232 ), 32233 "aria-hidden": true, 32234 tabIndex: -1 32235 }, 32236 `placeholder-$index2}` 32237 ) 32238 ), 32239 data.map((item) => { 32240 const itemId = getItemId2(item); 32241 const selectionProps = getSelectionProps(itemId); 32242 const stablePosition = item.position; 32243 return /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32244 import_components34.Composite.Item, 32245 { 32246 render: (props) => /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32247 GridItem, 32248 { 32249 ...props, 32250 id: itemId, 32251 role: "article", 32252 view, 32253 selection, 32254 onChangeSelection, 32255 onClickItem, 32256 isItemClickable: isItemClickable2, 32257 renderItemLink, 32258 getItemId: getItemId2, 32259 item, 32260 actions: actions2, 32261 onMouseDown: (event) => { 32262 props.onMouseDown?.(event); 32263 selectionProps.onMouseDown( 32264 event 32265 ); 32266 }, 32267 onClickCapture: (event) => { 32268 props.onClickCapture?.(event); 32269 selectionProps.onClickCapture( 32270 event 32271 ); 32272 }, 32273 mediaField, 32274 titleField: titleField2, 32275 descriptionField: descriptionField3, 32276 regularFields, 32277 badgeFields, 32278 hasBulkActions, 32279 posinset: stablePosition, 32280 setsize: paginationInfo.totalItems, 32281 config: { 32282 sizes: size4 32283 } 32284 } 32285 ) 32286 }, 32287 itemId 32288 ); 32289 }) 32290 ] 32291 } 32292 ), 32293 // Render standard grid layout (with rows, grid semantics) 32294 !isInfiniteScroll && /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32295 import_components34.Composite, 32296 { 32297 role: "grid", 32298 className: clsx_default("dataviews-view-grid", className, { 32299 [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes( 32300 view.layout.density 32301 ) 32302 }), 32303 focusWrap: true, 32304 "aria-busy": isLoading, 32305 "aria-rowcount": totalRows, 32306 ref: resizeObserverRef, 32307 inert, 32308 children: chunk(data, gridColumns).map((row, i3) => /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32309 import_components34.Composite.Row, 32310 { 32311 render: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32312 "div", 32313 { 32314 role: "row", 32315 "aria-rowindex": i3 + 1, 32316 "aria-label": (0, import_i18n89.sprintf)( 32317 /* translators: %d: The row number in the grid */ 32318 (0, import_i18n89.__)("Row %d"), 32319 i3 + 1 32320 ), 32321 className: "dataviews-view-grid__row", 32322 style: { 32323 gridTemplateColumns: `repeat( $gridColumns}, minmax(0, 1fr) )` 32324 } 32325 } 32326 ), 32327 children: row.map((item) => { 32328 const itemId = getItemId2(item); 32329 const selectionProps = getSelectionProps(itemId); 32330 return /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32331 import_components34.Composite.Item, 32332 { 32333 render: (props) => /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 32334 GridItem, 32335 { 32336 ...props, 32337 id: itemId, 32338 role: "gridcell", 32339 view, 32340 selection, 32341 onChangeSelection, 32342 onClickItem, 32343 isItemClickable: isItemClickable2, 32344 renderItemLink, 32345 getItemId: getItemId2, 32346 item, 32347 actions: actions2, 32348 onMouseDown: (event) => { 32349 props.onMouseDown?.( 32350 event 32351 ); 32352 selectionProps.onMouseDown( 32353 event 32354 ); 32355 }, 32356 onClickCapture: (event) => { 32357 props.onClickCapture?.( 32358 event 32359 ); 32360 selectionProps.onClickCapture( 32361 event 32362 ); 32363 }, 32364 mediaField, 32365 titleField: titleField2, 32366 descriptionField: descriptionField3, 32367 regularFields, 32368 badgeFields, 32369 hasBulkActions, 32370 config: { 32371 sizes: size4 32372 } 32373 } 32374 ) 32375 }, 32376 itemId 32377 ); 32378 }) 32379 }, 32380 i3 32381 )) 32382 } 32383 ) 32384 ] 32385 }); 32386 } 32387 32388 // packages/dataviews/build-module/components/dataviews-layouts/grid/index.mjs 32389 var import_jsx_runtime188 = __toESM(require_jsx_runtime(), 1); 32390 function ViewGrid({ 32391 actions: actions2, 32392 data, 32393 fields: fields2, 32394 getItemId: getItemId2, 32395 isLoading, 32396 onChangeSelection, 32397 onClickItem, 32398 isItemClickable: isItemClickable2, 32399 renderItemLink, 32400 selection, 32401 view, 32402 className, 32403 empty 32404 }) { 32405 const isDelayedLoading = useDelayedLoading(!!isLoading); 32406 const hasData = !!data?.length; 32407 const groupField = view.groupBy?.field ? fields2.find((f3) => f3.id === view.groupBy?.field) : null; 32408 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 32409 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 32410 const orderedData = dataByGroup ? Array.from(dataByGroup.values()).flat() : data; 32411 const { getSelectionProps } = useSelectionProps({ 32412 data: orderedData, 32413 actions: actions2, 32414 getItemId: getItemId2, 32415 selection, 32416 onChangeSelection 32417 }); 32418 if (!hasData) { 32419 return /* @__PURE__ */ (0, import_jsx_runtime188.jsx)( 32420 "div", 32421 { 32422 className: clsx_default("dataviews-no-results", { 32423 "is-refreshing": isDelayedLoading 32424 }), 32425 children: empty 32426 } 32427 ); 32428 } 32429 const gridProps = { 32430 className: clsx_default(className, { 32431 "is-refreshing": !isInfiniteScroll && isDelayedLoading 32432 }), 32433 inert: !isInfiniteScroll && !!isLoading ? "true" : void 0, 32434 isLoading, 32435 view, 32436 fields: fields2, 32437 selection, 32438 onChangeSelection, 32439 onClickItem, 32440 isItemClickable: isItemClickable2, 32441 renderItemLink, 32442 getItemId: getItemId2, 32443 actions: actions2, 32444 getSelectionProps 32445 }; 32446 return /* @__PURE__ */ (0, import_jsx_runtime188.jsxs)(import_jsx_runtime188.Fragment, { 32447 // Render multiple groups. 32448 children: [ 32449 hasData && groupField && dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime188.jsx)(Stack, { direction: "column", gap: "lg", children: Array.from(dataByGroup.entries()).map( 32450 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime188.jsxs)( 32451 Stack, 32452 { 32453 direction: "column", 32454 gap: "sm", 32455 children: [ 32456 /* @__PURE__ */ (0, import_jsx_runtime188.jsx)("h3", { className: "dataviews-view-grid__group-header", children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n90.sprintf)( 32457 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 32458 (0, import_i18n90.__)("%1$s: %2$s"), 32459 groupField.label, 32460 groupName 32461 ) }), 32462 /* @__PURE__ */ (0, import_jsx_runtime188.jsx)( 32463 CompositeGrid, 32464 { 32465 ...gridProps, 32466 data: groupItems, 32467 isInfiniteScroll: false 32468 } 32469 ) 32470 ] 32471 }, 32472 groupName 32473 ) 32474 ) }), 32475 // Render a single grid with all data. 32476 !dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime188.jsx)( 32477 CompositeGrid, 32478 { 32479 ...gridProps, 32480 data, 32481 isInfiniteScroll: !!isInfiniteScroll 32482 } 32483 ), 32484 isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime188.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime188.jsx)(import_components35.Spinner, {}) }) 32485 ] 32486 }); 32487 } 32488 var grid_default = ViewGrid; 32489 32490 // packages/dataviews/build-module/components/dataviews-layouts/list/index.mjs 32491 var import_compose10 = __toESM(require_compose(), 1); 32492 var import_components36 = __toESM(require_components(), 1); 32493 var import_element86 = __toESM(require_element(), 1); 32494 var import_i18n91 = __toESM(require_i18n(), 1); 32495 var import_data35 = __toESM(require_data(), 1); 32496 var import_jsx_runtime189 = __toESM(require_jsx_runtime(), 1); 32497 var { Menu: Menu3 } = unlock5(import_components36.privateApis); 32498 function generateItemWrapperCompositeId(idPrefix) { 32499 return `$idPrefix}-item-wrapper`; 32500 } 32501 function generatePrimaryActionCompositeId(idPrefix, primaryActionId) { 32502 return `$idPrefix}-primary-action-$primaryActionId}`; 32503 } 32504 function generateDropdownTriggerCompositeId(idPrefix) { 32505 return `$idPrefix}-dropdown`; 32506 } 32507 function PrimaryActionGridCell({ 32508 idPrefix, 32509 primaryAction, 32510 item 32511 }) { 32512 const registry = (0, import_data35.useRegistry)(); 32513 const [isModalOpen, setIsModalOpen] = (0, import_element86.useState)(false); 32514 const compositeItemId = generatePrimaryActionCompositeId( 32515 idPrefix, 32516 primaryAction.id 32517 ); 32518 const label = typeof primaryAction.label === "string" ? primaryAction.label : primaryAction.label([item]); 32519 return "RenderModal" in primaryAction ? /* @__PURE__ */ (0, import_jsx_runtime189.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32520 import_components36.Composite.Item, 32521 { 32522 id: compositeItemId, 32523 render: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32524 import_components36.Button, 32525 { 32526 disabled: !!primaryAction.disabled, 32527 accessibleWhenDisabled: true, 32528 text: label, 32529 size: "small", 32530 onClick: () => setIsModalOpen(true) 32531 } 32532 ), 32533 children: isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32534 ActionModal, 32535 { 32536 action: primaryAction, 32537 items: [item], 32538 closeModal: () => setIsModalOpen(false) 32539 } 32540 ) 32541 } 32542 ) }, primaryAction.id) : /* @__PURE__ */ (0, import_jsx_runtime189.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32543 import_components36.Composite.Item, 32544 { 32545 id: compositeItemId, 32546 render: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32547 import_components36.Button, 32548 { 32549 disabled: !!primaryAction.disabled, 32550 accessibleWhenDisabled: true, 32551 size: "small", 32552 onClick: () => { 32553 primaryAction.callback([item], { registry }); 32554 }, 32555 children: label 32556 } 32557 ) 32558 } 32559 ) }, primaryAction.id); 32560 } 32561 function ListItem({ 32562 view, 32563 actions: actions2, 32564 idPrefix, 32565 isSelected: isSelected2, 32566 item, 32567 titleField: titleField2, 32568 mediaField, 32569 descriptionField: descriptionField3, 32570 onSelect, 32571 otherFields, 32572 onDropdownTriggerKeyDown, 32573 posinset 32574 }) { 32575 const { 32576 showTitle = true, 32577 showMedia = true, 32578 showDescription = true, 32579 infiniteScrollEnabled 32580 } = view; 32581 const itemRef = (0, import_element86.useRef)(null); 32582 const labelId = `$idPrefix}-label`; 32583 const descriptionId = `$idPrefix}-description`; 32584 const registry = (0, import_data35.useRegistry)(); 32585 const [isHovered, setIsHovered] = (0, import_element86.useState)(false); 32586 const [activeModalAction, setActiveModalAction] = (0, import_element86.useState)( 32587 null 32588 ); 32589 const handleHover = ({ type }) => { 32590 const isHover = type === "mouseenter"; 32591 setIsHovered(isHover); 32592 }; 32593 const { paginationInfo } = (0, import_element86.useContext)(dataviews_context_default); 32594 (0, import_element86.useEffect)(() => { 32595 if (isSelected2) { 32596 itemRef.current?.scrollIntoView({ 32597 behavior: "auto", 32598 block: "nearest", 32599 inline: "nearest" 32600 }); 32601 } 32602 }, [isSelected2]); 32603 const { primaryAction, eligibleActions } = (0, import_element86.useMemo)(() => { 32604 const _eligibleActions = actions2.filter( 32605 (action) => !action.isEligible || action.isEligible(item) 32606 ); 32607 const _primaryActions = _eligibleActions.filter( 32608 (action) => action.isPrimary 32609 ); 32610 return { 32611 primaryAction: _primaryActions[0], 32612 eligibleActions: _eligibleActions 32613 }; 32614 }, [actions2, item]); 32615 const hasOnlyOnePrimaryAction = primaryAction && actions2.length === 1; 32616 const renderedMediaField = showMedia && mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime189.jsx)("div", { className: "dataviews-view-list__media-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32617 mediaField.render, 32618 { 32619 item, 32620 field: mediaField, 32621 config: { sizes: "52px" } 32622 } 32623 ) }) : null; 32624 const renderedTitleField = showTitle && titleField2?.render ? /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(titleField2.render, { item, field: titleField2 }) : null; 32625 const renderDescription = showDescription && descriptionField3?.render; 32626 const hasOnlyMediaAndTitle = !!renderedMediaField && !renderDescription && !otherFields.length; 32627 const usedActions = eligibleActions?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime189.jsxs)( 32628 Stack, 32629 { 32630 direction: "row", 32631 gap: "md", 32632 className: "dataviews-view-list__item-actions", 32633 children: [ 32634 primaryAction && /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32635 PrimaryActionGridCell, 32636 { 32637 idPrefix, 32638 primaryAction, 32639 item 32640 } 32641 ), 32642 !hasOnlyOnePrimaryAction && /* @__PURE__ */ (0, import_jsx_runtime189.jsxs)("div", { role: "gridcell", children: [ 32643 /* @__PURE__ */ (0, import_jsx_runtime189.jsxs)(Menu3, { placement: "bottom-end", children: [ 32644 /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32645 Menu3.TriggerButton, 32646 { 32647 render: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32648 import_components36.Composite.Item, 32649 { 32650 id: generateDropdownTriggerCompositeId( 32651 idPrefix 32652 ), 32653 render: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32654 import_components36.Button, 32655 { 32656 size: "small", 32657 icon: more_vertical_default, 32658 label: (0, import_i18n91.__)("Actions"), 32659 accessibleWhenDisabled: true, 32660 disabled: !actions2.length, 32661 onKeyDown: onDropdownTriggerKeyDown 32662 } 32663 ) 32664 } 32665 ) 32666 } 32667 ), 32668 /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(Menu3.Popover, { children: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32669 ActionsMenuGroup, 32670 { 32671 actions: eligibleActions, 32672 item, 32673 registry, 32674 setActiveModalAction 32675 } 32676 ) }) 32677 ] }), 32678 !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32679 ActionModal, 32680 { 32681 action: activeModalAction, 32682 items: [item], 32683 closeModal: () => setActiveModalAction(null) 32684 } 32685 ) 32686 ] }) 32687 ] 32688 } 32689 ); 32690 return /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32691 import_components36.Composite.Row, 32692 { 32693 ref: itemRef, 32694 render: ( 32695 /* aria-posinset breaks Composite.Row if passed to it directly. */ 32696 /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32697 "div", 32698 { 32699 "aria-posinset": posinset, 32700 "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0 32701 } 32702 ) 32703 ), 32704 role: infiniteScrollEnabled ? "article" : "row", 32705 className: clsx_default({ 32706 "is-selected": isSelected2, 32707 "is-hovered": isHovered 32708 }), 32709 onMouseEnter: handleHover, 32710 onMouseLeave: handleHover, 32711 children: /* @__PURE__ */ (0, import_jsx_runtime189.jsxs)( 32712 Stack, 32713 { 32714 direction: "row", 32715 className: "dataviews-view-list__item-wrapper", 32716 children: [ 32717 /* @__PURE__ */ (0, import_jsx_runtime189.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32718 import_components36.Composite.Item, 32719 { 32720 id: generateItemWrapperCompositeId(idPrefix), 32721 "aria-pressed": isSelected2, 32722 "aria-labelledby": labelId, 32723 "aria-describedby": descriptionId, 32724 className: "dataviews-view-list__item", 32725 onClick: () => onSelect(item) 32726 } 32727 ) }), 32728 /* @__PURE__ */ (0, import_jsx_runtime189.jsxs)( 32729 Stack, 32730 { 32731 direction: "row", 32732 gap: "md", 32733 justify: "start", 32734 align: hasOnlyMediaAndTitle ? "center" : "flex-start", 32735 style: { flex: 1, minWidth: 0 }, 32736 children: [ 32737 renderedMediaField, 32738 /* @__PURE__ */ (0, import_jsx_runtime189.jsxs)( 32739 Stack, 32740 { 32741 direction: "column", 32742 gap: "xs", 32743 className: "dataviews-view-list__field-wrapper", 32744 children: [ 32745 /* @__PURE__ */ (0, import_jsx_runtime189.jsxs)(Stack, { direction: "row", align: "center", children: [ 32746 /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32747 "div", 32748 { 32749 className: "dataviews-title-field dataviews-view-list__title-field", 32750 id: labelId, 32751 children: renderedTitleField 32752 } 32753 ), 32754 usedActions 32755 ] }), 32756 renderDescription && /* @__PURE__ */ (0, import_jsx_runtime189.jsx)("div", { className: "dataviews-view-list__field", children: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32757 descriptionField3.render, 32758 { 32759 item, 32760 field: descriptionField3 32761 } 32762 ) }), 32763 /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32764 "div", 32765 { 32766 className: "dataviews-view-list__fields", 32767 id: descriptionId, 32768 children: otherFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime189.jsxs)( 32769 "div", 32770 { 32771 className: "dataviews-view-list__field", 32772 children: [ 32773 /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32774 VisuallyHidden, 32775 { 32776 className: "dataviews-view-list__field-label", 32777 render: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)("span", {}), 32778 children: field.label 32779 } 32780 ), 32781 /* @__PURE__ */ (0, import_jsx_runtime189.jsx)("span", { className: "dataviews-view-list__field-value", children: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32782 field.render, 32783 { 32784 item, 32785 field 32786 } 32787 ) }) 32788 ] 32789 }, 32790 field.id 32791 )) 32792 } 32793 ) 32794 ] 32795 } 32796 ) 32797 ] 32798 } 32799 ) 32800 ] 32801 } 32802 ) 32803 } 32804 ); 32805 } 32806 function isDefined2(item) { 32807 return !!item; 32808 } 32809 function ViewList(props) { 32810 const { 32811 actions: actions2, 32812 data, 32813 fields: fields2, 32814 getItemId: getItemId2, 32815 isLoading, 32816 onChangeSelection, 32817 selection, 32818 view, 32819 className, 32820 empty 32821 } = props; 32822 const baseId = (0, import_compose10.useInstanceId)(ViewList, "view-list"); 32823 const isDelayedLoading = useDelayedLoading(!!isLoading); 32824 const { paginationInfo } = (0, import_element86.useContext)(dataviews_context_default); 32825 const selectedItem = data?.findLast( 32826 (item) => selection.includes(getItemId2(item)) 32827 ); 32828 const titleField2 = fields2.find((field) => field.id === view.titleField); 32829 const mediaField = fields2.find((field) => field.id === view.mediaField); 32830 const descriptionField3 = fields2.find( 32831 (field) => field.id === view.descriptionField 32832 ); 32833 const otherFields = (view?.fields ?? []).map((fieldId) => fields2.find((f3) => fieldId === f3.id)).filter(isDefined2); 32834 const onSelect = (item) => onChangeSelection([getItemId2(item)]); 32835 const generateCompositeItemIdPrefix = (0, import_element86.useCallback)( 32836 (item) => `$baseId}-$getItemId2(item)}`, 32837 [baseId, getItemId2] 32838 ); 32839 const isActiveCompositeItem = (0, import_element86.useCallback)( 32840 (item, idToCheck) => { 32841 return idToCheck.startsWith( 32842 generateCompositeItemIdPrefix(item) 32843 ); 32844 }, 32845 [generateCompositeItemIdPrefix] 32846 ); 32847 const [activeCompositeId, setActiveCompositeId] = (0, import_element86.useState)(void 0); 32848 const compositeRef = (0, import_element86.useRef)(null); 32849 (0, import_element86.useEffect)(() => { 32850 if (selectedItem) { 32851 setActiveCompositeId( 32852 generateItemWrapperCompositeId( 32853 generateCompositeItemIdPrefix(selectedItem) 32854 ) 32855 ); 32856 } 32857 }, [selectedItem, generateCompositeItemIdPrefix]); 32858 const activeItemIndex = data.findIndex( 32859 (item) => isActiveCompositeItem(item, activeCompositeId ?? "") 32860 ); 32861 const previousActiveItemIndex = (0, import_compose10.usePrevious)(activeItemIndex); 32862 const isActiveIdInList = activeItemIndex !== -1; 32863 const selectCompositeItem = (0, import_element86.useCallback)( 32864 (targetIndex, generateCompositeId) => { 32865 const clampedIndex = Math.min( 32866 data.length - 1, 32867 Math.max(0, targetIndex) 32868 ); 32869 if (!data[clampedIndex]) { 32870 return; 32871 } 32872 const itemIdPrefix = generateCompositeItemIdPrefix( 32873 data[clampedIndex] 32874 ); 32875 const targetCompositeItemId = generateCompositeId(itemIdPrefix); 32876 setActiveCompositeId(targetCompositeItemId); 32877 if (compositeRef.current?.contains( 32878 compositeRef.current.ownerDocument.activeElement 32879 )) { 32880 document.getElementById(targetCompositeItemId)?.focus(); 32881 } 32882 }, 32883 [data, generateCompositeItemIdPrefix] 32884 ); 32885 (0, import_element86.useEffect)(() => { 32886 const wasActiveIdInList = previousActiveItemIndex !== void 0 && previousActiveItemIndex !== -1; 32887 if (!isActiveIdInList && wasActiveIdInList) { 32888 selectCompositeItem( 32889 previousActiveItemIndex, 32890 generateItemWrapperCompositeId 32891 ); 32892 } 32893 }, [isActiveIdInList, selectCompositeItem, previousActiveItemIndex]); 32894 const onDropdownTriggerKeyDown = (0, import_element86.useCallback)( 32895 (event) => { 32896 if (event.key === "ArrowDown") { 32897 event.preventDefault(); 32898 selectCompositeItem( 32899 activeItemIndex + 1, 32900 generateDropdownTriggerCompositeId 32901 ); 32902 } 32903 if (event.key === "ArrowUp") { 32904 event.preventDefault(); 32905 selectCompositeItem( 32906 activeItemIndex - 1, 32907 generateDropdownTriggerCompositeId 32908 ); 32909 } 32910 }, 32911 [selectCompositeItem, activeItemIndex] 32912 ); 32913 const hasData = !!data?.length; 32914 const groupField = view.groupBy?.field ? fields2.find((field) => field.id === view.groupBy?.field) : null; 32915 const dataByGroup = hasData && groupField ? getDataByGroup(data, groupField) : null; 32916 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 32917 const hasMoreItems = isInfiniteScroll && (view.startPosition ?? 1) + (view.perPage ?? 0) < paginationInfo.totalItems; 32918 const listClassName = clsx_default("dataviews-view-list", className, { 32919 [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(view.layout.density), 32920 "is-refreshing": !isInfiniteScroll && isDelayedLoading 32921 }); 32922 const compositeProps = { 32923 ref: compositeRef, 32924 id: baseId, 32925 render: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)("div", {}), 32926 activeId: activeCompositeId, 32927 setActiveId: setActiveCompositeId, 32928 inert: !isInfiniteScroll && !!isLoading ? "true" : void 0 32929 }; 32930 if (!hasData) { 32931 return /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32932 "div", 32933 { 32934 className: clsx_default("dataviews-no-results", { 32935 "is-refreshing": isDelayedLoading 32936 }), 32937 children: empty 32938 } 32939 ); 32940 } 32941 if (hasData && groupField && dataByGroup) { 32942 return /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32943 import_components36.Composite, 32944 { 32945 ...compositeProps, 32946 className: "dataviews-view-list__group", 32947 role: "grid", 32948 children: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(Stack, { direction: "column", gap: "lg", className: listClassName, children: Array.from(dataByGroup.entries()).map( 32949 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime189.jsxs)(Stack, { direction: "column", children: [ 32950 /* @__PURE__ */ (0, import_jsx_runtime189.jsx)("h3", { className: "dataviews-view-list__group-header", children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n91.sprintf)( 32951 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 32952 (0, import_i18n91.__)("%1$s: %2$s"), 32953 groupField.label, 32954 groupName 32955 ) }), 32956 groupItems.map((item) => { 32957 const id = generateCompositeItemIdPrefix(item); 32958 return /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32959 ListItem, 32960 { 32961 view, 32962 idPrefix: id, 32963 actions: actions2, 32964 item, 32965 isSelected: item === selectedItem, 32966 onSelect, 32967 mediaField, 32968 titleField: titleField2, 32969 descriptionField: descriptionField3, 32970 otherFields, 32971 onDropdownTriggerKeyDown 32972 }, 32973 id 32974 ); 32975 }) 32976 ] }, groupName) 32977 ) }) 32978 } 32979 ); 32980 } 32981 return /* @__PURE__ */ (0, import_jsx_runtime189.jsxs)(import_jsx_runtime189.Fragment, { children: [ 32982 /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32983 import_components36.Composite, 32984 { 32985 ...compositeProps, 32986 className: listClassName, 32987 role: view.infiniteScrollEnabled ? "feed" : "grid", 32988 children: data.map((item, index2) => { 32989 const id = generateCompositeItemIdPrefix(item); 32990 return /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32991 ListItem, 32992 { 32993 view, 32994 idPrefix: id, 32995 actions: actions2, 32996 item, 32997 isSelected: item === selectedItem, 32998 onSelect, 32999 mediaField, 33000 titleField: titleField2, 33001 descriptionField: descriptionField3, 33002 otherFields, 33003 onDropdownTriggerKeyDown, 33004 posinset: view.infiniteScrollEnabled ? index2 + 1 : void 0 33005 }, 33006 id 33007 ); 33008 }) 33009 } 33010 ), 33011 (hasMoreItems || isInfiniteScroll && isLoading) && // Keep the spinner's height reserved while loading more so the 33012 // scroll position doesn't bounce. Hidden, and silent to a11y, 33013 // while idle. 33014 /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 33015 "p", 33016 { 33017 className: "dataviews-loading-more", 33018 "aria-hidden": !isLoading, 33019 children: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(import_components36.Spinner, {}) 33020 } 33021 ) 33022 ] }); 33023 } 33024 33025 // packages/dataviews/build-module/components/dataviews-layouts/activity/index.mjs 33026 var import_components37 = __toESM(require_components(), 1); 33027 33028 // packages/dataviews/build-module/components/dataviews-layouts/activity/activity-group.mjs 33029 var import_i18n92 = __toESM(require_i18n(), 1); 33030 var import_element87 = __toESM(require_element(), 1); 33031 var import_jsx_runtime190 = __toESM(require_jsx_runtime(), 1); 33032 function ActivityGroup({ 33033 groupName, 33034 groupData, 33035 groupField, 33036 showLabel = true, 33037 children 33038 }) { 33039 const groupHeader = showLabel ? (0, import_element87.createInterpolateElement)( 33040 // translators: %s: The label of the field e.g. "Status". 33041 (0, import_i18n92.sprintf)((0, import_i18n92.__)("%s: <groupName />"), groupField.label).trim(), 33042 { 33043 groupName: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)( 33044 groupField.render, 33045 { 33046 item: groupData[0], 33047 field: groupField 33048 } 33049 ) 33050 } 33051 ) : /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(groupField.render, { item: groupData[0], field: groupField }); 33052 return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)( 33053 Stack, 33054 { 33055 direction: "column", 33056 className: "dataviews-view-activity__group", 33057 children: [ 33058 /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("h3", { className: "dataviews-view-activity__group-header", children: groupHeader }), 33059 children 33060 ] 33061 }, 33062 groupName 33063 ); 33064 } 33065 33066 // packages/dataviews/build-module/components/dataviews-layouts/activity/activity-item.mjs 33067 var import_element88 = __toESM(require_element(), 1); 33068 var import_data36 = __toESM(require_data(), 1); 33069 var import_compose11 = __toESM(require_compose(), 1); 33070 var import_jsx_runtime191 = __toESM(require_jsx_runtime(), 1); 33071 function ActivityItem(props) { 33072 const { 33073 view, 33074 actions: actions2, 33075 item, 33076 titleField: titleField2, 33077 mediaField, 33078 descriptionField: descriptionField3, 33079 otherFields, 33080 posinset, 33081 onClickItem, 33082 renderItemLink, 33083 isItemClickable: isItemClickable2 33084 } = props; 33085 const { 33086 showTitle = true, 33087 showMedia = true, 33088 showDescription = true, 33089 infiniteScrollEnabled 33090 } = view; 33091 const itemRef = (0, import_element88.useRef)(null); 33092 const registry = (0, import_data36.useRegistry)(); 33093 const { paginationInfo } = (0, import_element88.useContext)(dataviews_context_default); 33094 const { primaryActions, eligibleActions } = (0, import_element88.useMemo)(() => { 33095 const _eligibleActions = actions2.filter( 33096 (action) => !action.isEligible || action.isEligible(item) 33097 ); 33098 const _primaryActions = _eligibleActions.filter( 33099 (action) => action.isPrimary 33100 ); 33101 return { 33102 primaryActions: _primaryActions, 33103 eligibleActions: _eligibleActions 33104 }; 33105 }, [actions2, item]); 33106 const isMobileViewport = (0, import_compose11.useViewportMatch)("medium", "<"); 33107 const density = view.layout?.density ?? "balanced"; 33108 const mediaContent = showMedia && density !== "compact" && mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)( 33109 mediaField.render, 33110 { 33111 item, 33112 field: mediaField, 33113 config: { 33114 sizes: density === "comfortable" ? "32px" : "24px" 33115 } 33116 } 33117 ) : null; 33118 const renderedMediaField = /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { className: "dataviews-view-activity__item-type-icon", children: mediaContent || /* @__PURE__ */ (0, import_jsx_runtime191.jsx)( 33119 "span", 33120 { 33121 className: "dataviews-view-activity__item-bullet", 33122 "aria-hidden": "true" 33123 } 33124 ) }); 33125 const renderedTitleField = showTitle && titleField2?.render ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(titleField2.render, { item, field: titleField2 }) : null; 33126 const verticalGap = (0, import_element88.useMemo)(() => { 33127 switch (density) { 33128 case "comfortable": 33129 return "md"; 33130 default: 33131 return "sm"; 33132 } 33133 }, [density]); 33134 return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)( 33135 "div", 33136 { 33137 ref: itemRef, 33138 role: infiniteScrollEnabled ? "article" : void 0, 33139 "aria-posinset": posinset, 33140 "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0, 33141 className: clsx_default( 33142 "dataviews-view-activity__item", 33143 density === "compact" && "is-compact", 33144 density === "balanced" && "is-balanced", 33145 density === "comfortable" && "is-comfortable" 33146 ), 33147 children: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(Stack, { direction: "row", gap: "lg", justify: "start", align: "flex-start", children: [ 33148 /* @__PURE__ */ (0, import_jsx_runtime191.jsx)( 33149 Stack, 33150 { 33151 direction: "column", 33152 gap: "xs", 33153 align: "center", 33154 className: "dataviews-view-activity__item-type", 33155 children: renderedMediaField 33156 } 33157 ), 33158 /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)( 33159 Stack, 33160 { 33161 direction: "column", 33162 gap: verticalGap, 33163 align: "flex-start", 33164 className: "dataviews-view-activity__item-content", 33165 children: [ 33166 renderedTitleField && /* @__PURE__ */ (0, import_jsx_runtime191.jsx)( 33167 ItemClickWrapper, 33168 { 33169 item, 33170 isItemClickable: isItemClickable2, 33171 onClickItem, 33172 renderItemLink, 33173 className: "dataviews-view-activity__item-title", 33174 children: renderedTitleField 33175 } 33176 ), 33177 showDescription && descriptionField3 && /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { className: "dataviews-view-activity__item-description", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)( 33178 descriptionField3.render, 33179 { 33180 item, 33181 field: descriptionField3 33182 } 33183 ) }), 33184 /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { className: "dataviews-view-activity__item-fields", children: otherFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)( 33185 "div", 33186 { 33187 className: "dataviews-view-activity__item-field", 33188 children: [ 33189 /* @__PURE__ */ (0, import_jsx_runtime191.jsx)( 33190 VisuallyHidden, 33191 { 33192 className: "dataviews-view-activity__item-field-label", 33193 render: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", {}), 33194 children: field.label 33195 } 33196 ), 33197 /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "dataviews-view-activity__item-field-value", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)( 33198 field.render, 33199 { 33200 item, 33201 field 33202 } 33203 ) }) 33204 ] 33205 }, 33206 field.id 33207 )) }), 33208 !!primaryActions?.length && /* @__PURE__ */ (0, import_jsx_runtime191.jsx)( 33209 PrimaryActions, 33210 { 33211 item, 33212 actions: primaryActions, 33213 registry, 33214 buttonVariant: "secondary" 33215 } 33216 ) 33217 ] 33218 } 33219 ), 33220 (primaryActions.length < eligibleActions.length || // Since we hide primary actions on mobile, we need to show the menu 33221 // there if there are any actions at all. 33222 isMobileViewport && // At the same time, only show the menu if there are actions to show. 33223 eligibleActions.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { className: "dataviews-view-activity__item-actions", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)( 33224 ItemActions, 33225 { 33226 item, 33227 actions: eligibleActions, 33228 isCompact: true 33229 } 33230 ) }) 33231 ] }) 33232 } 33233 ); 33234 } 33235 var activity_item_default = ActivityItem; 33236 33237 // packages/dataviews/build-module/components/dataviews-layouts/activity/activity-items.mjs 33238 var import_react16 = __toESM(require_react(), 1); 33239 function isDefined3(item) { 33240 return !!item; 33241 } 33242 function ActivityItems(props) { 33243 const { data, fields: fields2, getItemId: getItemId2, view } = props; 33244 const titleField2 = fields2.find((field) => field.id === view.titleField); 33245 const mediaField = fields2.find((field) => field.id === view.mediaField); 33246 const descriptionField3 = fields2.find( 33247 (field) => field.id === view.descriptionField 33248 ); 33249 const otherFields = (view?.fields ?? []).map((fieldId) => fields2.find((f3) => fieldId === f3.id)).filter(isDefined3); 33250 return data.map((item, index2) => { 33251 return /* @__PURE__ */ (0, import_react16.createElement)( 33252 activity_item_default, 33253 { 33254 ...props, 33255 key: getItemId2(item), 33256 item, 33257 mediaField, 33258 titleField: titleField2, 33259 descriptionField: descriptionField3, 33260 otherFields, 33261 posinset: view.infiniteScrollEnabled ? index2 + 1 : void 0 33262 } 33263 ); 33264 }); 33265 } 33266 33267 // packages/dataviews/build-module/components/dataviews-layouts/activity/index.mjs 33268 var import_jsx_runtime192 = __toESM(require_jsx_runtime(), 1); 33269 function ViewActivity(props) { 33270 const { empty, data, fields: fields2, isLoading, view, className } = props; 33271 const isDelayedLoading = useDelayedLoading(!!isLoading); 33272 const hasData = !!data?.length; 33273 const groupField = view.groupBy?.field ? fields2.find((field) => field.id === view.groupBy?.field) : null; 33274 const dataByGroup = hasData && groupField ? getDataByGroup(data, groupField) : null; 33275 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 33276 if (!hasData) { 33277 return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)( 33278 "div", 33279 { 33280 className: clsx_default("dataviews-no-results", { 33281 "is-refreshing": isDelayedLoading 33282 }), 33283 children: empty 33284 } 33285 ); 33286 } 33287 const isInert = !isInfiniteScroll && !!isLoading; 33288 const wrapperClassName = clsx_default("dataviews-view-activity", className, { 33289 "is-refreshing": !isInfiniteScroll && isDelayedLoading 33290 }); 33291 const groupedEntries = dataByGroup ? Array.from(dataByGroup.entries()) : []; 33292 if (hasData && groupField && dataByGroup) { 33293 return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)( 33294 Stack, 33295 { 33296 direction: "column", 33297 gap: "sm", 33298 className: wrapperClassName, 33299 inert: isInert ? "true" : void 0, 33300 children: groupedEntries.map( 33301 ([groupName, groupData]) => /* @__PURE__ */ (0, import_jsx_runtime192.jsx)( 33302 ActivityGroup, 33303 { 33304 groupName, 33305 groupData, 33306 groupField, 33307 showLabel: view.groupBy?.showLabel !== false, 33308 children: /* @__PURE__ */ (0, import_jsx_runtime192.jsx)( 33309 ActivityItems, 33310 { 33311 ...props, 33312 data: groupData 33313 } 33314 ) 33315 }, 33316 groupName 33317 ) 33318 ) 33319 } 33320 ); 33321 } 33322 return /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(import_jsx_runtime192.Fragment, { children: [ 33323 /* @__PURE__ */ (0, import_jsx_runtime192.jsx)( 33324 "div", 33325 { 33326 className: wrapperClassName, 33327 role: view.infiniteScrollEnabled ? "feed" : void 0, 33328 inert: isInert ? "true" : void 0, 33329 children: /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(ActivityItems, { ...props }) 33330 } 33331 ), 33332 isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(import_components37.Spinner, {}) }) 33333 ] }); 33334 } 33335 33336 // packages/dataviews/build-module/components/dataviews-layouts/picker-grid/index.mjs 33337 var import_components40 = __toESM(require_components(), 1); 33338 var import_i18n95 = __toESM(require_i18n(), 1); 33339 var import_compose12 = __toESM(require_compose(), 1); 33340 var import_element91 = __toESM(require_element(), 1); 33341 33342 // packages/dataviews/build-module/components/dataviews-picker-footer/index.mjs 33343 var import_components39 = __toESM(require_components(), 1); 33344 var import_data37 = __toESM(require_data(), 1); 33345 var import_element90 = __toESM(require_element(), 1); 33346 var import_i18n94 = __toESM(require_i18n(), 1); 33347 33348 // packages/dataviews/build-module/components/dataviews-pagination/index.mjs 33349 var import_components38 = __toESM(require_components(), 1); 33350 var import_element89 = __toESM(require_element(), 1); 33351 var import_i18n93 = __toESM(require_i18n(), 1); 33352 var import_jsx_runtime193 = __toESM(require_jsx_runtime(), 1); 33353 function hasPaginationControls(view, paginationInfo) { 33354 return !view.infiniteScrollEnabled && paginationInfo.totalItems > 0 && paginationInfo.totalPages > 1; 33355 } 33356 function DataViewsPagination() { 33357 const { view, onChangeView, paginationInfo } = (0, import_element89.useContext)(dataviews_context_default); 33358 if (!hasPaginationControls(view, paginationInfo)) { 33359 return null; 33360 } 33361 const { totalPages } = paginationInfo; 33362 const currentPage = view.page ?? 1; 33363 const pageSelectOptions = Array.from(Array(totalPages)).map( 33364 (_, i3) => { 33365 const page = i3 + 1; 33366 return { 33367 value: page.toString(), 33368 label: page.toString(), 33369 "aria-label": currentPage === page ? (0, import_i18n93.sprintf)( 33370 // translators: 1: current page number. 2: total number of pages. 33371 (0, import_i18n93.__)("Page %1$d of %2$d"), 33372 currentPage, 33373 totalPages 33374 ) : page.toString() 33375 }; 33376 } 33377 ); 33378 return /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)( 33379 Stack, 33380 { 33381 direction: "row", 33382 className: "dataviews-pagination", 33383 justify: "end", 33384 align: "center", 33385 gap: "xl", 33386 children: [ 33387 /* @__PURE__ */ (0, import_jsx_runtime193.jsx)( 33388 Stack, 33389 { 33390 direction: "row", 33391 justify: "flex-start", 33392 align: "center", 33393 gap: "xs", 33394 className: "dataviews-pagination__page-select", 33395 children: (0, import_element89.createInterpolateElement)( 33396 (0, import_i18n93.sprintf)( 33397 // translators: 1: Current page number, 2: Total number of pages. 33398 (0, import_i18n93._x)("<div>Page</div>%1$s<div>of %2$d</div>", "paging"), 33399 "<CurrentPage />", 33400 totalPages 33401 ), 33402 { 33403 div: /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("div", { "aria-hidden": true }), 33404 // @ts-expect-error — Tag injected via sprintf argument, not visible in format string. 33405 CurrentPage: /* @__PURE__ */ (0, import_jsx_runtime193.jsx)( 33406 import_components38.SelectControl, 33407 { 33408 "aria-label": (0, import_i18n93.__)("Current page"), 33409 value: currentPage.toString(), 33410 options: pageSelectOptions, 33411 onChange: (newValue) => { 33412 onChangeView({ 33413 ...view, 33414 page: +newValue 33415 }); 33416 }, 33417 size: "small", 33418 variant: "minimal" 33419 } 33420 ) 33421 } 33422 ) 33423 } 33424 ), 33425 /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(Stack, { direction: "row", gap: "xs", align: "center", children: [ 33426 /* @__PURE__ */ (0, import_jsx_runtime193.jsx)( 33427 import_components38.Button, 33428 { 33429 onClick: () => onChangeView({ 33430 ...view, 33431 page: currentPage - 1 33432 }), 33433 disabled: currentPage === 1, 33434 accessibleWhenDisabled: true, 33435 label: (0, import_i18n93.__)("Previous page"), 33436 icon: (0, import_i18n93.isRTL)() ? next_default : previous_default, 33437 showTooltip: true, 33438 size: "compact", 33439 tooltipPosition: "top" 33440 } 33441 ), 33442 /* @__PURE__ */ (0, import_jsx_runtime193.jsx)( 33443 import_components38.Button, 33444 { 33445 onClick: () => onChangeView({ ...view, page: currentPage + 1 }), 33446 disabled: currentPage >= totalPages, 33447 accessibleWhenDisabled: true, 33448 label: (0, import_i18n93.__)("Next page"), 33449 icon: (0, import_i18n93.isRTL)() ? previous_default : next_default, 33450 showTooltip: true, 33451 size: "compact", 33452 tooltipPosition: "top" 33453 } 33454 ) 33455 ] }) 33456 ] 33457 } 33458 ); 33459 } 33460 var dataviews_pagination_default = (0, import_element89.memo)(DataViewsPagination); 33461 33462 // packages/dataviews/build-module/components/dataviews-picker-footer/index.mjs 33463 var import_jsx_runtime194 = __toESM(require_jsx_runtime(), 1); 33464 var EMPTY_ARRAY6 = []; 33465 function useIsMultiselectPicker(actions2) { 33466 return (0, import_element90.useMemo)(() => { 33467 return !!actions2?.length && actions2?.every((action) => action.supportsBulk); 33468 }, [actions2]); 33469 } 33470 function BulkSelectionCheckbox2({ 33471 selection, 33472 selectedItems, 33473 onChangeSelection, 33474 data, 33475 getItemId: getItemId2, 33476 disableSelectAll = false 33477 }) { 33478 const hasSelection = selection.length > 0; 33479 const areAllSelected = selectedItems.length === data.length; 33480 if (disableSelectAll) { 33481 return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)( 33482 import_components39.CheckboxControl, 33483 { 33484 className: "dataviews-view-table-selection-checkbox", 33485 checked: hasSelection, 33486 disabled: !hasSelection, 33487 onChange: () => { 33488 onChangeSelection([]); 33489 }, 33490 "aria-label": (0, import_i18n94.__)("Deselect all") 33491 } 33492 ); 33493 } 33494 return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)( 33495 import_components39.CheckboxControl, 33496 { 33497 className: "dataviews-view-table-selection-checkbox", 33498 checked: areAllSelected, 33499 indeterminate: !areAllSelected && !!selectedItems.length, 33500 onChange: () => { 33501 if (areAllSelected) { 33502 onChangeSelection( 33503 selection.filter( 33504 (id) => !data.some( 33505 (item) => id === getItemId2(item) 33506 ) 33507 ) 33508 ); 33509 } else { 33510 const selectionSet = /* @__PURE__ */ new Set([ 33511 ...selection, 33512 ...data.map((item) => getItemId2(item)) 33513 ]); 33514 onChangeSelection(Array.from(selectionSet)); 33515 } 33516 }, 33517 "aria-label": areAllSelected ? (0, import_i18n94.__)("Deselect all") : (0, import_i18n94.__)("Select all") 33518 } 33519 ); 33520 } 33521 function ActionButtons({ 33522 actions: actions2, 33523 items, 33524 selection 33525 }) { 33526 const registry = (0, import_data37.useRegistry)(); 33527 const [actionInProgress, setActionInProgress] = (0, import_element90.useState)( 33528 null 33529 ); 33530 return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(Stack, { direction: "row", gap: "xs", children: actions2.map((action) => { 33531 if (!("callback" in action)) { 33532 return null; 33533 } 33534 const { id, label, icon, isPrimary, callback } = action; 33535 const _label = typeof label === "string" ? label : label(items); 33536 const variant = isPrimary ? "primary" : "tertiary"; 33537 const isInProgress = id === actionInProgress; 33538 return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)( 33539 import_components39.Button, 33540 { 33541 accessibleWhenDisabled: true, 33542 icon, 33543 disabled: isInProgress || !selection?.length, 33544 isBusy: isInProgress, 33545 onClick: async () => { 33546 setActionInProgress(id); 33547 await callback(items, { 33548 registry 33549 }); 33550 setActionInProgress(null); 33551 }, 33552 size: "compact", 33553 variant, 33554 children: _label 33555 }, 33556 id 33557 ); 33558 }) }); 33559 } 33560 function PickerBulkSelectionInfo() { 33561 const { 33562 data, 33563 selection, 33564 onChangeSelection, 33565 getItemId: getItemId2, 33566 actions: actions2 = EMPTY_ARRAY6, 33567 paginationInfo, 33568 view 33569 } = (0, import_element90.useContext)(dataviews_context_default); 33570 const isMultiselect = useIsMultiselectPicker(actions2); 33571 const selectedItems = (0, import_element90.useMemo)( 33572 () => data.filter((item) => selection.includes(getItemId2(item))), 33573 [selection, getItemId2, data] 33574 ); 33575 if (!actions2.length) { 33576 return null; 33577 } 33578 const message2 = getFooterMessage( 33579 selection.length, 33580 data.length, 33581 paginationInfo.totalItems, 33582 !!view.infiniteScrollEnabled 33583 ); 33584 return /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)( 33585 Stack, 33586 { 33587 direction: "row", 33588 className: "dataviews-picker-footer__bulk-selection", 33589 gap: "md", 33590 align: "center", 33591 children: [ 33592 isMultiselect && /* @__PURE__ */ (0, import_jsx_runtime194.jsx)( 33593 BulkSelectionCheckbox2, 33594 { 33595 selection, 33596 selectedItems, 33597 onChangeSelection, 33598 data, 33599 getItemId: getItemId2, 33600 disableSelectAll: !!view.infiniteScrollEnabled 33601 } 33602 ), 33603 /* @__PURE__ */ (0, import_jsx_runtime194.jsx)("span", { className: "dataviews-bulk-actions-footer__item-count", children: message2 }) 33604 ] 33605 } 33606 ); 33607 } 33608 function PickerActions() { 33609 const { 33610 data, 33611 selection, 33612 getItemId: getItemId2, 33613 actions: actions2 = EMPTY_ARRAY6 33614 } = (0, import_element90.useContext)(dataviews_context_default); 33615 const selectedItems = (0, import_element90.useMemo)( 33616 () => data.filter((item) => selection.includes(getItemId2(item))), 33617 [selection, getItemId2, data] 33618 ); 33619 if (!actions2.length) { 33620 return null; 33621 } 33622 return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)("div", { className: "dataviews-picker-footer__actions", children: /* @__PURE__ */ (0, import_jsx_runtime194.jsx)( 33623 ActionButtons, 33624 { 33625 actions: actions2, 33626 items: selectedItems, 33627 selection 33628 } 33629 ) }); 33630 } 33631 function DataViewsPickerBulkActionToolbar() { 33632 return /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)(Stack, { direction: "row", gap: "md", align: "center", children: [ 33633 /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(PickerBulkSelectionInfo, {}), 33634 /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(PickerActions, {}) 33635 ] }); 33636 } 33637 function DataViewsPickerFooter() { 33638 const { 33639 actions: actions2 = EMPTY_ARRAY6, 33640 paginationInfo, 33641 view 33642 } = (0, import_element90.useContext)(dataviews_context_default); 33643 const hasPagination = !view.infiniteScrollEnabled && !!paginationInfo.totalItems && paginationInfo.totalPages > 1; 33644 if (!actions2.length && !hasPagination) { 33645 return null; 33646 } 33647 return /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)( 33648 Stack, 33649 { 33650 direction: "row", 33651 justify: "space-between", 33652 align: "center", 33653 className: "dataviews-footer", 33654 gap: "sm", 33655 children: [ 33656 /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(PickerBulkSelectionInfo, {}), 33657 /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(dataviews_pagination_default, {}), 33658 /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(PickerActions, {}) 33659 ] 33660 } 33661 ); 33662 } 33663 33664 // packages/dataviews/build-module/components/dataviews-layouts/picker-grid/index.mjs 33665 var import_jsx_runtime195 = __toESM(require_jsx_runtime(), 1); 33666 var { Badge: WCBadge3 } = unlock5(import_components40.privateApis); 33667 function GridItem3({ 33668 view, 33669 multiselect, 33670 selection, 33671 onChangeSelection, 33672 getItemId: getItemId2, 33673 item, 33674 mediaField, 33675 titleField: titleField2, 33676 descriptionField: descriptionField3, 33677 regularFields, 33678 badgeFields, 33679 config: config2, 33680 posinset, 33681 setsize 33682 }) { 33683 const { showTitle = true, showMedia = true, showDescription = true } = view; 33684 const id = getItemId2(item); 33685 const elementRef = (0, import_element91.useRef)(null); 33686 const isSelected2 = selection.includes(id); 33687 useIntersectionObserver(elementRef, posinset); 33688 const renderedMediaField = mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 33689 mediaField.render, 33690 { 33691 item, 33692 field: mediaField, 33693 config: config2 33694 } 33695 ) : null; 33696 const renderedTitleField = showTitle && titleField2?.render ? /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(titleField2.render, { item, field: titleField2 }) : null; 33697 return /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)( 33698 import_components40.Composite.Item, 33699 { 33700 ref: elementRef, 33701 "aria-label": titleField2 ? titleField2.getValue({ item }) || (0, import_i18n95.__)("(no title)") : void 0, 33702 render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(Stack, { direction: "column", children, ...props }), 33703 role: "option", 33704 "aria-posinset": posinset, 33705 "aria-setsize": setsize, 33706 className: clsx_default("dataviews-view-picker-grid__card", { 33707 "is-selected": isSelected2 33708 }), 33709 "aria-selected": isSelected2, 33710 onClick: () => { 33711 if (isSelected2) { 33712 onChangeSelection( 33713 selection.filter((itemId) => id !== itemId) 33714 ); 33715 } else { 33716 const newSelection = multiselect ? [...selection, id] : [id]; 33717 onChangeSelection(newSelection); 33718 } 33719 }, 33720 children: [ 33721 showMedia && renderedMediaField && /* @__PURE__ */ (0, import_jsx_runtime195.jsx)("div", { className: "dataviews-view-picker-grid__media", children: renderedMediaField }), 33722 showMedia && renderedMediaField && /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 33723 DataViewsSelectionCheckbox, 33724 { 33725 item, 33726 selection, 33727 onChangeSelection, 33728 getItemId: getItemId2, 33729 titleField: titleField2, 33730 disabled: false, 33731 "aria-hidden": true, 33732 tabIndex: -1 33733 } 33734 ), 33735 showTitle && /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 33736 Stack, 33737 { 33738 direction: "row", 33739 justify: "space-between", 33740 className: "dataviews-view-picker-grid__title-actions", 33741 children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)("div", { className: "dataviews-view-picker-grid__title-field dataviews-title-field", children: renderedTitleField }) 33742 } 33743 ), 33744 /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)(Stack, { direction: "column", gap: "xs", children: [ 33745 showDescription && descriptionField3?.render && /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 33746 descriptionField3.render, 33747 { 33748 item, 33749 field: descriptionField3 33750 } 33751 ), 33752 !!badgeFields?.length && /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 33753 Stack, 33754 { 33755 direction: "row", 33756 className: "dataviews-view-picker-grid__badge-fields", 33757 gap: "sm", 33758 wrap: "wrap", 33759 align: "top", 33760 justify: "flex-start", 33761 children: badgeFields.map((field) => { 33762 return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 33763 WCBadge3, 33764 { 33765 className: "dataviews-view-picker-grid__field-value", 33766 children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 33767 field.render, 33768 { 33769 item, 33770 field 33771 } 33772 ) 33773 }, 33774 field.id 33775 ); 33776 }) 33777 } 33778 ), 33779 !!regularFields?.length && /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 33780 Stack, 33781 { 33782 direction: "column", 33783 className: "dataviews-view-picker-grid__fields", 33784 gap: "xs", 33785 children: regularFields.map((field) => { 33786 return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 33787 import_components40.Flex, 33788 { 33789 className: "dataviews-view-picker-grid__field", 33790 gap: 1, 33791 justify: "flex-start", 33792 expanded: true, 33793 style: { height: "auto" }, 33794 direction: "row", 33795 children: /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)(import_jsx_runtime195.Fragment, { children: [ 33796 /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_components40.FlexItem, { className: "dataviews-view-picker-grid__field-name", children: field.header }), 33797 /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 33798 import_components40.FlexItem, 33799 { 33800 className: "dataviews-view-picker-grid__field-value", 33801 style: { maxHeight: "none" }, 33802 children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 33803 field.render, 33804 { 33805 item, 33806 field 33807 } 33808 ) 33809 } 33810 ) 33811 ] }) 33812 }, 33813 field.id 33814 ); 33815 }) 33816 } 33817 ) 33818 ] }) 33819 ] 33820 }, 33821 id 33822 ); 33823 } 33824 function GridGroup({ 33825 groupName, 33826 groupField, 33827 showLabel = true, 33828 children 33829 }) { 33830 const headerId = (0, import_compose12.useInstanceId)( 33831 GridGroup, 33832 "dataviews-view-picker-grid-group__header" 33833 ); 33834 return /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)( 33835 Stack, 33836 { 33837 direction: "column", 33838 gap: "sm", 33839 role: "group", 33840 "aria-labelledby": headerId, 33841 children: [ 33842 /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 33843 "h3", 33844 { 33845 className: "dataviews-view-picker-grid-group__header", 33846 id: headerId, 33847 children: showLabel ? (0, import_i18n95.sprintf)( 33848 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 33849 (0, import_i18n95.__)("%1$s: %2$s"), 33850 groupField.label, 33851 groupName 33852 ) : groupName 33853 } 33854 ), 33855 children 33856 ] 33857 }, 33858 groupName 33859 ); 33860 } 33861 function ViewPickerGrid({ 33862 actions: actions2, 33863 data, 33864 fields: fields2, 33865 getItemId: getItemId2, 33866 isLoading, 33867 onChangeSelection, 33868 selection, 33869 view, 33870 className, 33871 empty 33872 }) { 33873 const { resizeObserverRef, paginationInfo, itemListLabel } = (0, import_element91.useContext)(dataviews_context_default); 33874 const titleField2 = fields2.find( 33875 (field) => field.id === view?.titleField 33876 ); 33877 const mediaField = fields2.find( 33878 (field) => field.id === view?.mediaField 33879 ); 33880 const descriptionField3 = fields2.find( 33881 (field) => field.id === view?.descriptionField 33882 ); 33883 const otherFields = view.fields ?? []; 33884 const { regularFields, badgeFields } = otherFields.reduce( 33885 (accumulator, fieldId) => { 33886 const field = fields2.find((f3) => f3.id === fieldId); 33887 if (!field) { 33888 return accumulator; 33889 } 33890 const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields"; 33891 accumulator[key].push(field); 33892 return accumulator; 33893 }, 33894 { regularFields: [], badgeFields: [] } 33895 ); 33896 const hasData = !!data?.length; 33897 const usedPreviewSize = view.layout?.previewSize; 33898 const isMultiselect = useIsMultiselectPicker(actions2); 33899 const size4 = "900px"; 33900 const groupField = view.groupBy?.field ? fields2.find((f3) => f3.id === view.groupBy?.field) : null; 33901 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 33902 const isInfiniteScroll = (view.infiniteScrollEnabled && !dataByGroup) ?? false; 33903 const currentPage = view?.page ?? 1; 33904 const perPage = view?.perPage ?? 0; 33905 const setSize = isInfiniteScroll ? paginationInfo?.totalItems : void 0; 33906 const gridColumns = useGridColumns(); 33907 const placeholdersNeeded = usePlaceholdersNeeded( 33908 data, 33909 isInfiniteScroll, 33910 gridColumns 33911 ); 33912 return /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)(import_jsx_runtime195.Fragment, { 33913 // Render multiple groups. 33914 children: [ 33915 hasData && groupField && dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 33916 import_components40.Composite, 33917 { 33918 virtualFocus: true, 33919 orientation: "horizontal", 33920 role: "listbox", 33921 "aria-multiselectable": isMultiselect, 33922 className: clsx_default( 33923 "dataviews-view-picker-grid", 33924 className, 33925 { 33926 [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes( 33927 view.layout.density 33928 ) 33929 } 33930 ), 33931 "aria-label": itemListLabel, 33932 render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 33933 Stack, 33934 { 33935 direction: "column", 33936 gap: "lg", 33937 children, 33938 ...props 33939 } 33940 ), 33941 children: Array.from(dataByGroup.entries()).map( 33942 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 33943 GridGroup, 33944 { 33945 groupName, 33946 groupField, 33947 showLabel: view.groupBy?.showLabel !== false, 33948 children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 33949 GridItems, 33950 { 33951 previewSize: usedPreviewSize, 33952 style: { 33953 gridTemplateColumns: usedPreviewSize && `repeat(auto-fill, minmax($usedPreviewSize}px, 1fr))` 33954 }, 33955 "aria-busy": isLoading, 33956 ref: resizeObserverRef, 33957 children: groupItems.map((item) => { 33958 const posInSet = item.position ?? (currentPage - 1) * perPage + data.indexOf(item) + 1; 33959 return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 33960 GridItem3, 33961 { 33962 view, 33963 multiselect: isMultiselect, 33964 selection, 33965 onChangeSelection, 33966 getItemId: getItemId2, 33967 item, 33968 mediaField, 33969 titleField: titleField2, 33970 descriptionField: descriptionField3, 33971 regularFields, 33972 badgeFields, 33973 config: { 33974 sizes: size4 33975 }, 33976 posinset: posInSet, 33977 setsize: setSize 33978 }, 33979 getItemId2(item) 33980 ); 33981 }) 33982 } 33983 ) 33984 }, 33985 groupName 33986 ) 33987 ) 33988 } 33989 ), 33990 // Render a single grid with all data. 33991 hasData && !dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)( 33992 import_components40.Composite, 33993 { 33994 render: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 33995 GridItems, 33996 { 33997 className: clsx_default( 33998 "dataviews-view-picker-grid", 33999 className, 34000 { 34001 [`has-$view.layout?.density}-density`]: view.layout?.density && [ 34002 "compact", 34003 "comfortable" 34004 ].includes(view.layout.density) 34005 } 34006 ), 34007 previewSize: usedPreviewSize, 34008 "aria-busy": isLoading, 34009 ref: resizeObserverRef 34010 } 34011 ), 34012 virtualFocus: true, 34013 orientation: "horizontal", 34014 role: "listbox", 34015 "aria-multiselectable": isMultiselect, 34016 "aria-label": itemListLabel, 34017 children: [ 34018 Array.from({ length: placeholdersNeeded }).map( 34019 (_, index2) => /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 34020 import_components40.Composite.Item, 34021 { 34022 render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 34023 Stack, 34024 { 34025 direction: "column", 34026 children, 34027 ...props 34028 } 34029 ), 34030 role: "option", 34031 "aria-hidden": true, 34032 tabIndex: -1, 34033 className: "dataviews-view-picker-grid__card dataviews-view-picker-grid__placeholder" 34034 }, 34035 `placeholder-$index2}` 34036 ) 34037 ), 34038 data.map((item) => { 34039 const posinset = item.position; 34040 return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 34041 GridItem3, 34042 { 34043 view, 34044 multiselect: isMultiselect, 34045 selection, 34046 onChangeSelection, 34047 getItemId: getItemId2, 34048 item, 34049 mediaField, 34050 titleField: titleField2, 34051 descriptionField: descriptionField3, 34052 regularFields, 34053 badgeFields, 34054 config: { 34055 sizes: size4 34056 }, 34057 posinset, 34058 setsize: setSize 34059 }, 34060 getItemId2(item) 34061 ); 34062 }) 34063 ] 34064 } 34065 ), 34066 // Render empty state. 34067 !hasData && /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 34068 "div", 34069 { 34070 className: clsx_default({ 34071 "dataviews-loading": isLoading, 34072 "dataviews-no-results": !isLoading 34073 }), 34074 children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime195.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_components40.Spinner, {}) }) : empty 34075 } 34076 ), 34077 hasData && isLoading && /* @__PURE__ */ (0, import_jsx_runtime195.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_components40.Spinner, {}) }) 34078 ] 34079 }); 34080 } 34081 var picker_grid_default = ViewPickerGrid; 34082 34083 // packages/dataviews/build-module/components/dataviews-layouts/picker-table/index.mjs 34084 var import_i18n96 = __toESM(require_i18n(), 1); 34085 var import_components41 = __toESM(require_components(), 1); 34086 var import_element92 = __toESM(require_element(), 1); 34087 var import_jsx_runtime196 = __toESM(require_jsx_runtime(), 1); 34088 function TableColumnField2({ 34089 item, 34090 fields: fields2, 34091 column, 34092 align 34093 }) { 34094 const field = fields2.find((f3) => f3.id === column); 34095 if (!field) { 34096 return null; 34097 } 34098 const className = clsx_default("dataviews-view-table__cell-content-wrapper", { 34099 "dataviews-view-table__cell-align-end": align === "end", 34100 "dataviews-view-table__cell-align-center": align === "center" 34101 }); 34102 return /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(field.render, { item, field }) }); 34103 } 34104 function TableRow2({ 34105 item, 34106 fields: fields2, 34107 id, 34108 view, 34109 titleField: titleField2, 34110 mediaField, 34111 descriptionField: descriptionField3, 34112 selection, 34113 getItemId: getItemId2, 34114 onChangeSelection, 34115 multiselect, 34116 posinset 34117 }) { 34118 const { paginationInfo } = (0, import_element92.useContext)(dataviews_context_default); 34119 const isSelected2 = selection.includes(id); 34120 const [isHovered, setIsHovered] = (0, import_element92.useState)(false); 34121 const elementRef = (0, import_element92.useRef)(null); 34122 useIntersectionObserver(elementRef, posinset); 34123 const { 34124 showTitle = true, 34125 showMedia = true, 34126 showDescription = true, 34127 infiniteScrollEnabled 34128 } = view; 34129 const handleMouseEnter = () => { 34130 setIsHovered(true); 34131 }; 34132 const handleMouseLeave = () => { 34133 setIsHovered(false); 34134 }; 34135 const columns = view.fields ?? []; 34136 const hasPrimaryColumn = titleField2 && showTitle || mediaField && showMedia || descriptionField3 && showDescription; 34137 return /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)( 34138 import_components41.Composite.Item, 34139 { 34140 ref: elementRef, 34141 render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 34142 "tr", 34143 { 34144 className: clsx_default("dataviews-view-table__row", { 34145 "is-selected": isSelected2, 34146 "is-hovered": isHovered 34147 }), 34148 onMouseEnter: handleMouseEnter, 34149 onMouseLeave: handleMouseLeave, 34150 children, 34151 ...props 34152 } 34153 ), 34154 "aria-selected": isSelected2, 34155 "aria-setsize": paginationInfo.totalItems || void 0, 34156 "aria-posinset": posinset, 34157 role: infiniteScrollEnabled ? "article" : "option", 34158 onMouseDown: (event) => { 34159 if (event.button !== 0) { 34160 return; 34161 } 34162 event.currentTarget.parentElement?.focus({ 34163 preventScroll: true 34164 }); 34165 }, 34166 onClick: () => { 34167 if (isSelected2) { 34168 onChangeSelection( 34169 selection.filter((itemId) => id !== itemId) 34170 ); 34171 } else { 34172 const newSelection = multiselect ? [...selection, id] : [id]; 34173 onChangeSelection(newSelection); 34174 } 34175 }, 34176 children: [ 34177 /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 34178 "td", 34179 { 34180 className: "dataviews-view-table__checkbox-column", 34181 role: "presentation", 34182 children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 34183 DataViewsSelectionCheckbox, 34184 { 34185 item, 34186 selection, 34187 onChangeSelection, 34188 getItemId: getItemId2, 34189 titleField: titleField2, 34190 disabled: false, 34191 "aria-hidden": true, 34192 tabIndex: -1 34193 } 34194 ) }) 34195 } 34196 ), 34197 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 34198 "td", 34199 { 34200 role: "presentation", 34201 children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 34202 column_primary_default, 34203 { 34204 item, 34205 titleField: showTitle ? titleField2 : void 0, 34206 mediaField: showMedia ? mediaField : void 0, 34207 descriptionField: showDescription ? descriptionField3 : void 0, 34208 isItemClickable: () => false 34209 } 34210 ) 34211 } 34212 ), 34213 columns.map((column) => { 34214 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {}; 34215 return /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 34216 "td", 34217 { 34218 style: { 34219 width, 34220 maxWidth, 34221 minWidth 34222 }, 34223 role: "presentation", 34224 children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 34225 TableColumnField2, 34226 { 34227 fields: fields2, 34228 item, 34229 column, 34230 align 34231 } 34232 ) 34233 }, 34234 column 34235 ); 34236 }) 34237 ] 34238 }, 34239 id 34240 ); 34241 } 34242 function ViewPickerTable({ 34243 actions: actions2, 34244 data, 34245 fields: fields2, 34246 getItemId: getItemId2, 34247 isLoading = false, 34248 onChangeView, 34249 onChangeSelection, 34250 selection, 34251 setOpenedFilter, 34252 view, 34253 className, 34254 empty 34255 }) { 34256 const headerMenuRefs = (0, import_element92.useRef)(/* @__PURE__ */ new Map()); 34257 const headerMenuToFocusRef = (0, import_element92.useRef)(void 0); 34258 const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0, import_element92.useState)(); 34259 const isMultiselect = useIsMultiselectPicker(actions2) ?? false; 34260 (0, import_element92.useEffect)(() => { 34261 if (headerMenuToFocusRef.current) { 34262 headerMenuToFocusRef.current.focus(); 34263 headerMenuToFocusRef.current = void 0; 34264 } 34265 }); 34266 const groupField = view.groupBy?.field ? fields2.find((f3) => f3.id === view.groupBy?.field) : null; 34267 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 34268 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 34269 const tableNoticeId = (0, import_element92.useId)(); 34270 if (nextHeaderMenuToFocus) { 34271 headerMenuToFocusRef.current = nextHeaderMenuToFocus; 34272 setNextHeaderMenuToFocus(void 0); 34273 return; 34274 } 34275 const onHide = (field) => { 34276 const hidden = headerMenuRefs.current.get(field.id); 34277 const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : void 0; 34278 setNextHeaderMenuToFocus(fallback?.node); 34279 }; 34280 const hasData = !!data?.length; 34281 const titleField2 = fields2.find((field) => field.id === view.titleField); 34282 const mediaField = fields2.find((field) => field.id === view.mediaField); 34283 const descriptionField3 = fields2.find( 34284 (field) => field.id === view.descriptionField 34285 ); 34286 const { showTitle = true, showMedia = true, showDescription = true } = view; 34287 const hasPrimaryColumn = titleField2 && showTitle || mediaField && showMedia || descriptionField3 && showDescription; 34288 const columns = view.fields ?? []; 34289 const headerMenuRef = (column, index2) => (node) => { 34290 if (node) { 34291 headerMenuRefs.current.set(column, { 34292 node, 34293 fallback: columns[index2 > 0 ? index2 - 1 : 1] 34294 }); 34295 } else { 34296 headerMenuRefs.current.delete(column); 34297 } 34298 }; 34299 return /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)(import_jsx_runtime196.Fragment, { children: [ 34300 /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)( 34301 "table", 34302 { 34303 className: clsx_default( 34304 "dataviews-view-table", 34305 "dataviews-view-picker-table", 34306 className, 34307 { 34308 [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes( 34309 view.layout.density 34310 ) 34311 } 34312 ), 34313 "aria-busy": isLoading, 34314 "aria-describedby": tableNoticeId, 34315 role: isInfiniteScroll ? "feed" : "listbox", 34316 children: [ 34317 /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("thead", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)( 34318 "tr", 34319 { 34320 className: "dataviews-view-table__row", 34321 role: "presentation", 34322 children: [ 34323 /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("th", { className: "dataviews-view-table__checkbox-column", children: isMultiselect && /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 34324 BulkSelectionCheckbox, 34325 { 34326 selection, 34327 onChangeSelection, 34328 data, 34329 actions: actions2, 34330 getItemId: getItemId2, 34331 disableSelectAll: isInfiniteScroll 34332 } 34333 ) }), 34334 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("th", { children: titleField2 && /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 34335 column_header_menu_default, 34336 { 34337 ref: headerMenuRef( 34338 titleField2.id, 34339 0 34340 ), 34341 fieldId: titleField2.id, 34342 view, 34343 fields: fields2, 34344 onChangeView, 34345 onHide, 34346 setOpenedFilter, 34347 canMove: false 34348 } 34349 ) }), 34350 columns.map((column, index2) => { 34351 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {}; 34352 return /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 34353 "th", 34354 { 34355 style: { 34356 width, 34357 maxWidth, 34358 minWidth, 34359 textAlign: align 34360 }, 34361 "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0, 34362 scope: "col", 34363 children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 34364 column_header_menu_default, 34365 { 34366 ref: headerMenuRef(column, index2), 34367 fieldId: column, 34368 view, 34369 fields: fields2, 34370 onChangeView, 34371 onHide, 34372 setOpenedFilter, 34373 canMove: view.layout?.enableMoving ?? true 34374 } 34375 ) 34376 }, 34377 column 34378 ); 34379 }) 34380 ] 34381 } 34382 ) }), 34383 hasData && groupField && dataByGroup ? Array.from(dataByGroup.entries()).map( 34384 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)( 34385 import_components41.Composite, 34386 { 34387 virtualFocus: true, 34388 orientation: "vertical", 34389 render: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("tbody", { role: "group" }), 34390 children: [ 34391 /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 34392 "tr", 34393 { 34394 className: "dataviews-view-table__group-header-row", 34395 role: "presentation", 34396 children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 34397 "td", 34398 { 34399 colSpan: columns.length + (hasPrimaryColumn ? 1 : 0) + 1, 34400 className: "dataviews-view-table__group-header-cell", 34401 role: "presentation", 34402 children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n96.sprintf)( 34403 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 34404 (0, import_i18n96.__)("%1$s: %2$s"), 34405 groupField.label, 34406 groupName 34407 ) 34408 } 34409 ) 34410 } 34411 ), 34412 groupItems.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 34413 TableRow2, 34414 { 34415 item, 34416 fields: fields2, 34417 id: getItemId2(item) || index2.toString(), 34418 view, 34419 titleField: titleField2, 34420 mediaField, 34421 descriptionField: descriptionField3, 34422 selection, 34423 getItemId: getItemId2, 34424 onChangeSelection, 34425 multiselect: isMultiselect 34426 }, 34427 getItemId2(item) 34428 )) 34429 ] 34430 }, 34431 `group-$groupName}` 34432 ) 34433 ) : /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 34434 import_components41.Composite, 34435 { 34436 render: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("tbody", { role: "presentation" }), 34437 virtualFocus: true, 34438 orientation: "vertical", 34439 children: hasData && data.map((item, index2) => { 34440 const itemId = getItemId2(item); 34441 const posinset = item.position; 34442 return /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 34443 TableRow2, 34444 { 34445 item, 34446 fields: fields2, 34447 id: itemId || index2.toString(), 34448 view, 34449 titleField: titleField2, 34450 mediaField, 34451 descriptionField: descriptionField3, 34452 selection, 34453 getItemId: getItemId2, 34454 onChangeSelection, 34455 multiselect: isMultiselect, 34456 posinset 34457 }, 34458 itemId 34459 ); 34460 }) 34461 } 34462 ) 34463 ] 34464 } 34465 ), 34466 /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)( 34467 "div", 34468 { 34469 className: clsx_default({ 34470 "dataviews-loading": isLoading, 34471 "dataviews-no-results": !hasData && !isLoading 34472 }), 34473 id: tableNoticeId, 34474 children: [ 34475 !hasData && (isLoading ? /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(import_components41.Spinner, {}) }) : empty), 34476 hasData && isLoading && /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(import_components41.Spinner, {}) }) 34477 ] 34478 } 34479 ) 34480 ] }); 34481 } 34482 var picker_table_default = ViewPickerTable; 34483 34484 // packages/dataviews/build-module/components/dataviews-layouts/picker-activity/index.mjs 34485 var import_components42 = __toESM(require_components(), 1); 34486 var import_element93 = __toESM(require_element(), 1); 34487 var import_compose13 = __toESM(require_compose(), 1); 34488 var import_i18n97 = __toESM(require_i18n(), 1); 34489 var import_jsx_runtime197 = __toESM(require_jsx_runtime(), 1); 34490 function isDefined4(item) { 34491 return !!item; 34492 } 34493 function PickerActivityItem({ 34494 view, 34495 multiselect, 34496 selection, 34497 onChangeSelection, 34498 getItemId: getItemId2, 34499 item, 34500 titleField: titleField2, 34501 mediaField, 34502 descriptionField: descriptionField3, 34503 otherFields, 34504 posinset, 34505 setsize 34506 }) { 34507 const elementRef = (0, import_element93.useRef)(null); 34508 useIntersectionObserver(elementRef, posinset); 34509 const { showTitle = true, showMedia = true, showDescription = true } = view; 34510 const id = getItemId2(item); 34511 const isSelected2 = selection.includes(id); 34512 const density = view.layout?.density ?? "balanced"; 34513 const mediaContent = showMedia && density !== "compact" && mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime197.jsx)( 34514 mediaField.render, 34515 { 34516 item, 34517 field: mediaField, 34518 config: { 34519 sizes: density === "comfortable" ? "32px" : "24px" 34520 } 34521 } 34522 ) : null; 34523 const renderedMediaField = /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("div", { className: "dataviews-view-picker-activity__item-type-icon", children: mediaContent || /* @__PURE__ */ (0, import_jsx_runtime197.jsx)( 34524 "span", 34525 { 34526 className: "dataviews-view-picker-activity__item-bullet", 34527 "aria-hidden": "true" 34528 } 34529 ) }); 34530 const renderedTitleField = showTitle && titleField2?.render ? /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(titleField2.render, { item, field: titleField2 }) : null; 34531 const renderedDescriptionField = showDescription && descriptionField3?.render ? /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(descriptionField3.render, { item, field: descriptionField3 }) : null; 34532 const verticalGap = (0, import_element93.useMemo)(() => { 34533 switch (density) { 34534 case "comfortable": 34535 return "md"; 34536 default: 34537 return "sm"; 34538 } 34539 }, [density]); 34540 return /* @__PURE__ */ (0, import_jsx_runtime197.jsx)( 34541 import_components42.Composite.Item, 34542 { 34543 ref: elementRef, 34544 role: "option", 34545 "aria-label": titleField2 ? titleField2.getValue({ item }) || void 0 : void 0, 34546 "aria-posinset": posinset, 34547 "aria-setsize": setsize, 34548 "aria-selected": isSelected2, 34549 className: clsx_default( 34550 "dataviews-view-picker-activity__item", 34551 density === "compact" && "is-compact", 34552 density === "balanced" && "is-balanced", 34553 density === "comfortable" && "is-comfortable", 34554 isSelected2 && "is-selected" 34555 ), 34556 onClick: () => { 34557 if (isSelected2) { 34558 onChangeSelection( 34559 selection.filter((itemId) => id !== itemId) 34560 ); 34561 } else { 34562 const newSelection = multiselect ? [...selection, id] : [id]; 34563 onChangeSelection(newSelection); 34564 } 34565 }, 34566 render: /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("div", {}), 34567 children: /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)(Stack, { direction: "row", gap: "lg", justify: "start", align: "flex-start", children: [ 34568 /* @__PURE__ */ (0, import_jsx_runtime197.jsx)( 34569 Stack, 34570 { 34571 direction: "column", 34572 gap: "xs", 34573 align: "center", 34574 className: "dataviews-view-picker-activity__item-type", 34575 children: renderedMediaField 34576 } 34577 ), 34578 /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)( 34579 Stack, 34580 { 34581 direction: "column", 34582 gap: verticalGap, 34583 align: "flex-start", 34584 className: "dataviews-view-picker-activity__item-content", 34585 children: [ 34586 renderedTitleField && /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("div", { className: "dataviews-view-picker-activity__item-title", children: renderedTitleField }), 34587 renderedDescriptionField && /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("div", { className: "dataviews-view-picker-activity__item-description", children: renderedDescriptionField }), 34588 /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("div", { className: "dataviews-view-picker-activity__item-fields", children: otherFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)( 34589 "div", 34590 { 34591 className: "dataviews-view-picker-activity__item-field", 34592 children: [ 34593 /* @__PURE__ */ (0, import_jsx_runtime197.jsx)( 34594 VisuallyHidden, 34595 { 34596 render: /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("span", {}), 34597 className: "dataviews-view-picker-activity__item-field-label", 34598 children: field.label 34599 } 34600 ), 34601 /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("span", { className: "dataviews-view-picker-activity__item-field-value", children: /* @__PURE__ */ (0, import_jsx_runtime197.jsx)( 34602 field.render, 34603 { 34604 item, 34605 field 34606 } 34607 ) }) 34608 ] 34609 }, 34610 field.id 34611 )) }) 34612 ] 34613 } 34614 ) 34615 ] }) 34616 } 34617 ); 34618 } 34619 function PickerActivityGroup({ 34620 groupName, 34621 groupField, 34622 showLabel = true, 34623 children 34624 }) { 34625 const headerId = (0, import_compose13.useInstanceId)( 34626 PickerActivityGroup, 34627 "dataviews-view-picker-activity-group__header" 34628 ); 34629 return /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)( 34630 Stack, 34631 { 34632 direction: "column", 34633 role: "group", 34634 "aria-labelledby": headerId, 34635 className: "dataviews-view-picker-activity-group", 34636 children: [ 34637 /* @__PURE__ */ (0, import_jsx_runtime197.jsx)( 34638 "h3", 34639 { 34640 className: "dataviews-view-picker-activity-group__header", 34641 id: headerId, 34642 children: showLabel ? (0, import_i18n97.sprintf)( 34643 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 34644 (0, import_i18n97.__)("%1$s: %2$s"), 34645 groupField.label, 34646 groupName 34647 ) : groupName 34648 } 34649 ), 34650 children 34651 ] 34652 } 34653 ); 34654 } 34655 function ViewPickerActivity({ 34656 data, 34657 fields: fields2, 34658 getItemId: getItemId2, 34659 isLoading, 34660 onChangeSelection, 34661 selection, 34662 view, 34663 actions: actions2, 34664 className, 34665 empty 34666 }) { 34667 const { itemListLabel, paginationInfo } = (0, import_element93.useContext)(dataviews_context_default); 34668 const isMultiselect = useIsMultiselectPicker(actions2); 34669 const titleField2 = fields2.find( 34670 (field) => field.id === view?.titleField 34671 ); 34672 const mediaField = fields2.find( 34673 (field) => field.id === view?.mediaField 34674 ); 34675 const descriptionField3 = fields2.find( 34676 (field) => field.id === view?.descriptionField 34677 ); 34678 const otherFields = (view?.fields ?? []).map((fieldId) => fields2.find((f3) => fieldId === f3.id)).filter(isDefined4); 34679 const groupField = view.groupBy?.field ? fields2.find((f3) => f3.id === view.groupBy?.field) : null; 34680 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 34681 const isInfiniteScroll = (view.infiniteScrollEnabled && !dataByGroup) ?? false; 34682 const setsize = isInfiniteScroll ? paginationInfo?.totalItems : void 0; 34683 const hasData = !!data?.length; 34684 const isGrouped = !!(groupField && dataByGroup); 34685 const renderItem = (item) => /* @__PURE__ */ (0, import_jsx_runtime197.jsx)( 34686 PickerActivityItem, 34687 { 34688 view, 34689 multiselect: isMultiselect, 34690 selection, 34691 onChangeSelection, 34692 getItemId: getItemId2, 34693 item, 34694 titleField: titleField2, 34695 mediaField, 34696 descriptionField: descriptionField3, 34697 otherFields, 34698 posinset: item.position, 34699 setsize 34700 }, 34701 getItemId2(item) 34702 ); 34703 if (!hasData) { 34704 return /* @__PURE__ */ (0, import_jsx_runtime197.jsx)( 34705 "div", 34706 { 34707 className: clsx_default({ 34708 "dataviews-loading": isLoading, 34709 "dataviews-no-results": !isLoading 34710 }), 34711 children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(import_components42.Spinner, {}) }) : empty 34712 } 34713 ); 34714 } 34715 return /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)(import_jsx_runtime197.Fragment, { children: [ 34716 /* @__PURE__ */ (0, import_jsx_runtime197.jsx)( 34717 import_components42.Composite, 34718 { 34719 virtualFocus: true, 34720 orientation: "vertical", 34721 role: "listbox", 34722 "aria-multiselectable": isMultiselect, 34723 "aria-label": itemListLabel, 34724 "aria-busy": isLoading, 34725 render: isGrouped ? /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(Stack, { direction: "column", gap: "sm" }) : void 0, 34726 className: clsx_default( 34727 "dataviews-view-picker-activity", 34728 className 34729 ), 34730 children: isGrouped && dataByGroup ? Array.from(dataByGroup.entries()).map( 34731 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime197.jsx)( 34732 PickerActivityGroup, 34733 { 34734 groupName, 34735 groupField, 34736 showLabel: view.groupBy?.showLabel !== false, 34737 children: groupItems.map(renderItem) 34738 }, 34739 groupName 34740 ) 34741 ) : data.map(renderItem) 34742 } 34743 ), 34744 isLoading && /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(import_components42.Spinner, {}) }) 34745 ] }); 34746 } 34747 34748 // packages/dataviews/build-module/components/dataviews-layouts/utils/density-picker.mjs 34749 var import_components43 = __toESM(require_components(), 1); 34750 var import_i18n98 = __toESM(require_i18n(), 1); 34751 var import_element94 = __toESM(require_element(), 1); 34752 var import_jsx_runtime198 = __toESM(require_jsx_runtime(), 1); 34753 function DensityPicker() { 34754 const context = (0, import_element94.useContext)(dataviews_context_default); 34755 const view = context.view; 34756 return /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)( 34757 import_components43.__experimentalToggleGroupControl, 34758 { 34759 label: (0, import_i18n98.__)("Density"), 34760 value: view.layout?.density || "balanced", 34761 onChange: (value) => { 34762 context.onChangeView({ 34763 ...view, 34764 layout: { 34765 ...view.layout, 34766 density: value 34767 } 34768 }); 34769 }, 34770 isBlock: true, 34771 children: [ 34772 /* @__PURE__ */ (0, import_jsx_runtime198.jsx)( 34773 import_components43.__experimentalToggleGroupControlOption, 34774 { 34775 value: "comfortable", 34776 label: (0, import_i18n98._x)( 34777 "Comfortable", 34778 "Density option for DataView layout" 34779 ) 34780 }, 34781 "comfortable" 34782 ), 34783 /* @__PURE__ */ (0, import_jsx_runtime198.jsx)( 34784 import_components43.__experimentalToggleGroupControlOption, 34785 { 34786 value: "balanced", 34787 label: (0, import_i18n98._x)("Balanced", "Density option for DataView layout") 34788 }, 34789 "balanced" 34790 ), 34791 /* @__PURE__ */ (0, import_jsx_runtime198.jsx)( 34792 import_components43.__experimentalToggleGroupControlOption, 34793 { 34794 value: "compact", 34795 label: (0, import_i18n98._x)("Compact", "Density option for DataView layout") 34796 }, 34797 "compact" 34798 ) 34799 ] 34800 } 34801 ); 34802 } 34803 34804 // packages/dataviews/build-module/components/dataviews-layouts/utils/preview-size-picker.mjs 34805 var import_components44 = __toESM(require_components(), 1); 34806 var import_i18n99 = __toESM(require_i18n(), 1); 34807 var import_element95 = __toESM(require_element(), 1); 34808 var import_jsx_runtime199 = __toESM(require_jsx_runtime(), 1); 34809 var imageSizes2 = [ 34810 { 34811 value: 120, 34812 breakpoint: 1 34813 }, 34814 { 34815 value: 170, 34816 breakpoint: 1 34817 }, 34818 { 34819 value: 230, 34820 breakpoint: 1 34821 }, 34822 { 34823 value: 290, 34824 breakpoint: 1112 34825 // at minimum image width, 4 images display at this container size 34826 }, 34827 { 34828 value: 350, 34829 breakpoint: 1636 34830 // at minimum image width, 6 images display at this container size 34831 }, 34832 { 34833 value: 430, 34834 breakpoint: 588 34835 // at minimum image width, 2 images display at this container size 34836 } 34837 ]; 34838 function PreviewSizePicker() { 34839 const context = (0, import_element95.useContext)(dataviews_context_default); 34840 const view = context.view; 34841 const breakValues = imageSizes2.filter((size4) => { 34842 return context.containerWidth >= size4.breakpoint; 34843 }); 34844 const layoutPreviewSize = view.layout?.previewSize ?? 230; 34845 const previewSizeToUse = breakValues.map((size4, index2) => ({ ...size4, index: index2 })).filter((size4) => size4.value <= layoutPreviewSize).sort((a3, b3) => b3.value - a3.value)[0]?.index ?? 0; 34846 const marks = breakValues.map((size4, index2) => { 34847 return { 34848 value: index2 34849 }; 34850 }); 34851 return /* @__PURE__ */ (0, import_jsx_runtime199.jsx)( 34852 import_components44.RangeControl, 34853 { 34854 showTooltip: false, 34855 label: (0, import_i18n99.__)("Preview size"), 34856 value: previewSizeToUse, 34857 min: 0, 34858 max: breakValues.length - 1, 34859 withInputField: false, 34860 onChange: (value = 0) => { 34861 context.onChangeView({ 34862 ...view, 34863 layout: { 34864 ...view.layout, 34865 previewSize: breakValues[value].value 34866 } 34867 }); 34868 }, 34869 step: 1, 34870 marks 34871 } 34872 ); 34873 } 34874 34875 // packages/dataviews/build-module/components/dataviews-layouts/utils/grid-config-options.mjs 34876 var import_jsx_runtime200 = __toESM(require_jsx_runtime(), 1); 34877 function GridConfigOptions() { 34878 return /* @__PURE__ */ (0, import_jsx_runtime200.jsxs)(import_jsx_runtime200.Fragment, { children: [ 34879 /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(DensityPicker, {}), 34880 /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(PreviewSizePicker, {}) 34881 ] }); 34882 } 34883 34884 // packages/dataviews/build-module/components/dataviews-layouts/index.mjs 34885 var VIEW_LAYOUTS = [ 34886 { 34887 type: LAYOUT_TABLE, 34888 label: (0, import_i18n100.__)("Table"), 34889 component: table_default, 34890 icon: block_table_default, 34891 viewConfigOptions: DensityPicker 34892 }, 34893 { 34894 type: LAYOUT_GRID, 34895 label: (0, import_i18n100.__)("Grid"), 34896 component: grid_default, 34897 icon: category_default, 34898 viewConfigOptions: GridConfigOptions 34899 }, 34900 { 34901 type: LAYOUT_LIST, 34902 label: (0, import_i18n100.__)("List"), 34903 component: ViewList, 34904 icon: (0, import_i18n100.isRTL)() ? format_list_bullets_rtl_default : format_list_bullets_default, 34905 viewConfigOptions: DensityPicker 34906 }, 34907 { 34908 type: LAYOUT_ACTIVITY, 34909 label: (0, import_i18n100.__)("Activity"), 34910 component: ViewActivity, 34911 icon: scheduled_default, 34912 viewConfigOptions: DensityPicker 34913 }, 34914 { 34915 type: LAYOUT_PICKER_GRID, 34916 label: (0, import_i18n100.__)("Grid"), 34917 component: picker_grid_default, 34918 icon: category_default, 34919 viewConfigOptions: GridConfigOptions, 34920 isPicker: true 34921 }, 34922 { 34923 type: LAYOUT_PICKER_TABLE, 34924 label: (0, import_i18n100.__)("Table"), 34925 component: picker_table_default, 34926 icon: block_table_default, 34927 viewConfigOptions: DensityPicker, 34928 isPicker: true 34929 }, 34930 { 34931 type: LAYOUT_PICKER_ACTIVITY, 34932 label: (0, import_i18n100.__)("Activity"), 34933 component: ViewPickerActivity, 34934 icon: scheduled_default, 34935 viewConfigOptions: DensityPicker, 34936 isPicker: true 34937 } 34938 ]; 34939 34940 // packages/dataviews/build-module/components/dataviews-filters/filters.mjs 34941 var import_element103 = __toESM(require_element(), 1); 34942 34943 // packages/dataviews/build-module/components/dataviews-filters/filter.mjs 34944 var import_components47 = __toESM(require_components(), 1); 34945 var import_i18n103 = __toESM(require_i18n(), 1); 34946 var import_element100 = __toESM(require_element(), 1); 34947 34948 // node_modules/@ariakit/react-components/dist/focusable/focusable-context.js 34949 var import_react17 = __toESM(require_react(), 1); 34950 var FocusableContext = (0, import_react17.createContext)(true); 34951 34952 // node_modules/@ariakit/utils/dist/index.js 34953 function toArray2(arg) { 34954 if (Array.isArray(arg)) return arg; 34955 return typeof arg !== "undefined" ? [arg] : []; 34956 } 34957 function flatten2DArray(array) { 34958 const flattened = []; 34959 for (const row of array) flattened.push(...row); 34960 return flattened; 34961 } 34962 function reverseArray(array) { 34963 return array.slice().reverse(); 34964 } 34965 function noop6(..._) { 34966 } 34967 function hasOwnProperty(object, prop) { 34968 if (typeof Object.hasOwn === "function") return Object.hasOwn(object, prop); 34969 return Object.prototype.hasOwnProperty.call(object, prop); 34970 } 34971 function chain(...fns) { 34972 return (...args) => { 34973 for (const fn of fns) if (typeof fn === "function") fn(...args); 34974 }; 34975 } 34976 function normalizeString(str3) { 34977 return str3.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); 34978 } 34979 function omit(object, keys) { 34980 const result = { ...object }; 34981 for (const key of keys) if (hasOwnProperty(result, key)) delete result[key]; 34982 return result; 34983 } 34984 function pick(object, paths) { 34985 const result = {}; 34986 for (const key of paths) if (hasOwnProperty(object, key)) result[key] = object[key]; 34987 return result; 34988 } 34989 function identity(value) { 34990 return value; 34991 } 34992 function afterPaint(cb = noop6) { 34993 let raf2 = requestAnimationFrame(() => { 34994 raf2 = requestAnimationFrame(cb); 34995 }); 34996 return () => cancelAnimationFrame(raf2); 34997 } 34998 function invariant(condition, message2) { 34999 if (condition) return; 35000 if (typeof message2 !== "string") throw new Error("Invariant failed"); 35001 throw new Error(message2); 35002 } 35003 function getKeys(obj) { 35004 return Object.keys(obj); 35005 } 35006 function isFalsyBooleanCallback(booleanOrCallback, ...args) { 35007 const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback; 35008 if (result == null) return false; 35009 return !result; 35010 } 35011 function disabledFromProps(props) { 35012 return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true"; 35013 } 35014 function removeUndefinedValues(obj) { 35015 const result = {}; 35016 for (const key in obj) if (obj[key] !== void 0) result[key] = obj[key]; 35017 return result; 35018 } 35019 function defaultValue(...values) { 35020 for (const value of values) if (value !== void 0) return value; 35021 } 35022 var canUseDOM = checkIsBrowser(); 35023 function checkIsBrowser() { 35024 return typeof window !== "undefined" && !!window.document?.createElement; 35025 } 35026 function getDocument(node) { 35027 if (!node) return document; 35028 if ("self" in node) return node.document; 35029 return node.ownerDocument || document; 35030 } 35031 function getActiveElement(node, activeDescendant = false) { 35032 const { activeElement: activeElement2 } = getDocument(node); 35033 if (!activeElement2?.nodeName) return null; 35034 if (isFrame(activeElement2) && activeElement2.contentDocument?.body) return getActiveElement(activeElement2.contentDocument.body, activeDescendant); 35035 if (activeDescendant) { 35036 const id = activeElement2.getAttribute("aria-activedescendant"); 35037 if (id) { 35038 const element = getDocument(activeElement2).getElementById(id); 35039 if (element) return element; 35040 } 35041 } 35042 return activeElement2; 35043 } 35044 function contains2(parent, child) { 35045 return parent === child || parent.contains(child); 35046 } 35047 function isElement2(target) { 35048 return target?.nodeType === 1; 35049 } 35050 function isNode2(target) { 35051 return typeof target?.nodeType === "number"; 35052 } 35053 function isFrame(element) { 35054 return element.tagName === "IFRAME"; 35055 } 35056 function isButton(element) { 35057 const tagName = element.tagName.toLowerCase(); 35058 if (tagName === "button") return true; 35059 if (tagName === "input" && element.type) return buttonInputTypes.indexOf(element.type) !== -1; 35060 return false; 35061 } 35062 var buttonInputTypes = [ 35063 "button", 35064 "color", 35065 "file", 35066 "image", 35067 "reset", 35068 "submit" 35069 ]; 35070 function isVisible(element) { 35071 if (typeof element.checkVisibility === "function") return element.checkVisibility(); 35072 const htmlElement = element; 35073 return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0; 35074 } 35075 function isTextField(element) { 35076 try { 35077 if (element.tagName === "TEXTAREA") return true; 35078 if (element.tagName !== "INPUT") return false; 35079 return element.selectionStart !== null; 35080 } catch (_error) { 35081 return false; 35082 } 35083 } 35084 function isTextbox(element) { 35085 return element.isContentEditable || isTextField(element); 35086 } 35087 function getTextboxValue(element) { 35088 if (isTextField(element)) return element.value; 35089 if (element.isContentEditable) { 35090 const range = getDocument(element).createRange(); 35091 range.selectNodeContents(element); 35092 return range.toString(); 35093 } 35094 return ""; 35095 } 35096 function getTextboxSelection(element) { 35097 let start2 = 0; 35098 let end = 0; 35099 if (isTextField(element)) { 35100 start2 = element.selectionStart || 0; 35101 end = element.selectionEnd || 0; 35102 } else if (element.isContentEditable) { 35103 const selection = getDocument(element).getSelection(); 35104 if (selection?.rangeCount && selection.anchorNode && contains2(element, selection.anchorNode) && selection.focusNode && contains2(element, selection.focusNode)) { 35105 const range = selection.getRangeAt(0); 35106 const nextRange = range.cloneRange(); 35107 nextRange.selectNodeContents(element); 35108 nextRange.setEnd(range.startContainer, range.startOffset); 35109 start2 = nextRange.toString().length; 35110 nextRange.setEnd(range.endContainer, range.endOffset); 35111 end = nextRange.toString().length; 35112 } 35113 } 35114 return { 35115 start: start2, 35116 end 35117 }; 35118 } 35119 var allowedPopupRoles = [ 35120 "dialog", 35121 "menu", 35122 "listbox", 35123 "tree", 35124 "grid" 35125 ]; 35126 var itemRoleByPopupRole = { 35127 menu: "menuitem", 35128 listbox: "option", 35129 tree: "treeitem" 35130 }; 35131 function getPopupRole(element, fallback) { 35132 const role = element?.getAttribute("role"); 35133 if (role && allowedPopupRoles.indexOf(role) !== -1) return role; 35134 return fallback; 35135 } 35136 function getItemRoleByPopupRole(popupRole) { 35137 if (popupRole == null) return; 35138 if (!hasOwnProperty(itemRoleByPopupRole, popupRole)) return; 35139 return itemRoleByPopupRole[popupRole]; 35140 } 35141 function getScrollingElement(element) { 35142 if (!element) return null; 35143 const isScrollableOverflow = (overflow) => { 35144 if (overflow === "auto") return true; 35145 if (overflow === "scroll") return true; 35146 return false; 35147 }; 35148 if (element.clientHeight && element.scrollHeight > element.clientHeight) { 35149 const { overflowY } = getComputedStyle(element); 35150 if (isScrollableOverflow(overflowY)) return element; 35151 } else if (element.clientWidth && element.scrollWidth > element.clientWidth) { 35152 const { overflowX } = getComputedStyle(element); 35153 if (isScrollableOverflow(overflowX)) return element; 35154 } 35155 const doc = getDocument(element); 35156 return getScrollingElement(element.parentElement) || doc.scrollingElement || doc.body; 35157 } 35158 function setSelectionRange(element, ...args) { 35159 if (/text|search|password|tel|url/i.test(element.type)) element.setSelectionRange(...args); 35160 } 35161 function sortBasedOnDOMPosition(items, getElement) { 35162 const pairs = items.map((item, index2) => [index2, item]); 35163 let isOrderDifferent = false; 35164 pairs.sort(([indexA, a3], [indexB, b3]) => { 35165 const elementA = getElement(a3); 35166 const elementB = getElement(b3); 35167 if (elementA === elementB) return 0; 35168 if (!elementA || !elementB) return 0; 35169 if (isElementPreceding(elementA, elementB)) { 35170 if (indexA > indexB) isOrderDifferent = true; 35171 return -1; 35172 } 35173 if (indexA < indexB) isOrderDifferent = true; 35174 return 1; 35175 }); 35176 if (isOrderDifferent) return pairs.map(([_, item]) => item); 35177 return items; 35178 } 35179 function isElementPreceding(a3, b3) { 35180 return Boolean(b3.compareDocumentPosition(a3) & Node.DOCUMENT_POSITION_PRECEDING); 35181 } 35182 function isTouchDevice() { 35183 return canUseDOM && !!navigator.maxTouchPoints; 35184 } 35185 function isApple() { 35186 if (!canUseDOM) return false; 35187 return /mac|iphone|ipad|ipod/i.test(navigator.platform); 35188 } 35189 function isSafari() { 35190 return canUseDOM && isApple() && /apple/i.test(navigator.vendor); 35191 } 35192 function isFirefox() { 35193 return canUseDOM && /firefox\//i.test(navigator.userAgent); 35194 } 35195 function isPortalEvent(event) { 35196 const { currentTarget, target } = event; 35197 if (!currentTarget) return false; 35198 if (!isNode2(target)) return true; 35199 return !contains2(currentTarget, target); 35200 } 35201 function isSelfTarget(event) { 35202 return event.target === event.currentTarget; 35203 } 35204 function isActivatableNavigationTarget(element) { 35205 if (!isElement2(element)) return false; 35206 const target = element; 35207 const tagName = target.tagName.toLowerCase(); 35208 if (tagName === "a") return true; 35209 if (tagName === "button" && target.type === "submit") return true; 35210 if (tagName === "input" && target.type === "submit") return true; 35211 return false; 35212 } 35213 function isOpeningInNewTab(event) { 35214 const isAppleDevice = isApple(); 35215 if (isAppleDevice && !event.metaKey) return false; 35216 if (!isAppleDevice && !event.ctrlKey) return false; 35217 return isActivatableNavigationTarget(event.currentTarget); 35218 } 35219 function isDownloading(event) { 35220 if (!event.altKey) return false; 35221 return isActivatableNavigationTarget(event.currentTarget); 35222 } 35223 function fireBlurEvent(element, eventInit) { 35224 const event = new FocusEvent("blur", eventInit); 35225 const defaultAllowed = element.dispatchEvent(event); 35226 const bubbleInit = { 35227 ...eventInit, 35228 bubbles: true 35229 }; 35230 element.dispatchEvent(new FocusEvent("focusout", bubbleInit)); 35231 return defaultAllowed; 35232 } 35233 function fireKeyboardEvent(element, type, eventInit) { 35234 const event = new KeyboardEvent(type, eventInit); 35235 return element.dispatchEvent(event); 35236 } 35237 function fireClickEvent(element, eventInit) { 35238 const event = new MouseEvent("click", eventInit); 35239 return element.dispatchEvent(event); 35240 } 35241 function isFocusEventOutside(event, container) { 35242 const containerElement = container || event.currentTarget; 35243 const relatedTarget = event.relatedTarget; 35244 return !isNode2(relatedTarget) || !contains2(containerElement, relatedTarget); 35245 } 35246 function isInputEvent(event) { 35247 return event.type === "input"; 35248 } 35249 function queueBeforeEvent(element, type, callback, timeout) { 35250 const createTimer = (callback2) => { 35251 if (timeout) { 35252 const timerId2 = setTimeout(callback2, timeout); 35253 return () => clearTimeout(timerId2); 35254 } 35255 const timerId = requestAnimationFrame(callback2); 35256 return () => cancelAnimationFrame(timerId); 35257 }; 35258 const cancelTimer = createTimer(() => { 35259 element.removeEventListener(type, callSync, true); 35260 callback(); 35261 }); 35262 const callSync = () => { 35263 cancelTimer(); 35264 callback(); 35265 }; 35266 element.addEventListener(type, callSync, { 35267 once: true, 35268 capture: true 35269 }); 35270 return () => { 35271 cancelTimer(); 35272 element.removeEventListener(type, callSync, true); 35273 }; 35274 } 35275 function addGlobalEventListener(type, listener, options, scope = window) { 35276 const children = []; 35277 try { 35278 scope.document.addEventListener(type, listener, options); 35279 for (const frame of Array.from(scope.frames)) children.push(addGlobalEventListener(type, listener, options, frame)); 35280 } catch { 35281 } 35282 const removeEventListener = () => { 35283 try { 35284 scope.document.removeEventListener(type, listener, options); 35285 } catch { 35286 } 35287 for (const remove of children) remove(); 35288 }; 35289 return removeEventListener; 35290 } 35291 var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])"; 35292 function isFocusable(element) { 35293 if (!element.matches(selector)) return false; 35294 if (!isVisible(element)) return false; 35295 if (element.closest("[inert]")) return false; 35296 return true; 35297 } 35298 function hasFocus(element) { 35299 const activeElement2 = getActiveElement(element); 35300 if (!activeElement2) return false; 35301 if (activeElement2 === element) return true; 35302 const activeDescendant = activeElement2.getAttribute("aria-activedescendant"); 35303 if (!activeDescendant) return false; 35304 return activeDescendant === element.id; 35305 } 35306 function hasFocusWithin(element) { 35307 const activeElement2 = getActiveElement(element); 35308 if (!activeElement2) return false; 35309 if (contains2(element, activeElement2)) return true; 35310 const activeDescendant = activeElement2.getAttribute("aria-activedescendant"); 35311 if (!activeDescendant) return false; 35312 if (!("id" in element)) return false; 35313 if (activeDescendant === element.id) return true; 35314 return !!element.querySelector(`#$CSS.escape(activeDescendant)}`); 35315 } 35316 function focusIntoView(element, options) { 35317 if (!("scrollIntoView" in element)) element.focus(); 35318 else { 35319 element.focus({ preventScroll: true }); 35320 element.scrollIntoView({ 35321 block: "nearest", 35322 inline: "nearest", 35323 ...options 35324 }); 35325 } 35326 } 35327 function createUndoCallback(callback) { 35328 return async () => { 35329 const redo2 = await callback?.(); 35330 return createUndoCallback(async () => { 35331 await redo2?.(); 35332 return callback; 35333 }); 35334 }; 35335 } 35336 var UndoManager = createUndoManager(); 35337 function createUndoManager({ limit = 100 } = {}) { 35338 const undoStack = []; 35339 let redoStack = []; 35340 let currentGroup = null; 35341 const canUndo = () => undoStack.length > 0; 35342 const canRedo = () => redoStack.length > 0; 35343 const undo2 = async () => { 35344 if (!canUndo()) return; 35345 currentGroup = null; 35346 redoStack.push(await undoStack.pop()?.()); 35347 }; 35348 const redo2 = async () => { 35349 if (!canRedo()) return; 35350 currentGroup = null; 35351 undoStack.push(await redoStack.pop()?.()); 35352 }; 35353 const execute = async (callback, group) => { 35354 if (!callback) return; 35355 const sameGroup = group === currentGroup; 35356 currentGroup = group ?? null; 35357 const nextIndex = sameGroup ? Math.max(0, undoStack.length - 1) : undoStack.length; 35358 const undoCallback = await callback(); 35359 if (!undoCallback) return; 35360 redoStack = []; 35361 const currentUndo = undoStack[nextIndex]; 35362 undoStack[nextIndex] = createUndoCallback(async () => { 35363 await undoCallback?.(); 35364 const currentRedo = await currentUndo?.(); 35365 return async () => { 35366 await currentRedo?.(); 35367 await callback?.(); 35368 }; 35369 }); 35370 while (undoStack.length > limit) undoStack.shift(); 35371 }; 35372 return { 35373 canUndo, 35374 canRedo, 35375 undo: undo2, 35376 redo: redo2, 35377 execute 35378 }; 35379 } 35380 35381 // node_modules/@ariakit/react-utils/dist/index.js 35382 var React75 = __toESM(require_react(), 1); 35383 var import_react18 = __toESM(require_react(), 1); 35384 var import_jsx_runtime201 = __toESM(require_jsx_runtime(), 1); 35385 function setRef(ref, value) { 35386 if (typeof ref === "function") { 35387 const cleanup = ref(value); 35388 if (typeof cleanup === "function") return cleanup; 35389 } else if (ref) ref.current = value; 35390 } 35391 function isValidElementWithRef(element) { 35392 if (!element) return false; 35393 if (!(0, import_react18.isValidElement)(element)) return false; 35394 if ("ref" in element.props) return true; 35395 if ("ref" in element) return true; 35396 return false; 35397 } 35398 function getRefProperty(element) { 35399 if (!isValidElementWithRef(element)) return null; 35400 return { ...element.props }.ref || element.ref; 35401 } 35402 function mergeProps2(base, overrides) { 35403 const props = { ...base }; 35404 for (const key in overrides) { 35405 if (!hasOwnProperty(overrides, key)) continue; 35406 if (key === "className") { 35407 const prop = "className"; 35408 const baseClass = base[prop]; 35409 const overrideClass = overrides[prop]; 35410 if (baseClass && overrideClass) props[prop] = `$baseClass} $overrideClass}`; 35411 else props[prop] = overrideClass || baseClass; 35412 continue; 35413 } 35414 if (key === "style") { 35415 const prop = "style"; 35416 props[prop] = base[prop] ? { 35417 ...base[prop], 35418 ...overrides[prop] 35419 } : overrides[prop]; 35420 continue; 35421 } 35422 const overrideValue = overrides[key]; 35423 if (key.startsWith("on")) { 35424 if (typeof overrideValue !== "function") continue; 35425 const baseValue = base[key]; 35426 if (typeof baseValue === "function") { 35427 props[key] = (...args) => { 35428 overrideValue(...args); 35429 baseValue(...args); 35430 }; 35431 continue; 35432 } 35433 } 35434 props[key] = overrideValue; 35435 } 35436 return props; 35437 } 35438 var _React = { ...React75 }; 35439 var useReactId = _React.useId; 35440 var useReactDeferredValue = _React.useDeferredValue; 35441 var useReactInsertionEffect = _React.useInsertionEffect; 35442 var useSafeLayoutEffect = canUseDOM ? import_react18.useLayoutEffect : import_react18.useEffect; 35443 function useInitialValue(value) { 35444 const [initialValue] = (0, import_react18.useState)(value); 35445 return initialValue; 35446 } 35447 function useLiveRef(value) { 35448 const ref = (0, import_react18.useRef)(value); 35449 useSafeLayoutEffect(() => { 35450 ref.current = value; 35451 }); 35452 return ref; 35453 } 35454 function useEvent2(callback) { 35455 const ref = (0, import_react18.useRef)(() => { 35456 throw new Error("Cannot call an event handler while rendering."); 35457 }); 35458 if (useReactInsertionEffect) useReactInsertionEffect(() => { 35459 ref.current = callback; 35460 }); 35461 else ref.current = callback; 35462 return (0, import_react18.useCallback)((...args) => ref.current?.(...args), []); 35463 } 35464 function useTransactionState(callback) { 35465 const [state2, setState] = (0, import_react18.useState)(null); 35466 useSafeLayoutEffect(() => { 35467 if (state2 == null) return; 35468 if (!callback) return; 35469 let prevState = null; 35470 callback((prev) => { 35471 prevState = prev; 35472 return state2; 35473 }); 35474 return () => { 35475 callback(prevState); 35476 }; 35477 }, [state2, callback]); 35478 return [state2, setState]; 35479 } 35480 function useMergeRefs2(...refs) { 35481 return (0, import_react18.useMemo)(() => { 35482 if (!refs.some(Boolean)) return; 35483 return (value) => { 35484 const refEffects = []; 35485 for (const ref of refs) { 35486 if (!ref) continue; 35487 const cleanup = setRef(ref, value); 35488 refEffects.push({ 35489 ref, 35490 cleanup: typeof cleanup === "function" ? cleanup : void 0 35491 }); 35492 } 35493 if (!refEffects.some((effect) => effect.cleanup)) return; 35494 return () => { 35495 for (const { ref, cleanup } of refEffects) if (cleanup) cleanup(); 35496 else setRef(ref, null); 35497 }; 35498 }; 35499 }, refs); 35500 } 35501 function useId5(defaultId) { 35502 if (useReactId) { 35503 const reactId = useReactId(); 35504 if (defaultId) return defaultId; 35505 return reactId; 35506 } 35507 const [id, setId] = (0, import_react18.useState)(defaultId); 35508 useSafeLayoutEffect(() => { 35509 if (defaultId || id) return; 35510 setId(`id-$Math.random().toString(36).slice(2, 8)}`); 35511 }, [defaultId, id]); 35512 return defaultId || id; 35513 } 35514 function useTagName(refOrElement, type) { 35515 const stringOrUndefined = (type2) => { 35516 if (typeof type2 !== "string") return; 35517 return type2; 35518 }; 35519 const [tagName, setTagName] = (0, import_react18.useState)(() => stringOrUndefined(type)); 35520 useSafeLayoutEffect(() => { 35521 setTagName((refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement)?.tagName.toLowerCase() || stringOrUndefined(type)); 35522 }, [refOrElement, type]); 35523 return tagName; 35524 } 35525 function useAttribute(refOrElement, attributeName, defaultValue2) { 35526 const initialValue = useInitialValue(defaultValue2); 35527 const [attribute, setAttribute] = (0, import_react18.useState)(initialValue); 35528 (0, import_react18.useEffect)(() => { 35529 const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; 35530 if (!element) return; 35531 const callback = () => { 35532 const value = element.getAttribute(attributeName); 35533 setAttribute(value == null ? initialValue : value); 35534 }; 35535 const observer = new MutationObserver(callback); 35536 observer.observe(element, { attributeFilter: [attributeName] }); 35537 callback(); 35538 return () => observer.disconnect(); 35539 }, [ 35540 refOrElement, 35541 attributeName, 35542 initialValue 35543 ]); 35544 return attribute; 35545 } 35546 function useUpdateEffect(effect, deps) { 35547 const mounted = (0, import_react18.useRef)(false); 35548 (0, import_react18.useEffect)(() => { 35549 if (mounted.current) return effect(); 35550 mounted.current = true; 35551 }, deps); 35552 (0, import_react18.useEffect)(() => () => { 35553 mounted.current = false; 35554 }, []); 35555 } 35556 function useUpdateLayoutEffect(effect, deps) { 35557 const mounted = (0, import_react18.useRef)(false); 35558 useSafeLayoutEffect(() => { 35559 if (mounted.current) return effect(); 35560 mounted.current = true; 35561 }, deps); 35562 useSafeLayoutEffect(() => () => { 35563 mounted.current = false; 35564 }, []); 35565 } 35566 function useForceUpdate2() { 35567 return (0, import_react18.useReducer)(() => [], []); 35568 } 35569 function useBooleanEvent(booleanOrCallback) { 35570 return useEvent2(typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback); 35571 } 35572 function useWrapElement(props, callback, deps = []) { 35573 const wrapElement = (0, import_react18.useCallback)((element) => { 35574 if (props.wrapElement) element = props.wrapElement(element); 35575 return callback(element); 35576 }, [...deps, props.wrapElement]); 35577 return { 35578 ...props, 35579 wrapElement 35580 }; 35581 } 35582 function useMetadataProps(props, key, value) { 35583 const parent = props.onLoadedMetadataCapture; 35584 const onLoadedMetadataCapture = (0, import_react18.useMemo)(() => { 35585 return Object.assign(() => { 35586 }, parent, ...value !== void 0 ? [{ [key]: value }] : []); 35587 }, [ 35588 parent, 35589 key, 35590 value 35591 ]); 35592 return [parent?.[key], { onLoadedMetadataCapture }]; 35593 } 35594 var hasInstalledGlobalEventListeners = false; 35595 function useIsMouseMoving() { 35596 (0, import_react18.useEffect)(() => { 35597 if (hasInstalledGlobalEventListeners) return; 35598 addGlobalEventListener("mousemove", setMouseMoving, true); 35599 addGlobalEventListener("mousedown", resetMouseMoving, true); 35600 addGlobalEventListener("mouseup", resetMouseMoving, true); 35601 addGlobalEventListener("keydown", resetMouseMoving, true); 35602 addGlobalEventListener("scroll", resetMouseMoving, true); 35603 hasInstalledGlobalEventListeners = true; 35604 }, []); 35605 return useEvent2(() => mouseMoving); 35606 } 35607 var mouseMoving = false; 35608 var previousScreenX = 0; 35609 var previousScreenY = 0; 35610 function hasMouseMovement(event) { 35611 const movementX = event.movementX || event.screenX - previousScreenX; 35612 const movementY = event.movementY || event.screenY - previousScreenY; 35613 previousScreenX = event.screenX; 35614 previousScreenY = event.screenY; 35615 return movementX || movementY || false; 35616 } 35617 function setMouseMoving(event) { 35618 if (!hasMouseMovement(event)) return; 35619 mouseMoving = true; 35620 } 35621 function resetMouseMoving() { 35622 mouseMoving = false; 35623 } 35624 function forwardRef54(render5) { 35625 const Role = React75.forwardRef((props, ref) => render5({ 35626 ...props, 35627 ref 35628 })); 35629 Role.displayName = render5.displayName || render5.name; 35630 return Role; 35631 } 35632 function memo4(Component3, propsAreEqual) { 35633 return React75.memo(Component3, propsAreEqual); 35634 } 35635 function createElement5(Type, props) { 35636 const { wrapElement, render: render5, ...rest } = props; 35637 const mergedRef = useMergeRefs2(props.ref, getRefProperty(render5)); 35638 let element; 35639 if (React75.isValidElement(render5)) { 35640 const renderProps = { 35641 ...render5.props, 35642 ref: mergedRef 35643 }; 35644 element = React75.cloneElement(render5, mergeProps2(rest, renderProps)); 35645 } else if (render5) element = render5(rest); 35646 else element = /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(Type, { ...rest }); 35647 if (wrapElement) return wrapElement(element); 35648 return element; 35649 } 35650 function createHook(useProps) { 35651 const useRole = (props = {}) => { 35652 return useProps(props); 35653 }; 35654 useRole.displayName = useProps.name; 35655 return useRole; 35656 } 35657 function createStoreContext(providers = [], scopedProviders = []) { 35658 const context = React75.createContext(void 0); 35659 const scopedContext = React75.createContext(void 0); 35660 const useContext72 = () => React75.useContext(context); 35661 const useScopedContext = (onlyScoped = false) => { 35662 const scoped = React75.useContext(scopedContext); 35663 const store4 = useContext72(); 35664 if (onlyScoped) return scoped; 35665 return scoped || store4; 35666 }; 35667 const useProviderContext = () => { 35668 const scoped = React75.useContext(scopedContext); 35669 const store4 = useContext72(); 35670 if (scoped && scoped === store4) return; 35671 return store4; 35672 }; 35673 const ContextProvider = (props) => { 35674 return providers.reduceRight((children, Provider2) => /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(Provider2, { 35675 ...props, 35676 children 35677 }), /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(context.Provider, { ...props })); 35678 }; 35679 const ScopedContextProvider = (props) => { 35680 return /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(ContextProvider, { 35681 ...props, 35682 children: scopedProviders.reduceRight((children, Provider2) => /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(Provider2, { 35683 ...props, 35684 children 35685 }), /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(scopedContext.Provider, { ...props })) 35686 }); 35687 }; 35688 return { 35689 context, 35690 scopedContext, 35691 useContext: useContext72, 35692 useScopedContext, 35693 useProviderContext, 35694 ContextProvider, 35695 ScopedContextProvider 35696 }; 35697 } 35698 35699 // node_modules/@ariakit/react-components/dist/focusable/focusable.js 35700 var import_react19 = __toESM(require_react(), 1); 35701 var TagName = "div"; 35702 var accessibleWhenDisabledSymbol = /* @__PURE__ */ Symbol("accessibleWhenDisabled"); 35703 var isSafariBrowser = isSafari(); 35704 var alwaysFocusVisibleInputTypes = [ 35705 "text", 35706 "search", 35707 "url", 35708 "tel", 35709 "email", 35710 "password", 35711 "number", 35712 "date", 35713 "month", 35714 "week", 35715 "time", 35716 "datetime", 35717 "datetime-local" 35718 ]; 35719 function isAlwaysFocusVisible(element) { 35720 const { tagName, readOnly, type } = element; 35721 if (tagName === "TEXTAREA" && !readOnly) return true; 35722 if (tagName === "SELECT" && !readOnly) return true; 35723 if (tagName === "INPUT" && !readOnly) return alwaysFocusVisibleInputTypes.includes(type); 35724 if (element.isContentEditable) return true; 35725 if (element.getAttribute("role") === "combobox" && element.dataset.name) return true; 35726 return false; 35727 } 35728 function isNativeTabbable(tagName) { 35729 if (!tagName) return true; 35730 return tagName === "button" || tagName === "summary" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a"; 35731 } 35732 function supportsDisabledAttribute(tagName) { 35733 if (!tagName) return true; 35734 return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea"; 35735 } 35736 function isNativeSubmitControl(element) { 35737 if (element.tagName === "BUTTON") { 35738 const { type } = element; 35739 return type === "submit"; 35740 } 35741 if (element.tagName === "INPUT") { 35742 const { type } = element; 35743 return type === "submit" || type === "image"; 35744 } 35745 return false; 35746 } 35747 function getTabIndex2({ focusable: focusable2, trulyDisabled, nativeTabbable, supportsDisabled, safariTabIndex, tabIndexProp }) { 35748 if (!focusable2) return tabIndexProp; 35749 if (trulyDisabled) { 35750 if (nativeTabbable && !supportsDisabled) return -1; 35751 return; 35752 } 35753 if (nativeTabbable) { 35754 if (safariTabIndex && tabIndexProp == null) return 0; 35755 return tabIndexProp; 35756 } 35757 return tabIndexProp ?? 0; 35758 } 35759 function useDisableEvent(onEvent, disabled2) { 35760 return useEvent2((event) => { 35761 onEvent?.(event); 35762 if (event.defaultPrevented) return; 35763 if (disabled2) { 35764 event.stopPropagation(); 35765 event.preventDefault(); 35766 } 35767 }); 35768 } 35769 var hasInstalledGlobalEventListeners2 = false; 35770 var isKeyboardModality = true; 35771 function onGlobalMouseDown(event) { 35772 const target = event.target; 35773 if (isElement2(target) && !target.hasAttribute("data-focus-visible")) isKeyboardModality = false; 35774 } 35775 function onGlobalKeyDown(event) { 35776 if (event.metaKey) return; 35777 if (event.ctrlKey) return; 35778 if (event.altKey) return; 35779 isKeyboardModality = true; 35780 } 35781 var useFocusable = createHook(function useFocusable2({ focusable: focusable2 = true, accessibleWhenDisabled, autoFocus, onFocusVisible, ...props }) { 35782 const ref = (0, import_react19.useRef)(null); 35783 const [parentAccessibleWhenDisabled, metadataProps] = useMetadataProps(props, accessibleWhenDisabledSymbol, accessibleWhenDisabled); 35784 accessibleWhenDisabled ??= parentAccessibleWhenDisabled; 35785 (0, import_react19.useEffect)(() => { 35786 if (!focusable2) return; 35787 if (hasInstalledGlobalEventListeners2) return; 35788 addGlobalEventListener("mousedown", onGlobalMouseDown, true); 35789 addGlobalEventListener("keydown", onGlobalKeyDown, true); 35790 hasInstalledGlobalEventListeners2 = true; 35791 }, [focusable2]); 35792 const disabled2 = focusable2 && disabledFromProps(props); 35793 const trulyDisabled = disabled2 && !accessibleWhenDisabled; 35794 const [focusVisible, setFocusVisible] = (0, import_react19.useState)(false); 35795 const focusVisibleRef = (0, import_react19.useRef)(false); 35796 const nativeSubmitObserverCleanupRef = (0, import_react19.useRef)(null); 35797 const cleanupFocusVisible = useEvent2((element) => { 35798 nativeSubmitObserverCleanupRef.current?.(); 35799 nativeSubmitObserverCleanupRef.current = null; 35800 focusVisibleRef.current = false; 35801 element?.removeAttribute("data-focus-visible"); 35802 }); 35803 (0, import_react19.useEffect)(() => { 35804 if (!focusable2) return; 35805 if (!trulyDisabled) return; 35806 cleanupFocusVisible(ref.current); 35807 if (focusVisible) setFocusVisible(false); 35808 }, [ 35809 focusable2, 35810 trulyDisabled, 35811 focusVisible, 35812 cleanupFocusVisible 35813 ]); 35814 (0, import_react19.useEffect)(() => { 35815 if (!focusable2) return; 35816 if (!focusVisible) return; 35817 const element = ref.current; 35818 if (!element) return; 35819 if (typeof IntersectionObserver === "undefined") return; 35820 const observer = new IntersectionObserver(() => { 35821 if (!isFocusable(element)) { 35822 focusVisibleRef.current = false; 35823 setFocusVisible(false); 35824 } 35825 }); 35826 observer.observe(element); 35827 return () => observer.disconnect(); 35828 }, [focusable2, focusVisible]); 35829 (0, import_react19.useEffect)(() => { 35830 return () => nativeSubmitObserverCleanupRef.current?.(); 35831 }, []); 35832 const onKeyPressCapture = useDisableEvent(props.onKeyPressCapture, disabled2); 35833 const onMouseDownCapture = useDisableEvent(props.onMouseDownCapture, disabled2); 35834 const onClickCapture = useDisableEvent(props.onClickCapture, disabled2); 35835 const handleFocusVisible = (event, currentTarget) => { 35836 if (currentTarget) event.currentTarget = currentTarget; 35837 if (!focusable2) return; 35838 const element = event.currentTarget; 35839 if (!element) return; 35840 if (!hasFocus(element)) return; 35841 onFocusVisible?.(event); 35842 if (event.defaultPrevented) return; 35843 element.dataset.focusVisible = "true"; 35844 focusVisibleRef.current = true; 35845 if (isNativeSubmitControl(element)) { 35846 nativeSubmitObserverCleanupRef.current?.(); 35847 nativeSubmitObserverCleanupRef.current = null; 35848 if (typeof IntersectionObserver !== "undefined") { 35849 const observer = new IntersectionObserver(() => { 35850 if (isFocusable(element)) return; 35851 cleanupFocusVisible(element); 35852 }); 35853 observer.observe(element); 35854 nativeSubmitObserverCleanupRef.current = () => observer.disconnect(); 35855 } 35856 return; 35857 } 35858 setFocusVisible(true); 35859 }; 35860 const onKeyDownCaptureProp = props.onKeyDownCapture; 35861 const onKeyDownCapture = useEvent2((event) => { 35862 onKeyDownCaptureProp?.(event); 35863 if (event.defaultPrevented) return; 35864 if (!focusable2) return; 35865 if (focusVisible) return; 35866 if (focusVisibleRef.current) return; 35867 if (event.metaKey) return; 35868 if (event.altKey) return; 35869 if (event.ctrlKey) return; 35870 if (!isSelfTarget(event)) return; 35871 const element = event.currentTarget; 35872 const applyFocusVisible = () => handleFocusVisible(event, element); 35873 queueBeforeEvent(element, "focusout", applyFocusVisible); 35874 }); 35875 const onFocusCaptureProp = props.onFocusCapture; 35876 const onFocusCapture = useEvent2((event) => { 35877 onFocusCaptureProp?.(event); 35878 if (event.defaultPrevented) return; 35879 if (!focusable2) return; 35880 if (!isSelfTarget(event)) { 35881 setFocusVisible(false); 35882 return; 35883 } 35884 const element = event.currentTarget; 35885 const applyFocusVisible = () => handleFocusVisible(event, element); 35886 if (isKeyboardModality || isAlwaysFocusVisible(event.target)) queueBeforeEvent(event.target, "focusout", applyFocusVisible); 35887 else setFocusVisible(false); 35888 }); 35889 const onBlurProp = props.onBlur; 35890 const onBlur = useEvent2((event) => { 35891 onBlurProp?.(event); 35892 if (!focusable2) return; 35893 if (!isFocusEventOutside(event)) return; 35894 cleanupFocusVisible(event.currentTarget); 35895 setFocusVisible(false); 35896 }); 35897 const autoFocusOnShow = (0, import_react19.useContext)(FocusableContext); 35898 const autoFocusRef = useEvent2((element) => { 35899 if (!focusable2) return; 35900 if (!autoFocus) return; 35901 if (!element) return; 35902 if (!autoFocusOnShow) return; 35903 queueMicrotask(() => { 35904 if (hasFocus(element)) return; 35905 if (!isFocusable(element)) return; 35906 element.focus(); 35907 }); 35908 }); 35909 const tagName = useTagName(ref); 35910 const nativeTabbable = focusable2 && isNativeTabbable(tagName); 35911 const supportsDisabled = focusable2 && supportsDisabledAttribute(tagName); 35912 const [safariTabIndex, setSafariTabIndex] = (0, import_react19.useState)(false); 35913 if (isSafariBrowser) (0, import_react19.useEffect)(() => { 35914 if (!focusable2) return; 35915 const element = ref.current; 35916 if (!element) return; 35917 const { type } = element; 35918 const isNativeCheckboxOrRadio = element.tagName === "INPUT" && (type === "checkbox" || type === "radio"); 35919 setSafariTabIndex(isButton(element) || isNativeCheckboxOrRadio); 35920 }, [focusable2]); 35921 const styleProp = props.style; 35922 const style = (0, import_react19.useMemo)(() => { 35923 if (trulyDisabled) return { 35924 pointerEvents: "none", 35925 ...styleProp 35926 }; 35927 return styleProp; 35928 }, [trulyDisabled, styleProp]); 35929 props = { 35930 "data-focus-visible": focusable2 && focusVisible || void 0, 35931 "data-autofocus": autoFocus || void 0, 35932 "aria-disabled": disabled2 || void 0, 35933 ...props, 35934 ...metadataProps, 35935 ref: useMergeRefs2(ref, autoFocusRef, props.ref), 35936 style, 35937 tabIndex: getTabIndex2({ 35938 focusable: focusable2, 35939 trulyDisabled, 35940 nativeTabbable, 35941 supportsDisabled, 35942 safariTabIndex, 35943 tabIndexProp: props.tabIndex 35944 }), 35945 disabled: supportsDisabled && trulyDisabled ? true : void 0, 35946 contentEditable: disabled2 ? void 0 : props.contentEditable, 35947 onKeyPressCapture, 35948 onClickCapture, 35949 onMouseDownCapture, 35950 onKeyDownCapture, 35951 onFocusCapture, 35952 onBlur 35953 }; 35954 return removeUndefinedValues(props); 35955 }); 35956 var Focusable = forwardRef54(function Focusable2(props) { 35957 return createElement5(TagName, useFocusable(props)); 35958 }); 35959 35960 // node_modules/@ariakit/react-components/dist/command/command.js 35961 var import_react20 = __toESM(require_react(), 1); 35962 var TagName2 = "button"; 35963 function isNativeClick(event) { 35964 if (!event.isTrusted) return false; 35965 const element = event.currentTarget; 35966 if (event.key === "Enter") return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "A"; 35967 if (event.key === " ") return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT"; 35968 return false; 35969 } 35970 var symbol = /* @__PURE__ */ Symbol("command"); 35971 var useCommand = createHook(function useCommand2({ clickOnEnter = true, clickOnSpace = true, ...props }) { 35972 const ref = (0, import_react20.useRef)(null); 35973 const [isNativeButton, setIsNativeButton] = (0, import_react20.useState)(false); 35974 (0, import_react20.useEffect)(() => { 35975 if (!ref.current) return; 35976 setIsNativeButton(isButton(ref.current)); 35977 }, []); 35978 const [active, setActive] = (0, import_react20.useState)(false); 35979 const activeRef = (0, import_react20.useRef)(false); 35980 const disabled2 = disabledFromProps(props); 35981 const [isDuplicate, metadataProps] = useMetadataProps(props, symbol, true); 35982 useSafeLayoutEffect(() => { 35983 if (!disabled2) return; 35984 activeRef.current = false; 35985 setActive(false); 35986 }, [disabled2]); 35987 const onKeyDownProp = props.onKeyDown; 35988 const onKeyDown = useEvent2((event) => { 35989 onKeyDownProp?.(event); 35990 const element = event.currentTarget; 35991 if (event.defaultPrevented) return; 35992 if (isDuplicate) return; 35993 if (disabled2) return; 35994 if (!isSelfTarget(event)) return; 35995 if (isTextField(element)) return; 35996 if (element.isContentEditable) return; 35997 const isEnter = clickOnEnter && event.key === "Enter"; 35998 const isSpace = clickOnSpace && event.key === " "; 35999 const shouldPreventEnter = event.key === "Enter" && !clickOnEnter; 36000 const shouldPreventSpace = event.key === " " && !clickOnSpace; 36001 if (shouldPreventEnter || shouldPreventSpace) { 36002 event.preventDefault(); 36003 return; 36004 } 36005 if (isEnter || isSpace) { 36006 const nativeClick = isNativeClick(event); 36007 if (isEnter) { 36008 if (!nativeClick) { 36009 event.preventDefault(); 36010 const { view, ...eventInit } = event; 36011 const click = () => fireClickEvent(element, eventInit); 36012 if (isFirefox()) queueBeforeEvent(element, "keyup", click); 36013 else queueMicrotask(click); 36014 } 36015 } else if (isSpace) { 36016 activeRef.current = true; 36017 if (!nativeClick) { 36018 event.preventDefault(); 36019 setActive(true); 36020 } 36021 } 36022 } 36023 }); 36024 const onKeyUpProp = props.onKeyUp; 36025 const onKeyUp = useEvent2((event) => { 36026 onKeyUpProp?.(event); 36027 if (isDuplicate) return; 36028 const isSpace = clickOnSpace && event.key === " "; 36029 if (!activeRef.current || !isSpace) return; 36030 const nativeClick = isNativeClick(event); 36031 activeRef.current = false; 36032 if (!nativeClick) setActive(false); 36033 if (event.defaultPrevented) return; 36034 if (!isSelfTarget(event)) return; 36035 if (disabled2) return; 36036 if (event.metaKey) return; 36037 if (nativeClick) return; 36038 event.preventDefault(); 36039 const element = event.currentTarget; 36040 const { view, ...eventInit } = event; 36041 queueMicrotask(() => fireClickEvent(element, eventInit)); 36042 }); 36043 const onBlurProp = props.onBlur; 36044 const onBlur = useEvent2((event) => { 36045 onBlurProp?.(event); 36046 if (!activeRef.current) return; 36047 activeRef.current = false; 36048 setActive(false); 36049 }); 36050 props = { 36051 "data-active": active || void 0, 36052 type: isNativeButton ? "button" : void 0, 36053 ...metadataProps, 36054 ...props, 36055 ref: useMergeRefs2(ref, props.ref), 36056 onKeyDown, 36057 onKeyUp, 36058 onBlur 36059 }; 36060 props = useFocusable(props); 36061 return props; 36062 }); 36063 var Command = forwardRef54(function Command2(props) { 36064 return createElement5(TagName2, useCommand(props)); 36065 }); 36066 36067 // node_modules/@ariakit/react-components/dist/collection/collection-context.js 36068 var ctx2 = createStoreContext(); 36069 var useCollectionContext = ctx2.useContext; 36070 var useCollectionScopedContext = ctx2.useScopedContext; 36071 var useCollectionProviderContext = ctx2.useProviderContext; 36072 var CollectionContextProvider = ctx2.ContextProvider; 36073 var CollectionScopedContextProvider = ctx2.ScopedContextProvider; 36074 36075 // node_modules/@ariakit/react-components/dist/collection/collection-item.js 36076 var import_react21 = __toESM(require_react(), 1); 36077 var TagName3 = "div"; 36078 var useCollectionItem = createHook(function useCollectionItem2({ store: store4, shouldRegisterItem = true, getItem = identity, element, ...props }) { 36079 const context = useCollectionContext(); 36080 store4 = store4 || context; 36081 const id = useId5(props.id); 36082 const ref = (0, import_react21.useRef)(element); 36083 (0, import_react21.useEffect)(() => { 36084 const element2 = ref.current; 36085 if (!id) return; 36086 if (!element2) return; 36087 if (!shouldRegisterItem) return; 36088 const item = getItem({ 36089 id, 36090 element: element2 36091 }); 36092 return store4?.renderItem(item); 36093 }, [ 36094 id, 36095 shouldRegisterItem, 36096 getItem, 36097 store4 36098 ]); 36099 props = { 36100 ...props, 36101 ref: useMergeRefs2(ref, props.ref) 36102 }; 36103 return removeUndefinedValues(props); 36104 }); 36105 var CollectionItem = forwardRef54(function CollectionItem2(props) { 36106 return createElement5(TagName3, useCollectionItem(props)); 36107 }); 36108 36109 // node_modules/@ariakit/react-components/dist/composite/composite-context.js 36110 var import_react22 = __toESM(require_react(), 1); 36111 var ctx3 = createStoreContext([CollectionContextProvider], [CollectionScopedContextProvider]); 36112 var useCompositeContext = ctx3.useContext; 36113 var useCompositeScopedContext = ctx3.useScopedContext; 36114 var useCompositeProviderContext = ctx3.useProviderContext; 36115 var CompositeContextProvider = ctx3.ContextProvider; 36116 var CompositeScopedContextProvider = ctx3.ScopedContextProvider; 36117 var CompositeItemContext = (0, import_react22.createContext)(void 0); 36118 var CompositeRowContext = (0, import_react22.createContext)(void 0); 36119 36120 // node_modules/@ariakit/store/dist/index.js 36121 function getInternal(store4, key) { 36122 const internals = store4.__unstableInternals; 36123 invariant(internals, "Invalid store"); 36124 return internals[key]; 36125 } 36126 function hasUpdatedKey(keys, updatedKey) { 36127 if (!keys) return true; 36128 for (const currentKey of keys) if (updatedKey instanceof Set) { 36129 if (updatedKey.has(currentKey)) return true; 36130 } else if (currentKey === updatedKey) return true; 36131 return false; 36132 } 36133 function isSameValue(value, other) { 36134 return value === other || value !== value && other !== other; 36135 } 36136 function getCleanupPrevState(prevState, state2, stateBeforeCleanup, updatedKey) { 36137 let cleanupPrevState; 36138 for (const key of getKeys(state2)) { 36139 if (isSameValue(state2[key], stateBeforeCleanup[key])) continue; 36140 if (updatedKey !== void 0 && hasUpdatedKey([key], updatedKey)) continue; 36141 cleanupPrevState ??= { ...prevState }; 36142 cleanupPrevState[key] = state2[key]; 36143 } 36144 return cleanupPrevState; 36145 } 36146 var MAX_REPAIR_PASSES = 100; 36147 function addKeyedListener(map, keys, listener) { 36148 if (!keys) return; 36149 for (const key of keys) { 36150 let listeners2 = map.get(key); 36151 if (!listeners2) { 36152 listeners2 = /* @__PURE__ */ new Set(); 36153 map.set(key, listeners2); 36154 } 36155 listeners2.add(listener); 36156 } 36157 } 36158 function deleteKeyedListener(map, keys, listener) { 36159 if (!map) return; 36160 if (!keys) return; 36161 for (const key of keys) { 36162 const listeners2 = map.get(key); 36163 if (!listeners2) continue; 36164 listeners2.delete(listener); 36165 if (!listeners2.size) map.delete(key); 36166 } 36167 } 36168 function getFastPathNotifiedListeners(frame) { 36169 const notifiedListeners = /* @__PURE__ */ new Set(); 36170 const currentListener = frame.currentListener; 36171 if (!currentListener) return notifiedListeners; 36172 for (const listener of frame.keyedListeners) { 36173 notifiedListeners.add(listener); 36174 if (listener === currentListener) return notifiedListeners; 36175 } 36176 notifiedListeners.clear(); 36177 notifiedListeners.add(currentListener); 36178 return notifiedListeners; 36179 } 36180 function preserveFastPathNotifiedListeners(frame) { 36181 frame.notifiedListeners ??= getFastPathNotifiedListeners(frame); 36182 } 36183 function hasFastPathPassedListener(frame, listener) { 36184 if (!frame.currentListener) return false; 36185 let foundCurrentKeyedListener = false; 36186 for (const currentListener of frame.keyedListeners) { 36187 if (currentListener === frame.currentListener) { 36188 foundCurrentKeyedListener = true; 36189 continue; 36190 } 36191 if (!foundCurrentKeyedListener) continue; 36192 if (currentListener === listener) return false; 36193 } 36194 let foundListener = false; 36195 for (const currentListener of frame.group.listeners) { 36196 if (currentListener === frame.currentListener) return foundListener; 36197 if (currentListener === listener) foundListener = true; 36198 } 36199 return false; 36200 } 36201 function preserveFastPathFrames(fastPathFrames, group, listener) { 36202 for (const frame of fastPathFrames) { 36203 if (frame.group !== group) continue; 36204 if (frame.recovering) continue; 36205 if (listener && !frame.keyedListeners.has(listener)) continue; 36206 preserveFastPathNotifiedListeners(frame); 36207 for (const currentListener of frame.group.listeners) { 36208 if (currentListener === frame.currentListener) break; 36209 if (!hasFastPathPassedListener(frame, currentListener)) continue; 36210 frame.notifiedListeners?.add(currentListener); 36211 } 36212 } 36213 } 36214 function preserveFastPathPassedListeners(fastPathFrames, group, listener) { 36215 for (const frame of fastPathFrames) { 36216 if (frame.group !== group) continue; 36217 if (frame.recovering) continue; 36218 if (!hasFastPathPassedListener(frame, listener)) continue; 36219 preserveFastPathNotifiedListeners(frame); 36220 frame.notifiedListeners?.add(listener); 36221 } 36222 } 36223 function preserveFastPathPassedKeyedListeners({ fastPathFrames, group, keys, listener }) { 36224 const wasRegistered = group.listeners.has(listener); 36225 for (const frame of fastPathFrames) { 36226 if (frame.group !== group) continue; 36227 if (frame.recovering) continue; 36228 if (!keys.includes(frame.updatedKey)) continue; 36229 if (hasFastPathPassedListener(frame, listener)) { 36230 preserveFastPathNotifiedListeners(frame); 36231 frame.notifiedListeners?.add(listener); 36232 } else if (wasRegistered) { 36233 preserveFastPathNotifiedListeners(frame); 36234 frame.recoverToLive = true; 36235 } 36236 } 36237 } 36238 function clearFastPathNotifiedListener(fastPathFrames, group, listener) { 36239 for (const frame of fastPathFrames) { 36240 if (frame.group !== group) continue; 36241 frame.notifiedListeners?.delete(listener); 36242 } 36243 } 36244 function addFastPathKeyedListener({ fastPathFrames, group, keys, listener }) { 36245 for (const frame of fastPathFrames) { 36246 if (frame.group !== group) continue; 36247 if (frame.recovering) continue; 36248 if (!keys.includes(frame.updatedKey)) continue; 36249 frame.keyedListeners.add(listener); 36250 } 36251 } 36252 function runPendingCleanup(group, listener) { 36253 if (!group.disposables.size) return; 36254 const cleanup = group.disposables.get(listener); 36255 if (!cleanup) return; 36256 group.disposables.delete(listener); 36257 cleanup(); 36258 } 36259 function setListenerCleanup(group, listener, cleanup) { 36260 const currentCleanup = group.disposables.get(listener); 36261 if (!currentCleanup) { 36262 group.disposables.set(listener, cleanup); 36263 return; 36264 } 36265 group.disposables.set(listener, () => { 36266 currentCleanup(); 36267 cleanup(); 36268 }); 36269 } 36270 function notifyStoreListener(group, listener, state2, prevState, getState2, updatedKey) { 36271 if (group.suspendCounts?.has(listener)) return; 36272 const { disposables } = group; 36273 const cleanup = disposables.size ? disposables.get(listener) : void 0; 36274 if (cleanup) { 36275 disposables.delete(listener); 36276 const stateBeforeCleanup = state2; 36277 cleanup(); 36278 state2 = getState2?.() ?? state2; 36279 if (state2 !== stateBeforeCleanup) prevState = getCleanupPrevState(prevState, state2, stateBeforeCleanup, updatedKey) ?? prevState; 36280 } 36281 const result = listener(state2, prevState); 36282 if (result) setListenerCleanup(group, listener, result); 36283 } 36284 function runLiveListeners({ group, getState: getState2, prevState, updatedKey, notifiedListeners }) { 36285 const allKeysListeners = group.allKeysListeners; 36286 for (const listener of group.listeners) { 36287 if (notifiedListeners?.has(listener)) continue; 36288 if (!allKeysListeners?.has(listener)) { 36289 if (!hasUpdatedKey(group.listenerKeys.get(listener), updatedKey)) continue; 36290 } 36291 notifiedListeners?.add(listener); 36292 notifyStoreListener(group, listener, getState2(), prevState, getState2, updatedKey); 36293 } 36294 } 36295 function createStore(initialState, ...stores) { 36296 let state2 = initialState; 36297 let prevStateBatch = state2; 36298 let destroy = noop6; 36299 let batchPending = false; 36300 let inDispatch = false; 36301 let updatedKeys = /* @__PURE__ */ new Set(); 36302 const instances = /* @__PURE__ */ new Set(); 36303 const setups = /* @__PURE__ */ new Set(); 36304 const syncListenerGroup = { 36305 listeners: /* @__PURE__ */ new Set(), 36306 disposables: /* @__PURE__ */ new Map(), 36307 listenerKeys: /* @__PURE__ */ new WeakMap() 36308 }; 36309 const batchListenerGroup = { 36310 listeners: /* @__PURE__ */ new Set(), 36311 disposables: /* @__PURE__ */ new Map(), 36312 listenerKeys: /* @__PURE__ */ new WeakMap() 36313 }; 36314 const storeSetup = (callback) => { 36315 setups.add(callback); 36316 return () => setups.delete(callback); 36317 }; 36318 const storeInit = () => { 36319 const initializedInstances = instances.size; 36320 const instance = /* @__PURE__ */ Symbol(); 36321 instances.add(instance); 36322 const maybeDestroy = () => { 36323 if (!instances.delete(instance)) return; 36324 if (instances.size) return; 36325 destroy(); 36326 }; 36327 if (initializedInstances) return maybeDestroy; 36328 const stateKeys = getKeys(state2); 36329 const desyncs = []; 36330 for (const store4 of stores) { 36331 const storeState = store4?.getState?.(); 36332 if (!storeState) continue; 36333 const keys = stateKeys.filter((key) => hasOwnProperty(storeState, key)); 36334 if (!keys.length) continue; 36335 if (stores.length === 1 || keys.length === stateKeys.length) { 36336 for (const key of keys) desyncs.push(sync2(store4, [key], (state3) => { 36337 setState(key, state3[key], true); 36338 })); 36339 continue; 36340 } 36341 desyncs.push(subscribe3(store4, keys, (state3, prevState) => { 36342 for (const key of keys) { 36343 if (state3[key] === prevState[key]) continue; 36344 setState(key, state3[key], true); 36345 } 36346 })); 36347 for (const key of keys) { 36348 const liveState = store4?.getState?.(); 36349 if (!liveState) continue; 36350 setState(key, liveState[key], true); 36351 } 36352 } 36353 const teardowns = []; 36354 for (const setup2 of setups) teardowns.push(setup2()); 36355 const cleanups = stores.map(init); 36356 destroy = chain(...desyncs, ...teardowns, ...cleanups); 36357 return maybeDestroy; 36358 }; 36359 const deleteListenerIndexes = (group, listener, keys) => { 36360 if (keys === void 0) return; 36361 if (keys) deleteKeyedListener(group.listenersByKey, keys, listener); 36362 else group.allKeysListeners?.delete(listener); 36363 }; 36364 const fastPathFrames = []; 36365 const registerListener = (keys, listener, group = syncListenerGroup) => { 36366 const listenerKeysValue = keys ? [...keys] : null; 36367 const wasRegistered = group.listeners.has(listener); 36368 if (!wasRegistered) clearFastPathNotifiedListener(fastPathFrames, group, listener); 36369 if (!listenerKeysValue) { 36370 if (wasRegistered) preserveFastPathFrames(fastPathFrames, group); 36371 preserveFastPathPassedListeners(fastPathFrames, group, listener); 36372 } else preserveFastPathPassedKeyedListeners({ 36373 fastPathFrames, 36374 group, 36375 keys: listenerKeysValue, 36376 listener 36377 }); 36378 if (wasRegistered) { 36379 preserveFastPathFrames(fastPathFrames, group, listener); 36380 deleteListenerIndexes(group, listener, group.listenerKeys.get(listener)); 36381 } 36382 group.listeners.add(listener); 36383 if (listenerKeysValue) { 36384 group.listenersByKey ??= /* @__PURE__ */ new Map(); 36385 addKeyedListener(group.listenersByKey, listenerKeysValue, listener); 36386 addFastPathKeyedListener({ 36387 fastPathFrames, 36388 group, 36389 keys: listenerKeysValue, 36390 listener 36391 }); 36392 } else { 36393 group.allKeysListeners ??= /* @__PURE__ */ new Set(); 36394 group.allKeysListeners.add(listener); 36395 } 36396 group.listenerKeys.set(listener, listenerKeysValue); 36397 return () => { 36398 const cleanup = group.disposables.get(listener); 36399 group.disposables.delete(listener); 36400 preserveFastPathFrames(fastPathFrames, group, listener); 36401 const currentKeys = group.listenerKeys.get(listener); 36402 deleteListenerIndexes(group, listener, listenerKeysValue); 36403 if (currentKeys !== listenerKeysValue) deleteListenerIndexes(group, listener, currentKeys); 36404 group.listenerKeys.delete(listener); 36405 group.listeners.delete(listener); 36406 cleanup?.(); 36407 }; 36408 }; 36409 const storeSubscribe = (keys, listener) => registerListener(keys, listener); 36410 const runInitialListener = (group, listener, prevState) => { 36411 const shouldSuspend = group.listeners.has(listener); 36412 if (shouldSuspend) { 36413 group.suspendCounts ??= /* @__PURE__ */ new Map(); 36414 const count = group.suspendCounts.get(listener) ?? 0; 36415 group.suspendCounts.set(listener, count + 1); 36416 } 36417 let cleanupPrevState; 36418 try { 36419 const stateBeforeCleanups = state2; 36420 runPendingCleanup(group, listener); 36421 if (state2 !== stateBeforeCleanups) cleanupPrevState = getCleanupPrevState(prevState, state2, stateBeforeCleanups); 36422 const cleanup = listener(state2, cleanupPrevState ?? prevState); 36423 if (cleanup) setListenerCleanup(group, listener, cleanup); 36424 } finally { 36425 if (shouldSuspend) { 36426 const suspendCounts = group.suspendCounts; 36427 const count = suspendCounts?.get(listener); 36428 if (count && count > 1) suspendCounts?.set(listener, count - 1); 36429 else suspendCounts?.delete(listener); 36430 if (!suspendCounts?.size) delete group.suspendCounts; 36431 } 36432 } 36433 }; 36434 const storeSync = (keys, listener) => { 36435 runInitialListener(syncListenerGroup, listener, state2); 36436 return registerListener(keys, listener); 36437 }; 36438 const storeBatch = (keys, listener) => { 36439 if (!batchListenerGroup.listeners.size && !inDispatch) prevStateBatch = state2; 36440 runInitialListener(batchListenerGroup, listener, prevStateBatch); 36441 return registerListener(keys, listener, batchListenerGroup); 36442 }; 36443 const storePick = (keys) => createStore(pick(state2, keys), finalStore); 36444 const storeOmit = (keys) => createStore(omit(state2, keys), finalStore); 36445 const getState2 = () => state2; 36446 const runListeners = (group, prevState, updatedKey) => { 36447 if (!(updatedKey instanceof Set) && !group.allKeysListeners?.size) { 36448 const keyedListeners = group.listenersByKey?.get(updatedKey); 36449 if (!keyedListeners) return; 36450 const frame = { 36451 group, 36452 keyedListeners, 36453 updatedKey, 36454 currentListener: null 36455 }; 36456 fastPathFrames.push(frame); 36457 try { 36458 for (const listener of keyedListeners) { 36459 if (frame.notifiedListeners?.has(listener)) continue; 36460 frame.currentListener = listener; 36461 frame.notifiedListeners?.add(listener); 36462 notifyStoreListener(group, listener, state2, prevState, getState2, updatedKey); 36463 if (!group.allKeysListeners?.size && !frame.recoverToLive) continue; 36464 const notifiedListeners = frame.notifiedListeners ?? getFastPathNotifiedListeners(frame); 36465 frame.notifiedListeners = notifiedListeners; 36466 frame.recovering = true; 36467 runLiveListeners({ 36468 group, 36469 getState: getState2, 36470 prevState, 36471 updatedKey, 36472 notifiedListeners 36473 }); 36474 return; 36475 } 36476 } finally { 36477 fastPathFrames.pop(); 36478 } 36479 return; 36480 } 36481 runLiveListeners({ 36482 group, 36483 getState: getState2, 36484 prevState, 36485 updatedKey 36486 }); 36487 }; 36488 const setState = (key, value, fromStores = false) => { 36489 if (!hasOwnProperty(state2, key)) return; 36490 const currentValue = state2[key]; 36491 const nextValue = typeof value === "function" ? value(currentValue) : value; 36492 if (isSameValue(nextValue, currentValue)) return; 36493 const wasInDispatch = inDispatch; 36494 inDispatch = true; 36495 const prevState = state2; 36496 const nextState = { 36497 ...state2, 36498 [key]: nextValue 36499 }; 36500 state2 = nextState; 36501 let superseded = false; 36502 try { 36503 if (!fromStores && stores.length) { 36504 for (const store4 of stores) { 36505 store4?.setState?.(key, nextValue); 36506 if (isSameValue(state2[key], nextValue)) continue; 36507 superseded = true; 36508 break; 36509 } 36510 if (superseded) { 36511 let pass = 0; 36512 for (; pass < MAX_REPAIR_PASSES; pass += 1) { 36513 let changed = false; 36514 for (const store4 of stores) { 36515 const previousValue = state2[key]; 36516 store4?.setState?.(key, previousValue); 36517 if (!isSameValue(state2[key], previousValue)) changed = true; 36518 } 36519 if (!changed) break; 36520 } 36521 if (pass === MAX_REPAIR_PASSES) console.warn("Parent stores did not converge after a superseded fan-out; a parent listener may be rewriting this key in a cycle."); 36522 } 36523 } 36524 if (!superseded) runListeners(syncListenerGroup, state2 === nextState ? prevState : { 36525 ...state2, 36526 [key]: prevState[key] 36527 }, key); 36528 } finally { 36529 inDispatch = wasInDispatch; 36530 } 36531 if (!batchListenerGroup.listeners.size) { 36532 if (!inDispatch) prevStateBatch = state2; 36533 return; 36534 } 36535 updatedKeys.add(key); 36536 if (batchPending) return; 36537 batchPending = true; 36538 queueMicrotask(() => { 36539 batchPending = false; 36540 const snapshot = state2; 36541 const updatedKeysSnapshot = updatedKeys; 36542 updatedKeys = /* @__PURE__ */ new Set(); 36543 const prevStateBatchBefore = prevStateBatch; 36544 runListeners(batchListenerGroup, prevStateBatchBefore, updatedKeysSnapshot); 36545 if (prevStateBatch === prevStateBatchBefore) prevStateBatch = snapshot; 36546 }); 36547 }; 36548 const finalStore = { 36549 getState: getState2, 36550 setState, 36551 __unstableInternals: { 36552 setup: storeSetup, 36553 init: storeInit, 36554 subscribe: storeSubscribe, 36555 sync: storeSync, 36556 batch: storeBatch, 36557 pick: storePick, 36558 omit: storeOmit 36559 } 36560 }; 36561 return finalStore; 36562 } 36563 function setup(store4, ...args) { 36564 if (!store4) return; 36565 return getInternal(store4, "setup")(...args); 36566 } 36567 function init(store4, ...args) { 36568 if (!store4) return; 36569 return getInternal(store4, "init")(...args); 36570 } 36571 function subscribe3(store4, ...args) { 36572 if (!store4) return; 36573 return getInternal(store4, "subscribe")(...args); 36574 } 36575 function sync2(store4, ...args) { 36576 if (!store4) return; 36577 return getInternal(store4, "sync")(...args); 36578 } 36579 function batch(store4, ...args) { 36580 if (!store4) return; 36581 return getInternal(store4, "batch")(...args); 36582 } 36583 function omit2(store4, ...args) { 36584 if (!store4) return; 36585 return getInternal(store4, "omit")(...args); 36586 } 36587 function pick2(store4, ...args) { 36588 if (!store4) return; 36589 return getInternal(store4, "pick")(...args); 36590 } 36591 function mergeStore(...stores) { 36592 const initialState = {}; 36593 for (const store5 of stores) { 36594 const nextState = store5?.getState?.(); 36595 if (nextState) Object.assign(initialState, nextState); 36596 } 36597 const store4 = createStore(initialState, ...stores); 36598 return Object.assign({}, ...stores, store4); 36599 } 36600 function throwOnConflictingProps(props, store4) { 36601 if (false) return; 36602 if (!store4) return; 36603 const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => { 36604 const stateKey = key.replace("default", ""); 36605 return `$stateKey[0]?.toLowerCase() || ""}$stateKey.slice(1)}`; 36606 }); 36607 if (!defaultKeys.length) return; 36608 const storeState = store4.getState(); 36609 if (!defaultKeys.filter((key) => hasOwnProperty(storeState, key)).length) return; 36610 throw new Error(`Passing a store prop in conjunction with a default state is not supported. 36611 36612 const store = useSelectStore(); 36613 <SelectProvider store={store} defaultValue="Apple" /> 36614 ^ ^ 36615 36616 Instead, pass the default state to the topmost store: 36617 36618 const store = useSelectStore({ defaultValue: "Apple" }); 36619 <SelectProvider store={store} /> 36620 36621 See https://github.com/ariakit/ariakit/pull/2745 for more details. 36622 36623 If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit 36624 `); 36625 } 36626 36627 // node_modules/@ariakit/components/dist/collection/collection-store.js 36628 function getCommonParent(items) { 36629 const firstItem = items.find((item) => !!item.element); 36630 const lastElement = [...items].reverse().find((item) => !!item.element)?.element; 36631 let parentElement = firstItem?.element?.parentElement; 36632 if (!lastElement) return getDocument(parentElement).body; 36633 while (parentElement) { 36634 if (parentElement.contains(lastElement)) return parentElement; 36635 parentElement = parentElement.parentElement; 36636 } 36637 return getDocument(parentElement).body; 36638 } 36639 function getPrivateStore(store4) { 36640 return store4?.__unstablePrivateStore; 36641 } 36642 function createCollectionStore(props = {}) { 36643 throwOnConflictingProps(props, props.store); 36644 const syncState = props.store?.getState(); 36645 const items = defaultValue(props.items, syncState?.items, props.defaultItems, []); 36646 const itemsMap = new Map(items.map((item) => [item.id, item])); 36647 const initialState = { 36648 items, 36649 renderedItems: defaultValue(syncState?.renderedItems, []) 36650 }; 36651 const syncPrivateStore = getPrivateStore(props.store); 36652 const privateStore = createStore({ 36653 items, 36654 renderedItems: initialState.renderedItems 36655 }, syncPrivateStore); 36656 const collection = createStore(initialState, props.store); 36657 const sortItems = (renderedItems) => { 36658 const sortedItems = sortBasedOnDOMPosition(renderedItems, (i3) => i3.element); 36659 privateStore.setState("renderedItems", sortedItems); 36660 collection.setState("renderedItems", sortedItems); 36661 }; 36662 setup(collection, () => init(privateStore)); 36663 setup(privateStore, () => { 36664 return batch(privateStore, ["items"], (state2) => { 36665 collection.setState("items", state2.items); 36666 }); 36667 }); 36668 setup(privateStore, () => { 36669 return batch(privateStore, ["renderedItems"], (state2) => { 36670 let firstRun = true; 36671 let raf2 = requestAnimationFrame(() => { 36672 const { renderedItems } = collection.getState(); 36673 if (state2.renderedItems === renderedItems) return; 36674 sortItems(state2.renderedItems); 36675 }); 36676 if (typeof IntersectionObserver !== "function") return () => cancelAnimationFrame(raf2); 36677 const ioCallback = () => { 36678 if (firstRun) { 36679 firstRun = false; 36680 return; 36681 } 36682 cancelAnimationFrame(raf2); 36683 raf2 = requestAnimationFrame(() => sortItems(state2.renderedItems)); 36684 }; 36685 const root = getCommonParent(state2.renderedItems); 36686 const observer = new IntersectionObserver(ioCallback, { root }); 36687 for (const item of state2.renderedItems) { 36688 if (!item.element) continue; 36689 observer.observe(item.element); 36690 } 36691 return () => { 36692 cancelAnimationFrame(raf2); 36693 observer.disconnect(); 36694 }; 36695 }); 36696 }); 36697 const mergeItem = (item, setItems, canDeleteFromMap = false) => { 36698 let prevItem; 36699 setItems((items2) => { 36700 const index2 = items2.findIndex(({ id }) => id === item.id); 36701 const nextItems = items2.slice(); 36702 if (index2 !== -1) { 36703 prevItem = items2[index2]; 36704 const nextItem = { 36705 ...prevItem, 36706 ...item 36707 }; 36708 nextItems[index2] = nextItem; 36709 itemsMap.set(item.id, nextItem); 36710 } else { 36711 nextItems.push(item); 36712 itemsMap.set(item.id, item); 36713 } 36714 return nextItems; 36715 }); 36716 const unmergeItem = () => { 36717 setItems((items2) => { 36718 if (!prevItem) { 36719 if (canDeleteFromMap) itemsMap.delete(item.id); 36720 return items2.filter(({ id }) => id !== item.id); 36721 } 36722 const index2 = items2.findIndex(({ id }) => id === item.id); 36723 if (index2 === -1) return items2; 36724 const nextItems = items2.slice(); 36725 nextItems[index2] = prevItem; 36726 itemsMap.set(item.id, prevItem); 36727 return nextItems; 36728 }); 36729 }; 36730 return unmergeItem; 36731 }; 36732 const registerItem = (item) => mergeItem(item, (getItems) => privateStore.setState("items", getItems), true); 36733 return { 36734 ...collection, 36735 registerItem, 36736 renderItem: (item) => chain(registerItem(item), mergeItem(item, (getItems) => privateStore.setState("renderedItems", getItems))), 36737 item: (id) => { 36738 if (!id) return null; 36739 let item = itemsMap.get(id); 36740 if (!item) { 36741 const { items: items2 } = privateStore.getState(); 36742 item = items2.find((item2) => item2.id === id); 36743 if (item) itemsMap.set(id, item); 36744 } 36745 return item || null; 36746 }, 36747 __unstablePrivateStore: privateStore 36748 }; 36749 } 36750 36751 // node_modules/@ariakit/components/dist/composite/composite-store.js 36752 var NULL_ITEM = { id: null }; 36753 function findFirstEnabledItem(items, excludeId) { 36754 return items.find((item) => { 36755 if (excludeId) return !item.disabled && item.id !== excludeId; 36756 return !item.disabled; 36757 }); 36758 } 36759 function getEnabledItems(items, excludeId) { 36760 return items.filter((item) => { 36761 if (excludeId) return !item.disabled && item.id !== excludeId; 36762 return !item.disabled; 36763 }); 36764 } 36765 function getItemsInRow(items, rowId) { 36766 return items.filter((item) => item.rowId === rowId); 36767 } 36768 function findEnabledItemId({ items, fromIndex, step, rowId, excludeId }) { 36769 for (let i3 = fromIndex; i3 >= 0 && i3 < items.length; i3 += step) { 36770 const item = items[i3]; 36771 if (!item) continue; 36772 if (item.rowId !== rowId) continue; 36773 if (item.disabled) continue; 36774 if (excludeId != null && item.id === excludeId) continue; 36775 return item.id; 36776 } 36777 } 36778 function flipItems(items, activeId, shouldInsertNullItem = false) { 36779 const index2 = items.findIndex((item) => item.id === activeId); 36780 return [ 36781 ...items.slice(index2 + 1), 36782 ...shouldInsertNullItem ? [NULL_ITEM] : [], 36783 ...items.slice(0, index2) 36784 ]; 36785 } 36786 function groupItemsByRows(items) { 36787 const rows = []; 36788 for (const item of items) { 36789 const row = rows.find((currentRow) => currentRow[0]?.rowId === item.rowId); 36790 if (row) row.push(item); 36791 else rows.push([item]); 36792 } 36793 return rows; 36794 } 36795 function getMaxRowLength(array) { 36796 let maxLength = 0; 36797 for (const { length: length2 } of array) if (length2 > maxLength) maxLength = length2; 36798 return maxLength; 36799 } 36800 function createEmptyItem(rowId) { 36801 return { 36802 id: "__EMPTY_ITEM__", 36803 disabled: true, 36804 rowId 36805 }; 36806 } 36807 function normalizeRows(rows, activeId, focusShift) { 36808 const maxLength = getMaxRowLength(rows); 36809 for (const row of rows) for (let i3 = 0; i3 < maxLength; i3 += 1) { 36810 const item = row[i3]; 36811 if (!item || focusShift && item.disabled) { 36812 const previousItem = i3 === 0 && focusShift ? findFirstEnabledItem(row) : row[i3 - 1]; 36813 row[i3] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem?.rowId); 36814 } 36815 } 36816 return rows; 36817 } 36818 function verticalizeItems(items) { 36819 const rows = groupItemsByRows(items); 36820 const maxLength = getMaxRowLength(rows); 36821 const verticalized = []; 36822 for (let i3 = 0; i3 < maxLength; i3 += 1) for (const row of rows) { 36823 const item = row[i3]; 36824 if (item) verticalized.push({ 36825 ...item, 36826 rowId: item.rowId ? `$i3}` : void 0 36827 }); 36828 } 36829 return verticalized; 36830 } 36831 function createCompositeStore(props = {}) { 36832 const syncState = props.store?.getState(); 36833 const collection = createCollectionStore(props); 36834 const activeId = defaultValue(props.activeId, syncState?.activeId, props.defaultActiveId); 36835 const composite = createStore({ 36836 ...collection.getState(), 36837 id: defaultValue(props.id, syncState?.id) ?? `id-$Math.random().toString(36).slice(2, 8)}`, 36838 activeId, 36839 baseElement: defaultValue(syncState?.baseElement, null), 36840 includesBaseElement: defaultValue(props.includesBaseElement, syncState?.includesBaseElement, activeId === null), 36841 moves: defaultValue(syncState?.moves, 0), 36842 orientation: defaultValue(props.orientation, syncState?.orientation, "both"), 36843 rtl: defaultValue(props.rtl, syncState?.rtl, false), 36844 virtualFocus: defaultValue(props.virtualFocus, syncState?.virtualFocus, false), 36845 focusLoop: defaultValue(props.focusLoop, syncState?.focusLoop, false), 36846 focusWrap: defaultValue(props.focusWrap, syncState?.focusWrap, false), 36847 focusShift: defaultValue(props.focusShift, syncState?.focusShift, false) 36848 }, collection, props.store); 36849 setup(composite, () => sync2(composite, ["renderedItems", "activeId"], (state2) => { 36850 composite.setState("activeId", (activeId2) => { 36851 if (activeId2 !== void 0) return activeId2; 36852 return findFirstEnabledItem(state2.renderedItems)?.id; 36853 }); 36854 })); 36855 const getNextId = (direction = "next", options = {}) => { 36856 const defaultState = composite.getState(); 36857 const { skip = 0, activeId: activeId2 = defaultState.activeId, focusShift = defaultState.focusShift, focusLoop = defaultState.focusLoop, focusWrap = defaultState.focusWrap, includesBaseElement = defaultState.includesBaseElement, renderedItems = defaultState.renderedItems, rtl = defaultState.rtl } = options; 36858 const isVerticalDirection = direction === "up" || direction === "down"; 36859 const isNextDirection = direction === "next" || direction === "down"; 36860 const canReverse = isNextDirection ? rtl && !isVerticalDirection : !rtl || isVerticalDirection; 36861 const canShift = focusShift && !skip; 36862 if (!skip && !focusWrap && !includesBaseElement && activeId2 != null) { 36863 if (!isVerticalDirection ? true : !canShift && !renderedItems.some((item) => item.rowId != null)) { 36864 const activeIndex2 = renderedItems.findIndex((item) => item.id === activeId2); 36865 const activeItem2 = renderedItems[activeIndex2]; 36866 if (activeItem2) { 36867 const step = canReverse ? -1 : 1; 36868 const nextId2 = findEnabledItemId({ 36869 items: renderedItems, 36870 fromIndex: activeIndex2 + step, 36871 step, 36872 rowId: activeItem2.rowId, 36873 excludeId: activeId2 36874 }); 36875 if (nextId2 !== void 0) return nextId2; 36876 if (!(focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical"))) return void 0; 36877 return findEnabledItemId({ 36878 items: renderedItems, 36879 fromIndex: step === 1 ? 0 : renderedItems.length - 1, 36880 step, 36881 rowId: activeItem2.rowId, 36882 excludeId: activeId2 36883 }); 36884 } 36885 } 36886 } 36887 let items = !isVerticalDirection ? renderedItems : flatten2DArray(normalizeRows(groupItemsByRows(renderedItems), activeId2, canShift)); 36888 items = canReverse ? reverseArray(items) : items; 36889 items = isVerticalDirection ? verticalizeItems(items) : items; 36890 if (activeId2 == null) return findFirstEnabledItem(items)?.id; 36891 const activeItem = items.find((item) => item.id === activeId2); 36892 if (!activeItem) return findFirstEnabledItem(items)?.id; 36893 const isGrid2 = items.some((item) => item.rowId); 36894 const activeIndex = items.indexOf(activeItem); 36895 const nextItems = items.slice(activeIndex + 1); 36896 const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId); 36897 if (skip) { 36898 const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2); 36899 return (nextEnabledItemsInRow.slice(skip)[0] || nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1])?.id; 36900 } 36901 const canLoop = focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical"); 36902 const canWrap = isGrid2 && focusWrap && (isVerticalDirection ? focusWrap !== "horizontal" : focusWrap !== "vertical"); 36903 const hasNullItem = isNextDirection ? (!isGrid2 || isVerticalDirection) && canLoop && includesBaseElement : isVerticalDirection ? includesBaseElement : false; 36904 if (canLoop) return findFirstEnabledItem(flipItems(canWrap && !hasNullItem ? items : getItemsInRow(items, activeItem.rowId), activeId2, hasNullItem), activeId2)?.id; 36905 if (canWrap) { 36906 const nextItem2 = findFirstEnabledItem(hasNullItem ? nextItemsInRow : nextItems, activeId2); 36907 return hasNullItem ? nextItem2?.id || null : nextItem2?.id; 36908 } 36909 const nextItem = findFirstEnabledItem(nextItemsInRow, activeId2); 36910 if (!nextItem && hasNullItem) return null; 36911 return nextItem?.id; 36912 }; 36913 const getNextIdFromOptions = (direction, options) => { 36914 if (typeof options === "number") return getNextId(direction, { skip: options }); 36915 return getNextId(direction, options); 36916 }; 36917 return { 36918 ...collection, 36919 ...composite, 36920 setBaseElement: (element) => composite.setState("baseElement", element), 36921 setActiveId: (id) => composite.setState("activeId", id), 36922 move: (id) => { 36923 if (id === void 0) return; 36924 composite.setState("activeId", id); 36925 composite.setState("moves", (moves) => moves + 1); 36926 }, 36927 first: () => findFirstEnabledItem(composite.getState().renderedItems)?.id, 36928 last: () => findFirstEnabledItem(reverseArray(composite.getState().renderedItems))?.id, 36929 next: (options) => getNextIdFromOptions("next", options), 36930 previous: (options) => getNextIdFromOptions("previous", options), 36931 down: (options) => getNextIdFromOptions("down", options), 36932 up: (options) => getNextIdFromOptions("up", options) 36933 }; 36934 } 36935 36936 // node_modules/@ariakit/react-components/dist/composite/utils.js 36937 var findFirstEnabledItem2 = findFirstEnabledItem; 36938 var groupItemsByRows2 = groupItemsByRows; 36939 function getEnabledItem(store4, id) { 36940 if (!id) return null; 36941 return store4.item(id) || null; 36942 } 36943 function selectTextField(element, collapseToEnd = false) { 36944 if (isTextField(element)) element.setSelectionRange(collapseToEnd ? element.value.length : 0, element.value.length); 36945 else if (element.isContentEditable) { 36946 const selection = getDocument(element).getSelection(); 36947 selection?.selectAllChildren(element); 36948 if (collapseToEnd) selection?.collapseToEnd(); 36949 } 36950 } 36951 var FOCUS_SILENTLY = /* @__PURE__ */ Symbol("FOCUS_SILENTLY"); 36952 function focusSilently(element) { 36953 element[FOCUS_SILENTLY] = true; 36954 element.focus({ preventScroll: true }); 36955 } 36956 function silentlyFocused(element) { 36957 const isSilentlyFocused = element[FOCUS_SILENTLY]; 36958 delete element[FOCUS_SILENTLY]; 36959 return isSilentlyFocused; 36960 } 36961 function isItem(store4, element, exclude) { 36962 if (!element) return false; 36963 if (element === exclude) return false; 36964 const item = store4.item(element.id); 36965 if (!item) return false; 36966 if (exclude && item.element === exclude) return false; 36967 return true; 36968 } 36969 36970 // node_modules/@ariakit/react-components/dist/composite/composite-item.js 36971 var import_react23 = __toESM(require_react(), 1); 36972 var import_jsx_runtime202 = __toESM(require_jsx_runtime(), 1); 36973 36974 // node_modules/@ariakit/react-store/dist/index.js 36975 var React76 = __toESM(require_react(), 1); 36976 var import_shim3 = __toESM(require_shim(), 1); 36977 var noopSubscribe = () => () => { 36978 }; 36979 function useStoreState(store4, keyOrSelector = identity) { 36980 const storeSubscribe = React76.useCallback((callback) => { 36981 if (!store4) return noopSubscribe(); 36982 return subscribe3(store4, null, callback); 36983 }, [store4]); 36984 const getSnapshot2 = () => { 36985 const key = typeof keyOrSelector === "string" ? keyOrSelector : null; 36986 const selector2 = typeof keyOrSelector === "function" ? keyOrSelector : null; 36987 const state2 = store4?.getState(); 36988 if (selector2) return selector2(state2); 36989 if (!state2) return; 36990 if (!key) return; 36991 if (!hasOwnProperty(state2, key)) return; 36992 return state2[key]; 36993 }; 36994 return (0, import_shim3.useSyncExternalStore)(storeSubscribe, getSnapshot2, getSnapshot2); 36995 } 36996 function useStoreStateObject(store4, object) { 36997 const objRef = React76.useRef({}); 36998 const storeSubscribe = React76.useCallback((callback) => { 36999 if (!store4) return noopSubscribe(); 37000 return subscribe3(store4, null, callback); 37001 }, [store4]); 37002 const getSnapshot2 = () => { 37003 const state2 = store4?.getState(); 37004 let updated = false; 37005 const obj = objRef.current; 37006 for (const prop in object) { 37007 const keyOrSelector = object[prop]; 37008 if (typeof keyOrSelector === "function") { 37009 const value = keyOrSelector(state2); 37010 if (!Object.is(value, obj[prop])) { 37011 obj[prop] = value; 37012 updated = true; 37013 } 37014 } 37015 if (typeof keyOrSelector === "string") { 37016 if (!state2) continue; 37017 if (!hasOwnProperty(state2, keyOrSelector)) continue; 37018 const value = state2[keyOrSelector]; 37019 if (!Object.is(value, obj[prop])) { 37020 obj[prop] = value; 37021 updated = true; 37022 } 37023 } 37024 } 37025 if (updated) objRef.current = { ...obj }; 37026 return objRef.current; 37027 }; 37028 return (0, import_shim3.useSyncExternalStore)(storeSubscribe, getSnapshot2, getSnapshot2); 37029 } 37030 function useStoreProps(store4, props, key, setKey) { 37031 const value = hasOwnProperty(props, key) ? props[key] : void 0; 37032 const propsRef = useLiveRef({ 37033 value, 37034 setValue: setKey ? props[setKey] : void 0 37035 }); 37036 useSafeLayoutEffect(() => { 37037 return sync2(store4, [key], (state2, prev) => { 37038 const { value: value2, setValue } = propsRef.current; 37039 if (!setValue) return; 37040 if (state2[key] === prev[key]) return; 37041 if (state2[key] === value2) return; 37042 setValue(state2[key]); 37043 }); 37044 }, [store4, key]); 37045 useSafeLayoutEffect(() => { 37046 if (value === void 0) return; 37047 store4.setState(key, value); 37048 return batch(store4, [key], () => { 37049 if (value === void 0) return; 37050 store4.setState(key, value); 37051 }); 37052 }); 37053 } 37054 function useStore2(createStore2, props) { 37055 const [store4, setStore] = React76.useState(() => createStore2(props)); 37056 useSafeLayoutEffect(() => init(store4), [store4]); 37057 const useState161 = React76.useCallback((keyOrSelector) => useStoreState(store4, keyOrSelector), [store4]); 37058 return [React76.useMemo(() => ({ 37059 ...store4, 37060 useState: useState161 37061 }), [store4, useState161]), useEvent2(() => { 37062 setStore((store5) => createStore2({ 37063 ...props, 37064 ...store5.getState() 37065 })); 37066 })]; 37067 } 37068 37069 // node_modules/@ariakit/react-components/dist/composite/composite-item.js 37070 var TagName4 = "button"; 37071 function isEditableElement(element) { 37072 if (isTextbox(element)) return true; 37073 return element.tagName === "INPUT" && !isButton(element); 37074 } 37075 function getNextPageOffset(scrollingElement, pageUp = false) { 37076 const height = scrollingElement.clientHeight; 37077 const { top } = scrollingElement.getBoundingClientRect(); 37078 const pageSize = Math.max(height * 0.875, height - 40) * 1.5; 37079 const pageOffset = pageUp ? height - pageSize + top : pageSize + top; 37080 if (scrollingElement.tagName === "HTML") return pageOffset + scrollingElement.scrollTop; 37081 return pageOffset; 37082 } 37083 function getItemOffset(itemElement, pageUp = false) { 37084 const { top } = itemElement.getBoundingClientRect(); 37085 if (pageUp) return top + itemElement.clientHeight; 37086 return top; 37087 } 37088 function findNextPageItemId(element, store4, next, pageUp = false) { 37089 if (!store4) return; 37090 if (!next) return; 37091 const { renderedItems } = store4.getState(); 37092 const scrollingElement = getScrollingElement(element); 37093 if (!scrollingElement) return; 37094 const nextPageOffset = getNextPageOffset(scrollingElement, pageUp); 37095 let id; 37096 let prevDifference; 37097 for (let i3 = 0; i3 < renderedItems.length; i3 += 1) { 37098 const previousId = id; 37099 id = next(i3); 37100 if (!id) break; 37101 if (id === previousId) continue; 37102 const itemElement = getEnabledItem(store4, id)?.element; 37103 if (!itemElement) continue; 37104 const difference = getItemOffset(itemElement, pageUp) - nextPageOffset; 37105 const absDifference = Math.abs(difference); 37106 if (pageUp && difference <= 0 || !pageUp && difference >= 0) { 37107 if (prevDifference !== void 0 && prevDifference < absDifference) id = previousId; 37108 break; 37109 } 37110 prevDifference = absDifference; 37111 } 37112 return id; 37113 } 37114 function targetIsAnotherItem(event, store4) { 37115 if (isSelfTarget(event)) return false; 37116 return isItem(store4, event.target); 37117 } 37118 var useCompositeItem2 = createHook(function useCompositeItem3({ store: store4, rowId: rowIdProp, preventScrollOnKeyDown = false, moveOnKeyPress = true, tabbable: tabbable2 = false, getItem: getItemProp, "aria-setsize": ariaSetSizeProp, "aria-posinset": ariaPosInSetProp, ...props }) { 37119 const context = useCompositeScopedContext(); 37120 store4 = store4 || context; 37121 const id = useId5(props.id); 37122 const ref = (0, import_react23.useRef)(null); 37123 const row = (0, import_react23.useContext)(CompositeRowContext); 37124 const trulyDisabled = disabledFromProps(props) && !props.accessibleWhenDisabled; 37125 const shouldRegisterItem = props.shouldRegisterItem; 37126 const getRowId = (state2) => { 37127 if (rowIdProp) return rowIdProp; 37128 if (!state2) return; 37129 if (!row?.baseElement) return; 37130 if (row.baseElement !== state2.baseElement) return; 37131 return row.id; 37132 }; 37133 const { rowId, baseElement, isActiveItem, ariaSetSize, ariaPosInSet, isTabbable } = useStoreStateObject(store4, { 37134 rowId: getRowId, 37135 baseElement(state2) { 37136 return state2?.baseElement || void 0; 37137 }, 37138 isActiveItem(state2) { 37139 return !!state2 && state2.activeId === id; 37140 }, 37141 ariaSetSize(state2) { 37142 if (ariaSetSizeProp != null) return ariaSetSizeProp; 37143 if (!state2) return; 37144 if (!row?.ariaSetSize) return; 37145 if (row.baseElement !== state2.baseElement) return; 37146 return row.ariaSetSize; 37147 }, 37148 ariaPosInSet(state2) { 37149 if (ariaPosInSetProp != null) return ariaPosInSetProp; 37150 if (!state2) return; 37151 if (!row?.ariaPosInSet) return; 37152 if (row.baseElement !== state2.baseElement) return; 37153 const rowId2 = getRowId(state2); 37154 const itemsInRow = state2.renderedItems.filter((item) => item.rowId === rowId2); 37155 return row.ariaPosInSet + itemsInRow.findIndex((item) => item.id === id); 37156 }, 37157 isTabbable(state2) { 37158 if (!state2?.renderedItems.length) return true; 37159 if (state2.virtualFocus) return false; 37160 if (tabbable2) return true; 37161 if (state2.activeId === null) return false; 37162 const item = store4?.item(state2.activeId); 37163 if (item?.disabled) return true; 37164 if (!item?.element) return true; 37165 return state2.activeId === id; 37166 } 37167 }); 37168 const getItem = (0, import_react23.useCallback)((item) => { 37169 const nextItem = { 37170 ...item, 37171 id: id || item.id, 37172 rowId, 37173 disabled: trulyDisabled, 37174 children: item.element?.textContent 37175 }; 37176 if (getItemProp) return getItemProp(nextItem); 37177 return nextItem; 37178 }, [ 37179 id, 37180 rowId, 37181 trulyDisabled, 37182 getItemProp 37183 ]); 37184 const onFocusProp = props.onFocus; 37185 const hasFocusedComposite = (0, import_react23.useRef)(false); 37186 const cancelScheduledFocusRedirectRef = (0, import_react23.useRef)(null); 37187 const onFocus = useEvent2((event) => { 37188 onFocusProp?.(event); 37189 if (event.defaultPrevented) return; 37190 if (isPortalEvent(event)) return; 37191 if (!id) return; 37192 if (!store4) return; 37193 if (targetIsAnotherItem(event, store4)) return; 37194 const { virtualFocus, baseElement: baseElement2 } = store4.getState(); 37195 store4.setActiveId(id); 37196 if (isTextbox(event.currentTarget)) selectTextField(event.currentTarget); 37197 if (!virtualFocus) return; 37198 if (!isSelfTarget(event)) return; 37199 if (isEditableElement(event.currentTarget)) return; 37200 const redirectFocusToBaseElement = (currentTarget2, relatedTarget2, baseElement3) => { 37201 if (isSafari() && currentTarget2.hasAttribute("data-autofocus")) currentTarget2.scrollIntoView({ 37202 block: "nearest", 37203 inline: "nearest" 37204 }); 37205 hasFocusedComposite.current = true; 37206 if (relatedTarget2 === baseElement3 || isItem(store4, relatedTarget2)) focusSilently(baseElement3); 37207 else baseElement3.focus(); 37208 }; 37209 if (baseElement2?.isConnected) { 37210 redirectFocusToBaseElement(event.currentTarget, event.relatedTarget, baseElement2); 37211 return; 37212 } 37213 if (shouldRegisterItem === false) return; 37214 const { currentTarget, relatedTarget } = event; 37215 const cancelScheduledFocusRedirect = () => { 37216 cancelScheduledFocusRedirectRef.current?.(); 37217 cancelScheduledFocusRedirectRef.current = null; 37218 }; 37219 cancelScheduledFocusRedirect(); 37220 cancelScheduledFocusRedirectRef.current = subscribe3(store4, null, () => { 37221 if (getActiveElement(currentTarget) !== currentTarget) { 37222 cancelScheduledFocusRedirect(); 37223 return; 37224 } 37225 const state2 = store4.getState(); 37226 const nextBaseElement = state2.baseElement; 37227 if (!nextBaseElement?.isConnected) return; 37228 cancelScheduledFocusRedirect(); 37229 if (!state2.virtualFocus) return; 37230 redirectFocusToBaseElement(currentTarget, relatedTarget, nextBaseElement); 37231 }); 37232 }); 37233 const onBlurCaptureProp = props.onBlurCapture; 37234 const onBlurCapture = useEvent2((event) => { 37235 onBlurCaptureProp?.(event); 37236 if (event.defaultPrevented) return; 37237 if (store4?.getState()?.virtualFocus && hasFocusedComposite.current) { 37238 hasFocusedComposite.current = false; 37239 event.preventDefault(); 37240 event.stopPropagation(); 37241 } 37242 }); 37243 const onKeyDownProp = props.onKeyDown; 37244 const preventScrollOnKeyDownProp = useBooleanEvent(preventScrollOnKeyDown); 37245 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 37246 const onKeyDown = useEvent2((event) => { 37247 onKeyDownProp?.(event); 37248 if (event.defaultPrevented) return; 37249 if (!isSelfTarget(event)) return; 37250 if (!store4) return; 37251 const { currentTarget } = event; 37252 const state2 = store4.getState(); 37253 const isGrid2 = !!store4.item(id)?.rowId; 37254 const isVertical = state2.orientation !== "horizontal"; 37255 const isHorizontal = state2.orientation !== "vertical"; 37256 const canHomeEnd = () => { 37257 if (isGrid2) return true; 37258 if (isHorizontal) return true; 37259 if (!state2.baseElement) return true; 37260 if (!isTextField(state2.baseElement)) return true; 37261 return false; 37262 }; 37263 const action = { 37264 ArrowUp: (isGrid2 || isVertical) && store4.up, 37265 ArrowRight: (isGrid2 || isHorizontal) && store4.next, 37266 ArrowDown: (isGrid2 || isVertical) && store4.down, 37267 ArrowLeft: (isGrid2 || isHorizontal) && store4.previous, 37268 Home: () => { 37269 if (!canHomeEnd()) return; 37270 if (!isGrid2 || event.ctrlKey) return store4?.first(); 37271 return store4?.previous(-1); 37272 }, 37273 End: () => { 37274 if (!canHomeEnd()) return; 37275 if (!isGrid2 || event.ctrlKey) return store4?.last(); 37276 return store4?.next(-1); 37277 }, 37278 PageUp: () => { 37279 return findNextPageItemId(currentTarget, store4, store4?.up, true); 37280 }, 37281 PageDown: () => { 37282 return findNextPageItemId(currentTarget, store4, store4?.down); 37283 } 37284 }[event.key]; 37285 if (action) { 37286 if (isTextbox(currentTarget)) { 37287 const selection = getTextboxSelection(currentTarget); 37288 const isLeft = isHorizontal && event.key === "ArrowLeft"; 37289 const isRight = isHorizontal && event.key === "ArrowRight"; 37290 const isUp = isVertical && event.key === "ArrowUp"; 37291 const isDown = isVertical && event.key === "ArrowDown"; 37292 if (isRight || isDown) { 37293 const { length: valueLength } = getTextboxValue(currentTarget); 37294 if (selection.end !== valueLength) return; 37295 } else if ((isLeft || isUp) && selection.start !== 0) return; 37296 } 37297 const nextId2 = action(); 37298 if (preventScrollOnKeyDownProp(event) || nextId2 !== void 0) { 37299 if (!moveOnKeyPressProp(event)) return; 37300 event.preventDefault(); 37301 store4.move(nextId2); 37302 } 37303 } 37304 }); 37305 const providerValue = (0, import_react23.useMemo)(() => ({ 37306 id, 37307 baseElement 37308 }), [id, baseElement]); 37309 props = useWrapElement(props, (element) => /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(CompositeItemContext.Provider, { 37310 value: providerValue, 37311 children: element 37312 }), [providerValue]); 37313 props = { 37314 "data-active-item": isActiveItem || void 0, 37315 ...props, 37316 id, 37317 ref: useMergeRefs2(ref, props.ref), 37318 tabIndex: isTabbable ? props.tabIndex : -1, 37319 onFocus, 37320 onBlurCapture, 37321 onKeyDown 37322 }; 37323 props = useCommand(props); 37324 props = useCollectionItem({ 37325 store: store4, 37326 ...props, 37327 getItem, 37328 shouldRegisterItem: id ? shouldRegisterItem : false 37329 }); 37330 return removeUndefinedValues({ 37331 ...props, 37332 "aria-setsize": ariaSetSize, 37333 "aria-posinset": ariaPosInSet 37334 }); 37335 }); 37336 var CompositeItem = memo4(forwardRef54(function CompositeItem2(props) { 37337 return createElement5(TagName4, useCompositeItem2(props)); 37338 })); 37339 37340 // node_modules/@ariakit/react-components/dist/composite/composite.js 37341 var import_react24 = __toESM(require_react(), 1); 37342 var import_jsx_runtime203 = __toESM(require_jsx_runtime(), 1); 37343 var TagName5 = "div"; 37344 function isGrid(items) { 37345 return items.some((item) => !!item.rowId); 37346 } 37347 function isPrintableKey(event) { 37348 const target = event.target; 37349 if (target && !isTextField(target)) return false; 37350 return event.key.length === 1 && !event.ctrlKey && !event.metaKey; 37351 } 37352 function isModifierKey(event) { 37353 return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta"; 37354 } 37355 function useKeyboardEventProxy(store4, onKeyboardEvent, previousElementRef) { 37356 return useEvent2((event) => { 37357 onKeyboardEvent?.(event); 37358 if (event.defaultPrevented) return; 37359 if (event.isPropagationStopped()) return; 37360 if (!isSelfTarget(event)) return; 37361 if (isModifierKey(event)) return; 37362 if (isPrintableKey(event)) return; 37363 const activeElement2 = getEnabledItem(store4, store4.getState().activeId)?.element; 37364 if (!activeElement2) return; 37365 const { view, ...eventInit } = event; 37366 if (activeElement2 !== previousElementRef?.current) activeElement2.focus(); 37367 if (!fireKeyboardEvent(activeElement2, event.type, eventInit)) event.preventDefault(); 37368 if (event.currentTarget.contains(activeElement2)) event.stopPropagation(); 37369 }); 37370 } 37371 function findFirstEnabledItemInTheLastRow(items) { 37372 return findFirstEnabledItem2(flatten2DArray(reverseArray(groupItemsByRows2(items)))); 37373 } 37374 function withBaseScrollPreserved(store4, callback) { 37375 const { virtualFocus, baseElement } = store4.getState(); 37376 if (!virtualFocus || !baseElement || !isTextField(baseElement)) { 37377 callback(); 37378 return; 37379 } 37380 const savedScrollLeft = baseElement.scrollLeft; 37381 const savedScrollTop = baseElement.scrollTop; 37382 callback(); 37383 baseElement.scrollLeft = savedScrollLeft; 37384 baseElement.scrollTop = savedScrollTop; 37385 } 37386 function useScheduleFocus(store4) { 37387 const [scheduled, setScheduled] = (0, import_react24.useState)(false); 37388 const schedule2 = (0, import_react24.useCallback)(() => setScheduled(true), []); 37389 const activeItem = useStoreState(store4, (state2) => scheduled ? getEnabledItem(store4, state2.activeId) : null); 37390 (0, import_react24.useEffect)(() => { 37391 const activeElement2 = activeItem?.element; 37392 if (!scheduled) return; 37393 if (!activeElement2) return; 37394 setScheduled(false); 37395 withBaseScrollPreserved(store4, () => { 37396 activeElement2.focus({ preventScroll: true }); 37397 }); 37398 }, [ 37399 store4, 37400 activeItem, 37401 scheduled 37402 ]); 37403 return schedule2; 37404 } 37405 var CompositeFocusOnMove = memo4(function CompositeFocusOnMove2({ store: store4, focusOnMove, previousElementRef }) { 37406 const moves = useStoreState(store4, "moves"); 37407 const baseElement = useStoreState(store4, "baseElement"); 37408 (0, import_react24.useEffect)(() => { 37409 if (!moves) return; 37410 if (!focusOnMove) return; 37411 const { activeId } = store4.getState(); 37412 const itemElement = getEnabledItem(store4, activeId)?.element; 37413 if (!itemElement) return; 37414 withBaseScrollPreserved(store4, () => focusIntoView(itemElement)); 37415 }, [ 37416 store4, 37417 moves, 37418 focusOnMove 37419 ]); 37420 useSafeLayoutEffect(() => { 37421 if (!moves) return; 37422 if (!baseElement) return; 37423 const { activeId } = store4.getState(); 37424 if (!(activeId === null)) return; 37425 const previousElement = previousElementRef.current; 37426 previousElementRef.current = null; 37427 if (previousElement) fireBlurEvent(previousElement, { relatedTarget: baseElement }); 37428 if (!hasFocus(baseElement)) baseElement.focus(); 37429 }, [ 37430 store4, 37431 moves, 37432 baseElement 37433 ]); 37434 return null; 37435 }); 37436 var useComposite = createHook(function useComposite2({ store: store4, composite = true, focusOnMove = composite, moveOnKeyPress = true, ...props }) { 37437 const context = useCompositeProviderContext(); 37438 store4 = store4 || context; 37439 invariant(store4, "Composite must receive a `store` prop or be wrapped in a CompositeProvider component."); 37440 const ref = (0, import_react24.useRef)(null); 37441 const previousElementRef = (0, import_react24.useRef)(null); 37442 const scheduleFocus = useScheduleFocus(store4); 37443 const [, setBaseElement] = useTransactionState(composite ? store4.setBaseElement : null); 37444 const virtualFocus = useStoreState(store4, "virtualFocus"); 37445 const activeId = useStoreState(store4, (state2) => state2.virtualFocus ? state2.activeId : null); 37446 useSafeLayoutEffect(() => { 37447 if (!store4) return; 37448 if (!composite) return; 37449 if (!virtualFocus) return; 37450 const previousElement = previousElementRef.current; 37451 previousElementRef.current = null; 37452 if (!previousElement) return; 37453 const relatedTarget = getEnabledItem(store4, activeId)?.element || getActiveElement(previousElement); 37454 if (relatedTarget === previousElement) return; 37455 fireBlurEvent(previousElement, { relatedTarget }); 37456 }, [ 37457 store4, 37458 activeId, 37459 virtualFocus, 37460 composite 37461 ]); 37462 const onKeyDownCapture = useKeyboardEventProxy(store4, props.onKeyDownCapture, previousElementRef); 37463 const onKeyUpCapture = useKeyboardEventProxy(store4, props.onKeyUpCapture, previousElementRef); 37464 const onFocusCaptureProp = props.onFocusCapture; 37465 const onFocusCapture = useEvent2((event) => { 37466 onFocusCaptureProp?.(event); 37467 if (event.defaultPrevented) return; 37468 if (!store4) return; 37469 const { virtualFocus: virtualFocus2 } = store4.getState(); 37470 if (!virtualFocus2) return; 37471 const previousActiveElement = event.relatedTarget; 37472 const isSilentlyFocused = silentlyFocused(event.currentTarget); 37473 if (isSelfTarget(event) && isSilentlyFocused) { 37474 event.stopPropagation(); 37475 previousElementRef.current = previousActiveElement; 37476 } 37477 }); 37478 const onFocusProp = props.onFocus; 37479 const onFocus = useEvent2((event) => { 37480 onFocusProp?.(event); 37481 if (event.defaultPrevented) return; 37482 if (!composite) return; 37483 if (!store4) return; 37484 const { relatedTarget } = event; 37485 const { virtualFocus: virtualFocus2 } = store4.getState(); 37486 if (virtualFocus2) { 37487 if (isSelfTarget(event) && !isItem(store4, relatedTarget)) queueMicrotask(scheduleFocus); 37488 } else if (isSelfTarget(event)) store4.setActiveId(null); 37489 }); 37490 const onBlurCaptureProp = props.onBlurCapture; 37491 const onBlurCapture = useEvent2((event) => { 37492 onBlurCaptureProp?.(event); 37493 if (event.defaultPrevented) return; 37494 if (!store4) return; 37495 const { virtualFocus: virtualFocus2, activeId: activeId2 } = store4.getState(); 37496 if (!virtualFocus2) return; 37497 const activeElement2 = getEnabledItem(store4, activeId2)?.element; 37498 const nextActiveElement = event.relatedTarget; 37499 const nextActiveElementIsItem = isItem(store4, nextActiveElement); 37500 const previousElement = previousElementRef.current; 37501 previousElementRef.current = null; 37502 if (isSelfTarget(event) && nextActiveElementIsItem) { 37503 if (nextActiveElement === activeElement2) { 37504 if (previousElement && previousElement !== nextActiveElement) fireBlurEvent(previousElement, event); 37505 } else if (activeElement2) fireBlurEvent(activeElement2, event); 37506 else if (previousElement) fireBlurEvent(previousElement, event); 37507 event.stopPropagation(); 37508 } else if (!isItem(store4, event.target) && activeElement2) fireBlurEvent(activeElement2, event); 37509 }); 37510 const onKeyDownProp = props.onKeyDown; 37511 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 37512 const onKeyDown = useEvent2((event) => { 37513 onKeyDownProp?.(event); 37514 if (event.nativeEvent.isComposing) return; 37515 if (event.defaultPrevented) return; 37516 if (!store4) return; 37517 if (!isSelfTarget(event)) return; 37518 const { orientation, renderedItems, activeId: activeId2, rtl } = store4.getState(); 37519 if (getEnabledItem(store4, activeId2)?.element?.isConnected) return; 37520 const isVertical = orientation !== "horizontal"; 37521 const isHorizontal = orientation !== "vertical"; 37522 const grid = isGrid(renderedItems); 37523 if ((event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End") && isTextField(event.currentTarget)) return; 37524 const up = () => { 37525 if (grid) return findFirstEnabledItemInTheLastRow(renderedItems)?.id; 37526 return store4?.last(); 37527 }; 37528 const action = { 37529 ArrowUp: (grid || isVertical) && up, 37530 ArrowRight: (grid || isHorizontal) && (rtl ? store4.last : store4.first), 37531 ArrowDown: (grid || isVertical) && store4.first, 37532 ArrowLeft: (grid || isHorizontal) && (rtl ? store4.first : store4.last), 37533 Home: store4.first, 37534 End: store4.last, 37535 PageUp: store4.first, 37536 PageDown: store4.last 37537 }[event.key]; 37538 if (action) { 37539 const id = action(); 37540 if (id !== void 0) { 37541 if (!moveOnKeyPressProp(event)) return; 37542 event.preventDefault(); 37543 store4.move(id); 37544 } 37545 } 37546 }); 37547 props = useWrapElement(props, (element) => /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)(CompositeScopedContextProvider, { 37548 value: store4, 37549 children: [element, composite && /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(CompositeFocusOnMove, { 37550 store: store4, 37551 focusOnMove, 37552 previousElementRef 37553 })] 37554 }), [ 37555 store4, 37556 composite, 37557 focusOnMove 37558 ]); 37559 props = { 37560 "aria-activedescendant": useStoreState(store4, (state2) => { 37561 if (!store4) return; 37562 if (!composite) return; 37563 if (!state2.virtualFocus) return; 37564 return getEnabledItem(store4, state2.activeId)?.id; 37565 }), 37566 ...props, 37567 ref: useMergeRefs2(ref, setBaseElement, props.ref), 37568 onKeyDownCapture, 37569 onKeyUpCapture, 37570 onFocusCapture, 37571 onFocus, 37572 onBlurCapture, 37573 onKeyDown 37574 }; 37575 props = useFocusable({ 37576 focusable: useStoreState(store4, (state2) => composite && (state2.virtualFocus || state2.activeId === null)), 37577 ...props 37578 }); 37579 return props; 37580 }); 37581 var Composite6 = forwardRef54(function Composite7(props) { 37582 return createElement5(TagName5, useComposite(props)); 37583 }); 37584 37585 // node_modules/@ariakit/react-components/dist/disclosure/disclosure-context.js 37586 var ctx4 = createStoreContext(); 37587 var useDisclosureContext = ctx4.useContext; 37588 var useDisclosureScopedContext = ctx4.useScopedContext; 37589 var useDisclosureProviderContext = ctx4.useProviderContext; 37590 var DisclosureContextProvider = ctx4.ContextProvider; 37591 var DisclosureScopedContextProvider = ctx4.ScopedContextProvider; 37592 37593 // node_modules/@ariakit/react-components/dist/dialog/dialog-context.js 37594 var import_react25 = __toESM(require_react(), 1); 37595 var ctx5 = createStoreContext([DisclosureContextProvider], [DisclosureScopedContextProvider]); 37596 var useDialogContext = ctx5.useContext; 37597 var useDialogScopedContext = ctx5.useScopedContext; 37598 var useDialogProviderContext = ctx5.useProviderContext; 37599 var DialogContextProvider = ctx5.ContextProvider; 37600 var DialogScopedContextProvider = ctx5.ScopedContextProvider; 37601 var DialogHeadingContext = (0, import_react25.createContext)(void 0); 37602 var DialogDescriptionContext = (0, import_react25.createContext)(void 0); 37603 37604 // node_modules/@ariakit/react-components/dist/disclosure/disclosure-content.js 37605 var import_react26 = __toESM(require_react(), 1); 37606 var import_jsx_runtime204 = __toESM(require_jsx_runtime(), 1); 37607 var import_react_dom5 = __toESM(require_react_dom(), 1); 37608 var TagName6 = "div"; 37609 function afterTimeout(timeoutMs, cb) { 37610 const timeoutId = setTimeout(cb, timeoutMs); 37611 return () => clearTimeout(timeoutId); 37612 } 37613 function parseCSSTime(time) { 37614 const value = time?.trim() || "0s"; 37615 const multiplier = value.endsWith("ms") ? 1 : 1e3; 37616 const parsed = Number.parseFloat(value) * multiplier; 37617 return Number.isNaN(parsed) ? 0 : parsed; 37618 } 37619 function getEndTime(names, delays, durations) { 37620 const nameList = names.split(","); 37621 const delayList = delays.split(","); 37622 const durationList = durations.split(","); 37623 let endTime = 0; 37624 for (const [index2, name2] of nameList.entries()) { 37625 if (name2.trim() === "none") continue; 37626 const delay = parseCSSTime(delayList[index2 % delayList.length]); 37627 const duration = parseCSSTime(durationList[index2 % durationList.length]); 37628 endTime = Math.max(endTime, delay + duration); 37629 } 37630 return endTime; 37631 } 37632 function getElementEndTime(element) { 37633 const { transitionProperty, transitionDuration, transitionDelay, animationName, animationDuration, animationDelay } = getComputedStyle(element); 37634 return Math.max(getEndTime(transitionProperty, transitionDelay, transitionDuration), getEndTime(animationName, animationDelay, animationDuration)); 37635 } 37636 function isHidden(mounted, hidden, alwaysVisible) { 37637 return !alwaysVisible && hidden !== false && (!mounted || !!hidden); 37638 } 37639 var useDisclosureContent = createHook(function useDisclosureContent2({ store: store4, alwaysVisible, unstable_otherElementRef: otherElementRef, ...props }) { 37640 const context = useDisclosureProviderContext(); 37641 store4 = store4 || context; 37642 invariant(store4, "DisclosureContent must receive a `store` prop or be wrapped in a DisclosureProvider component."); 37643 const ref = (0, import_react26.useRef)(null); 37644 const id = useId5(props.id); 37645 const [transition, setTransition] = (0, import_react26.useState)(null); 37646 const open = useStoreState(store4, "open"); 37647 const mounted = useStoreState(store4, "mounted"); 37648 const animated2 = useStoreState(store4, "animated"); 37649 const contentElement = useStoreState(store4, "contentElement"); 37650 const otherElement = useStoreState(store4.disclosure, "contentElement"); 37651 const hasClosedRef = (0, import_react26.useRef)(false); 37652 useSafeLayoutEffect(() => { 37653 if (!ref.current) return; 37654 store4?.setContentElement(ref.current); 37655 }, [store4]); 37656 useSafeLayoutEffect(() => { 37657 let previousAnimated; 37658 store4?.setState("animated", (animated3) => { 37659 previousAnimated = animated3; 37660 return true; 37661 }); 37662 return () => { 37663 if (previousAnimated === void 0) return; 37664 store4?.setState("animated", previousAnimated); 37665 }; 37666 }, [store4]); 37667 useSafeLayoutEffect(() => { 37668 if (!animated2) { 37669 if (!open) { 37670 hasClosedRef.current = true; 37671 setTransition(null); 37672 } else if (hasClosedRef.current) { 37673 hasClosedRef.current = false; 37674 setTransition("enter"); 37675 } 37676 return; 37677 } 37678 if (!contentElement?.isConnected) { 37679 setTransition(null); 37680 return; 37681 } 37682 return afterPaint(() => { 37683 setTransition(open ? "enter" : mounted ? "leave" : null); 37684 }); 37685 }, [ 37686 animated2, 37687 contentElement, 37688 open, 37689 mounted 37690 ]); 37691 useSafeLayoutEffect(() => { 37692 if (!store4) return; 37693 if (!animated2) return; 37694 if (!transition) return; 37695 if (!contentElement) return; 37696 const stopAnimation = () => store4?.setState("animating", false); 37697 const stopAnimationSync = () => (0, import_react_dom5.flushSync)(stopAnimation); 37698 if (transition === "leave" && open) return; 37699 if (transition === "enter" && !open) return; 37700 if (typeof animated2 === "number") return afterTimeout(animated2, stopAnimationSync); 37701 const elements2 = [contentElement]; 37702 if (otherElement) elements2.push(otherElement); 37703 const relatedElement = otherElementRef?.current; 37704 if (relatedElement) elements2.push(relatedElement); 37705 const timeout = Math.max(...elements2.map(getElementEndTime)); 37706 if (!timeout) { 37707 if (transition === "enter") store4.setState("animated", false); 37708 stopAnimation(); 37709 return; 37710 } 37711 return afterTimeout(Math.max(timeout - 1e3 / 60, 0), stopAnimationSync); 37712 }, [ 37713 store4, 37714 animated2, 37715 contentElement, 37716 otherElement, 37717 otherElementRef, 37718 open, 37719 transition 37720 ]); 37721 props = useWrapElement(props, (element) => /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(DialogScopedContextProvider, { 37722 value: store4, 37723 children: element 37724 }), [store4]); 37725 const hidden = isHidden(mounted, props.hidden, alwaysVisible); 37726 const styleProp = props.style; 37727 const style = (0, import_react26.useMemo)(() => { 37728 if (hidden) return { 37729 ...styleProp, 37730 display: "none" 37731 }; 37732 return styleProp; 37733 }, [hidden, styleProp]); 37734 props = { 37735 "data-open": open || void 0, 37736 "data-enter": transition === "enter" || void 0, 37737 "data-leave": transition === "leave" || void 0, 37738 hidden, 37739 ...props, 37740 id, 37741 ref: useMergeRefs2(id ? store4.setContentElement : null, ref, props.ref), 37742 style 37743 }; 37744 return removeUndefinedValues(props); 37745 }); 37746 var DisclosureContentImpl = forwardRef54(function DisclosureContentImpl2(props) { 37747 return createElement5(TagName6, useDisclosureContent(props)); 37748 }); 37749 var DisclosureContent = forwardRef54(function DisclosureContent2({ unmountOnHide, ...props }) { 37750 const context = useDisclosureProviderContext(); 37751 if (useStoreState(props.store || context, (state2) => !unmountOnHide || state2?.mounted) === false) return null; 37752 return /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(DisclosureContentImpl, { ...props }); 37753 }); 37754 37755 // node_modules/@ariakit/components/dist/disclosure/disclosure-store.js 37756 function createDisclosureStore(props = {}) { 37757 const store4 = mergeStore(props.store, omit2(props.disclosure, ["contentElement", "disclosureElement"])); 37758 throwOnConflictingProps(props, store4); 37759 const syncState = store4?.getState(); 37760 const open = defaultValue(props.open, syncState?.open, props.defaultOpen, false); 37761 const animated2 = defaultValue(props.animated, syncState?.animated, false); 37762 const disclosure = createStore({ 37763 open, 37764 animated: animated2, 37765 animating: !!animated2 && open, 37766 mounted: open, 37767 contentElement: defaultValue(syncState?.contentElement, null), 37768 disclosureElement: defaultValue(syncState?.disclosureElement, null) 37769 }, store4); 37770 setup(disclosure, () => sync2(disclosure, ["animated", "animating"], (state2) => { 37771 if (state2.animated) return; 37772 disclosure.setState("animating", false); 37773 })); 37774 setup(disclosure, () => subscribe3(disclosure, ["open"], () => { 37775 if (!disclosure.getState().animated) return; 37776 disclosure.setState("animating", true); 37777 })); 37778 setup(disclosure, () => sync2(disclosure, ["open", "animating"], (state2) => { 37779 disclosure.setState("mounted", state2.open || state2.animating); 37780 })); 37781 return { 37782 ...disclosure, 37783 disclosure: props.disclosure, 37784 setOpen: (value) => disclosure.setState("open", value), 37785 show: () => disclosure.setState("open", true), 37786 hide: () => disclosure.setState("open", false), 37787 toggle: () => disclosure.setState("open", (open2) => !open2), 37788 stopAnimation: () => disclosure.setState("animating", false), 37789 setContentElement: (value) => disclosure.setState("contentElement", value), 37790 setDisclosureElement: (value) => disclosure.setState("disclosureElement", value) 37791 }; 37792 } 37793 37794 // node_modules/@ariakit/react-components/dist/disclosure/disclosure-store.js 37795 function useDisclosureStoreProps(store4, update4, props) { 37796 useUpdateEffect(update4, [props.store, props.disclosure]); 37797 useStoreProps(store4, props, "open", "setOpen"); 37798 useStoreProps(store4, props, "mounted", "setMounted"); 37799 useStoreProps(store4, props, "animated"); 37800 return Object.assign(store4, { disclosure: props.disclosure }); 37801 } 37802 37803 // node_modules/@ariakit/react-components/dist/popover/popover-context.js 37804 var ctx6 = createStoreContext([DialogContextProvider], [DialogScopedContextProvider]); 37805 var usePopoverContext = ctx6.useContext; 37806 var usePopoverScopedContext = ctx6.useScopedContext; 37807 var usePopoverProviderContext = ctx6.useProviderContext; 37808 var PopoverContextProvider = ctx6.ContextProvider; 37809 var PopoverScopedContextProvider = ctx6.ScopedContextProvider; 37810 37811 // node_modules/@ariakit/react-components/dist/combobox/combobox-context.js 37812 var import_react27 = __toESM(require_react(), 1); 37813 var ComboboxListRoleContext = (0, import_react27.createContext)(void 0); 37814 var ctx7 = createStoreContext([PopoverContextProvider, CompositeContextProvider], [PopoverScopedContextProvider, CompositeScopedContextProvider]); 37815 var useComboboxContext = ctx7.useContext; 37816 var useComboboxScopedContext = ctx7.useScopedContext; 37817 var useComboboxProviderContext = ctx7.useProviderContext; 37818 var ComboboxContextProvider = ctx7.ContextProvider; 37819 var ComboboxScopedContextProvider = ctx7.ScopedContextProvider; 37820 var ComboboxItemValueContext = (0, import_react27.createContext)(void 0); 37821 var ComboboxItemCheckedContext = (0, import_react27.createContext)(false); 37822 37823 // node_modules/@ariakit/react-components/dist/collection/collection-store.js 37824 function useCollectionStoreProps(store4, update4, props) { 37825 useUpdateEffect(update4, [props.store]); 37826 useStoreProps(store4, props, "items", "setItems"); 37827 return store4; 37828 } 37829 37830 // node_modules/@ariakit/react-components/dist/composite/composite-store.js 37831 function useCompositeStoreOptions(props) { 37832 return { 37833 id: useId5(props.id), 37834 ...props 37835 }; 37836 } 37837 function useCompositeStoreProps(store4, update4, props) { 37838 store4 = useCollectionStoreProps(store4, update4, props); 37839 useStoreProps(store4, props, "activeId", "setActiveId"); 37840 useStoreProps(store4, props, "includesBaseElement"); 37841 useStoreProps(store4, props, "virtualFocus"); 37842 useStoreProps(store4, props, "orientation"); 37843 useStoreProps(store4, props, "rtl"); 37844 useStoreProps(store4, props, "focusLoop"); 37845 useStoreProps(store4, props, "focusWrap"); 37846 useStoreProps(store4, props, "focusShift"); 37847 return store4; 37848 } 37849 37850 // node_modules/@ariakit/components/dist/dialog/dialog-store.js 37851 function createDialogStore(props = {}) { 37852 return createDisclosureStore(props); 37853 } 37854 37855 // node_modules/@ariakit/react-components/dist/dialog/dialog-store.js 37856 function useDialogStoreProps(store4, update4, props) { 37857 return useDisclosureStoreProps(store4, update4, props); 37858 } 37859 37860 // node_modules/@ariakit/components/dist/popover/popover-store.js 37861 function createPopoverStore({ popover: otherPopover, ...props } = {}) { 37862 const store4 = mergeStore(props.store, omit2(otherPopover, [ 37863 "arrowElement", 37864 "anchorElement", 37865 "contentElement", 37866 "popoverElement", 37867 "disclosureElement" 37868 ])); 37869 throwOnConflictingProps(props, store4); 37870 const syncState = store4?.getState(); 37871 const dialog = createDialogStore({ 37872 ...props, 37873 store: store4 37874 }); 37875 const placement = defaultValue(props.placement, syncState?.placement, "bottom"); 37876 const popover = createStore({ 37877 ...dialog.getState(), 37878 placement, 37879 currentPlacement: placement, 37880 anchorElement: defaultValue(syncState?.anchorElement, null), 37881 popoverElement: defaultValue(syncState?.popoverElement, null), 37882 arrowElement: defaultValue(syncState?.arrowElement, null), 37883 rendered: /* @__PURE__ */ Symbol("rendered") 37884 }, dialog, store4); 37885 return { 37886 ...dialog, 37887 ...popover, 37888 setAnchorElement: (element) => popover.setState("anchorElement", element), 37889 setPopoverElement: (element) => popover.setState("popoverElement", element), 37890 setArrowElement: (element) => popover.setState("arrowElement", element), 37891 render: () => popover.setState("rendered", /* @__PURE__ */ Symbol("rendered")) 37892 }; 37893 } 37894 37895 // node_modules/@ariakit/react-components/dist/popover/popover-store.js 37896 function usePopoverStoreProps(store4, update4, props) { 37897 useUpdateEffect(update4, [props.popover]); 37898 useStoreProps(store4, props, "placement"); 37899 return useDialogStoreProps(store4, update4, props); 37900 } 37901 37902 // node_modules/@ariakit/react-components/dist/popover/popover-anchor.js 37903 var TagName7 = "div"; 37904 var usePopoverAnchor = createHook(function usePopoverAnchor2({ store: store4, ...props }) { 37905 const context = usePopoverProviderContext(); 37906 store4 = store4 || context; 37907 props = { 37908 ...props, 37909 ref: useMergeRefs2(store4?.setAnchorElement, props.ref) 37910 }; 37911 return props; 37912 }); 37913 var PopoverAnchor = forwardRef54(function PopoverAnchor2(props) { 37914 return createElement5(TagName7, usePopoverAnchor(props)); 37915 }); 37916 37917 // node_modules/@ariakit/react-components/dist/composite/composite-hover.js 37918 var import_react28 = __toESM(require_react(), 1); 37919 var TagName8 = "div"; 37920 function hoveringInside(event) { 37921 const nextElement = event.relatedTarget; 37922 if (!isElement2(nextElement)) return false; 37923 return contains2(event.currentTarget, nextElement); 37924 } 37925 var symbol2 = /* @__PURE__ */ Symbol("composite-hover"); 37926 function movingToAnotherItem(event) { 37927 const { relatedTarget } = event; 37928 if (!isElement2(relatedTarget)) return false; 37929 let dest = relatedTarget; 37930 do { 37931 if (hasOwnProperty(dest, symbol2) && dest[symbol2]) return true; 37932 dest = dest.parentElement; 37933 } while (dest); 37934 return false; 37935 } 37936 var useCompositeHover = createHook(function useCompositeHover2({ store: store4, focusOnHover = true, blurOnHoverEnd = !!focusOnHover, ...props }) { 37937 const context = useCompositeScopedContext(); 37938 store4 = store4 || context; 37939 invariant(store4, "CompositeHover must be wrapped in a Composite component."); 37940 const isMouseMoving = useIsMouseMoving(); 37941 const onMouseMoveProp = props.onMouseMove; 37942 const focusOnHoverProp = useBooleanEvent(focusOnHover); 37943 const onMouseMove = useEvent2((event) => { 37944 onMouseMoveProp?.(event); 37945 if (event.defaultPrevented) return; 37946 if (!isMouseMoving()) return; 37947 if (!focusOnHoverProp(event)) return; 37948 if (!hasFocusWithin(event.currentTarget)) { 37949 const baseElement = store4?.getState().baseElement; 37950 if (baseElement && !hasFocus(baseElement)) baseElement.focus(); 37951 } 37952 store4?.setActiveId(event.currentTarget.id); 37953 }); 37954 const onMouseLeaveProp = props.onMouseLeave; 37955 const blurOnHoverEndProp = useBooleanEvent(blurOnHoverEnd); 37956 const onMouseLeave = useEvent2((event) => { 37957 onMouseLeaveProp?.(event); 37958 if (event.defaultPrevented) return; 37959 if (!isMouseMoving()) return; 37960 if (hoveringInside(event)) return; 37961 if (movingToAnotherItem(event)) return; 37962 if (!focusOnHoverProp(event)) return; 37963 if (!blurOnHoverEndProp(event)) return; 37964 store4?.setActiveId(null); 37965 store4?.getState().baseElement?.focus(); 37966 }); 37967 const ref = (0, import_react28.useCallback)((element) => { 37968 if (!element) return; 37969 element[symbol2] = true; 37970 }, []); 37971 props = { 37972 ...props, 37973 ref: useMergeRefs2(ref, props.ref), 37974 onMouseMove, 37975 onMouseLeave 37976 }; 37977 return removeUndefinedValues(props); 37978 }); 37979 var CompositeHover = memo4(forwardRef54(function CompositeHover2(props) { 37980 return createElement5(TagName8, useCompositeHover(props)); 37981 })); 37982 37983 // node_modules/@ariakit/react-components/dist/combobox/combobox.js 37984 var import_react29 = __toESM(require_react(), 1); 37985 var TagName9 = "input"; 37986 function isFirstItemAutoSelected(items, activeValue, autoSelect) { 37987 if (!autoSelect) return false; 37988 return items.find((item) => !item.disabled && item.value)?.value === activeValue; 37989 } 37990 function hasCompletionString(value, activeValue) { 37991 if (!activeValue) return false; 37992 if (value == null) return false; 37993 const normalizedValue = normalizeString(value); 37994 const normalizedActiveValue = normalizeString(activeValue); 37995 if (normalizedValue.length !== value.length) return false; 37996 if (normalizedActiveValue.length !== activeValue.length) return false; 37997 return normalizedActiveValue.length > normalizedValue.length && normalizedActiveValue.toLowerCase().startsWith(normalizedValue.toLowerCase()); 37998 } 37999 function isAriaAutoCompleteValue(value) { 38000 return value === "inline" || value === "list" || value === "both" || value === "none"; 38001 } 38002 function getDefaultAutoSelectId(items) { 38003 return items.find((item) => { 38004 if (item.disabled) return false; 38005 return item.element?.getAttribute("role") !== "tab"; 38006 })?.id; 38007 } 38008 var useCombobox = createHook(function useCombobox2({ store: store4, focusable: focusable2 = true, autoSelect: autoSelectProp = false, getAutoSelectId, setValueOnChange, showMinLength = 0, showOnChange, showOnMouseDown, showOnClick = showOnMouseDown, showOnKeyDown, showOnKeyPress = showOnKeyDown, blurActiveItemOnClick, setValueOnClick = true, moveOnKeyPress = true, autoComplete = "list", ...props }) { 38009 const context = useComboboxProviderContext(); 38010 store4 = store4 || context; 38011 invariant(store4, "Combobox must receive a `store` prop or be wrapped in a ComboboxProvider component."); 38012 const ref = (0, import_react29.useRef)(null); 38013 const [valueUpdated, forceValueUpdate] = useForceUpdate2(); 38014 const canAutoSelectRef = (0, import_react29.useRef)(false); 38015 const composingRef = (0, import_react29.useRef)(false); 38016 const autoSelect = useStoreState(store4, (state2) => state2.virtualFocus && autoSelectProp); 38017 const inline4 = autoComplete === "inline" || autoComplete === "both"; 38018 const [canInline, setCanInline] = (0, import_react29.useState)(inline4); 38019 useUpdateLayoutEffect(() => { 38020 if (!inline4) return; 38021 setCanInline(true); 38022 }, [inline4]); 38023 const storeValue = useStoreState(store4, "value"); 38024 const prevSelectedValueRef = (0, import_react29.useRef)(void 0); 38025 (0, import_react29.useEffect)(() => { 38026 return sync2(store4, ["selectedValue", "activeId"], (_, prev) => { 38027 prevSelectedValueRef.current = prev.selectedValue; 38028 }); 38029 }, [store4]); 38030 const inlineActiveValue = useStoreState(store4, (state2) => { 38031 if (!inline4) return; 38032 if (!canInline) return; 38033 if (state2.activeValue && Array.isArray(state2.selectedValue)) { 38034 if (state2.selectedValue.includes(state2.activeValue)) return; 38035 if (prevSelectedValueRef.current?.includes(state2.activeValue)) return; 38036 } 38037 return state2.activeValue; 38038 }); 38039 const items = useStoreState(store4, "renderedItems"); 38040 const open = useStoreState(store4, "open"); 38041 const contentElement = useStoreState(store4, "contentElement"); 38042 const value = (0, import_react29.useMemo)(() => { 38043 if (!inline4) return storeValue; 38044 if (!canInline) return storeValue; 38045 if (isFirstItemAutoSelected(items, inlineActiveValue, autoSelect)) { 38046 if (hasCompletionString(storeValue, inlineActiveValue)) return storeValue + (inlineActiveValue?.slice(storeValue.length) || ""); 38047 return storeValue; 38048 } 38049 return inlineActiveValue || storeValue; 38050 }, [ 38051 inline4, 38052 canInline, 38053 items, 38054 inlineActiveValue, 38055 autoSelect, 38056 storeValue 38057 ]); 38058 (0, import_react29.useEffect)(() => { 38059 const element = ref.current; 38060 if (!element) return; 38061 const onCompositeItemMove = () => setCanInline(true); 38062 element.addEventListener("combobox-item-move", onCompositeItemMove); 38063 return () => { 38064 element.removeEventListener("combobox-item-move", onCompositeItemMove); 38065 }; 38066 }, []); 38067 (0, import_react29.useEffect)(() => { 38068 if (!inline4) return; 38069 if (!canInline) return; 38070 if (!inlineActiveValue) return; 38071 if (!isFirstItemAutoSelected(items, inlineActiveValue, autoSelect)) return; 38072 if (!hasCompletionString(storeValue, inlineActiveValue)) return; 38073 let cleanup = noop6; 38074 queueMicrotask(() => { 38075 const element = ref.current; 38076 if (!element) return; 38077 const { start: prevStart, end: prevEnd } = getTextboxSelection(element); 38078 const nextStart = storeValue.length; 38079 const nextEnd = inlineActiveValue.length; 38080 setSelectionRange(element, nextStart, nextEnd); 38081 cleanup = () => { 38082 if (!hasFocus(element)) return; 38083 const { start: start2, end } = getTextboxSelection(element); 38084 if (start2 !== nextStart) return; 38085 if (end !== nextEnd) return; 38086 setSelectionRange(element, prevStart, prevEnd); 38087 }; 38088 }); 38089 return () => cleanup(); 38090 }, [ 38091 valueUpdated, 38092 inline4, 38093 canInline, 38094 inlineActiveValue, 38095 items, 38096 autoSelect, 38097 storeValue 38098 ]); 38099 const getAutoSelectIdProp = useEvent2(getAutoSelectId); 38100 const autoSelectIdRef = (0, import_react29.useRef)(null); 38101 const autoSelectMovedRef = (0, import_react29.useRef)(void 0); 38102 const userScrolledRef = (0, import_react29.useRef)(false); 38103 const isAutoScrollingRef = (0, import_react29.useRef)(false); 38104 (0, import_react29.useEffect)(() => { 38105 if (!open) return; 38106 if (!contentElement) return; 38107 const scrollingElement = getScrollingElement(contentElement); 38108 if (!scrollingElement) return; 38109 const onUserScroll = () => { 38110 canAutoSelectRef.current = false; 38111 userScrolledRef.current = true; 38112 }; 38113 const onScroll = () => { 38114 if (!isAutoScrollingRef.current) userScrolledRef.current = true; 38115 if (!store4) return; 38116 if (!canAutoSelectRef.current) return; 38117 const { activeId } = store4.getState(); 38118 if (activeId === null) return; 38119 if (activeId === autoSelectIdRef.current) return; 38120 canAutoSelectRef.current = false; 38121 }; 38122 const options = { 38123 passive: true, 38124 capture: true 38125 }; 38126 scrollingElement.addEventListener("wheel", onUserScroll, options); 38127 scrollingElement.addEventListener("touchmove", onUserScroll, options); 38128 scrollingElement.addEventListener("scroll", onScroll, options); 38129 return () => { 38130 scrollingElement.removeEventListener("wheel", onUserScroll, true); 38131 scrollingElement.removeEventListener("touchmove", onUserScroll, true); 38132 scrollingElement.removeEventListener("scroll", onScroll, true); 38133 }; 38134 }, [ 38135 open, 38136 contentElement, 38137 store4 38138 ]); 38139 useSafeLayoutEffect(() => { 38140 userScrolledRef.current = false; 38141 if (!storeValue) return; 38142 if (composingRef.current) return; 38143 canAutoSelectRef.current = true; 38144 }, [storeValue]); 38145 useSafeLayoutEffect(() => { 38146 if (autoSelect !== "always" && open) return; 38147 canAutoSelectRef.current = open; 38148 }, [autoSelect, open]); 38149 useSafeLayoutEffect(() => { 38150 if (open) return; 38151 autoSelectMovedRef.current = void 0; 38152 }, [open]); 38153 const resetValueOnSelect = useStoreState(store4, "resetValueOnSelect"); 38154 useUpdateEffect(() => { 38155 const canAutoSelect = canAutoSelectRef.current; 38156 if (!store4) return; 38157 if (!open) return; 38158 if (!canAutoSelect && (!resetValueOnSelect || userScrolledRef.current)) return; 38159 const { baseElement, contentElement: contentElement2, activeId } = store4.getState(); 38160 if (baseElement && !hasFocus(baseElement)) return; 38161 if (contentElement2?.hasAttribute("data-placing")) { 38162 const observer = new MutationObserver(forceValueUpdate); 38163 observer.observe(contentElement2, { attributeFilter: ["data-placing"] }); 38164 return () => observer.disconnect(); 38165 } 38166 if (autoSelect && canAutoSelect) { 38167 const userAutoSelectId = getAutoSelectIdProp(items); 38168 const autoSelectId = userAutoSelectId !== void 0 ? userAutoSelectId : getDefaultAutoSelectId(items) ?? store4.first(); 38169 autoSelectIdRef.current = autoSelectId; 38170 const nextActiveId = autoSelectId ?? null; 38171 const nextActiveValue = store4.item(nextActiveId)?.value; 38172 const moved = autoSelectMovedRef.current; 38173 if (nextActiveId !== activeId || moved?.id !== nextActiveId || moved?.value !== nextActiveValue) { 38174 autoSelectMovedRef.current = { 38175 id: nextActiveId, 38176 value: nextActiveValue 38177 }; 38178 store4.move(nextActiveId); 38179 } else store4.setState("activeValue", nextActiveValue); 38180 } else { 38181 const element = store4.item(activeId || store4.first())?.element; 38182 if (element && "scrollIntoView" in element) { 38183 isAutoScrollingRef.current = true; 38184 element.scrollIntoView({ 38185 block: "nearest", 38186 inline: "nearest" 38187 }); 38188 requestAnimationFrame(() => { 38189 isAutoScrollingRef.current = false; 38190 }); 38191 } 38192 } 38193 }, [ 38194 store4, 38195 open, 38196 valueUpdated, 38197 storeValue, 38198 autoSelect, 38199 resetValueOnSelect, 38200 getAutoSelectIdProp, 38201 items 38202 ]); 38203 (0, import_react29.useEffect)(() => { 38204 if (!inline4) return; 38205 const combobox = ref.current; 38206 if (!combobox) return; 38207 const elements2 = [combobox, contentElement].filter((value2) => !!value2); 38208 const onBlur2 = (event) => { 38209 if (elements2.every((el) => isFocusEventOutside(event, el))) store4?.setValue(value); 38210 }; 38211 for (const element of elements2) element.addEventListener("focusout", onBlur2); 38212 return () => { 38213 for (const element of elements2) element.removeEventListener("focusout", onBlur2); 38214 }; 38215 }, [ 38216 inline4, 38217 contentElement, 38218 store4, 38219 value 38220 ]); 38221 const canShow = (event) => { 38222 return event.currentTarget.value.length >= showMinLength; 38223 }; 38224 const onChangeProp = props.onChange; 38225 const showOnChangeProp = useBooleanEvent(showOnChange ?? canShow); 38226 const setValueOnChangeProp = useBooleanEvent(setValueOnChange ?? !store4.tag); 38227 const onChange = useEvent2((event) => { 38228 onChangeProp?.(event); 38229 if (event.defaultPrevented) return; 38230 if (!store4) return; 38231 const currentTarget = event.currentTarget; 38232 const { value: value2, selectionStart, selectionEnd } = currentTarget; 38233 const nativeEvent = event.nativeEvent; 38234 canAutoSelectRef.current = true; 38235 if (isInputEvent(nativeEvent)) { 38236 if (nativeEvent.isComposing) { 38237 canAutoSelectRef.current = false; 38238 composingRef.current = true; 38239 } 38240 if (inline4) { 38241 const textInserted = nativeEvent.inputType === "insertText" || nativeEvent.inputType === "insertCompositionText"; 38242 const caretAtEnd = selectionStart === value2.length; 38243 setCanInline(textInserted && caretAtEnd); 38244 } 38245 } 38246 if (setValueOnChangeProp(event)) { 38247 const isSameValue2 = value2 === store4.getState().value; 38248 store4.setValue(value2); 38249 queueMicrotask(() => { 38250 setSelectionRange(currentTarget, selectionStart, selectionEnd); 38251 }); 38252 if (inline4 && autoSelect && isSameValue2) forceValueUpdate(); 38253 } 38254 if (showOnChangeProp(event)) store4.show(); 38255 if (!autoSelect || !canAutoSelectRef.current) store4.setActiveId(null); 38256 }); 38257 const onCompositionEndProp = props.onCompositionEnd; 38258 const onCompositionEnd = useEvent2((event) => { 38259 canAutoSelectRef.current = true; 38260 composingRef.current = false; 38261 onCompositionEndProp?.(event); 38262 if (event.defaultPrevented) return; 38263 if (!autoSelect) return; 38264 forceValueUpdate(); 38265 }); 38266 const onMouseDownProp = props.onMouseDown; 38267 const blurActiveItemOnClickProp = useBooleanEvent(blurActiveItemOnClick ?? (() => store4.getState().includesBaseElement)); 38268 const setValueOnClickProp = useBooleanEvent(setValueOnClick); 38269 const showOnClickProp = useBooleanEvent(showOnClick ?? canShow); 38270 const onMouseDown = useEvent2((event) => { 38271 onMouseDownProp?.(event); 38272 if (event.defaultPrevented) return; 38273 if (event.button) return; 38274 if (event.ctrlKey) return; 38275 if (!store4) return; 38276 if (blurActiveItemOnClickProp(event)) store4.setActiveId(null); 38277 if (setValueOnClickProp(event)) store4.setValue(value); 38278 if (showOnClickProp(event)) queueBeforeEvent(event.currentTarget, "mouseup", store4.show); 38279 }); 38280 const onKeyDownProp = props.onKeyDown; 38281 const showOnKeyPressProp = useBooleanEvent(showOnKeyPress ?? canShow); 38282 const onKeyDown = useEvent2((event) => { 38283 onKeyDownProp?.(event); 38284 if (!event.repeat) canAutoSelectRef.current = false; 38285 if (event.defaultPrevented) return; 38286 if (!store4) return; 38287 const { open: open2 } = store4.getState(); 38288 if (open2 && event.key === "Enter") { 38289 event.preventDefault(); 38290 return; 38291 } 38292 if (event.ctrlKey) return; 38293 if (event.altKey) return; 38294 if (event.shiftKey) return; 38295 if (event.metaKey) return; 38296 if (open2) return; 38297 if (event.key === "ArrowUp" || event.key === "ArrowDown") { 38298 if (showOnKeyPressProp(event)) { 38299 event.preventDefault(); 38300 store4.show(); 38301 } 38302 } 38303 }); 38304 const onBlurProp = props.onBlur; 38305 const onBlur = useEvent2((event) => { 38306 canAutoSelectRef.current = false; 38307 onBlurProp?.(event); 38308 }); 38309 const id = useId5(props.id); 38310 const ariaAutoComplete = isAriaAutoCompleteValue(autoComplete) ? autoComplete : void 0; 38311 const isActiveItem = useStoreState(store4, (state2) => state2.activeId === null); 38312 props = { 38313 role: "combobox", 38314 "aria-autocomplete": ariaAutoComplete, 38315 "aria-haspopup": getPopupRole(contentElement, "listbox"), 38316 "aria-expanded": open, 38317 "aria-controls": contentElement?.id, 38318 "data-active-item": isActiveItem || void 0, 38319 value, 38320 ...props, 38321 id, 38322 ref: useMergeRefs2(ref, props.ref), 38323 onChange, 38324 onCompositionEnd, 38325 onMouseDown, 38326 onKeyDown, 38327 onBlur 38328 }; 38329 props = useComposite({ 38330 store: store4, 38331 focusable: focusable2, 38332 ...props, 38333 moveOnKeyPress: (event) => { 38334 if (isFalsyBooleanCallback(moveOnKeyPress, event)) return false; 38335 if (inline4) setCanInline(true); 38336 return true; 38337 } 38338 }); 38339 props = usePopoverAnchor({ 38340 store: store4, 38341 ...props 38342 }); 38343 return { 38344 autoComplete: "off", 38345 ...props 38346 }; 38347 }); 38348 var Combobox = forwardRef54(function Combobox2(props) { 38349 return createElement5(TagName9, useCombobox(props)); 38350 }); 38351 38352 // node_modules/@ariakit/react-components/dist/combobox/combobox-item.js 38353 var import_react30 = __toESM(require_react(), 1); 38354 var import_jsx_runtime205 = __toESM(require_jsx_runtime(), 1); 38355 var TagName10 = "div"; 38356 function isSelected(storeValue, itemValue) { 38357 if (itemValue == null) return; 38358 if (storeValue == null) return false; 38359 if (Array.isArray(storeValue)) return storeValue.includes(itemValue); 38360 return storeValue === itemValue; 38361 } 38362 function getItemRole(popupRole) { 38363 return getItemRoleByPopupRole(popupRole) ?? "option"; 38364 } 38365 var useComboboxItem = createHook(function useComboboxItem2({ store: store4, value, hideOnClick, setValueOnClick, selectValueOnClick = true, resetValueOnSelect, focusOnHover = false, moveOnKeyPress = true, getItem: getItemProp, ...props }) { 38366 const context = useComboboxScopedContext(); 38367 store4 = store4 || context; 38368 invariant(store4, "ComboboxItem must be wrapped in a ComboboxList or ComboboxPopover component."); 38369 const { resetValueOnSelectState, multiSelectable, selected } = useStoreStateObject(store4, { 38370 resetValueOnSelectState: "resetValueOnSelect", 38371 multiSelectable(state2) { 38372 return Array.isArray(state2.selectedValue); 38373 }, 38374 selected(state2) { 38375 return isSelected(state2.selectedValue, value); 38376 } 38377 }); 38378 const getItem = (0, import_react30.useCallback)((item) => { 38379 const nextItem = { 38380 ...item, 38381 value 38382 }; 38383 if (getItemProp) return getItemProp(nextItem); 38384 return nextItem; 38385 }, [value, getItemProp]); 38386 setValueOnClick = setValueOnClick ?? !multiSelectable; 38387 hideOnClick = hideOnClick ?? (value != null && !multiSelectable); 38388 const onClickProp = props.onClick; 38389 const setValueOnClickProp = useBooleanEvent(setValueOnClick); 38390 const selectValueOnClickProp = useBooleanEvent(selectValueOnClick); 38391 const resetValueOnSelectProp = useBooleanEvent(resetValueOnSelect ?? resetValueOnSelectState ?? multiSelectable); 38392 const hideOnClickProp = useBooleanEvent(hideOnClick); 38393 const onClick = useEvent2((event) => { 38394 onClickProp?.(event); 38395 if (event.defaultPrevented) return; 38396 if (isDownloading(event)) return; 38397 if (isOpeningInNewTab(event)) return; 38398 if (value != null) { 38399 if (selectValueOnClickProp(event)) { 38400 if (resetValueOnSelectProp(event)) store4?.resetValue(); 38401 store4?.setSelectedValue((prevValue) => { 38402 if (!Array.isArray(prevValue)) return value; 38403 if (prevValue.includes(value)) return prevValue.filter((v3) => v3 !== value); 38404 return [...prevValue, value]; 38405 }); 38406 } 38407 if (setValueOnClickProp(event)) store4?.setValue(value); 38408 } 38409 if (hideOnClickProp(event)) store4?.hide(); 38410 }); 38411 const onKeyDownProp = props.onKeyDown; 38412 const onKeyDown = useEvent2((event) => { 38413 onKeyDownProp?.(event); 38414 if (event.defaultPrevented) return; 38415 const baseElement = store4?.getState().baseElement; 38416 if (!baseElement) return; 38417 if (hasFocus(baseElement)) return; 38418 const printable = event.key.length === 1 && !event.ctrlKey && !event.metaKey; 38419 const paste = (!isApple() ? event.ctrlKey : event.metaKey) && event.key.toLowerCase() === "v"; 38420 const deleteKey = event.key === "Backspace" || event.key === "Delete"; 38421 if (printable || paste || deleteKey) { 38422 queueMicrotask(() => baseElement.focus()); 38423 if (isTextField(baseElement)) store4?.setValue(baseElement.value); 38424 } 38425 }); 38426 if (multiSelectable && selected != null) props = { 38427 "aria-selected": selected, 38428 ...props 38429 }; 38430 props = useWrapElement(props, (element) => /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(ComboboxItemValueContext.Provider, { 38431 value, 38432 children: /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(ComboboxItemCheckedContext.Provider, { 38433 value: selected ?? false, 38434 children: element 38435 }) 38436 }), [value, selected]); 38437 props = { 38438 role: getItemRole((0, import_react30.useContext)(ComboboxListRoleContext)), 38439 children: value, 38440 ...props, 38441 onClick, 38442 onKeyDown 38443 }; 38444 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 38445 props = useCompositeItem2({ 38446 store: store4, 38447 ...props, 38448 getItem, 38449 moveOnKeyPress: (event) => { 38450 if (!moveOnKeyPressProp(event)) return false; 38451 const moveEvent = new Event("combobox-item-move"); 38452 store4?.getState().baseElement?.dispatchEvent(moveEvent); 38453 return true; 38454 } 38455 }); 38456 props = useCompositeHover({ 38457 store: store4, 38458 focusOnHover, 38459 ...props 38460 }); 38461 return props; 38462 }); 38463 var ComboboxItem = memo4(forwardRef54(function ComboboxItem2(props) { 38464 return createElement5(TagName10, useComboboxItem(props)); 38465 })); 38466 38467 // node_modules/@ariakit/react-components/dist/combobox/combobox-item-value.js 38468 var import_react31 = __toESM(require_react(), 1); 38469 var import_jsx_runtime206 = __toESM(require_jsx_runtime(), 1); 38470 var TagName11 = "span"; 38471 function normalizeValue2(value) { 38472 return normalizeString(value).toLowerCase(); 38473 } 38474 function getOffsets(string, values) { 38475 const offsets = []; 38476 for (const value of values) { 38477 if (!value) continue; 38478 let pos = 0; 38479 const length2 = value.length; 38480 let index2 = string.indexOf(value, pos); 38481 while (index2 !== -1) { 38482 offsets.push([index2, length2]); 38483 pos = index2 + 1; 38484 index2 = string.indexOf(value, pos); 38485 } 38486 } 38487 return offsets; 38488 } 38489 function mergeOverlappingOffsets(offsets) { 38490 offsets.sort(([a3], [b3]) => a3 - b3); 38491 const merged = []; 38492 for (const [offset4, length2] of offsets) { 38493 const last = merged[merged.length - 1]; 38494 if (last && offset4 < last[0] + last[1]) last[1] = Math.max(last[1], offset4 + length2 - last[0]); 38495 else merged.push([offset4, length2]); 38496 } 38497 return merged; 38498 } 38499 function getNormalizedIndexes(itemValue) { 38500 const starts = []; 38501 const ends = []; 38502 let index2 = 0; 38503 for (const char of itemValue) { 38504 const normalizedLength = normalizeValue2(char).length; 38505 for (let i3 = 0; i3 < normalizedLength; i3 += 1) { 38506 starts.push(i3 === 0 ? index2 : -1); 38507 ends.push(index2); 38508 } 38509 index2 += char.length; 38510 } 38511 starts.push(itemValue.length); 38512 ends.push(itemValue.length); 38513 let nextBoundary = itemValue.length; 38514 for (let i3 = starts.length - 1; i3 >= 0; i3 -= 1) { 38515 const start2 = starts[i3]; 38516 if (start2 == null) continue; 38517 if (start2 === -1) starts[i3] = nextBoundary; 38518 else nextBoundary = start2; 38519 } 38520 return { 38521 starts, 38522 ends 38523 }; 38524 } 38525 function toOriginalOffsets(itemValue, normalizedOffsets) { 38526 if (!normalizedOffsets.length) return normalizedOffsets; 38527 const { starts, ends } = getNormalizedIndexes(itemValue); 38528 const offsets = []; 38529 for (const [normalizedOffset, normalizedLength] of normalizedOffsets) { 38530 const start2 = starts[normalizedOffset]; 38531 const end = ends[normalizedOffset + normalizedLength]; 38532 if (start2 == null || end == null) continue; 38533 if (end <= start2) continue; 38534 offsets.push([start2, end - start2]); 38535 } 38536 return offsets; 38537 } 38538 function splitValue(itemValue, userValue) { 38539 if (!itemValue) return itemValue; 38540 if (!userValue) return itemValue; 38541 const userValues = toArray2(userValue).map(normalizeValue2); 38542 const parts = []; 38543 const span = (value, autocomplete = false) => /* @__PURE__ */ (0, import_jsx_runtime206.jsx)("span", { 38544 "data-autocomplete-value": autocomplete ? "" : void 0, 38545 "data-user-value": autocomplete ? void 0 : "", 38546 children: value 38547 }, parts.length); 38548 const offsets = toOriginalOffsets(itemValue, mergeOverlappingOffsets(getOffsets(normalizeValue2(itemValue), new Set(userValues)))); 38549 const firstEntry = offsets[0]; 38550 if (!firstEntry) { 38551 parts.push(span(itemValue, true)); 38552 return parts; 38553 } 38554 const [firstOffset] = firstEntry; 38555 [itemValue.slice(0, firstOffset), ...offsets.flatMap(([offset4, length2], i3) => { 38556 const value = itemValue.slice(offset4, offset4 + length2); 38557 const nextOffset = offsets[i3 + 1]?.[0]; 38558 return [value, itemValue.slice(offset4 + length2, nextOffset)]; 38559 })].forEach((value, i3) => { 38560 if (!value) return; 38561 parts.push(span(value, i3 % 2 === 0)); 38562 }); 38563 return parts; 38564 } 38565 var useComboboxItemValue = createHook(function useComboboxItemValue2({ store: store4, value, userValue, ...props }) { 38566 const context = useComboboxScopedContext(); 38567 store4 = store4 || context; 38568 const itemContext = (0, import_react31.useContext)(ComboboxItemValueContext); 38569 const itemValue = value ?? itemContext; 38570 const inputValue = useStoreState(store4, (state2) => userValue ?? state2?.value); 38571 props = { 38572 children: (0, import_react31.useMemo)(() => { 38573 if (!itemValue) return; 38574 if (!inputValue) return itemValue; 38575 return splitValue(itemValue, inputValue); 38576 }, [itemValue, inputValue]), 38577 ...props 38578 }; 38579 return removeUndefinedValues(props); 38580 }); 38581 var ComboboxItemValue = forwardRef54(function ComboboxItemValue2(props) { 38582 return createElement5(TagName11, useComboboxItemValue(props)); 38583 }); 38584 38585 // node_modules/@ariakit/react-components/dist/combobox/combobox-label.js 38586 var TagName12 = "label"; 38587 var useComboboxLabel = createHook(function useComboboxLabel2({ store: store4, ...props }) { 38588 const context = useComboboxProviderContext(); 38589 store4 = store4 || context; 38590 invariant(store4, "ComboboxLabel must receive a `store` prop or be wrapped in a ComboboxProvider component."); 38591 props = { 38592 htmlFor: useStoreState(store4, (state2) => state2.baseElement?.id), 38593 ...props 38594 }; 38595 return removeUndefinedValues(props); 38596 }); 38597 var ComboboxLabel = memo4(forwardRef54(function ComboboxLabel2(props) { 38598 return createElement5(TagName12, useComboboxLabel(props)); 38599 })); 38600 38601 // node_modules/@ariakit/react-components/dist/combobox/combobox-list.js 38602 var import_react32 = __toESM(require_react(), 1); 38603 var import_jsx_runtime207 = __toESM(require_jsx_runtime(), 1); 38604 var TagName13 = "div"; 38605 var useComboboxList = createHook(function useComboboxList2({ store: store4, alwaysVisible, ...props }) { 38606 const scopedContext = useComboboxScopedContext(true); 38607 const context = useComboboxContext(); 38608 store4 = store4 || context; 38609 const scopedContextSameStore = !!store4 && store4 === scopedContext; 38610 invariant(store4, "ComboboxList must receive a `store` prop or be wrapped in a ComboboxProvider component."); 38611 const ref = (0, import_react32.useRef)(null); 38612 const id = useId5(props.id); 38613 const mounted = useStoreState(store4, "mounted"); 38614 const hidden = isHidden(mounted, props.hidden, alwaysVisible); 38615 const style = hidden ? { 38616 ...props.style, 38617 display: "none" 38618 } : props.style; 38619 const multiSelectable = useStoreState(store4, (state2) => Array.isArray(state2.selectedValue)); 38620 const role = useAttribute(ref, "role", props.role); 38621 const ariaMultiSelectable = role === "listbox" || role === "tree" || role === "grid" ? multiSelectable || void 0 : void 0; 38622 const [hasListboxInside, setHasListboxInside] = (0, import_react32.useState)(false); 38623 const contentElement = useStoreState(store4, "contentElement"); 38624 useSafeLayoutEffect(() => { 38625 if (!mounted) return; 38626 const element = ref.current; 38627 if (!element) return; 38628 if (contentElement !== element) return; 38629 const callback = () => { 38630 setHasListboxInside(!!element.querySelector("[role='listbox']")); 38631 }; 38632 const observer = new MutationObserver(callback); 38633 observer.observe(element, { 38634 subtree: true, 38635 childList: true, 38636 attributeFilter: ["role"] 38637 }); 38638 callback(); 38639 return () => observer.disconnect(); 38640 }, [mounted, contentElement]); 38641 if (!hasListboxInside) props = { 38642 role: "listbox", 38643 "aria-multiselectable": ariaMultiSelectable, 38644 ...props 38645 }; 38646 props = useWrapElement(props, (element) => /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(ComboboxScopedContextProvider, { 38647 value: store4, 38648 children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(ComboboxListRoleContext.Provider, { 38649 value: role, 38650 children: element 38651 }) 38652 }), [store4, role]); 38653 const setContentElement = id && (!scopedContext || !scopedContextSameStore) ? store4.setContentElement : null; 38654 props = { 38655 hidden, 38656 ...props, 38657 id, 38658 ref: useMergeRefs2(setContentElement, ref, props.ref), 38659 style 38660 }; 38661 return removeUndefinedValues(props); 38662 }); 38663 var ComboboxList = forwardRef54(function ComboboxList2(props) { 38664 return createElement5(TagName13, useComboboxList(props)); 38665 }); 38666 38667 // node_modules/@ariakit/react-components/dist/tag/tag-context.js 38668 var import_react33 = __toESM(require_react(), 1); 38669 var TagValueContext = (0, import_react33.createContext)(null); 38670 var TagRemoveIdContext = (0, import_react33.createContext)(null); 38671 var ctx8 = createStoreContext([CompositeContextProvider], [CompositeScopedContextProvider]); 38672 var useTagContext = ctx8.useContext; 38673 var useTagScopedContext = ctx8.useScopedContext; 38674 var useTagProviderContext = ctx8.useProviderContext; 38675 var TagContextProvider = ctx8.ContextProvider; 38676 var TagScopedContextProvider = ctx8.ScopedContextProvider; 38677 38678 // node_modules/@ariakit/components/dist/combobox/combobox-store.js 38679 var isTouchSafari = isSafari() && isTouchDevice(); 38680 function createComboboxStore({ tag, ...props } = {}) { 38681 const store4 = mergeStore(props.store, pick2(tag, ["value", "rtl"])); 38682 throwOnConflictingProps(props, store4); 38683 const tagState = tag?.getState(); 38684 const syncState = store4?.getState(); 38685 const activeId = defaultValue(props.activeId, syncState?.activeId, props.defaultActiveId, null); 38686 const composite = createCompositeStore({ 38687 ...props, 38688 activeId, 38689 includesBaseElement: defaultValue(props.includesBaseElement, syncState?.includesBaseElement, true), 38690 orientation: defaultValue(props.orientation, syncState?.orientation, "vertical"), 38691 focusLoop: defaultValue(props.focusLoop, syncState?.focusLoop, true), 38692 focusWrap: defaultValue(props.focusWrap, syncState?.focusWrap, true), 38693 virtualFocus: defaultValue(props.virtualFocus, syncState?.virtualFocus, true) 38694 }); 38695 const popover = createPopoverStore({ 38696 ...props, 38697 placement: defaultValue(props.placement, syncState?.placement, "bottom-start") 38698 }); 38699 const value = defaultValue(props.value, syncState?.value, props.defaultValue, ""); 38700 const selectedValue = defaultValue(props.selectedValue, syncState?.selectedValue, tagState?.values, props.defaultSelectedValue, ""); 38701 const multiSelectable = Array.isArray(selectedValue); 38702 const initialState = { 38703 ...composite.getState(), 38704 ...popover.getState(), 38705 value, 38706 selectedValue, 38707 resetValueOnSelect: defaultValue(props.resetValueOnSelect, syncState?.resetValueOnSelect, multiSelectable), 38708 resetValueOnHide: defaultValue(props.resetValueOnHide, syncState?.resetValueOnHide, multiSelectable && !tag), 38709 activeValue: syncState?.activeValue 38710 }; 38711 const combobox = createStore(initialState, composite, popover, store4); 38712 if (isTouchSafari) setup(combobox, () => sync2(combobox, ["virtualFocus"], () => { 38713 combobox.setState("virtualFocus", false); 38714 })); 38715 setup(combobox, () => { 38716 if (!tag) return; 38717 return chain(sync2(combobox, ["selectedValue"], (state2) => { 38718 if (!Array.isArray(state2.selectedValue)) return; 38719 tag.setValues(state2.selectedValue); 38720 }), sync2(tag, ["values"], (state2) => { 38721 combobox.setState("selectedValue", state2.values); 38722 })); 38723 }); 38724 setup(combobox, () => sync2(combobox, ["resetValueOnHide", "mounted"], (state2) => { 38725 if (!state2.resetValueOnHide) return; 38726 if (state2.mounted) return; 38727 combobox.setState("value", value); 38728 })); 38729 setup(combobox, () => sync2(combobox, ["open"], (state2) => { 38730 if (state2.open) return; 38731 combobox.setState("activeId", activeId); 38732 combobox.setState("moves", 0); 38733 })); 38734 setup(combobox, () => sync2(combobox, ["moves", "activeId"], (state2, prevState) => { 38735 if (state2.moves === prevState.moves) combobox.setState("activeValue", void 0); 38736 })); 38737 setup(combobox, () => batch(combobox, ["moves", "renderedItems"], (state2, prev) => { 38738 if (state2.moves === prev.moves) return; 38739 const { activeId: activeId2 } = combobox.getState(); 38740 const activeItem = composite.item(activeId2); 38741 combobox.setState("activeValue", activeItem?.value); 38742 })); 38743 return { 38744 ...popover, 38745 ...composite, 38746 ...combobox, 38747 tag, 38748 setValue: (value2) => combobox.setState("value", value2), 38749 resetValue: () => combobox.setState("value", initialState.value), 38750 setSelectedValue: (selectedValue2) => combobox.setState("selectedValue", selectedValue2) 38751 }; 38752 } 38753 38754 // node_modules/@ariakit/react-components/dist/combobox/combobox-store.js 38755 function useComboboxStoreOptions(props) { 38756 const tag = useTagContext(); 38757 props = { 38758 ...props, 38759 tag: props.tag !== void 0 ? props.tag : tag 38760 }; 38761 return useCompositeStoreOptions(props); 38762 } 38763 function useComboboxStoreProps(store4, update4, props) { 38764 useUpdateEffect(update4, [props.tag]); 38765 useStoreProps(store4, props, "value", "setValue"); 38766 useStoreProps(store4, props, "selectedValue", "setSelectedValue"); 38767 useStoreProps(store4, props, "resetValueOnHide"); 38768 useStoreProps(store4, props, "resetValueOnSelect"); 38769 return Object.assign(useCompositeStoreProps(usePopoverStoreProps(store4, update4, props), update4, props), { tag: props.tag }); 38770 } 38771 function useComboboxStore(props = {}) { 38772 props = useComboboxStoreOptions(props); 38773 const [store4, update4] = useStore2(createComboboxStore, props); 38774 return useComboboxStoreProps(store4, update4, props); 38775 } 38776 38777 // node_modules/@ariakit/react-components/dist/combobox/combobox-provider.js 38778 var import_jsx_runtime208 = __toESM(require_jsx_runtime(), 1); 38779 function ComboboxProvider(props = {}) { 38780 return /* @__PURE__ */ (0, import_jsx_runtime208.jsx)(ComboboxContextProvider, { 38781 value: useComboboxStore(props), 38782 children: props.children 38783 }); 38784 } 38785 38786 // packages/dataviews/build-module/components/dataviews-filters/search-widget.mjs 38787 var import_remove_accents2 = __toESM(require_remove_accents(), 1); 38788 var import_compose14 = __toESM(require_compose(), 1); 38789 var import_i18n101 = __toESM(require_i18n(), 1); 38790 var import_element97 = __toESM(require_element(), 1); 38791 var import_components45 = __toESM(require_components(), 1); 38792 38793 // packages/dataviews/build-module/components/dataviews-filters/utils.mjs 38794 var EMPTY_ARRAY7 = []; 38795 var getCurrentValue = (filterDefinition, currentFilter) => { 38796 if (filterDefinition.singleSelection) { 38797 return currentFilter?.value; 38798 } 38799 if (Array.isArray(currentFilter?.value)) { 38800 return currentFilter.value; 38801 } 38802 if (!Array.isArray(currentFilter?.value) && !!currentFilter?.value) { 38803 return [currentFilter.value]; 38804 } 38805 return EMPTY_ARRAY7; 38806 }; 38807 38808 // packages/dataviews/build-module/hooks/use-elements.mjs 38809 var import_element96 = __toESM(require_element(), 1); 38810 var EMPTY_ARRAY8 = []; 38811 function useElements({ 38812 elements: elements2, 38813 getElements 38814 }) { 38815 const staticElements = Array.isArray(elements2) && elements2.length > 0 ? elements2 : EMPTY_ARRAY8; 38816 const [records, setRecords] = (0, import_element96.useState)(staticElements); 38817 const [isLoading, setIsLoading] = (0, import_element96.useState)(false); 38818 (0, import_element96.useEffect)(() => { 38819 if (!getElements) { 38820 setRecords(staticElements); 38821 return; 38822 } 38823 let cancelled = false; 38824 setIsLoading(true); 38825 getElements().then((fetchedElements) => { 38826 if (!cancelled) { 38827 const dynamicElements = Array.isArray(fetchedElements) && fetchedElements.length > 0 ? fetchedElements : staticElements; 38828 setRecords(dynamicElements); 38829 } 38830 }).catch(() => { 38831 if (!cancelled) { 38832 setRecords(staticElements); 38833 } 38834 }).finally(() => { 38835 if (!cancelled) { 38836 setIsLoading(false); 38837 } 38838 }); 38839 return () => { 38840 cancelled = true; 38841 }; 38842 }, [getElements, staticElements]); 38843 return { 38844 elements: records, 38845 isLoading 38846 }; 38847 } 38848 38849 // packages/dataviews/build-module/components/dataviews-filters/search-widget.mjs 38850 var import_jsx_runtime209 = __toESM(require_jsx_runtime(), 1); 38851 function normalizeSearchInput(input = "") { 38852 return (0, import_remove_accents2.default)(input.trim().toLowerCase()); 38853 } 38854 var getNewValue = (filterDefinition, currentFilter, value) => { 38855 if (filterDefinition.singleSelection) { 38856 return value; 38857 } 38858 if (Array.isArray(currentFilter?.value)) { 38859 return currentFilter.value.includes(value) ? currentFilter.value.filter((v3) => v3 !== value) : [...currentFilter.value, value]; 38860 } 38861 return [value]; 38862 }; 38863 function generateFilterElementCompositeItemId(prefix2, filterElementValue) { 38864 return `$prefix2}-$filterElementValue}`; 38865 } 38866 var MultiSelectionOption = ({ selected }) => { 38867 return /* @__PURE__ */ (0, import_jsx_runtime209.jsx)( 38868 "span", 38869 { 38870 className: clsx_default( 38871 "dataviews-filters__search-widget-listitem-multi-selection", 38872 { "is-selected": selected } 38873 ), 38874 children: selected && /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(import_components45.Icon, { icon: check_default }) 38875 } 38876 ); 38877 }; 38878 var SingleSelectionOption = ({ selected }) => { 38879 return /* @__PURE__ */ (0, import_jsx_runtime209.jsx)( 38880 "span", 38881 { 38882 className: clsx_default( 38883 "dataviews-filters__search-widget-listitem-single-selection", 38884 { "is-selected": selected } 38885 ) 38886 } 38887 ); 38888 }; 38889 function ListBox({ view, filter, onChangeView }) { 38890 const baseId = (0, import_compose14.useInstanceId)(ListBox, "dataviews-filter-list-box"); 38891 const [activeCompositeId, setActiveCompositeId] = (0, import_element97.useState)( 38892 // When there are one or less operators, the first item is set as active 38893 // (by setting the initial `activeId` to `undefined`). 38894 // With 2 or more operators, the focus is moved on the operators control 38895 // (by setting the initial `activeId` to `null`), meaning that there won't 38896 // be an active item initially. Focus is then managed via the 38897 // `onFocusVisible` callback. 38898 filter.operators?.length === 1 ? void 0 : null 38899 ); 38900 const currentFilter = view.filters?.find( 38901 (f3) => f3.field === filter.field 38902 ); 38903 const currentValue = getCurrentValue(filter, currentFilter); 38904 return /* @__PURE__ */ (0, import_jsx_runtime209.jsx)( 38905 import_components45.Composite, 38906 { 38907 virtualFocus: true, 38908 focusLoop: true, 38909 activeId: activeCompositeId, 38910 setActiveId: setActiveCompositeId, 38911 role: "listbox", 38912 className: "dataviews-filters__search-widget-listbox", 38913 "aria-label": (0, import_i18n101.sprintf)( 38914 /* translators: List of items for a filter. 1: Filter name. e.g.: "List of: Author". */ 38915 (0, import_i18n101.__)("List of: %1$s"), 38916 filter.name 38917 ), 38918 onFocusVisible: () => { 38919 if (!activeCompositeId && filter.elements.length) { 38920 setActiveCompositeId( 38921 generateFilterElementCompositeItemId( 38922 baseId, 38923 filter.elements[0].value 38924 ) 38925 ); 38926 } 38927 }, 38928 render: /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(import_components45.Composite.Typeahead, {}), 38929 children: filter.elements.map((element) => /* @__PURE__ */ (0, import_jsx_runtime209.jsxs)( 38930 import_components45.Composite.Hover, 38931 { 38932 render: /* @__PURE__ */ (0, import_jsx_runtime209.jsx)( 38933 import_components45.Composite.Item, 38934 { 38935 id: generateFilterElementCompositeItemId( 38936 baseId, 38937 element.value 38938 ), 38939 render: /* @__PURE__ */ (0, import_jsx_runtime209.jsx)( 38940 "div", 38941 { 38942 "aria-label": element.label, 38943 role: "option", 38944 className: "dataviews-filters__search-widget-listitem" 38945 } 38946 ), 38947 onClick: () => { 38948 const newFilters = currentFilter ? [ 38949 ...(view.filters ?? []).map( 38950 (_filter) => { 38951 if (_filter.field === filter.field) { 38952 return { 38953 ..._filter, 38954 operator: currentFilter.operator || filter.operators[0], 38955 value: getNewValue( 38956 filter, 38957 currentFilter, 38958 element.value 38959 ) 38960 }; 38961 } 38962 return _filter; 38963 } 38964 ) 38965 ] : [ 38966 ...view.filters ?? [], 38967 { 38968 field: filter.field, 38969 operator: filter.operators[0], 38970 value: getNewValue( 38971 filter, 38972 currentFilter, 38973 element.value 38974 ) 38975 } 38976 ]; 38977 onChangeView({ 38978 ...view, 38979 page: 1, 38980 filters: newFilters 38981 }); 38982 } 38983 } 38984 ), 38985 children: [ 38986 filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime209.jsx)( 38987 SingleSelectionOption, 38988 { 38989 selected: currentValue === element.value 38990 } 38991 ), 38992 !filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime209.jsx)( 38993 MultiSelectionOption, 38994 { 38995 selected: currentValue.includes(element.value) 38996 } 38997 ), 38998 /* @__PURE__ */ (0, import_jsx_runtime209.jsx)( 38999 "span", 39000 { 39001 className: "dataviews-filters__search-widget-listitem-value", 39002 title: element.label, 39003 children: element.label 39004 } 39005 ) 39006 ] 39007 }, 39008 element.value 39009 )) 39010 } 39011 ); 39012 } 39013 function ComboboxList22({ view, filter, onChangeView }) { 39014 const [searchValue, setSearchValue] = (0, import_element97.useState)(""); 39015 const deferredSearchValue = (0, import_element97.useDeferredValue)(searchValue); 39016 const currentFilter = view.filters?.find( 39017 (_filter) => _filter.field === filter.field 39018 ); 39019 const currentValue = getCurrentValue(filter, currentFilter); 39020 const matches = (0, import_element97.useMemo)(() => { 39021 const normalizedSearch = normalizeSearchInput(deferredSearchValue); 39022 return filter.elements.filter( 39023 (item) => normalizeSearchInput(item.label).includes(normalizedSearch) 39024 ); 39025 }, [filter.elements, deferredSearchValue]); 39026 return /* @__PURE__ */ (0, import_jsx_runtime209.jsxs)( 39027 ComboboxProvider, 39028 { 39029 selectedValue: currentValue, 39030 setSelectedValue: (value) => { 39031 const newFilters = currentFilter ? [ 39032 ...(view.filters ?? []).map((_filter) => { 39033 if (_filter.field === filter.field) { 39034 return { 39035 ..._filter, 39036 operator: currentFilter.operator || filter.operators[0], 39037 value 39038 }; 39039 } 39040 return _filter; 39041 }) 39042 ] : [ 39043 ...view.filters ?? [], 39044 { 39045 field: filter.field, 39046 operator: filter.operators[0], 39047 value 39048 } 39049 ]; 39050 onChangeView({ 39051 ...view, 39052 page: 1, 39053 filters: newFilters 39054 }); 39055 }, 39056 setValue: setSearchValue, 39057 children: [ 39058 /* @__PURE__ */ (0, import_jsx_runtime209.jsxs)("div", { className: "dataviews-filters__search-widget-filter-combobox__wrapper", children: [ 39059 /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(ComboboxLabel, {}), children: (0, import_i18n101.__)("Search items") }), 39060 /* @__PURE__ */ (0, import_jsx_runtime209.jsx)( 39061 Combobox, 39062 { 39063 autoSelect: "always", 39064 placeholder: (0, import_i18n101.__)("Search"), 39065 className: "dataviews-filters__search-widget-filter-combobox__input" 39066 } 39067 ), 39068 /* @__PURE__ */ (0, import_jsx_runtime209.jsx)("div", { className: "dataviews-filters__search-widget-filter-combobox__icon", children: /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(import_components45.Icon, { icon: search_default }) }) 39069 ] }), 39070 /* @__PURE__ */ (0, import_jsx_runtime209.jsxs)( 39071 ComboboxList, 39072 { 39073 className: "dataviews-filters__search-widget-filter-combobox-list", 39074 alwaysVisible: true, 39075 children: [ 39076 matches.map((element) => { 39077 return /* @__PURE__ */ (0, import_jsx_runtime209.jsxs)( 39078 ComboboxItem, 39079 { 39080 resetValueOnSelect: false, 39081 value: element.value, 39082 className: "dataviews-filters__search-widget-listitem", 39083 hideOnClick: false, 39084 setValueOnClick: false, 39085 focusOnHover: true, 39086 children: [ 39087 filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime209.jsx)( 39088 SingleSelectionOption, 39089 { 39090 selected: currentValue === element.value 39091 } 39092 ), 39093 !filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime209.jsx)( 39094 MultiSelectionOption, 39095 { 39096 selected: currentValue.includes( 39097 element.value 39098 ) 39099 } 39100 ), 39101 /* @__PURE__ */ (0, import_jsx_runtime209.jsxs)( 39102 "span", 39103 { 39104 className: "dataviews-filters__search-widget-listitem-value", 39105 title: element.label, 39106 children: [ 39107 /* @__PURE__ */ (0, import_jsx_runtime209.jsx)( 39108 ComboboxItemValue, 39109 { 39110 className: "dataviews-filters__search-widget-filter-combobox-item-value", 39111 value: element.label 39112 } 39113 ), 39114 !!element.description && /* @__PURE__ */ (0, import_jsx_runtime209.jsx)("span", { className: "dataviews-filters__search-widget-listitem-description", children: element.description }) 39115 ] 39116 } 39117 ) 39118 ] 39119 }, 39120 element.value 39121 ); 39122 }), 39123 !matches.length && /* @__PURE__ */ (0, import_jsx_runtime209.jsx)("p", { children: (0, import_i18n101.__)("No results found") }) 39124 ] 39125 } 39126 ) 39127 ] 39128 } 39129 ); 39130 } 39131 function SearchWidget(props) { 39132 const { elements: elements2, isLoading } = useElements({ 39133 elements: props.filter.elements, 39134 getElements: props.filter.getElements 39135 }); 39136 if (isLoading) { 39137 return /* @__PURE__ */ (0, import_jsx_runtime209.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(import_components45.Spinner, {}) }); 39138 } 39139 if (elements2.length === 0) { 39140 return /* @__PURE__ */ (0, import_jsx_runtime209.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: (0, import_i18n101.__)("No elements found") }); 39141 } 39142 const Widget = elements2.length > 10 ? ComboboxList22 : ListBox; 39143 return /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(Widget, { ...props, filter: { ...props.filter, elements: elements2 } }); 39144 } 39145 39146 // packages/dataviews/build-module/components/dataviews-filters/input-widget.mjs 39147 var import_es62 = __toESM(require_es6(), 1); 39148 var import_compose15 = __toESM(require_compose(), 1); 39149 var import_element98 = __toESM(require_element(), 1); 39150 var import_components46 = __toESM(require_components(), 1); 39151 var import_jsx_runtime210 = __toESM(require_jsx_runtime(), 1); 39152 function InputWidget({ 39153 filter, 39154 view, 39155 onChangeView, 39156 fields: fields2 39157 }) { 39158 const currentFilter = view.filters?.find( 39159 (f3) => f3.field === filter.field 39160 ); 39161 const currentValue = getCurrentValue(filter, currentFilter); 39162 const field = (0, import_element98.useMemo)(() => { 39163 const currentField = fields2.find((f3) => f3.id === filter.field); 39164 if (currentField) { 39165 return { 39166 ...currentField, 39167 // Deactivate validation for filters. 39168 isValid: {}, 39169 // Filter controls are always enabled. 39170 isDisabled: () => false, 39171 // Filter controls are always visible. 39172 isVisible: () => true, 39173 // Configure getValue/setValue as if Item was a plain object. 39174 getValue: ({ item }) => item[currentField.id], 39175 setValue: ({ value }) => ({ 39176 [currentField.id]: value 39177 }) 39178 }; 39179 } 39180 return currentField; 39181 }, [fields2, filter.field]); 39182 const data = (0, import_element98.useMemo)(() => { 39183 return (view.filters ?? []).reduce( 39184 (acc, activeFilter) => { 39185 acc[activeFilter.field] = activeFilter.value; 39186 return acc; 39187 }, 39188 {} 39189 ); 39190 }, [view.filters]); 39191 const handleChange = (0, import_compose15.useEvent)((updatedData) => { 39192 if (!field || !currentFilter) { 39193 return; 39194 } 39195 const nextValue = field.getValue({ item: updatedData }); 39196 if ((0, import_es62.default)(nextValue, currentValue)) { 39197 return; 39198 } 39199 onChangeView({ 39200 ...view, 39201 filters: (view.filters ?? []).map( 39202 (_filter) => _filter.field === filter.field ? { 39203 ..._filter, 39204 operator: currentFilter.operator || filter.operators[0], 39205 // Consider empty strings as undefined: 39206 // 39207 // - undefined as value means the filter is unset: the filter widget displays no value and the search returns all records 39208 // - empty string as value means "search empty string": returns only the records that have an empty string as value 39209 // 39210 // In practice, this means the filter will not be able to find an empty string as the value. 39211 value: nextValue === "" ? void 0 : nextValue 39212 } : _filter 39213 ) 39214 }); 39215 }); 39216 if (!field || !field.Edit || !currentFilter) { 39217 return null; 39218 } 39219 return /* @__PURE__ */ (0, import_jsx_runtime210.jsx)( 39220 import_components46.Flex, 39221 { 39222 className: "dataviews-filters__user-input-widget", 39223 gap: 2.5, 39224 direction: "column", 39225 children: /* @__PURE__ */ (0, import_jsx_runtime210.jsx)( 39226 field.Edit, 39227 { 39228 hideLabelFromVision: true, 39229 data, 39230 field, 39231 operator: currentFilter.operator, 39232 onChange: handleChange 39233 } 39234 ) 39235 } 39236 ); 39237 } 39238 39239 // node_modules/date-fns/constants.js 39240 var daysInYear = 365.2425; 39241 var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3; 39242 var minTime = -maxTime; 39243 var millisecondsInWeek = 6048e5; 39244 var millisecondsInDay = 864e5; 39245 var millisecondsInMinute = 6e4; 39246 var millisecondsInHour = 36e5; 39247 var secondsInHour = 3600; 39248 var secondsInDay = secondsInHour * 24; 39249 var secondsInWeek = secondsInDay * 7; 39250 var secondsInYear = secondsInDay * daysInYear; 39251 var secondsInMonth = secondsInYear / 12; 39252 var secondsInQuarter = secondsInMonth * 3; 39253 var constructFromSymbol = /* @__PURE__ */ Symbol.for("constructDateFrom"); 39254 39255 // node_modules/date-fns/constructFrom.js 39256 function constructFrom(date, value) { 39257 if (typeof date === "function") return date(value); 39258 if (date && typeof date === "object" && constructFromSymbol in date) 39259 return date[constructFromSymbol](value); 39260 if (date instanceof Date) return new date.constructor(value); 39261 return new Date(value); 39262 } 39263 39264 // node_modules/date-fns/toDate.js 39265 function toDate(argument, context) { 39266 return constructFrom(context || argument, argument); 39267 } 39268 39269 // node_modules/date-fns/addDays.js 39270 function addDays(date, amount, options) { 39271 const _date = toDate(date, options?.in); 39272 if (isNaN(amount)) return constructFrom(options?.in || date, NaN); 39273 if (!amount) return _date; 39274 _date.setDate(_date.getDate() + amount); 39275 return _date; 39276 } 39277 39278 // node_modules/date-fns/addMonths.js 39279 function addMonths(date, amount, options) { 39280 const _date = toDate(date, options?.in); 39281 if (isNaN(amount)) return constructFrom(options?.in || date, NaN); 39282 if (!amount) { 39283 return _date; 39284 } 39285 const dayOfMonth = _date.getDate(); 39286 const endOfDesiredMonth = constructFrom(options?.in || date, _date.getTime()); 39287 endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0); 39288 const daysInMonth = endOfDesiredMonth.getDate(); 39289 if (dayOfMonth >= daysInMonth) { 39290 return endOfDesiredMonth; 39291 } else { 39292 _date.setFullYear( 39293 endOfDesiredMonth.getFullYear(), 39294 endOfDesiredMonth.getMonth(), 39295 dayOfMonth 39296 ); 39297 return _date; 39298 } 39299 } 39300 39301 // node_modules/date-fns/_lib/defaultOptions.js 39302 var defaultOptions = {}; 39303 function getDefaultOptions() { 39304 return defaultOptions; 39305 } 39306 39307 // node_modules/date-fns/startOfWeek.js 39308 function startOfWeek(date, options) { 39309 const defaultOptions2 = getDefaultOptions(); 39310 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0; 39311 const _date = toDate(date, options?.in); 39312 const day = _date.getDay(); 39313 const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; 39314 _date.setDate(_date.getDate() - diff); 39315 _date.setHours(0, 0, 0, 0); 39316 return _date; 39317 } 39318 39319 // node_modules/date-fns/startOfISOWeek.js 39320 function startOfISOWeek(date, options) { 39321 return startOfWeek(date, { ...options, weekStartsOn: 1 }); 39322 } 39323 39324 // node_modules/date-fns/getISOWeekYear.js 39325 function getISOWeekYear(date, options) { 39326 const _date = toDate(date, options?.in); 39327 const year = _date.getFullYear(); 39328 const fourthOfJanuaryOfNextYear = constructFrom(_date, 0); 39329 fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4); 39330 fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0); 39331 const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear); 39332 const fourthOfJanuaryOfThisYear = constructFrom(_date, 0); 39333 fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4); 39334 fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0); 39335 const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear); 39336 if (_date.getTime() >= startOfNextYear.getTime()) { 39337 return year + 1; 39338 } else if (_date.getTime() >= startOfThisYear.getTime()) { 39339 return year; 39340 } else { 39341 return year - 1; 39342 } 39343 } 39344 39345 // node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js 39346 function getTimezoneOffsetInMilliseconds(date) { 39347 const _date = toDate(date); 39348 const utcDate = new Date( 39349 Date.UTC( 39350 _date.getFullYear(), 39351 _date.getMonth(), 39352 _date.getDate(), 39353 _date.getHours(), 39354 _date.getMinutes(), 39355 _date.getSeconds(), 39356 _date.getMilliseconds() 39357 ) 39358 ); 39359 utcDate.setUTCFullYear(_date.getFullYear()); 39360 return +date - +utcDate; 39361 } 39362 39363 // node_modules/date-fns/_lib/normalizeDates.js 39364 function normalizeDates(context, ...dates) { 39365 const normalize2 = constructFrom.bind( 39366 null, 39367 context || dates.find((date) => typeof date === "object") 39368 ); 39369 return dates.map(normalize2); 39370 } 39371 39372 // node_modules/date-fns/startOfDay.js 39373 function startOfDay(date, options) { 39374 const _date = toDate(date, options?.in); 39375 _date.setHours(0, 0, 0, 0); 39376 return _date; 39377 } 39378 39379 // node_modules/date-fns/differenceInCalendarDays.js 39380 function differenceInCalendarDays(laterDate, earlierDate, options) { 39381 const [laterDate_, earlierDate_] = normalizeDates( 39382 options?.in, 39383 laterDate, 39384 earlierDate 39385 ); 39386 const laterStartOfDay = startOfDay(laterDate_); 39387 const earlierStartOfDay = startOfDay(earlierDate_); 39388 const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay); 39389 const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay); 39390 return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay); 39391 } 39392 39393 // node_modules/date-fns/startOfISOWeekYear.js 39394 function startOfISOWeekYear(date, options) { 39395 const year = getISOWeekYear(date, options); 39396 const fourthOfJanuary = constructFrom(options?.in || date, 0); 39397 fourthOfJanuary.setFullYear(year, 0, 4); 39398 fourthOfJanuary.setHours(0, 0, 0, 0); 39399 return startOfISOWeek(fourthOfJanuary); 39400 } 39401 39402 // node_modules/date-fns/addWeeks.js 39403 function addWeeks(date, amount, options) { 39404 return addDays(date, amount * 7, options); 39405 } 39406 39407 // node_modules/date-fns/addYears.js 39408 function addYears(date, amount, options) { 39409 return addMonths(date, amount * 12, options); 39410 } 39411 39412 // node_modules/date-fns/isDate.js 39413 function isDate(value) { 39414 return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]"; 39415 } 39416 39417 // node_modules/date-fns/isValid.js 39418 function isValid(date) { 39419 return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date))); 39420 } 39421 39422 // node_modules/date-fns/endOfMonth.js 39423 function endOfMonth(date, options) { 39424 const _date = toDate(date, options?.in); 39425 const month = _date.getMonth(); 39426 _date.setFullYear(_date.getFullYear(), month + 1, 0); 39427 _date.setHours(23, 59, 59, 999); 39428 return _date; 39429 } 39430 39431 // node_modules/date-fns/startOfMonth.js 39432 function startOfMonth(date, options) { 39433 const _date = toDate(date, options?.in); 39434 _date.setDate(1); 39435 _date.setHours(0, 0, 0, 0); 39436 return _date; 39437 } 39438 39439 // node_modules/date-fns/startOfYear.js 39440 function startOfYear(date, options) { 39441 const date_ = toDate(date, options?.in); 39442 date_.setFullYear(date_.getFullYear(), 0, 1); 39443 date_.setHours(0, 0, 0, 0); 39444 return date_; 39445 } 39446 39447 // node_modules/date-fns/locale/en-US/_lib/formatDistance.js 39448 var formatDistanceLocale = { 39449 lessThanXSeconds: { 39450 one: "less than a second", 39451 other: "less than {{count}} seconds" 39452 }, 39453 xSeconds: { 39454 one: "1 second", 39455 other: "{{count}} seconds" 39456 }, 39457 halfAMinute: "half a minute", 39458 lessThanXMinutes: { 39459 one: "less than a minute", 39460 other: "less than {{count}} minutes" 39461 }, 39462 xMinutes: { 39463 one: "1 minute", 39464 other: "{{count}} minutes" 39465 }, 39466 aboutXHours: { 39467 one: "about 1 hour", 39468 other: "about {{count}} hours" 39469 }, 39470 xHours: { 39471 one: "1 hour", 39472 other: "{{count}} hours" 39473 }, 39474 xDays: { 39475 one: "1 day", 39476 other: "{{count}} days" 39477 }, 39478 aboutXWeeks: { 39479 one: "about 1 week", 39480 other: "about {{count}} weeks" 39481 }, 39482 xWeeks: { 39483 one: "1 week", 39484 other: "{{count}} weeks" 39485 }, 39486 aboutXMonths: { 39487 one: "about 1 month", 39488 other: "about {{count}} months" 39489 }, 39490 xMonths: { 39491 one: "1 month", 39492 other: "{{count}} months" 39493 }, 39494 aboutXYears: { 39495 one: "about 1 year", 39496 other: "about {{count}} years" 39497 }, 39498 xYears: { 39499 one: "1 year", 39500 other: "{{count}} years" 39501 }, 39502 overXYears: { 39503 one: "over 1 year", 39504 other: "over {{count}} years" 39505 }, 39506 almostXYears: { 39507 one: "almost 1 year", 39508 other: "almost {{count}} years" 39509 } 39510 }; 39511 var formatDistance = (token, count, options) => { 39512 let result; 39513 const tokenValue = formatDistanceLocale[token]; 39514 if (typeof tokenValue === "string") { 39515 result = tokenValue; 39516 } else if (count === 1) { 39517 result = tokenValue.one; 39518 } else { 39519 result = tokenValue.other.replace("{{count}}", count.toString()); 39520 } 39521 if (options?.addSuffix) { 39522 if (options.comparison && options.comparison > 0) { 39523 return "in " + result; 39524 } else { 39525 return result + " ago"; 39526 } 39527 } 39528 return result; 39529 }; 39530 39531 // node_modules/date-fns/locale/_lib/buildFormatLongFn.js 39532 function buildFormatLongFn(args) { 39533 return (options = {}) => { 39534 const width = options.width ? String(options.width) : args.defaultWidth; 39535 const format6 = args.formats[width] || args.formats[args.defaultWidth]; 39536 return format6; 39537 }; 39538 } 39539 39540 // node_modules/date-fns/locale/en-US/_lib/formatLong.js 39541 var dateFormats = { 39542 full: "EEEE, MMMM do, y", 39543 long: "MMMM do, y", 39544 medium: "MMM d, y", 39545 short: "MM/dd/yyyy" 39546 }; 39547 var timeFormats = { 39548 full: "h:mm:ss a zzzz", 39549 long: "h:mm:ss a z", 39550 med